Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideDalPos committed Dec 4, 2024
1 parent d7f6d6d commit 52d19b2
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*
!panels
!panels/**
!pages
!pages/**
!config
Expand Down
51 changes: 51 additions & 0 deletions panels/PanelGBIF/PanelGBIF.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<template>
<VCard v-if="url">
<VCardHeader><GBIFLogo class="h-6" /></VCardHeader>
<VCardContent>
<a
class="text-sm"
:href="url"
v-html="taxon.full_name_tag"
/>
</VCardContent>
</VCard>
</template>

<script setup>
import { computed, ref, onMounted } from 'vue'
import axios from 'axios'
import GBIFLogo from './components/gbifLogo.vue'
const props = defineProps({
taxon: {
type: Object,
required: true
},
perPage: {
type: Number,
default: 60
}
})
const url = computed(() => {
return usageKey.value
? `https://www.gbif.org/species/${usageKey.value}`
: null
})
const usageKey = ref(null)
function loadUsageKey() {
axios
.get('https://api.gbif.org/v1/species/match', {
params: {
name: props.taxon.expanded_name
}
})
.then(({ data }) => {
usageKey.value = data?.usageKey
})
}
onMounted(loadUsageKey)
</script>
42 changes: 42 additions & 0 deletions panels/PanelGBIF/components/gbifLogo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<template>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="150 100 800 300"
>
<path
class="cls-2"
d="M274.26,246.51c0-55.06,26.87-102.71,106.83-102.71,0,55.18-36.3,102.71-106.83,102.71"
/>
<path
class="cls-2"
d="M402.37,391.08c14.98,0,26.49-2.13,38.31-6.48,0-43.58-26-74.71-71.91-97.15-35.14-17.62-78.39-26.74-117.83-26.74,17.31-51.95,4.69-116.41-12.08-151.79-18.58,37.07-30.18,100.62-12.34,152.32-35.04,2.55-62.82,17.82-74.58,37.94-.89,1.53-2.67,4.81-1.6,5.37,.84,.45,2.19-.92,3.03-1.69,12.66-11.72,29.42-17.43,45.52-17.43,37.2,0,63.46,30.87,82.01,49.41,39.88,39.87,78.85,56.32,121.48,56.24"
/>
<g>
<path
class="cls-1"
d="M556.02,186.44l-19.39,9.94c-.97,.48-1.94,1.21-2.91,1.21-.73,0-1.45-.48-1.94-1.7-4.36-10.42-10.66-14.3-17.21-14.3h-15.99c-9.45,0-17.45,8-17.45,17.45v71.74c0,9.45,8,17.45,17.45,17.45h11.88c9.69,0,17.21-7.76,17.21-17.45v-11.39c0-1.7-.73-2.42-2.42-2.42h-22.78c-1.7,0-2.42-.73-2.42-2.42v-20.6c0-1.7,.73-2.42,2.42-2.42h50.65c1.7,0,2.42,.73,2.42,2.42v36.84c0,25.2-17.69,42.9-45.08,42.9h-11.88c-27.63,0-45.08-17.69-45.08-42.9v-71.74c0-25.2,17.45-42.9,45.08-42.9h15.99c20.11,0,31.02,8.24,38.29,19.63,2.18,3.64,4.6,7.51,4.6,8.97,0,.73-.48,1.21-1.45,1.7Z"
/>
<path
class="cls-1"
d="M633.09,311.25h-54.53c-1.7,0-2.42-.73-2.42-2.42V160.99c0-1.7,.73-2.42,2.42-2.42h54.53c27.63,0,45.08,17.69,45.08,45.08v2.42c0,8.97-5.82,19.39-12.85,26.17-.73,.48-.97,1.21-.97,1.7s.24,1.21,.97,1.7c7.03,6.79,12.85,18.42,12.85,27.39v3.63c0,27.39-17.45,44.59-45.08,44.59Zm17.45-109.79c0-9.45-8-17.45-17.45-17.45h-26.66c-1.7,0-2.42,.73-2.42,2.42v32.23c0,1.7,.73,2.42,2.42,2.42h26.66c9.45,0,17.45-8,17.45-17.45v-2.18Zm0,62.28c0-9.69-7.76-17.21-17.45-17.21h-26.66c-1.7,0-2.42,.73-2.42,2.42v34.41c0,1.7,.73,2.42,2.42,2.42h26.66c9.45,0,17.45-7.51,17.45-17.45v-4.61Z"
/>
<path
class="cls-1"
d="M726.64,311.25h-23.02c-1.7,0-2.42-.73-2.42-2.42V160.99c0-1.7,.73-2.42,2.42-2.42h23.02c1.7,0,2.42,.73,2.42,2.42v147.83c0,1.7-.73,2.42-2.42,2.42Z"
/>
<path
class="cls-1"
d="M847.58,184.01h-57.68c-1.7,0-2.42,.73-2.42,2.42v32.23c0,1.7,.73,2.42,2.42,2.42h47.26c1.7,0,2.42,.73,2.42,2.42v20.6c0,1.7-.73,2.42-2.42,2.42h-47.26c-1.7,0-2.42,.73-2.42,2.42v59.86c0,1.7-.73,2.42-2.42,2.42h-23.02c-1.7,0-2.42-.73-2.42-2.42V160.99c0-1.7,.73-2.42,2.42-2.42h85.55c1.7,0,2.42,.73,2.42,2.42v20.6c0,1.7-.73,2.42-2.42,2.42Z"
/>
</g>
</svg>
</template>

<style scoped>
.cls-1 {
fill: #231f20;
}
.cls-2 {
fill: #4c9c2e;
}
</style>
6 changes: 6 additions & 0 deletions panels/PanelGBIF/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import PanelGBIF from './PanelGBIF.vue'

export default {
id: 'panel:gbif',
component: PanelGBIF
}
61 changes: 61 additions & 0 deletions panels/PanelScrutiny/PanelScrutiny.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<template>
<VCard v-if="scrutinies.length">
<VCardHeader>Scrutiny</VCardHeader>
<VCardContent>
<ul class="text-sm">
<li v-for="item in scrutinies">
{{ item.value
}}{{ item.value[item.value.length - 1] === '.' ? '' : '.' }}
{{
item.citations
?.map((citation) => citation.citation_source_body)
.join('; ')
}}
</li>
</ul>
</VCardContent>
</VCard>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { makeAPIRequest } from '@/utils'
const SCRUTINY_ID = 3102
const props = defineProps({
taxonId: {
type: Number,
required: true
}
})
const scrutinies = ref([])
onMounted(() => {
const payload = {
attribute_subject_id: props.taxonId,
controlled_vocabulary_term_id: SCRUTINY_ID
}
makeAPIRequest
.get('/data_attributes.json', { params: payload })
.then(async (response) => {
scrutinies.value = response.data
scrutinies.value.forEach((scrutiny) => getCitationsFor(scrutiny))
})
})
function getCitationsFor(scrutiny) {
const payload = {
citation_object_id: scrutiny.id,
citation_object_type: 'DataAttribute'
}
makeAPIRequest
.get('/citations.json', { params: payload })
.then((response) => {
scrutiny.citations = response.data
})
}
</script>
6 changes: 6 additions & 0 deletions panels/PanelScrutiny/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import PanelScrutiny from './PanelScrutiny.vue'

export default {
id: 'panel:scrutiny',
component: PanelScrutiny
}

0 comments on commit 52d19b2

Please sign in to comment.