Skip to content

Commit

Permalink
Merge pull request #28 from scaife-viewer/develop
Browse files Browse the repository at this point in the history
Prepare for v2020-06-11-002 release
  • Loading branch information
jacobwegner authored Jun 11, 2020
2 parents abc284c + 5dfe6d0 commit 3efe5d6
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/reader/components/ReaderView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import TokenAnnotationWidget from '@/widgets/TokenAnnotationWidget.vue';
import NamedEntitiesWidget from '@/widgets/NamedEntitiesWidget';
import DisplayModeWidget from '@/widgets/DisplayModeWidget.vue';
import ScholiaWidget from '@/widgets/ScholiaWidget.vue';
import { FETCH_METADATA, FETCH_LIBRARY } from '@/constants';
export default {
Expand Down Expand Up @@ -55,6 +56,7 @@
TokenAnnotationWidget,
WordListWidget,
NewAlexandriaWidget,
ScholiaWidget,
];
},
},
Expand Down
75 changes: 75 additions & 0 deletions src/widgets/ScholiaWidget.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<div class="scholia">
<div v-if="!lines">No commentary found.</div>
<div v-for="line in lines" :key="line.idx" class="line">
<span class="lemma">{{ line.lemma }} </span>
<span class="comment">{{ line.comment }}</span>
</div>
</div>
</template>

<script>
import gql from 'graphql-tag';
import { URN } from '@scaife-viewer/scaife-widgets';
import { MODULE_NS } from '@/reader/constants';
export default {
scaifeConfig: {
displayName: 'Scholia',
location: 'sidebar',
singleton: true,
},
computed: {
urn() {
return this.$route.query.urn
? new URN(this.$route.query.urn)
: this.$store.getters[`${MODULE_NS}/firstPassageUrn`];
},
lines() {
return (
this.gqlData &&
this.gqlData.textAnnotations.edges.map(e => {
return {
idx: e.node.idx,
dse: e.node.data.dse,
comment: e.node.data.comment,
lemma: e.node.data.lemma,
references: e.node.data.references,
}
})
);
},
gqlQuery() {
if (this.urn) {
return gql`
{
textAnnotations(reference: "${this.urn}") {
edges {
node {
idx
data
}
}
}
}
`;
}
return null;
},
},
};
</script>

<style lang="scss" scoped>
.scholia {
margin: 0 2em;
}
.line {
font-family: $font-family-serif;
font-size: 14px;
.lemma {
font-weight: 700;
}
margin-bottom: 10px;
}
</style>

0 comments on commit 3efe5d6

Please sign in to comment.