Skip to content

Commit

Permalink
Merge pull request #58 from scaife-viewer/develop
Browse files Browse the repository at this point in the history
Prepare for v2020-07-31-001 release
  • Loading branch information
jacobwegner authored Jul 31, 2020
2 parents 46a320c + df0c71d commit 33caaf2
Show file tree
Hide file tree
Showing 45 changed files with 1,921 additions and 695 deletions.
4 changes: 2 additions & 2 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[context."master".environment]
VUE_APP_ATLAS_GRAPHQL_ENDPOINT = "https://explorehomer-atlas.scaife-viewer.org/graphql/"
[context."feature/passage-metadata-improvements".environment]
VUE_APP_ATLAS_GRAPHQL_ENDPOINT = "https://explorehomer-feature-pa-bpryib.herokuapp.com/graphql/"
[context."spike-apollo".environment]
VUE_APP_ATLAS_GRAPHQL_ENDPOINT = "https://explorehomer-perf-dl-xxvzwupn7.herokuapp.com/graphql/"
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
"openseadragon": "^2.4.2",
"path": "^0.12.7",
"sass-loader": "^8.0.2",
"scaife-skeleton": "^0.7.0",
"scaife-skeleton": "^0.10.0",
"vue": "^2.6.11",
"vue-apollo": "^3.0.3",
"vue-mapbox": "^0.4.1",
"vue-router": "^3.1.6",
"vuex": "^3.3.0",
"vuex-router-sync": "^5.0.0",
"webpack": "^4.43.0"
},
"devDependencies": {
Expand Down
34 changes: 7 additions & 27 deletions src/actions.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import gql from 'graphql-tag';

import { gqlclient } from '@/gql';
import client from '@/gql';
import {
FETCH_METADATA,
UPDATE_METADATA,
FETCH_LIBRARY,
SET_PASSAGE,
SET_DISPLAY_MODE_METRICAL,
SET_DISPLAY_MODE_INTERLINEAR,
SET_DISPLAY_MODE_NAMED_ENTITIES,
SET_DISPLAY_MODE_FOLIO,
SET_DISPLAY_MODE_SENTENCE_ALIGNMENTS,
SET_DISPLAY_MODE_DEFAULT,
SET_DISPLAY_MODE,
SELECT_NAMED_ENTITIES,
CLEAR_NAMED_ENTITIES,
PLAY_AUDIO,
Expand All @@ -35,26 +30,11 @@ export default {
[CLEAR_NAMED_ENTITIES]: ({ commit }) => {
commit(CLEAR_NAMED_ENTITIES);
},
[SET_DISPLAY_MODE_NAMED_ENTITIES]: ({ commit }) => {
commit(SET_DISPLAY_MODE_NAMED_ENTITIES);
},
[SET_DISPLAY_MODE_METRICAL]: ({ commit }) => {
commit(SET_DISPLAY_MODE_METRICAL);
},
[SET_DISPLAY_MODE_SENTENCE_ALIGNMENTS]: ({ commit }) => {
commit(SET_DISPLAY_MODE_SENTENCE_ALIGNMENTS);
},
[SET_DISPLAY_MODE_FOLIO]: ({ commit }) => {
commit(SET_DISPLAY_MODE_FOLIO);
},
[SET_DISPLAY_MODE_DEFAULT]: ({ commit }) => {
commit(SET_DISPLAY_MODE_DEFAULT);
},
[SET_DISPLAY_MODE_INTERLINEAR]: ({ commit }) => {
commit(SET_DISPLAY_MODE_INTERLINEAR);
[SET_DISPLAY_MODE]: ({ commit }, { mode }) => {
commit(SET_DISPLAY_MODE, mode);
},
[FETCH_METADATA]: ({ commit }) => {
gqlclient
client
.query({
query: gql`
{
Expand All @@ -77,7 +57,7 @@ export default {
);
},
[UPDATE_METADATA]: ({ commit }, { urn }) => {
gqlclient
client
.query({
query: gql`
{
Expand All @@ -101,7 +81,7 @@ export default {
},
// @@@ should this really be something within scaife-widgets?
[FETCH_LIBRARY]: ({ commit }) => {
gqlclient
client
.query({
query: gql`
{
Expand Down
89 changes: 89 additions & 0 deletions src/components/EntityMap.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<template>
<MglMap
:zoom="10"
:accessToken="accessToken"
:mapStyle="mapStyle"
:center="center"
@load="onMapLoaded"
>
<EntityMapMarker
v-for="(coordinates, idx) in coordinatesList"
:key="getMarkerKey(coordinates[2], idx)"
:lat="coordinates[0]"
:lng="coordinates[1]"
:placeId="coordinates[2]"
:placeLabel="coordinates[3]"
/>
<MglNavigationControl position="top-right" />
</MglMap>
</template>

<script>
import Mapbox from 'mapbox-gl';
import { MglMap, MglNavigationControl } from 'vue-mapbox';
import EntityMapMarker from './EntityMapMarker.vue';
export default {
props: ['coordinatesList', 'selectedPlace'],
components: {
MglMap,
MglNavigationControl,
EntityMapMarker,
},
created() {
this.map = null;
this.mapbox = Mapbox;
},
methods: {
onMapLoaded(event) {
this.map = event.map;
if (this.coordinatesList.length > 1) {
const bbox = this.coordinatesList.map(c => {
return [c[0], c[1]];
});
this.map.fitBounds(bbox);
}
},
getMarkerKey(entityId, idx) {
// constructs a key that will be recomputed
// when the value of `selectedNamedEntities` changes in the store
const isSelected =
this.selectedEntities.filter(id => entityId === id).length > 0;
return `${entityId}::${idx}::${isSelected}`;
},
},
watch: {
coordinatesList: {
immediate: true,
handler() {
this.$nextTick(() => {
if (this.map !== null) {
if (this.coordinatesList.length > 1) {
this.map.fitBounds(this.coordinatesList);
} else {
this.map.setCenter(this.coordinatesList[0]);
}
}
});
},
},
},
computed: {
center() {
return [this.coordinatesList[0][0], this.coordinatesList[0][1]];
},
config() {
return this.$scaife.config.entityMap;
},
accessToken() {
return this.config.accessToken;
},
mapStyle() {
return this.config.mapStyle;
},
selectedEntities() {
return this.$store.state.selectedNamedEntities;
},
},
};
</script>
46 changes: 46 additions & 0 deletions src/components/EntityMapMarker.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<template>
<MglMarker ref="marker" :coordinates="[lat, lng]" @click="onMarkerClick">
<MglPopup
ref="popup"
:showed="selected"
:closeButton="false"
:closeOnClick="false"
>
<div class="label">{{ placeLabel }}</div>
</MglPopup>
</MglMarker>
</template>

<script>
import { MglMarker, MglPopup } from 'vue-mapbox';
import { SELECT_NAMED_ENTITIES } from '../constants';
export default {
components: { MglMarker, MglPopup },
props: {
lat: Number,
lng: Number,
placeId: String,
placeLabel: String,
},
methods: {
onMarkerClick() {
if (!this.selected) {
this.$store.dispatch(SELECT_NAMED_ENTITIES, {
entities: [this.placeId],
});
}
},
},
computed: {
selected() {
return (
this.selectedEntities.filter(id => this.placeId === id).length > 0
);
},
selectedEntities() {
return this.$store.state.selectedNamedEntities;
},
},
};
</script>
69 changes: 69 additions & 0 deletions src/components/EntityMapToolbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<template>
<div class="entity-map-toolbar">
<a href :class="{ active: noMap }" @click.prevent="onNone">
<icon name="align-left" />
</a>
<a href :class="{ active: showVertical }" @click.prevent="onVertical">
<icon name="grip-lines" />
</a>
<a href :class="{ active: showHorizontal }" @click.prevent="onHorizontal">
<icon name="grip-lines-vertical" />
</a>
</div>
</template>

<script>
import {
MAP_STATE_HORIZONTAL,
MAP_STATE_VERTICAL,
MAP_STATE_NONE,
} from '@/constants';
export default {
props: ['mapState'],
methods: {
onNone() {
this.$emit('show', MAP_STATE_NONE);
},
onVertical() {
this.$emit('show', MAP_STATE_VERTICAL);
},
onHorizontal() {
this.$emit('show', MAP_STATE_HORIZONTAL);
},
},
computed: {
noMap() {
return this.mapState === MAP_STATE_NONE;
},
showHorizontal() {
return this.mapState === MAP_STATE_HORIZONTAL;
},
showVertical() {
return this.mapState === MAP_STATE_VERTICAL;
},
},
};
</script>

<style lang="scss" scoped>
.entity-map-toolbar {
display: flex;
padding-bottom: 0.75rem;
a {
margin: 0 0.5rem;
padding: 0.25rem;
border-radius: 3px;
border: 1px solid transparent;
}
a:hover {
border-color: $explorehomer-brand;
}
a.active {
font-weight: 700;
background: $explorehomer-brand;
color: $white;
border-color: transparent;
}
}
</style>
2 changes: 1 addition & 1 deletion src/components/ErrorMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</template>

<script>
export default {}
export default {};
</script>

<style lang="scss" scoped>
Expand Down
10 changes: 5 additions & 5 deletions src/components/ImageViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@
const openHandler = () => {
this.errorMessage = null;
this.displayViewer = true;
}
};
const openFailedHandler = err => {
this.errorMessage = err.message;
this.displayViewer = false;
}
};
this.viewer.addHandler('open', openHandler, false);
this.viewer.addHandler('open-failed', openFailedHandler, false);
},
Expand Down Expand Up @@ -129,9 +129,9 @@
.error {
margin: 10px 0px;
padding:12px;
color: #D8000C;
background-color: #FFD2D2;
padding: 12px;
color: #d8000c;
background-color: #ffd2d2;
vertical-align: middle;
max-width: 40em;
}
Expand Down
12 changes: 6 additions & 6 deletions src/components/ImageViewerToolbar.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<div class="image-viewer-toolbar">
<a href :class="{ active: showText }" @click.prevent="onShowText">
<icon name="align-justify" />
<icon name="align-left" />
</a>
<a href :class="{ active: showImage }" @click.prevent="onShowImage" >
<a href :class="{ active: showImage }" @click.prevent="onShowImage">
<icon name="book-open" />
</a>
<a href :class="{ active: showBoth }" @click.prevent="onShowBoth" >
<icon name="align-justify" /> |
<a href :class="{ active: showBoth }" @click.prevent="onShowBoth">
<icon name="align-left" /> |
<icon name="book-open" />
</a>
</div>
Expand Down Expand Up @@ -43,8 +43,8 @@
onShowBoth() {
this.$emit('show', IMAGE_VIEWER_STATE_BOTH);
},
}
}
},
};
</script>

<style lang="scss" scoped>
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoaderBall.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
background-color: #343a40;
}
.partial-loader {
margin-top: 1.0em;
margin-top: 1em;
text-align: center;
transform: translate3d(0, 0, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Paginator.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<nav class="paginator">
<router-link
v-if="urn"
v-if="urn"
:key="urn.toString()"
:to="{ path: 'reader', query: { urn: urn.toString() } }"
>
Expand Down
Loading

0 comments on commit 33caaf2

Please sign in to comment.