fix(frontend): add missing priorities field to skin snapshots UI
priorities was present in the model, API, and LLM prompt but never surfaced in the frontend — add it to create/edit forms, read view, AI photo pre-fill, and page.server.ts actions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
75ef1bca56
commit
17eaa5d1bd
4 changed files with 42 additions and 2 deletions
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -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<string, unknown> = { snapshot_date, active_concerns };
|
||||
const body: Record<string, unknown> = { 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<string, unknown> = { active_concerns };
|
||||
const priorities = priorities_raw
|
||||
?.split(',')
|
||||
.map((p) => p.trim())
|
||||
.filter(Boolean) ?? [];
|
||||
|
||||
const body: Record<string, unknown> = { active_concerns, priorities };
|
||||
if (snapshot_date) body.snapshot_date = snapshot_date;
|
||||
if (overall_state) body.overall_state = overall_state;
|
||||
if (texture) body.texture = texture;
|
||||
|
|
|
|||
|
|
@ -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 @@
|
|||
<Label for="active_concerns">{m["skin_activeConcerns"]()}</Label>
|
||||
<Input id="active_concerns" name="active_concerns" placeholder={m["skin_activeConcernsPlaceholder"]()} bind:value={activeConcernsRaw} />
|
||||
</div>
|
||||
<div class="space-y-1 col-span-2">
|
||||
<Label for="priorities">{m["skin_priorities"]()}</Label>
|
||||
<Input id="priorities" name="priorities" placeholder={m["skin_prioritiesPlaceholder"]()} bind:value={prioritiesRaw} />
|
||||
</div>
|
||||
<div class="space-y-1 col-span-2">
|
||||
<Label for="notes">{m.skin_notes()}</Label>
|
||||
<Input id="notes" name="notes" bind:value={notes} />
|
||||
|
|
@ -399,6 +407,10 @@
|
|||
<Label for="edit_active_concerns">{m["skin_activeConcerns"]()}</Label>
|
||||
<Input id="edit_active_concerns" name="active_concerns" placeholder={m["skin_activeConcernsPlaceholder"]()} bind:value={editActiveConcernsRaw} />
|
||||
</div>
|
||||
<div class="space-y-1 col-span-2">
|
||||
<Label for="edit_priorities">{m["skin_priorities"]()}</Label>
|
||||
<Input id="edit_priorities" name="priorities" placeholder={m["skin_prioritiesPlaceholder"]()} bind:value={editPrioritiesRaw} />
|
||||
</div>
|
||||
<div class="space-y-1 col-span-2">
|
||||
<Label for="edit_notes">{m.skin_notes()}</Label>
|
||||
<Input id="edit_notes" name="notes" bind:value={editNotes} />
|
||||
|
|
@ -459,6 +471,16 @@
|
|||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{#if snap.priorities?.length}
|
||||
<div class="mt-2">
|
||||
<p class="text-xs text-muted-foreground mb-1">{m["skin_prioritiesLabel"]()}</p>
|
||||
<div class="flex flex-wrap gap-1">
|
||||
{#each snap.priorities as p (p)}
|
||||
<Badge variant="outline" class="text-xs">{p}</Badge>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{#if snap.notes}
|
||||
<p class="mt-2 text-sm text-muted-foreground">{snap.notes}</p>
|
||||
{/if}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue