Skip to content

Commit

Permalink
Merge pull request #166 from Geoportail-Luxembourg/GSLUX-639-style-pa…
Browse files Browse the repository at this point in the history
…nel-export

GSLUX-639: Export style panel
  • Loading branch information
tkohr authored Oct 24, 2024
2 parents dac4327 + f6a3d78 commit c3cc294
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
13 changes: 13 additions & 0 deletions cypress/e2e/header-bar.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ describe('Header bar', () => {
cy.get('[data-cy="layerPanel"]').should('not.exist')
})
})

describe('When style panel is open', () => {
beforeEach(() => {
cy.get('[data-cy="myLayersButton"]').click()
cy.get('[data-cy="openStylePanel"]').click()
cy.get('[data-cy="selectedThemeIcon"]').click()
})

it('opens the theme grid and closes the style panel', () => {
cy.get('[data-cy="themeGrid"]').should('be.visible')
cy.get('[data-cy="stylePanel"]').should('not.exist')
})
})
})

describe('When side panel is NOT opened', () => {
Expand Down
5 changes: 1 addition & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ onUnmounted(() => window.removeEventListener('resize', map.resize))

<main class="flex grow">
<!-- Layer panel -->
<div
v-if="layersOpen && !styleEditorOpen"
class="w-full md:w-80 bg-secondary z-10"
>
<div v-if="layersOpen" class="w-full md:w-80 bg-secondary z-10">
<layer-panel />
</div>

Expand Down
4 changes: 2 additions & 2 deletions src/bundle/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { proxyUrlHelper } from '@/services/proxyurl/proxyurl.helper'
import { styleUrlHelper } from '@/services/styleurl/styleurl.helper'
import { themeSelectorService } from '@/components/theme-selector/theme-selector.service'
import MapLibreLayer from '@/lib/ol-mapbox-layer'
import StyleSelector from '@/components/style-selector/style-selector.vue'
import StylePanel from '@/components/style-selector/style-panel.vue'
import { clearLayersCache } from '@/stores/layers.cache'

import i18next, { InitOptions } from 'i18next'
Expand Down Expand Up @@ -154,6 +154,6 @@ export {
statePersistorMyMapService,
themeSelectorService,
MapLibreLayer,
StyleSelector,
StylePanel,
clearLayersCache,
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function getLabel() {
<span class="flex-1 text-left cursor-default">{{ getLabel() }}</span>
<button
v-if="showEditButton"
data-cy="openStylePanel"
class="fa fa-pencil"
:aria-label="t('Open editor panel', { ns: 'app' })"
:title="t('Open editor panel', { ns: 'app' })"
Expand Down
4 changes: 4 additions & 0 deletions src/stores/app.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export const useAppStore = defineStore(

function setThemeGridOpen(open: boolean) {
themeGridOpen.value = open
if (themeGridOpen.value) {
styleEditorOpen.value = false
}
}

function toggleThemeGrid() {
Expand All @@ -68,6 +71,7 @@ export const useAppStore = defineStore(
themeGridOpen.value = true
layersOpen.value = true
myMapsOpen.value = false
styleEditorOpen.value = false
myLayersTabOpen.value && (myLayersTabOpen.value = false)
}
}
Expand Down

0 comments on commit c3cc294

Please sign in to comment.