-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from SpeciesFileGroup/development
Development
- Loading branch information
Showing
9 changed files
with
198 additions
and
133 deletions.
There are no files selected for viewing
112 changes: 0 additions & 112 deletions
112
src/modules/otus/components/Panel/PanelCitation/PanelCitation.vue
This file was deleted.
Oops, something went wrong.
File renamed without changes.
40 changes: 40 additions & 0 deletions
40
src/modules/otus/components/Panel/PanelNomenclature/PanelNomenclature.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <template> | ||
| <PanelNomenlcatureCitations :list="citations" /> | ||
| <PanelNomenclatureReferences :list="sources" /> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| import { ref, watch } from 'vue' | ||
| import PanelNomenlcatureCitations from './PanelNomenclatureCitations.vue' | ||
| import PanelNomenclatureReferences from './PanelNomenclatureReferences.vue' | ||
| import TaxonWorks from '../../../services/TaxonWorks' | ||
| const props = defineProps({ | ||
| otuId: { | ||
| type: [Number, String], | ||
| required: true | ||
| }, | ||
| taxonId: { | ||
| type: [Number, String], | ||
| required: true | ||
| } | ||
| }) | ||
| const citations = ref([]) | ||
| const sources = ref([]) | ||
| watch( | ||
| () => props.taxonId, | ||
| async () => { | ||
| if (!props.taxonId) { | ||
| return | ||
| } | ||
| const { data } = await TaxonWorks.getTaxonNameCitations(props.taxonId) | ||
| citations.value = data.timeline | ||
| sources.value = data.sources | ||
| }, | ||
| { immediate: true } | ||
| ) | ||
| </script> |
67 changes: 67 additions & 0 deletions
67
src/modules/otus/components/Panel/PanelNomenclature/PanelNomenclatureCitations.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| <template> | ||
| <VCard> | ||
| <VCardHeader class="flex justify-between"> | ||
| <h2 class="text-md">Nomenclature ({{ list.length }})</h2> | ||
| <Dropdown :items="menuOptions"> | ||
| <template #button> | ||
| <IconHamburger class="text-base-soft h-4" /> | ||
| </template> | ||
| </Dropdown> | ||
| </VCardHeader> | ||
|
|
||
| <ul class="text-sm"> | ||
| <CitationRow | ||
| v-for="citation in citationList.first" | ||
| :key="citation.label" | ||
| :citation="citation" | ||
| /> | ||
|
|
||
| <PanelNomenclatureShowMore | ||
| v-if="!showAll && citationList.middle.length" | ||
| :count="citationList.middle.length" | ||
| @click="showAll = true" | ||
| /> | ||
| <AnimationOpacity> | ||
| <div v-show="showAll"> | ||
| <CitationRow | ||
| v-for="citation in citationList.middle" | ||
| :key="citation.label" | ||
| :citation="citation" | ||
| /> | ||
| </div> | ||
| </AnimationOpacity> | ||
|
|
||
| <CitationRow | ||
| v-for="citation in citationList.last" | ||
| :key="citation.label" | ||
| :citation="citation" | ||
| /> | ||
| </ul> | ||
| </VCard> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| import { ref, computed } from 'vue' | ||
| import { splitList } from './splitList' | ||
| import CitationRow from './PanelCitationRow.vue' | ||
| import PanelNomenclatureShowMore from './PanelNomenclatureShowMore.vue' | ||
| const MAX_CITATIONS = 5 | ||
| const props = defineProps({ | ||
| list: { | ||
| type: Array, | ||
| default: () => [] | ||
| } | ||
| }) | ||
| const showAll = ref(false) | ||
| const citationList = computed(() => splitList(props.list, MAX_CITATIONS)) | ||
| const menuOptions = computed(() => [ | ||
| { | ||
| label: showAll.value ? 'Show less' : 'Show all', | ||
| action: () => (showAll.value = !showAll.value) | ||
| } | ||
| ]) | ||
| </script> |
67 changes: 67 additions & 0 deletions
67
src/modules/otus/components/Panel/PanelNomenclature/PanelNomenclatureReferences.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| <template> | ||
| <VCard> | ||
| <VCardHeader class="flex justify-between"> | ||
| <h2 class="text-md">Nomenclature references ({{ list.length }})</h2> | ||
| <Dropdown :items="menuOptions"> | ||
| <template #button> | ||
| <IconHamburger class="text-base-soft h-4" /> | ||
| </template> | ||
| </Dropdown> | ||
| </VCardHeader> | ||
|
|
||
| <ul class="text-sm"> | ||
| <PanelReferenceRow | ||
| v-for="reference in referenceList.first" | ||
| :key="reference" | ||
| :reference="reference" | ||
| /> | ||
|
|
||
| <PanelNomenclatureShowMore | ||
| v-if="!showAll && referenceList.middle.length" | ||
| :count="referenceList.middle.length" | ||
| @click="showAll = true" | ||
| /> | ||
| <AnimationOpacity> | ||
| <div v-show="showAll"> | ||
| <PanelReferenceRow | ||
| v-for="reference in referenceList.middle" | ||
| :key="reference" | ||
| :reference="reference" | ||
| /> | ||
| </div> | ||
| </AnimationOpacity> | ||
|
|
||
| <PanelReferenceRow | ||
| v-for="reference in referenceList.last" | ||
| :key="reference" | ||
| :reference="reference" | ||
| /> | ||
| </ul> | ||
| </VCard> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| import { computed, ref } from 'vue' | ||
| import { splitList } from './splitList' | ||
| import PanelNomenclatureShowMore from './PanelNomenclatureShowMore.vue' | ||
| import PanelReferenceRow from './PanelReferenceRow.vue' | ||
| const MAX_REFERENCES = 2 | ||
| const props = defineProps({ | ||
| list: { | ||
| type: Array, | ||
| default: () => [] | ||
| } | ||
| }) | ||
| const showAll = ref(false) | ||
| const referenceList = computed(() => splitList(props.list, MAX_REFERENCES)) | ||
| const menuOptions = computed(() => [ | ||
| { | ||
| label: showAll.value ? 'Show less' : 'Show all', | ||
| action: () => (showAll.value = !showAll.value) | ||
| } | ||
| ]) | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/modules/otus/components/Panel/PanelNomenclature/splitList.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { computed } from 'vue' | ||
|
|
||
| export function splitList(list, MAX_RECORDS) { | ||
| const copyArr = list.slice() | ||
| const first = copyArr.splice(0, MAX_RECORDS) | ||
| const last = copyArr.splice(-MAX_RECORDS) | ||
| const middle = copyArr | ||
|
|
||
| return { | ||
| first, | ||
| middle, | ||
| last | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters