diff --git a/src/assets/css/vars.css b/src/assets/css/vars.css index 35fd134..387574a 100644 --- a/src/assets/css/vars.css +++ b/src/assets/css/vars.css @@ -5,6 +5,10 @@ --color-secondary: 14, 165, 233; --color-secondary-content: 255, 255, 255; + --color-success: 34, 197, 94; + --color-warning: 245, 158, 11; + --color-danger: 239, 68, 68; + --color-base-foreground: 255, 255, 255; --color-base-background: 245, 247, 251; --color-base-muted: 226, 232, 240; @@ -27,6 +31,10 @@ --color-secondary: 14, 165, 233; --color-secondary-content: 255, 255, 255; + --color-success: 22, 163, 74; + --color-warning: 217, 119, 6; + --color-danger: 185, 28, 28; + --color-base-background: 23, 23, 23; --color-base-foreground: 38, 38, 38; --color-base-muted: 48, 48, 48; diff --git a/src/components/Icon/IconWarning.global.vue b/src/components/Icon/IconWarning.global.vue new file mode 100644 index 0000000..7727481 --- /dev/null +++ b/src/components/Icon/IconWarning.global.vue @@ -0,0 +1,15 @@ + diff --git a/src/modules/otus/components/Panel/PanelMap/CachedMap.vue b/src/modules/otus/components/Panel/PanelMap/CachedMap.vue new file mode 100644 index 0000000..09fadbe --- /dev/null +++ b/src/modules/otus/components/Panel/PanelMap/CachedMap.vue @@ -0,0 +1,101 @@ + + + + diff --git a/src/modules/otus/components/Panel/PanelMap/PanelMap.vue b/src/modules/otus/components/Panel/PanelMap/PanelMap.vue index e1b345a..5facd86 100644 --- a/src/modules/otus/components/Panel/PanelMap/PanelMap.vue +++ b/src/modules/otus/components/Panel/PanelMap/PanelMap.vue @@ -25,6 +25,11 @@ :shapes="store.distribution.geojson" @close="() => (isOtuSearchVisible = false)" /> + +
import { ref, watch } from 'vue' import { useOtuStore } from '@/modules/otus/store/store' +import CachedMap from './CachedMap.vue' import OtuSearch from '../../Search/OtuSearch.vue' const props = defineProps({ diff --git a/src/modules/otus/services/TaxonWorks.js b/src/modules/otus/services/TaxonWorks.js index 507cdc0..f6f92ed 100644 --- a/src/modules/otus/services/TaxonWorks.js +++ b/src/modules/otus/services/TaxonWorks.js @@ -68,4 +68,8 @@ export default class TaxonWorks { static getDwC(otuId) { return makeAPIRequest.get(`/otus/${otuId}/inventory/dwc`) } + + static getCachedMap(id) { + return makeAPIRequest.get(`/cached_maps/${id}`) + } } diff --git a/src/modules/otus/store/actions/index.js b/src/modules/otus/store/actions/index.js index b2fbc8e..9f27990 100644 --- a/src/modules/otus/store/actions/index.js +++ b/src/modules/otus/store/actions/index.js @@ -1,3 +1,4 @@ export * from './loadCatalog' export * from './loadDistribution' export * from './loadTaxonomy' +export * from './loadCachedMap' diff --git a/src/modules/otus/store/actions/loadCachedMap.js b/src/modules/otus/store/actions/loadCachedMap.js new file mode 100644 index 0000000..7d25cdd --- /dev/null +++ b/src/modules/otus/store/actions/loadCachedMap.js @@ -0,0 +1,9 @@ +import TaxonWorks from '../../services/TaxonWorks' + +export const actionLoadCachedMap = { + loadCachedMap(mapId) { + TaxonWorks.getCachedMap(mapId).then((response) => { + this.distribution.cachedMap = response.data + }) + } +} diff --git a/src/modules/otus/store/actions/loadDistribution.js b/src/modules/otus/store/actions/loadDistribution.js index e74c545..8550194 100644 --- a/src/modules/otus/store/actions/loadDistribution.js +++ b/src/modules/otus/store/actions/loadDistribution.js @@ -19,6 +19,8 @@ export const actionLoadDistribution = { this.distribution.geojson = { features: [makeGeoJSONFeature(geojson, 'Aggregate')] } + + this.loadCachedMap(data.cached_map.id) }) .catch((e) => { this.distribution.errorMessage = e.response.data.error diff --git a/src/modules/otus/store/store.js b/src/modules/otus/store/store.js index b467a29..2f8e481 100644 --- a/src/modules/otus/store/store.js +++ b/src/modules/otus/store/store.js @@ -5,7 +5,8 @@ import { useOtuPageRequestStore } from './request' import { actionLoadDistribution, actionLoadCatalog, - actionLoadTaxonomy + actionLoadTaxonomy, + actionLoadCachedMap } from './actions' export const useOtuStore = defineStore('otuStore', { @@ -17,7 +18,8 @@ export const useOtuStore = defineStore('otuStore', { distribution: { geojson: null, errorMessage: null, - currentShapeTypes: [] + currentShapeTypes: [], + cachedMap: null }, catalog: { sources: [], @@ -70,6 +72,7 @@ export const useOtuStore = defineStore('otuStore', { ...actionLoadDistribution, ...actionLoadCatalog, - ...actionLoadTaxonomy + ...actionLoadTaxonomy, + ...actionLoadCachedMap } }) diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 15e08db..6c4c3de 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -50,7 +50,11 @@ module.exports = { secondary: { color: withOpacity('--color-secondary'), content: withOpacity('--color-secondary-content') - } + }, + + danger: withOpacity('--color-danger'), + success: withOpacity('--color-success'), + warning: withOpacity('--color-warning') }, typography: ({ theme }) => ({ DEFAULT: {