diff --git a/frontend/messages/en.json b/frontend/messages/en.json index d888a45..e9503c5 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -223,6 +223,9 @@ "skin_sebumCheeks": "Sebum cheeks (1–5)", "skin_activeConcerns": "Active concerns (comma-separated)", "skin_activeConcernsPlaceholder": "acne, redness, dehydration", + "skin_priorities": "Priorities (comma-separated)", + "skin_prioritiesPlaceholder": "strengthen barrier, reduce redness", + "skin_prioritiesLabel": "Priorities", "skin_notes": "Notes", "skin_addSnapshot": "Add snapshot", "skin_snapshotAdded": "Snapshot added.", diff --git a/frontend/messages/pl.json b/frontend/messages/pl.json index b9ddb87..0b7dde9 100644 --- a/frontend/messages/pl.json +++ b/frontend/messages/pl.json @@ -223,6 +223,9 @@ "skin_sebumCheeks": "Sebum policzki (1–5)", "skin_activeConcerns": "Aktywne problemy (przecinek)", "skin_activeConcernsPlaceholder": "trądzik, zaczerwienienie, odwodnienie", + "skin_priorities": "Priorytety (przecinek)", + "skin_prioritiesPlaceholder": "wzmocnić barierę, redukować zaczerwienienie", + "skin_prioritiesLabel": "Priorytety", "skin_notes": "Notatki", "skin_addSnapshot": "Dodaj wpis", "skin_snapshotAdded": "Wpis dodany.", diff --git a/frontend/src/routes/skin/+page.server.ts b/frontend/src/routes/skin/+page.server.ts index 95399cd..90a1401 100644 --- a/frontend/src/routes/skin/+page.server.ts +++ b/frontend/src/routes/skin/+page.server.ts @@ -19,6 +19,7 @@ export const actions: Actions = { const sensitivity_level = form.get('sensitivity_level') as string; const barrier_state = form.get('barrier_state') as string; const active_concerns_raw = form.get('active_concerns') as string; + const priorities_raw = form.get('priorities') as string; if (!snapshot_date) { return fail(400, { error: 'Date is required' }); @@ -29,11 +30,16 @@ export const actions: Actions = { .map((c) => c.trim()) .filter(Boolean) ?? []; + const priorities = priorities_raw + ?.split(',') + .map((p) => p.trim()) + .filter(Boolean) ?? []; + const skin_type = form.get('skin_type') as string; const sebum_tzone = form.get('sebum_tzone') as string; const sebum_cheeks = form.get('sebum_cheeks') as string; - const body: Record = { snapshot_date, active_concerns }; + const body: Record = { snapshot_date, active_concerns, priorities }; if (overall_state) body.overall_state = overall_state; if (texture) body.texture = texture; if (notes) body.notes = notes; @@ -63,6 +69,7 @@ export const actions: Actions = { const sensitivity_level = form.get('sensitivity_level') as string; const barrier_state = form.get('barrier_state') as string; const active_concerns_raw = form.get('active_concerns') as string; + const priorities_raw = form.get('priorities') as string; const skin_type = form.get('skin_type') as string; const sebum_tzone = form.get('sebum_tzone') as string; const sebum_cheeks = form.get('sebum_cheeks') as string; @@ -74,7 +81,12 @@ export const actions: Actions = { .map((c) => c.trim()) .filter(Boolean) ?? []; - const body: Record = { active_concerns }; + const priorities = priorities_raw + ?.split(',') + .map((p) => p.trim()) + .filter(Boolean) ?? []; + + const body: Record = { active_concerns, priorities }; if (snapshot_date) body.snapshot_date = snapshot_date; if (overall_state) body.overall_state = overall_state; if (texture) body.texture = texture; diff --git a/frontend/src/routes/skin/+page.svelte b/frontend/src/routes/skin/+page.svelte index c399284..a293e64 100644 --- a/frontend/src/routes/skin/+page.svelte +++ b/frontend/src/routes/skin/+page.svelte @@ -66,6 +66,7 @@ let sebumTzone = $state(''); let sebumCheeks = $state(''); let activeConcernsRaw = $state(''); + let prioritiesRaw = $state(''); let notes = $state(''); // Edit state @@ -80,6 +81,7 @@ let editSebumTzone = $state(''); let editSebumCheeks = $state(''); let editActiveConcernsRaw = $state(''); + let editPrioritiesRaw = $state(''); let editNotes = $state(''); function startEdit(snap: (typeof data.snapshots)[number]) { @@ -94,6 +96,7 @@ editSebumTzone = snap.sebum_tzone != null ? String(snap.sebum_tzone) : ''; editSebumCheeks = snap.sebum_cheeks != null ? String(snap.sebum_cheeks) : ''; editActiveConcernsRaw = snap.active_concerns?.join(', ') ?? ''; + editPrioritiesRaw = snap.priorities?.join(', ') ?? ''; editNotes = snap.notes ?? ''; showForm = false; } @@ -132,6 +135,7 @@ if (r.sebum_tzone != null) sebumTzone = String(r.sebum_tzone); if (r.sebum_cheeks != null) sebumCheeks = String(r.sebum_cheeks); if (r.active_concerns?.length) activeConcernsRaw = r.active_concerns.join(', '); + if (r.priorities?.length) prioritiesRaw = r.priorities.join(', '); if (r.notes) notes = r.notes; aiPanelOpen = false; } catch (e) { @@ -299,6 +303,10 @@ +
+ + +
@@ -399,6 +407,10 @@
+
+ + +
@@ -459,6 +471,16 @@ {/each}
{/if} + {#if snap.priorities?.length} +
+

{m["skin_prioritiesLabel"]()}

+
+ {#each snap.priorities as p (p)} + {p} + {/each} +
+
+ {/if} {#if snap.notes}

{snap.notes}

{/if}