-
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.
- Loading branch information
jlpereira
committed
Mar 27, 2023
1 parent
9f32a4b
commit fe1d86a
Showing
15 changed files
with
249 additions
and
84 deletions.
There are no files selected for viewing
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/components/Table/VTableBody.vue → src/components/Table/VTableBody.global.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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| <template> | ||
| <tbody class="normal-case"> | ||
| <tbody class="normal-case text-xs"> | ||
| <slot /> | ||
| </tbody> | ||
| </template> | ||
|
|
||
2 changes: 1 addition & 1 deletion
2
src/components/Table/VTableBodyCell.vue → ...omponents/Table/VTableBodyCell.global.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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| <template> | ||
| <td class="px-6 py-4"> | ||
| <td class="px-4 py-4"> | ||
| <slot /> | ||
| </td> | ||
| </template> | ||
|
|
||
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
src/components/Table/VTableHeaderCell.vue → ...ponents/Table/VTableHeaderCell.global.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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| <template> | ||
| <th class="px-6 py-3"> | ||
| <th class="px-4 py-3"> | ||
| <slot /> | ||
| </th> | ||
| </template> | ||
|
|
||
File renamed without changes.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| <template> | ||
| <VTable v-if="list.length"> | ||
| <VTableHeader> | ||
| <VTableHeaderRow> | ||
| <VTableHeaderCell | ||
| class="w-full flex justify-between box-border items-center" | ||
| > | ||
| <span>OTU</span> | ||
| <IconClose | ||
| class="opacity-30 cursor-pointer" | ||
| @click="emit('close:table')" | ||
| /> | ||
| </VTableHeaderCell> | ||
| </VTableHeaderRow> | ||
| </VTableHeader> | ||
| <VTableBody> | ||
| <VTableBodyRow | ||
| v-for="otu in list" | ||
| :key="otu.id" | ||
| > | ||
| <VTableBodyCell> | ||
| <RouterLink | ||
| v-html="otu.object_tag" | ||
| :to="{ name: 'otus-id', params: { id: otu.id } }" | ||
| @click="() => emit('close')" | ||
| /> | ||
| </VTableBodyCell> | ||
| </VTableBodyRow> | ||
| </VTableBody> | ||
| </VTable> | ||
| <div class="text-lg text-center text-base-lighter align-middle p-4"> | ||
| No OTUs found in this area | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| const props = defineProps({ | ||
| list: { | ||
| type: Array, | ||
| default: () => [] | ||
| } | ||
| }) | ||
| const emit = defineEmits(['close', 'close:table']) | ||
| </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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| <template> | ||
| <div | ||
| ref="root" | ||
| class="w-screen h-screen fixed top-0 left-0 z-[5000]" | ||
| > | ||
| <VSpinner v-if="isLoading" /> | ||
| <SearchBar | ||
| :label="otu.object_tag" | ||
| @search="loadOTUs" | ||
| @close="() => emit('close')" | ||
| /> | ||
| <div class="relative"> | ||
| <VMap | ||
| ref="mapRef" | ||
| class="w-screen h-screen" | ||
| controls | ||
| @draw:start="() => (geojson = {})" | ||
| @add:layer=" | ||
| ($event) => { | ||
| geoJson = JSON.stringify($event.geometry) | ||
| } | ||
| " | ||
| :zoom="4" | ||
| /> | ||
| <div | ||
| class="h-screen md:w-96 absolute top-0 bg-base-background z-[2000] overflow-auto ease-in-out duration-300 w-full" | ||
| :class="{ | ||
| 'md:-right-96 -right-full': !isTableVisible, | ||
| 'right-0': isTableVisible | ||
| }" | ||
| > | ||
| <ListResults | ||
| v-if="isTableVisible" | ||
| :list="list" | ||
| @close="() => emit('close')" | ||
| @close:table="() => (isTableVisible = false)" | ||
| /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup> | ||
| import { ref, onMounted, onUnmounted, watch } from 'vue' | ||
| import { makeAPIRequest } from '@/utils/request' | ||
| import SearchBar from './SearchBar.vue' | ||
| import ListResults from './ListResults.vue' | ||
| const props = defineProps({ | ||
| otu: { | ||
| type: Array, | ||
| default: () => [] | ||
| } | ||
| }) | ||
| const root = ref() | ||
| const emit = defineEmits(['close']) | ||
| const geoJson = ref({}) | ||
| const mapRef = ref(null) | ||
| const list = ref([]) | ||
| const isTableVisible = ref(false) | ||
| const isLoading = ref() | ||
| onMounted(() => { | ||
| document.addEventListener('keyup', handleKeyboard) | ||
| document.body.classList.add('overflow-hidden') | ||
| }) | ||
| onUnmounted(() => { | ||
| document.removeEventListener('keyup', handleKeyboard) | ||
| document.body.classList.remove('overflow-hidden') | ||
| }) | ||
| const handleKeyboard = ({ key }) => { | ||
| switch (key) { | ||
| case 'Escape': | ||
| emit('close') | ||
| break | ||
| } | ||
| } | ||
| function loadOTUs() { | ||
| const payload = { | ||
| geo_json: geoJson.value, | ||
| taxon_name_id: [props.otu.taxon_name_id], | ||
| descendants: true | ||
| } | ||
| isLoading.value = true | ||
| makeAPIRequest | ||
| .get('/otus.json', { params: payload }) | ||
| .then(({ data }) => { | ||
| list.value = data | ||
| isTableVisible.value = true | ||
| }) | ||
| .finally((_) => { | ||
| isLoading.value = false | ||
| }) | ||
| } | ||
| </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
Oops, something went wrong.