Skip to content

Commit

Permalink
Merge branch 'dev' into EEB20/advanced-search
Browse files Browse the repository at this point in the history
  • Loading branch information
kiri-diaconu authored Dec 20, 2023
2 parents a5d08ef + 281ae41 commit 0b9075c
Show file tree
Hide file tree
Showing 13 changed files with 190 additions and 101 deletions.
14 changes: 7 additions & 7 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@fortawesome/fontawesome-free": "5.2.0",
"@source-data/render-rev": "^0.2.0",
"@source-data/render-rev": "^0.2.1",
"axios": "^0.21.4",
"markdown-it": "^13.0.0",
"vue": "^2.6.11",
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template lang="pug">
v-app
Snackbar
TopNavBar
v-main.main-padding
v-container.main-content
Expand All @@ -11,6 +12,7 @@ v-app
<script>
import TopNavBar from './layouts/top-nav-bar'
import Banner from './layouts/banner'
import Snackbar from "./components/helpers/snackbar.vue";
import Footer from './layouts/footer'
export default {
Expand All @@ -19,7 +21,8 @@ export default {
components: {
TopNavBar,
Banner,
Footer
Footer,
Snackbar
},
metaInfo: {
meta: [
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/filtering/by-reviewing-service.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ v-card(flat)
v-card-title Filter by reviewer
v-card-subtitle Filter the reviewed preprints by the reviewer
v-card-text
v-chip-group(v-model="selectedReviewers" mandatory column multiple)
v-chip-group(v-model="selectedReviewers" column multiple)
span(v-for="service in this.reviewing_services" :key="`${service.id}-chip`")
v-chip(:value="service.id" :disabled="loadingRecords" filter filter-icon="mdi-check" outlined
active-class="active-chip" text-color="black")
Expand Down
39 changes: 39 additions & 0 deletions frontend/src/components/helpers/snackbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template lang="pug">
v-snackbar(v-model='show' :top="true" :color='color' timeout="3000" centered)
b {{ message }}
template(v-slot:action="{ attrs }")
v-btn(
text
v-bind="attrs"
@click="show = false" icon)
v-icon mdi-close
</template>

<script>
import { mapState } from 'vuex'
export default {
data() {
return {
show: false,
message: "",
color: ""
};
},
computed: {
...mapState(['snackMessage', 'snackColor']),
},
watch: {
snackMessage(nv, ov) {
if (nv != "" && nv != ov) {
this.show = true;
this.message = this.snackMessage;
this.color = this.snackColor;
this.$store.commit("setSnack", { message: "", color: "" });
}
}
}
};
</script>
11 changes: 10 additions & 1 deletion frontend/src/components/highlights/article.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
<template lang="pug">
v-container(fluid).pa-0
v-btn(
color="primary"
fixed
bottom
right
style="bottom: 75px;"
fab @click="$vuetify.goTo(0)")
v-icon mdi-arrow-up

v-row(v-if="article")
v-col.d-flex.align-center
HighlightedListItem(:article="article" :expandedReview="expandedReview" :open-preprint-boxes=[0, 1, 2] :open-reviewed-boxes=[0, 1, 2]).ml-auto.mr-auto
HighlightedListItem(:article="article" :expandedReview="expandedReview" :open-preprint-boxes=[0, 1, 2] :open-reviewed-boxes=[0, 1]).ml-auto.mr-auto
v-row(v-else)
v-col
v-card
Expand Down
27 changes: 14 additions & 13 deletions frontend/src/components/highlights/index.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<template lang="pug">
div(style="max-width: 100%;").d-flex.mr-auto.ml-auto
v-container(v-if="showAlert").mt-6
v-alert(color="red lighten-2" outlined) {{ error }}

v-container(v-if="loadingRecords").mt-6
v-progress-circular(:size="70" :width="7" color="primary" indeterminate).ml-auto

span(v-else style="max-width:100%;").mt-3
v-container(fluid v-if="paging.totalItems > 0" :class="{'highlights-loading': loadingRecords}")
h2 {{ paging.totalItems }} reviewed preprints found {{ query != '' ? `for search term "${query}" ` : '' }} in the selected sources
h2 {{ paging.totalItems }} reviewed preprints found
v-container(fluid v-if="paging.totalItems == 0")
h2 Sorry, we couldn't find any results
p Try changing some of the filter values.
Expand Down Expand Up @@ -46,10 +43,12 @@ div(style="max-width: 100%;").d-flex.mr-auto.ml-auto
v-btn(x-small v-bind="attrs" v-on="on" icon aria-label="ascending" value="asc")
v-icon(dense) mdi-sort-ascending
span Sort earliest first
v-row(v-if="paging.totalItems > 0")
v-switch(v-model="openAbstracts" dense label="Collapse all abstracts").pl-3.mt-0

v-row(v-for="article in records" :key="article.id")
v-col(cols=12)
HighlightedListItem(:article="article" :open-preprint-boxes="[]" :open-reviewed-boxes="[0]")
HighlightedListItem(:article="article" :open-preprint-boxes="openedByDefault" :open-reviewed-boxes="[1]")
v-row(v-if="paging.totalItems > 0" justify="start")
v-col(cols=6).px-0.d-flex
v-pagination(
Expand All @@ -66,7 +65,8 @@ import { mapState } from 'vuex'
export default {
data() {
return {
showAlert: false
openAbstracts: false,
openedByDefault: [0]
}
},
components: {
Expand Down Expand Up @@ -99,15 +99,16 @@ export default {
}
}
},
methods: {},
watch: {
error() {
this.showAlert = true;
window.setInterval(() => {
this.showAlert = false;
}, 5000)
openAbstracts(nv) {
if (nv) {
this.openedByDefault = []
}
else {
this.openedByDefault = [0]
}
}
}
},
}
</script>

Expand Down
118 changes: 65 additions & 53 deletions frontend/src/components/highlights/list-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ v-card(v-if="article" color="tertiary")
v-list(dense flat outlined)
v-list-item
v-list-item-title
v-btn(@click="copyFullUrlToClipboard" elevation=0 plain depressed v-ripple="false")
v-btn(@click="copyToClipboard(getFullStandaloneDoiUrl)" elevation=0 plain depressed v-ripple="false")
v-icon(color="primary") mdi-link-variant
span.ml-1 Copy link to clipboard
v-list-item
v-list-item-title
v-btn(@click="copyCitationToClipboard" elevation=0 plain depressed v-ripple="false")
v-btn(@click="copyToClipboard(citationText(true))" elevation=0 plain depressed v-ripple="false")
v-icon(color="primary") mdi-content-copy
span.ml-2 Copy citation
v-list-item
Expand Down Expand Up @@ -75,51 +75,51 @@ v-card(v-if="article" color="tertiary")
v-chip-group(v-if="article.assays.length > 0" :key="3" column)
v-chip(v-for="(item, index) in article.assays" outlined :key="`assays-${index}`").green--text {{ item }}

v-expansion-panels(accordion multiple v-model="dataOpenReviewedBoxes")
v-expansion-panel(readonly)
v-expansion-panel-header(hide-actions)
span.d-flex.flex-column
h3(style="color: black;") Preprint review timeline
//- TODO: enable this when the functionality is ready
//- v-tooltip(bottom transition="fade-transition")
//- template(v-slot:activator="{ on, hover, attrs }")
//- v-btn(@click="???" v-bind="attrs" v-on="on" icon elevation=0 plain depressed v-ripple="false")
//- v-icon(color="primary") mdi-download-circle
//- span Download all review data
v-card.no-bottom-radius
v-card-title
span.d-flex.flex-column
h4(style="color: black;") Preprint review timeline
//- TODO: enable this when the functionality is ready
//- v-tooltip(bottom transition="fade-transition")
//- template(v-slot:activator="{ on, hover, attrs }")
//- v-btn(@click="???" v-bind="attrs" v-on="on" icon elevation=0 plain depressed v-ripple="false")
//- v-icon(color="primary") mdi-download-circle
//- span Download all review data
v-card-subtitle
span.pb-0.d-flex.flex-row.align-center
b.mr-3 Reviewed by
v-bottom-sheet(v-model="dialog" eager inset)
template(v-slot:activator="{ on, attrs }")
v-chip-group
v-chip(
v-ripple="false" small
color="secondary"
outlined
@click="selectReviewerInfo(source)"
v-bind="attrs"
v-on="on" v-for='source in article.reviewed_by')
img(v-if="imageFileName(source)" :src="require(`@/assets/partner-logos/` + imageFileName(source))" height="24px" :alt="serviceId2Name(source)").pa-1
span(v-else) {{ serviceId2Name(source) }}
v-icon(right small) mdi-information

span.pb-0.d-flex.flex-row.align-center
b.mr-3 Reviewed by
v-bottom-sheet(v-model="dialog" inset)
template(v-slot:activator="{ on, attrs }")
v-chip-group
v-chip(
v-ripple="false" small
color="secondary"
outlined
@click="selectReviewerInfo(source)"
v-bind="attrs"
v-on="on" v-for='source in article.reviewed_by')
img(v-if="imageFileName(source)" :src="require(`@/assets/partner-logos/` + imageFileName(source))" height="24px" :alt="serviceId2Name(source)").pa-1
span(v-else) {{ serviceId2Name(service.id) }}
v-icon(right small) mdi-information

InfoCardsReviewServiceSummaryGraph(
:service_name="serviceId2Name(selectedSource)",
:url="reviewingService(selectedSource).url",
:peer_review_policy="reviewingService(selectedSource).peer_review_policy",
:review_requested_by="reviewingService(selectedSource).review_requested_by",
:reviewer_selected_by="reviewingService(selectedSource).reviewer_selected_by",
:review_coverage="reviewingService(selectedSource).review_coverage",
:reviewer_identity_known_to="reviewingService(selectedSource).reviewer_identity_known_to",
:competing_interests="reviewingService(selectedSource).competing_interests",
:public_interaction="reviewingService(selectedSource).public_interaction",
:opportunity_for_author_response="reviewingService(selectedSource).opportunity_for_author_response",
:recommendation="reviewingService(selectedSource).recommendation",
).px-0.mt-2
v-expansion-panel-content(eager).pt-0
span.review-process.d-flex.align-start.justify-start
render-rev-timeline(:ref='article.doi + "-rev-timeline"')
InfoCardsReviewServiceSummaryGraph(
:service_name="serviceId2Name(selectedSource)",
:url="reviewingService(selectedSource).url",
:peer_review_policy="reviewingService(selectedSource).peer_review_policy",
:review_requested_by="reviewingService(selectedSource).review_requested_by",
:reviewer_selected_by="reviewingService(selectedSource).reviewer_selected_by",
:review_coverage="reviewingService(selectedSource).review_coverage",
:reviewer_identity_known_to="reviewingService(selectedSource).reviewer_identity_known_to",
:competing_interests="reviewingService(selectedSource).competing_interests",
:public_interaction="reviewingService(selectedSource).public_interaction",
:opportunity_for_author_response="reviewingService(selectedSource).opportunity_for_author_response",
:recommendation="reviewingService(selectedSource).recommendation",
).px-0.mt-2
v-card-text
span.review-process.d-flex.align-start.justify-start
render-rev-timeline(:ref='article.doi + "-rev-timeline"')

v-expansion-panels(accordion multiple v-model="dataOpenReviewedBoxes").no-top-radius
v-expansion-panel(v-if="maybeReviewSummary")
v-expansion-panel-header
span
Expand All @@ -144,7 +144,7 @@ v-card(v-if="article" color="tertiary")
h3 Cite reviewed preprint
v-tooltip(color="tooltip" bottom transition="fade-transition")
template(v-slot:activator="{ on, hover, attrs }")
v-card(@click="copyCitationToClipboard" v-on:click.stop v-bind="attrs" v-on="on" icon elevation=0 plain depressed v-ripple="false").pl-2
v-card(@click="copyToClipboard(citationText(true))" v-on:click.stop v-bind="attrs" v-on="on" icon elevation=0 plain depressed v-ripple="false").pl-2
v-icon(color="primary") mdi-content-copy
span Click to copy reviewed preprint citation
v-expansion-panel-content
Expand All @@ -158,7 +158,7 @@ import { BASE_URL } from '../../lib/http'
import { serviceId2Name, normalizeServiceName } from '../../store/by-filters'
import '@source-data/render-rev'
import { parse as parseDocmaps } from '@source-data/render-rev/src/docmaps.js'
import { mapGetters } from 'vuex'
import { mapState, mapGetters } from 'vuex'
import InfoCardsReviewServiceSummaryGraph from '../helpers/review-service-summary-graph.vue'
export default {
Expand Down Expand Up @@ -225,11 +225,9 @@ export default {
responseId() {
return this.article.doi + '#rev0-ar'
},
copyFullUrlToClipboard () {
navigator.clipboard.writeText(this.getFullStandaloneDoiUrl);
},
copyCitationToClipboard () {
navigator.clipboard.writeText(this.citationText(true));
copyToClipboard (text) {
this.$store.commit("setSnack", { message: "Text copied to clipboard!", color: "gray" });
return navigator.clipboard.writeText(text);
},
selectReviewerInfo(value) {
this.selectedSource = value;
Expand Down Expand Up @@ -262,6 +260,7 @@ export default {
},
computed: {
...mapGetters('byFilters', ['reviewingService']),
...mapState(['snackMessage, snackColor']),
authorList() {
// first, clone the authors array because sort() operates in-place on the array it's called on.
Expand Down Expand Up @@ -294,6 +293,11 @@ export default {
return fullLink
},
},
watch: {
openPreprintBoxes: function (newVal) {
this.dataOpenPreprintBoxes = newVal
},
},
mounted() {
const doi = this.article.doi;
const highlightDoi = this.expandedReview ? this.expandedReview.doi : null;
Expand Down Expand Up @@ -367,9 +371,17 @@ export default {
.v-expansion-panel-header:not(.v-expansion-panel-header--active) .hide-when-not-expanded {
display: none;
}
.paper-title {
letter-spacing: normal;
line-height: normal;
}
.no-bottom-radius {
border-radius: 4px 4px 0 0 !important;
}
.no-top-radius>:first-child {
border-radius: 0 0 !important;
border-top: 1px solid rgb(0, 0, 0, 0.1);
}
</style>
3 changes: 2 additions & 1 deletion frontend/src/layouts/top-nav-bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
height=90
color="tertiary"
hide-on-scroll
scroll-off-screen
scroll-threshold=0
scroll-off-screen tile elevation=1
)
v-row
v-col(cols=3)
Expand Down
Loading

0 comments on commit 0b9075c

Please sign in to comment.