2024-04-04 21:27:51 +02:00
|
|
|
<!----------------------------------------------------
|
|
|
|
File: ResearcherProfile.vue
|
|
|
|
Author: Maxime Bartha
|
|
|
|
Scope: Extension Publicatons scientifiquess
|
|
|
|
Description: Researcher Profile Page containing his articles and his statistics
|
|
|
|
----------------------------------------------------->
|
|
|
|
|
2024-03-29 15:32:08 +01:00
|
|
|
<script setup>
|
2024-04-05 09:44:41 +02:00
|
|
|
import { ref, reactive } from "vue";
|
2024-04-08 22:56:44 +02:00
|
|
|
import FilterComponent from "@/Apps/ScientificPublications/FilterComponent.vue";
|
2024-04-10 11:50:17 +02:00
|
|
|
import ArticleComponent from "@/Apps/ScientificPublications/ResearchComponent.vue";
|
2024-04-15 23:35:05 +02:00
|
|
|
import {fetchResearcher, fetchResearches} from "@/rest/ScientificPublications/ResearcherProfile.js";
|
2024-04-04 15:01:10 +02:00
|
|
|
const input = ref("");
|
|
|
|
const statsOf = ref("");
|
|
|
|
const statsBy = ref("");
|
2024-04-08 22:56:44 +02:00
|
|
|
const isFilterOpened = ref(false);
|
2024-04-10 11:50:17 +02:00
|
|
|
const isResearchOpened = ref(false);
|
2024-04-15 23:35:05 +02:00
|
|
|
const articleToDisplay = ref(Object)
|
|
|
|
const filters = ref([""])
|
|
|
|
const researchList = ref(await fetchResearches(1))
|
2024-04-05 09:44:41 +02:00
|
|
|
let chart;
|
2024-04-04 15:01:10 +02:00
|
|
|
|
2024-04-15 23:35:05 +02:00
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
researcher: ref(Object),
|
|
|
|
filters: ref([""]),
|
|
|
|
});
|
|
|
|
|
2024-04-10 11:50:17 +02:00
|
|
|
const openFilter = () => {
|
2024-04-08 22:56:44 +02:00
|
|
|
isFilterOpened.value = true;
|
|
|
|
};
|
2024-04-10 11:50:17 +02:00
|
|
|
const closeFilter = () => {
|
2024-04-08 22:56:44 +02:00
|
|
|
isFilterOpened.value = false;
|
|
|
|
};
|
2024-04-09 17:32:04 +02:00
|
|
|
const submitFilters = ()=>{
|
2024-04-08 22:56:44 +02:00
|
|
|
}
|
2024-04-10 11:50:17 +02:00
|
|
|
const openResearch = (article) => {
|
|
|
|
isResearchOpened.value = true;
|
2024-04-15 23:35:05 +02:00
|
|
|
articleToDisplay.value = article;
|
2024-04-09 17:32:04 +02:00
|
|
|
}
|
|
|
|
|
2024-04-10 11:50:17 +02:00
|
|
|
const closeResearch = () => {
|
|
|
|
isResearchOpened.value =false;
|
2024-04-15 23:35:05 +02:00
|
|
|
articleToDisplay.value = null;
|
2024-04-09 17:32:04 +02:00
|
|
|
}
|
|
|
|
|
2024-04-10 11:50:17 +02:00
|
|
|
const downloadBibTex = (research) => {
|
2024-04-09 17:32:04 +02:00
|
|
|
//todo
|
|
|
|
}
|
|
|
|
|
2024-04-10 11:50:17 +02:00
|
|
|
const downloadArticle = (research) => {
|
2024-04-09 17:32:04 +02:00
|
|
|
//todo
|
|
|
|
}
|
2024-04-15 23:35:05 +02:00
|
|
|
//todo changer dynamiquement le 1 ici en fct de sur quel profil on est
|
|
|
|
const researcher = ref(await fetchResearcher(1))
|
2024-04-09 17:32:04 +02:00
|
|
|
|
2024-04-15 23:35:05 +02:00
|
|
|
function downloadCoAuthors(){
|
|
|
|
const data = JSON.stringify(researcher.value);
|
|
|
|
const blob = new Blob([data], {type:"application/json"});
|
|
|
|
return URL.createObjectURL(blob);
|
|
|
|
}
|
2024-04-07 15:51:53 +02:00
|
|
|
|
2024-04-09 17:32:04 +02:00
|
|
|
|
2024-04-04 21:27:51 +02:00
|
|
|
const jsonMockViewsByYears= [
|
|
|
|
{label: "2004", y:4},
|
|
|
|
{label: "2005", y:99},
|
|
|
|
{label: "2007", y:555},
|
|
|
|
{label: "2009", y:22},
|
|
|
|
{label: "2011", y:1666},
|
|
|
|
]
|
2024-04-04 15:01:10 +02:00
|
|
|
|
2024-04-10 11:50:17 +02:00
|
|
|
function searchInList(list, searchInput) {
|
|
|
|
let retList = []
|
2024-04-07 15:51:53 +02:00
|
|
|
for (let i = 0; i < list.length; i++) {
|
2024-04-15 23:35:05 +02:00
|
|
|
if (lDistance(list[i].title, searchInput) < 10 || list[i].title.toUpperCase().indexOf(searchInput.toUpperCase()) > -1){
|
|
|
|
retList.push(list[i])
|
2024-04-04 15:01:10 +02:00
|
|
|
}
|
|
|
|
}
|
2024-04-07 15:51:53 +02:00
|
|
|
return retList
|
2024-04-04 15:01:10 +02:00
|
|
|
}
|
2024-03-30 12:23:56 +01:00
|
|
|
|
2024-04-07 15:51:53 +02:00
|
|
|
function lDistance(s,t){
|
|
|
|
if (!s.length) return t.length;
|
|
|
|
if (!t.length) return s.length;
|
|
|
|
const arr = [];
|
|
|
|
for (let i = 0; i <= t.length; i++) {
|
|
|
|
arr[i] = [i];
|
|
|
|
for (let j = 1; j <= s.length; j++) {
|
|
|
|
arr[i][j] =
|
|
|
|
i === 0
|
|
|
|
? j
|
|
|
|
: Math.min(
|
|
|
|
arr[i - 1][j] + 1,
|
|
|
|
arr[i][j - 1] + 1,
|
|
|
|
arr[i - 1][j - 1] + (s[j - 1] === t[i - 1] ? 0 : 1)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return arr[t.length][s.length];
|
2024-04-08 22:56:44 +02:00
|
|
|
}
|
2024-04-07 15:51:53 +02:00
|
|
|
|
2024-04-05 09:44:41 +02:00
|
|
|
const options = reactive({
|
2024-04-04 15:01:10 +02:00
|
|
|
backgroundColor:null,
|
|
|
|
theme: "light2",
|
|
|
|
animationEnabled: true,
|
|
|
|
title: {
|
|
|
|
fontColor: "white",
|
2024-04-04 21:27:51 +02:00
|
|
|
text : "please select options",
|
2024-04-04 15:01:10 +02:00
|
|
|
},
|
|
|
|
data: [
|
|
|
|
{
|
|
|
|
type: "pie",
|
|
|
|
indexLabel: "{label} (#percent%)",
|
|
|
|
yValueFormatString: "#,##0",
|
|
|
|
indexLabelFontColor: "white",
|
|
|
|
toolTipContent:
|
|
|
|
"<span style='\"'color: {color};'\"'>{label}</span> {y}(#percent%)",
|
2024-04-05 09:44:41 +02:00
|
|
|
}]
|
|
|
|
});
|
|
|
|
|
|
|
|
function update(){
|
|
|
|
options.title = {
|
2024-04-04 16:14:19 +02:00
|
|
|
fontColor: "white",
|
|
|
|
text: statsOf.value + " By "+ statsBy.value,
|
|
|
|
}
|
2024-04-04 21:27:51 +02:00
|
|
|
if (statsOf.value === "views" && statsBy.value === "years") {
|
2024-04-05 09:44:41 +02:00
|
|
|
options.data[0].dataPoints = jsonMockViewsByYears;
|
2024-04-04 21:27:51 +02:00
|
|
|
}
|
|
|
|
|
2024-04-05 09:44:41 +02:00
|
|
|
options.title.text = statsOf.value + " By "+ statsBy.value;
|
|
|
|
chart.render()
|
2024-04-04 15:01:10 +02:00
|
|
|
}
|
2024-03-29 15:32:08 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-04-04 15:01:10 +02:00
|
|
|
<div id="main">
|
2024-04-15 23:35:05 +02:00
|
|
|
<FilterComponent :isOpen="isFilterOpened" :allArticles="researchList" @modal-close="closeFilter" @submit="submitFilters()"></FilterComponent>
|
|
|
|
<ArticleComponent :article="articleToDisplay" :isOpen="isResearchOpened" @modal-close="closeResearch"></ArticleComponent>
|
2024-04-04 15:01:10 +02:00
|
|
|
<div id="profilePicture">
|
|
|
|
<img src="/Clyde.png" />
|
2024-03-29 15:32:08 +01:00
|
|
|
</div>
|
2024-04-04 15:01:10 +02:00
|
|
|
<div id="researcherInfos">
|
2024-04-15 23:35:05 +02:00
|
|
|
<div class="surrounded">{{researcher.user.lastName}} {{researcher.user.firstName}}</div>
|
|
|
|
<div class="surrounded">Orcid : {{researcher.orcidId}}</div>
|
|
|
|
<div class="surrounded">Email : {{researcher.user.email}}</div>
|
2024-04-04 15:01:10 +02:00
|
|
|
<div class="surrounded">
|
2024-04-15 23:35:05 +02:00
|
|
|
site : <a :href=researcher.site style="color: #007aff"> {{researcher.site}}</a>
|
2024-04-04 15:01:10 +02:00
|
|
|
</div>
|
2024-04-15 23:35:05 +02:00
|
|
|
<div class="surrounded">Domain : {{researcher.domain}}</div>
|
|
|
|
<div id="coAuthorList" class="surrounded">Co-authors list : <a :href=downloadCoAuthors() download="coAuthors.json"> here </a></div>
|
2024-03-29 15:32:08 +01:00
|
|
|
</div>
|
2024-04-04 15:01:10 +02:00
|
|
|
<div id="stats">
|
|
|
|
<div class="surrounded">
|
|
|
|
Stat type :
|
2024-04-05 09:44:41 +02:00
|
|
|
<select @change="update()" id="stats-select" v-model="statsOf">
|
2024-04-04 15:01:10 +02:00
|
|
|
<option value="views">Views</option>
|
|
|
|
<option value="co-authors">Co-authors</option>
|
2024-04-10 11:50:17 +02:00
|
|
|
<option value="researches">Researches</option>
|
2024-04-04 15:01:10 +02:00
|
|
|
<option value="language">Languages</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="surrounded">
|
|
|
|
Class by:
|
2024-04-05 09:44:41 +02:00
|
|
|
<select @change="update()" id="classed-select" v-model="statsBy">
|
2024-04-04 15:01:10 +02:00
|
|
|
<option selected="selected" value="years">Years</option>
|
|
|
|
<option value="months">Months</option>
|
|
|
|
<option value="topics">Topics</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div id="statsPie">
|
2024-04-05 09:44:41 +02:00
|
|
|
<CanvasJSChart :options="options" id=chart @chart-ref="c => chart = c "/>
|
2024-04-04 15:01:10 +02:00
|
|
|
</div>
|
2024-03-29 15:32:08 +01:00
|
|
|
</div>
|
2024-04-10 11:50:17 +02:00
|
|
|
<div id="researches">
|
2024-04-08 22:56:44 +02:00
|
|
|
<div id="search">
|
2024-04-10 11:50:17 +02:00
|
|
|
<input type="text" id="search-input" placeholder="search for researches" v-model="input"/>
|
|
|
|
<button id="filterButton" @click="openFilter"> Filters </button>
|
2024-04-08 22:56:44 +02:00
|
|
|
</div>
|
2024-04-10 11:50:17 +02:00
|
|
|
<ul id="researchUL">
|
|
|
|
<li id="researchLi" v-for="n in searchInList(researchList,input)">
|
2024-04-15 23:35:05 +02:00
|
|
|
<div class="vl"> {{n.title}}</div>
|
|
|
|
<div class="vl"> {{ n.researcher.user.firstName +" "+ n.researcher.user.lastName }}</div>
|
|
|
|
<a @click="openResearch(n)"> MoreInfo </a></li>
|
2024-04-04 15:01:10 +02:00
|
|
|
</ul>
|
2024-03-29 15:32:08 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
#main {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 22% auto;
|
|
|
|
grid-template-rows: 26% auto;
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
#profilePicture {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
2024-04-04 15:01:10 +02:00
|
|
|
|
|
|
|
#profilePicture img {
|
2024-03-29 15:32:08 +01:00
|
|
|
align-self: center;
|
|
|
|
justify-self: center;
|
2024-04-04 15:01:10 +02:00
|
|
|
width: 60%;
|
2024-03-29 15:32:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#researcherInfos {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: auto auto auto;
|
|
|
|
column-gap: 5px;
|
2024-04-04 15:01:10 +02:00
|
|
|
grid-template-rows: auto auto;
|
2024-03-29 15:32:08 +01:00
|
|
|
}
|
2024-04-04 15:01:10 +02:00
|
|
|
|
2024-03-29 15:32:08 +01:00
|
|
|
.surrounded {
|
2024-04-04 15:01:10 +02:00
|
|
|
border: 2px solid black;
|
|
|
|
color: white;
|
2024-03-29 15:32:08 +01:00
|
|
|
font-size: x-large;
|
|
|
|
align-self: center;
|
|
|
|
text-align: center;
|
|
|
|
background-color: rgba(255, 255, 255, 0.09);
|
2024-04-04 15:01:10 +02:00
|
|
|
border-radius: 20px;
|
|
|
|
margin-bottom: 10px;
|
2024-03-29 15:32:08 +01:00
|
|
|
}
|
|
|
|
|
2024-03-30 12:23:56 +01:00
|
|
|
.surrounded select {
|
|
|
|
margin-top: 2px;
|
|
|
|
margin-bottom: 2px;
|
|
|
|
border: 1px solid black;
|
|
|
|
color: white;
|
2024-04-04 15:01:10 +02:00
|
|
|
background-color: rgb(255, 255, 255, 0.1);
|
2024-03-30 12:23:56 +01:00
|
|
|
font-size: large;
|
|
|
|
}
|
|
|
|
|
2024-04-04 15:01:10 +02:00
|
|
|
#statsPie {
|
2024-03-30 12:23:56 +01:00
|
|
|
|
2024-03-29 15:32:08 +01:00
|
|
|
}
|
|
|
|
|
2024-04-08 22:56:44 +02:00
|
|
|
#search{
|
|
|
|
width: 100%;
|
|
|
|
height: 10%;
|
|
|
|
display: inline-flex;
|
2024-03-29 15:32:08 +01:00
|
|
|
}
|
2024-04-04 15:01:10 +02:00
|
|
|
#search-input {
|
2024-04-08 22:56:44 +02:00
|
|
|
margin-left: 25px;
|
|
|
|
width: 75%;
|
2024-04-01 19:13:39 +02:00
|
|
|
font-size: 16px;
|
|
|
|
padding: 12px 20px 12px 40px;
|
|
|
|
border: 1px solid #ddd;
|
2024-04-08 22:56:44 +02:00
|
|
|
height: 20px;
|
|
|
|
align-self: center;
|
2024-04-01 19:13:39 +02:00
|
|
|
}
|
2024-04-04 15:01:10 +02:00
|
|
|
|
2024-04-08 22:56:44 +02:00
|
|
|
#filterButton {
|
|
|
|
align-self: center;
|
|
|
|
margin-left: 2px;
|
|
|
|
font-size: xx-large;
|
|
|
|
color: white;
|
|
|
|
background: rgba(191, 64, 191,0.5);
|
|
|
|
border:2px solid black;
|
|
|
|
}
|
|
|
|
#filterButton:hover{
|
|
|
|
background: rgba(191, 64, 191);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-04-10 11:50:17 +02:00
|
|
|
#researchUL {
|
2024-04-01 19:13:39 +02:00
|
|
|
list-style-type: none;
|
2024-04-07 15:51:53 +02:00
|
|
|
color: white;
|
2024-04-04 15:01:10 +02:00
|
|
|
padding: 12px;
|
2024-04-08 11:02:59 +02:00
|
|
|
margin: 5px;
|
|
|
|
height: 400px;
|
|
|
|
overflow: scroll;
|
2024-04-01 19:13:39 +02:00
|
|
|
}
|
2024-04-10 11:50:17 +02:00
|
|
|
#researchLi{
|
2024-04-09 17:32:04 +02:00
|
|
|
display: grid;
|
|
|
|
grid-template-columns: auto auto auto;
|
2024-04-08 11:02:59 +02:00
|
|
|
border: 2px solid black;
|
|
|
|
color: white;
|
|
|
|
font-size: x-large;
|
2024-04-09 17:32:04 +02:00
|
|
|
text-align: center;
|
2024-04-08 11:02:59 +02:00
|
|
|
text-indent: 7px;
|
|
|
|
background-color: rgba(255, 255, 255, 0.09);
|
2024-04-09 17:32:04 +02:00
|
|
|
border-radius: 18px;
|
2024-04-08 11:02:59 +02:00
|
|
|
margin-bottom: 15px;
|
2024-04-01 19:13:39 +02:00
|
|
|
}
|
2024-04-09 17:32:04 +02:00
|
|
|
a{
|
|
|
|
color:#007aff;
|
|
|
|
text-decoration: underline;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.vl {
|
|
|
|
border-right: 2px solid black;
|
|
|
|
}
|
2024-04-05 09:44:41 +02:00
|
|
|
|
2024-04-01 19:13:39 +02:00
|
|
|
</style>
|