1
0
forked from PGL/Clyde
Clyde/frontend/src/Apps/ScientificPublications/ResearcherProfile.vue

165 lines
4.5 KiB
Vue
Raw Normal View History

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-20 19:56:07 +02:00
import {fetchResearcher, fetchResearches, fetchStats} from "@/rest/ScientificPublications/ResearcherProfile.js";
2024-04-20 01:12:37 +02:00
import ListResearches from "@/Apps/ScientificPublications/ListResearches.vue";
2024-04-04 15:01:10 +02:00
const input = ref("");
const statsOf = ref("");
const statsBy = ref("");
2024-04-05 09:44:41 +02:00
let chart;
2024-04-04 15:01:10 +02:00
const researcherId = window.location.href.split("=")[1]
const researchList = ref(await fetchResearches(researcherId));
const researcher = ref(await fetchResearcher(researcherId));
const stats = ref(await fetchStats(researcherId))
2024-04-15 23:35:05 +02:00
function downloadCoAuthors(){
2024-04-20 19:07:27 +02:00
let coAuthors = []
for (let i in researchList.value) {
for (const j in researchList.value[i].coAuthors){
const coAuthor = researchList.value[i].coAuthors[j]
coAuthors.push(coAuthor)
}
}
const data = JSON.stringify(coAuthors);
2024-04-15 23:35:05 +02:00
const blob = new Blob([data], {type:"application/json"});
return URL.createObjectURL(blob);
}
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(){
2024-04-17 00:09:30 +02:00
options.title = {
fontColor: "white",
text: statsOf.value + " By "+ statsBy.value,
}
let index = (statsOf.value === "views"?0:(statsOf.value === "researches"?3:6)) + (statsBy.value ==="years"?0:(statsBy.value==="months"?1:2))
2024-04-17 00:09:30 +02:00
if (statsOf.value !== "" && statsBy.value !== "")
options.data[0].dataPoints = stats.value[index]
2024-04-17 00:09:30 +02:00
options.title.text = statsOf.value + " By "+ statsBy.value;
chart.render();
}
2024-03-29 15:32:08 +01:00
</script>
<template>
2024-04-04 15:01:10 +02:00
<div id="main">
<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="researches">Researches</option>
2024-04-17 00:09:30 +02:00
<option value="languages">Languages</option>
2024-04-04 15:01:10 +02:00
</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-17 00:09:30 +02:00
<option value="years">Years</option>
2024-04-04 15:01:10 +02:00
<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-20 01:12:37 +02:00
<div id="researches"><list-researches :researchList="researchList"></list-researches></div>
2024-03-29 15:32:08 +01:00
</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-09 17:32:04 +02:00
a{
color:#007aff;
text-decoration: underline;
cursor: pointer;
}
</style>