From b68fcc8fd1713fed9b1c94ce598d482a844585d1 Mon Sep 17 00:00:00 2001 From: Till JS Date: Thu, 9 Apr 2026 14:05:56 +0200 Subject: [PATCH] =?UTF-8?q?fix(mana/web/planta):=20/planta=20routes=20?= =?UTF-8?q?=E2=80=94=20layout=20fix,=20i18n,=20nullability,=20button=20nes?= =?UTF-8?q?ting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add /planta/+layout.svelte that provides every live-query context the legacy routes already reference via getContext (plants, plantPhotos, wateringSchedules, wateringLogs, plantTags, tags). Without this layout the legacy routes would crash at runtime with "Cannot read properties of undefined (reading 'value')" — they had always relied on a provider that did not exist anywhere in the repo. - Replace every hardcoded German label across +page.svelte, [id]/+page.svelte, add/+page.svelte and tags/+page.svelte with $_('planta.*') calls so the locale switcher actually changes the copy. Health/light/humidity helper maps converted from German maps to switch + i18n lookups. - Fix the 4 type errors in [id]/+page.svelte caused by SvelteKit's $page.params.id being string | undefined: coerce to '' so the helpers stay strictly typed and "missing id" still resolves to "not found". - Fix the SSR hydration warning on /planta from a {/if} - + {/each} {/if} diff --git a/apps/mana/apps/web/src/routes/(app)/planta/[id]/+page.svelte b/apps/mana/apps/web/src/routes/(app)/planta/[id]/+page.svelte index cca5a528c..9e25af3bb 100644 --- a/apps/mana/apps/web/src/routes/(app)/planta/[id]/+page.svelte +++ b/apps/mana/apps/web/src/routes/(app)/planta/[id]/+page.svelte @@ -1,7 +1,9 @@ - {plant?.name || 'Pflanze'} - Planta + {plant?.name || $_('planta.app.name')} - Planta {#if !plant}
-

Pflanze nicht gefunden

- Zurueck zur Uebersicht +

{$_('planta.plant.notFound')}

+ {$_('planta.nav.plants')}
{:else}
@@ -131,30 +153,28 @@
-

Pflege

+

{$_('planta.plant.careNotes')}

-

Licht

-

☀️ {getLightText(plant.lightRequirements)}

+

{$_('planta.plant.light')}

+

{getLightText(plant.lightRequirements)}

-

Giessen

+

{$_('planta.watering.water')}

- 💧 {plant.wateringFrequencyDays ? `Alle ${plant.wateringFrequencyDays} Tage` : '-'} + {plant.wateringFrequencyDays + ? $_('planta.list.everyXDays', { values: { days: plant.wateringFrequencyDays } }) + : $_('planta.common.none')}

-

Luftfeuchtigkeit

-

💨 {getHumidityText(plant.humidity)}

-
-
-

Temperatur

-

🌡️ {plant.temperature || '-'}

+

{$_('planta.humidity.medium')}

+

{getHumidityText(plant.humidity)}

{#if plant.careNotes}
-

Pflegehinweise

+

{$_('planta.plant.careNotes')}

{plant.careNotes}

{/if} @@ -163,14 +183,14 @@
-

Giessplan

+

{$_('planta.nav.watering')}

@@ -178,11 +198,11 @@ {#if wateringSchedule}
-

Zuletzt gegossen

+

{$_('planta.watering.lastWatered')}

{formatDate(wateringSchedule.lastWateredAt)}

-

Naechstes Giessen

+

{$_('planta.watering.nextWatering')}

{formatDate(wateringSchedule.nextWateringAt)}

@@ -190,11 +210,11 @@ {#if wateringHistory.length > 0}
-

Letzte Giessvorgaenge

+

{$_('planta.watering.watered')}

    {#each wateringHistory.slice(0, 5) as log (log.id)}
  • - 💧 Gegossen + {$_('planta.watering.watered')} {formatDate(log.wateredAt)}
  • {/each} @@ -205,9 +225,9 @@
    - Zurueck + {$_('planta.nav.plants')}
diff --git a/apps/mana/apps/web/src/routes/(app)/planta/add/+page.svelte b/apps/mana/apps/web/src/routes/(app)/planta/add/+page.svelte index 9c3b23d93..bae5c0408 100644 --- a/apps/mana/apps/web/src/routes/(app)/planta/add/+page.svelte +++ b/apps/mana/apps/web/src/routes/(app)/planta/add/+page.svelte @@ -1,5 +1,7 @@ - Pflanze hinzufuegen - Planta + {$_('planta.plant.add')} - Planta
-

Pflanze hinzufuegen

+

{$_('planta.plant.add')}

{#if error}
@@ -48,37 +51,41 @@
- +
- +
@@ -88,14 +95,14 @@ class="inline-block h-4 w-4 animate-spin rounded-full border-2 border-white border-r-transparent" > {:else} - Pflanze speichern + {$_('planta.common.save')} {/if}
diff --git a/apps/mana/apps/web/src/routes/(app)/planta/tags/+page.svelte b/apps/mana/apps/web/src/routes/(app)/planta/tags/+page.svelte index e230496b5..f605de905 100644 --- a/apps/mana/apps/web/src/routes/(app)/planta/tags/+page.svelte +++ b/apps/mana/apps/web/src/routes/(app)/planta/tags/+page.svelte @@ -1,4 +1,5 @@