From d41751c1bfdfde204b5484134c8753183a4c513f Mon Sep 17 00:00:00 2001
From: Dorine Lambinet <dorine.lambinet@assemblee-nationale.fr>
Date: Wed, 19 Feb 2025 09:39:27 +0100
Subject: [PATCH] Supprime composant ValueChangeGraph

---
 src/lib/components/ValueChangeGraph.svelte | 140 ---------------------
 1 file changed, 140 deletions(-)
 delete mode 100644 src/lib/components/ValueChangeGraph.svelte

diff --git a/src/lib/components/ValueChangeGraph.svelte b/src/lib/components/ValueChangeGraph.svelte
deleted file mode 100644
index be3307134..000000000
--- a/src/lib/components/ValueChangeGraph.svelte
+++ /dev/null
@@ -1,140 +0,0 @@
-<script lang="ts">
-  import { shared } from "$lib/shared.svelte"
-  import { valueFormatter } from "$lib/values"
-  import type { VariableValueByCalculationName } from "$lib/variables"
-
-  interface Props {
-    showLoader?: boolean
-    unitName: string | undefined | null
-    valueByCalculationName: VariableValueByCalculationName
-    children?: import("svelte").Snippet<[any]>
-  }
-
-  let {
-    showLoader = true,
-    unitName,
-    valueByCalculationName,
-    children,
-  }: Props = $props()
-
-  function mustShowAmendmentValue(
-    amendmentValueFormatted: string | undefined,
-    billValueFormatted: string | undefined,
-    lawValueFormatted: string | undefined,
-    revaluationValueFormatted: string | undefined,
-  ): boolean {
-    if (amendmentValueFormatted === undefined) {
-      return false
-    }
-    if (billValueFormatted !== undefined) {
-      return amendmentValueFormatted !== billValueFormatted
-    }
-    if (revaluationValueFormatted !== undefined) {
-      return amendmentValueFormatted !== revaluationValueFormatted
-    }
-    return amendmentValueFormatted !== lawValueFormatted
-  }
-  let amendmentValue = $derived(
-    valueByCalculationName.amendment as number | undefined,
-  )
-  let billValue = $derived(valueByCalculationName.bill as number | undefined)
-  let lawValue = $derived(valueByCalculationName.law as number | undefined)
-  let revaluationValue = $derived(
-    valueByCalculationName.revaluation as number | undefined,
-  )
-  let baseValue = $derived(
-    lawValue === undefined
-      ? revaluationValue === undefined
-        ? billValue === undefined
-          ? amendmentValue
-          : billValue
-        : revaluationValue
-      : lawValue,
-  )
-  let format = $derived(valueFormatter(baseValue, unitName))
-  let runningCalculationNames = $derived(
-    Object.entries(shared.calculationByName)
-      .filter(([, calculation]) => calculation.running)
-      .map(([calculationName]) => calculationName),
-  )
-  let modificationsAmendmentCount = $derived(
-    Object.keys(shared.parametricReform).length,
-  )
-  let amendmentValueFormatted = $derived(
-    amendmentValue === undefined ? undefined : format(amendmentValue),
-  )
-  let billValueFormatted = $derived(
-    billValue === undefined ? undefined : format(billValue),
-  )
-  let lawValueFormatted = $derived(
-    lawValue === undefined ? undefined : format(lawValue),
-  )
-  let revaluationValueFormatted = $derived(
-    revaluationValue === undefined ? undefined : format(revaluationValue),
-  )
-  let showLawValue = $derived(lawValueFormatted !== undefined)
-  let showRevaluationValue = $derived(
-    revaluationValueFormatted !== undefined &&
-      revaluationValueFormatted !== lawValueFormatted,
-  )
-  let showBillValue = $derived(
-    billValueFormatted !== undefined &&
-      (showRevaluationValue
-        ? billValueFormatted !== revaluationValueFormatted
-        : billValueFormatted !== lawValueFormatted),
-  )
-  let showAmendmentValue = $derived(
-    mustShowAmendmentValue(
-      amendmentValueFormatted,
-      billValueFormatted,
-      lawValueFormatted,
-      revaluationValueFormatted,
-    ),
-  )
-</script>
-
-<ul class="flex flex-col">
-  {#if showLoader && (runningCalculationNames.includes("law") || runningCalculationNames.includes("revaluation"))}
-    <li class="animate-pulse-2 bg-gray-500 px-1 text-black blur-xs">
-      <span class="text-white blur">value €</span>&nbsp;/an
-    </li>
-  {:else if showLawValue || showRevaluationValue}
-    <li
-      class={showBillValue
-        ? "line-through-bill "
-        : showAmendmentValue
-          ? "line-through-amendment "
-          : ""}
-    >
-      {showRevaluationValue
-        ? revaluationValueFormatted
-        : lawValueFormatted}&nbsp;/an
-      {@render children?.({
-        lawOrRevaluationValue: showRevaluationValue
-          ? revaluationValue
-          : lawValue,
-      })}
-    </li>
-  {/if}
-  {#if showLoader && runningCalculationNames.includes("bill")}
-    <li class="animate-pulse-2 bg-le-rouge-bill px-1 text-black blur-xs">
-      <span class="text-white blur">value €</span>&nbsp;/an
-    </li>
-  {:else if showBillValue}
-    <li
-      class="text-le-rouge-bill"
-      class:line-through-amendment={showAmendmentValue}
-    >
-      {billValueFormatted}&nbsp;/an
-    </li>
-  {/if}
-  {#if showLoader && runningCalculationNames.includes("amendment") && modificationsAmendmentCount > 0}
-    <li class="animate-pulse-2 bg-le-jaune px-1 text-black blur-xs">
-      <span class="text-white blur">value €</span>&nbsp;/an
-    </li>
-  {:else if showAmendmentValue}
-    <li class="bg-le-jaune px-1 text-black">
-      {amendmentValueFormatted}&nbsp;/an
-    </li>
-  {/if}
-</ul>
-- 
GitLab