Skip to content

Commit

Permalink
Merge pull request #185 from SpeciesFileGroup/development
Browse files Browse the repository at this point in the history
Add footer store
  • Loading branch information
jlpereira authored Nov 2, 2023
2 parents 383c6f2 + a258d44 commit cbbce5b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/components/Layout/LayoutFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<div class="container mx-auto text-sm pt-2 pb-4">
<div class="pt-4 pb-2 break-words">
{{ project_authors }}
<span v-html="store.nextAuthor" />
{{ project_citation }}.
<ClientOnly>
<span>Retrieved on {{ currentDate }}</span>
Expand Down Expand Up @@ -37,7 +38,9 @@
<hr class="mt-3 mb-3 border-gray-500" />

<div class="flex flex-col sm:flex-row justify-between gap-4">
<div class="[&>*:not(:last-child)]:after:content-['|'] [&>*:not(:last-child)]:after:mx-1">
<div
class="[&>*:not(:last-child)]:after:content-['|'] [&>*:not(:last-child)]:after:mx-1"
>
<span>
Data provided by
<a
Expand Down Expand Up @@ -68,7 +71,7 @@
Species File Group
</a>
</span>
<FooterAnalytics class="italic"/>
<FooterAnalytics class="italic" />
</div>
<TrackerReport
icon
Expand All @@ -83,6 +86,7 @@
<script setup>
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import { useFooterStore } from '@/store'
import FooterAnalytics from '@/components/Footer/FooterAnalytics.vue'
const {
Expand All @@ -95,6 +99,7 @@ const {
hash_mode
} = __APP_ENV__
const store = useFooterStore()
const currentDate = new Date().toISOString().split('T')[0]
const route = useRoute()
Expand Down
7 changes: 6 additions & 1 deletion src/modules/otus/components/Panel/PanelMap/PanelMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<VMap
class="h-96 max-h-96"
dragging
cluster
:cluster="cluster"
:zoom="zoom"
:zoom-bounds="8"
:geojson="store.distribution.geojson"
Expand Down Expand Up @@ -81,6 +81,11 @@ const props = defineProps({
taxon: {
type: Object,
required: true
},
cluster: {
type: Boolean,
default: true
}
})
Expand Down
5 changes: 4 additions & 1 deletion src/modules/otus/store/store.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { defineStore } from 'pinia'
import TaxonWorks from '../services/TaxonWorks'
import { useOtuPageRequest } from '../helpers/useOtuPageRequest'
import { useOtuPageRequestStore } from './request'
import { useFooterStore } from '@/store'
import TaxonWorks from '../services/TaxonWorks'

export const useOtuStore = defineStore('otuStore', {
state: () => {
Expand All @@ -23,6 +24,7 @@ export const useOtuStore = defineStore('otuStore', {
},
actions: {
async loadTaxon(id, { signal }) {
const footerStore = useFooterStore()
const responses = await Promise.all([
TaxonWorks.getTaxon(id, {
params: { extend: ['type_taxon_name_relationship'] }
Expand All @@ -31,6 +33,7 @@ export const useOtuStore = defineStore('otuStore', {
])

this.taxon = Object.assign({}, ...responses.map((r) => r.data))
footerStore.setNextAuthorText(this.taxon.full_name_tag + '.')
},
async loadOtu(id, { signal }) {
const otu = await TaxonWorks.getOtu(id, { signal })
Expand Down
4 changes: 3 additions & 1 deletion src/modules/otus/views/PageLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:key="index"
>
<template
v-for="{ component, rankGroup, id } in column"
v-for="{ component, rankGroup, id, bind } in column"
:key="id"
>
<component
Expand All @@ -21,6 +21,8 @@
:otu="otu"
:taxon-id="taxonId"
:taxon="taxon"
:panel-key="id"
v-bind="bind"
/>
</template>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './useFooterStore'
14 changes: 14 additions & 0 deletions src/store/useFooterStore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineStore } from 'pinia'

export const useFooterStore = defineStore('footerStore', {
state: () => {
return {
nextAuthor: ''
}
},
actions: {
setNextAuthorText(value) {
this.nextAuthor = value
}
}
})

0 comments on commit cbbce5b

Please sign in to comment.