From 85de7fef151cda6071442962ed9bc4e0c1047508 Mon Sep 17 00:00:00 2001 From: Dorine Lambinet <dorine.lambinet@assemblee-nationale.fr> Date: Thu, 13 Feb 2025 16:40:34 +0100 Subject: [PATCH] =?UTF-8?q?Nettoyage=20de=20la=20propri=C3=A9t=C3=A9=20tab?= =?UTF-8?q?=20dans=20displayMode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/components/WaterfallPlainView.svelte | 2 + .../components/test_cases/TestCaseView.svelte | 2 - .../variables/VariableDetail.svelte | 6 ++- src/lib/displays.ts | 1 - src/lib/tabs.ts | 12 ------ src/lib/urls.ts | 3 -- src/routes/+page.svelte | 37 ------------------- 7 files changed, 6 insertions(+), 57 deletions(-) delete mode 100644 src/lib/tabs.ts diff --git a/src/lib/components/WaterfallPlainView.svelte b/src/lib/components/WaterfallPlainView.svelte index 0a7395b5e..c5d3697fb 100644 --- a/src/lib/components/WaterfallPlainView.svelte +++ b/src/lib/components/WaterfallPlainView.svelte @@ -109,6 +109,7 @@ } </script> +<!--Version du composant avec chaque waterfall séparé (vue accueil simulateur)--> {#if !compact} {#each waterfallsDecompositions as { waterfall, visibleDecompositions }} {#if visibleDecompositions.length > 0} @@ -203,6 +204,7 @@ {/if} {/each} {:else} + <!--Version du composant sous forme d'un onglet par waterfall (vue simulateur sans dispositif sélectionné)--> <div class="overflow-hidden rounded-lg border shadow-lg"> <div class="flex divide-x-2"> {#each waterfallsDecompositions as { waterfall, visibleDecompositions }} diff --git a/src/lib/components/test_cases/TestCaseView.svelte b/src/lib/components/test_cases/TestCaseView.svelte index 589ce3dc3..dfbe17f9b 100644 --- a/src/lib/components/test_cases/TestCaseView.svelte +++ b/src/lib/components/test_cases/TestCaseView.svelte @@ -7,7 +7,6 @@ import type { DisplayMode } from "$lib/displays" import type { Situation } from "$lib/situations" import { billName, shared } from "$lib/shared.svelte" - import type { TabsConfig } from "$lib/tabs" import { newSimulationUrl } from "$lib/urls" import { oilTypes, @@ -21,7 +20,6 @@ highlightDecomposition?: boolean situation: Situation situationIndex: number - tabsConfig: TabsConfig valuesByCalculationNameByVariableName: ValuesByCalculationNameByVariableName year: number } diff --git a/src/lib/components/variables/VariableDetail.svelte b/src/lib/components/variables/VariableDetail.svelte index b6386e0aa..71cbec6e7 100644 --- a/src/lib/components/variables/VariableDetail.svelte +++ b/src/lib/components/variables/VariableDetail.svelte @@ -322,6 +322,7 @@ <a class="mx-auto mt-4 flex w-fit items-center gap-2 rounded-md bg-le-vert-400 px-4 py-1.5 text-sm font-bold uppercase tracking-[0.085em] text-white shadow-lg hover:bg-le-vert-500 active:bg-le-vert-600 xl:text-base" href={newSimulationUrl({ + ...displayMode, budget: true, parametersVariableName: name, })} @@ -368,10 +369,12 @@ <a class="lx-card-bg-gray-underline-le-vert group flex flex-col gap-2 px-4 py-2" href={newSimulationUrl({ + ...displayMode, + budget: false, parametersVariableName: name, testCasesIndex: indices, - tab: "dispositif", })} + onclick={() => dispatch("close")} > <div class="flex flex-1 items-center gap-3" @@ -447,7 +450,6 @@ ...displayMode, parametersVariableName: name, testCasesIndex: [detail], - tab: "dispositif", }), )} showOnlyDeciles={false} diff --git a/src/lib/displays.ts b/src/lib/displays.ts index 631817b82..f0cc9f517 100644 --- a/src/lib/displays.ts +++ b/src/lib/displays.ts @@ -7,6 +7,5 @@ export interface DisplayMode { testCasesIndex: number[] // Contains at least the index of a single test case. variableName?: string waterfallName: string - tab?: string parameterHash?: string } diff --git a/src/lib/tabs.ts b/src/lib/tabs.ts deleted file mode 100644 index cdbd0845b..000000000 --- a/src/lib/tabs.ts +++ /dev/null @@ -1,12 +0,0 @@ -export interface TabsConfig { - defaultTab: string - tabs: TabItem[] -} - -export interface TabItem { - disabled?: boolean - icon?: string - picto?: string - tab: string - title: string -} diff --git a/src/lib/urls.ts b/src/lib/urls.ts index 0d6a6d30d..8a6909196 100644 --- a/src/lib/urls.ts +++ b/src/lib/urls.ts @@ -43,9 +43,6 @@ export function newSimulationUrl(displayMode: DisplayMode): string { ) { parametersQuery.append("waterfall", displayMode.waterfallName) } - if (displayMode.tab !== undefined) { - parametersQuery.append("tab", displayMode.tab) - } const parametersQueryString = parametersQuery.toString() const hashesQuery: URLSearchParams = new URLSearchParams() diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 89d5b0882..e05a3eddc 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -75,7 +75,6 @@ } from "$lib/shared.svelte" import { publishTestCaseSimulation } from "$lib/simulations" import { getPopulationReservedKeys, type Situation } from "$lib/situations" - import type { TabsConfig } from "$lib/tabs" import { newSimulationUrl, type SelfTargetAProps } from "$lib/urls" import { budgetEditableParametersName, @@ -241,27 +240,6 @@ ]) setContext("newSelfTargetAProps", newSelfTargetAProps) const ordinalPluralRules = new Intl.PluralRules("fr-FR", { type: "ordinal" }) - const tabsConfig = $state({ - defaultTab: "fiche_de_paie", - tabs: [ - { - title: "Dispositif", - icon: "ri:zoom-in-line", - tab: "dispositif", - }, - // { - // title: "Impacts directs", - // icon: "ri:mastercard-line", - // tab: "impacts_directs", - // disabled: true, - // }, - { - title: "Fiche de paie", - picto: "PictoFicheDePaie", - tab: "fiche_de_paie", - }, - ], - } as TabsConfig) let testCaseSharingModal: { open: boolean; token?: string } = $state({ open: false, }) @@ -385,14 +363,6 @@ auditSetNullish(waterfalls[0].name), ), ) - audit.attribute( - data, - "tab", - true, - errors, - remainingKeys, - auditQuerySingleton(auditTrimString), - ) if ( data.edit !== undefined && @@ -618,7 +588,6 @@ newSimulationUrl({ ...displayMode, parametersVariableName: variableName, - tab: "dispositif", }), { noScroll: true }, ) @@ -867,10 +836,6 @@ Object.keys(shared.parametricReform).length > 0 && shared.budgetSimulation?.result?.amendement !== undefined, ) - run(() => { - tabsConfig.tabs[0].disabled = - displayMode.parametersVariableName === undefined - }) </script> <svelte:window bind:innerWidth={windowInnerWidth} onkeydown={onKeyDown} /> @@ -1109,7 +1074,6 @@ newSimulationUrl({ ...displayMode, parametersVariableName: parameterParentName, - tab: "fiche_de_paie", }), ) }} @@ -1486,7 +1450,6 @@ }} situation={shared.testCases[shared.testCasesIndex[0]]} situationIndex={shared.testCasesIndex[0]} - {tabsConfig} valuesByCalculationNameByVariableName={shared .valuesByCalculationNameByVariableNameArray[ shared.testCasesIndex[0] -- GitLab