Skip to content

Commit

Permalink
indicators: add secteur and levier filters
Browse files Browse the repository at this point in the history
  • Loading branch information
abulte committed Jan 7, 2025
1 parent 822a4b6 commit 5b619cd
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
24 changes: 24 additions & 0 deletions configs/ecospheres/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,27 @@ indicators:
name: Atténuation
- id: biodiversite
name: Biodiversité
- name: Levier
id: levier
color: green-archipel
values:
- id: gestion-forets
name: Gestion des forêts et produits bois
- id: fertilisation
name: Changements de pratiques de fertilisation azotée
- id: elevage
name: Elevage durable
- id: haies
name: Gestion des haies
- name: Secteur
id: secteur
color: purple-glycine
values:
- id: agriculture
name: Agriculture, Forêts et Sols
- id: alimentation
name: Alimentation
- id: batiment
name: Bâtiment
- id: dechets
name: Déchets
18 changes: 18 additions & 0 deletions src/custom/ecospheres/components/indicators/IndicatorSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ watchEffect(() => {
@update:model-value="(value) => switchFilter('enjeu', value)"
/>
</div>
<div class="fr-select-group">
<SelectComponent
default-option="Tous les secteurs"
:label="filtersConf.secteur.name"
:options="filtersConf.secteur.values"
:model-value="props.secteur"
@update:model-value="(value) => switchFilter('secteur', value)"
/>
</div>
<div class="fr-select-group">
<SelectComponent
default-option="Tous les leviers"
:label="filtersConf.levier.name"
:options="filtersConf.levier.values"
:model-value="props.levier"
@update:model-value="(value) => switchFilter('levier', value)"
/>
</div>
<div class="fr-select-group">
<label class="fr-label" for="select-spatial-coverage"
>Couverture territoriale</label
Expand Down
4 changes: 3 additions & 1 deletion src/custom/ecospheres/model/indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ export type Indicator = DatasetV2

// repeating keys is necessary, type becomes too complex to be usable if we don't
// we're keeping values and type in the same place to facilitate maintenance
export const FILTER_KEYS = ['theme', 'enjeu'] as const
export const FILTER_KEYS = ['theme', 'enjeu', 'secteur', 'levier'] as const

export type IndicatorFilters = {
theme: string | null
enjeu: string | null
secteur: string | null
levier: string | null
}

export interface IndicatorTag {
Expand Down
1 change: 1 addition & 0 deletions src/custom/ecospheres/utils/indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const useTags = (indicator: Indicator): ComputedRef<IndicatorTag[]> => {
})
}

// FIXME: some tag have multiple values (e.g. enjeux), use useTags with a filter instead
export const useTag = (
indicator: Indicator | undefined,
type: string
Expand Down

0 comments on commit 5b619cd

Please sign in to comment.