diff --git a/frontend/src/routes/SettingsPage.svelte b/frontend/src/routes/SettingsPage.svelte index 38376a6..38883f1 100644 --- a/frontend/src/routes/SettingsPage.svelte +++ b/frontend/src/routes/SettingsPage.svelte @@ -1,6 +1,22 @@ +{#snippet heading(Icon: Component, title: string, note: string)} +
+ +
+

{title}

+ {#if note}

{note}

{/if} +
+
+{/snippet} + {#snippet actions(path: string, key: string)} -
+ {/snippet} -{#snippet childBoxes(group: number[])} -
- Children +{#snippet childChips(group: number[])} +
+ Children
{#each h.children as c (c.id)} - + {/each}
{/snippet} -

Settings

- -
-

Appearance

-
- {#each [['system', 'Match this device'], ['light', 'Light'], ['dark', 'Dark']] as [value, label]} - - {/each} +{#snippet nameAndColor(value: { name?: string; display_name?: string; color: string }, key: 'name' | 'display_name', label: string, placeholder: string)} +
+ +
+ + +
-
+{/snippet} -
-

Time zone

-

Events are exported in {h.timezone}.

- {#if deviceZone && deviceZone !== h.timezone} - - {/if} -
- -

Children

-
    - {#each h.children as c (c.id)} -
  • - {#if editing?.kind === 'child' && editing.id === c.id} -
    -
    - {@render actions(`/children/${c.id}`, `child-${c.id}`)} -
    - {:else} - - {/if} -
  • - {/each} -
-{#if editing?.kind === 'child' && editing.id === null} -
-
- {@render actions('', '')} +{#snippet childForm()} + + {@render nameAndColor(child, 'display_name', 'Nickname or initials', 'Sam')} + {@render actions(`/children/${editing?.id}`, `child-${editing?.id}`)}
-{:else} - -{/if} - -

Calendars

-

A calendar is what you download or subscribe to: one per child, or one for the whole family.

-
    - {#each h.calendars as c (c.id)} -
  • - {#if editing?.kind === 'calendar' && editing.id === c.id} - {@render calendarForm()} - {:else} - - {/if} -
  • - {/each} -
-{#if editing?.kind === 'calendar' && editing.id === null} -
{@render calendarForm()}
-{:else} - -{/if} +{/snippet} {#snippet calendarForm()} -
-
- {@render childBoxes(calendar.child_ids)} -
- Sources (none checked: all of them) + + {@render nameAndColor(calendar, 'name', 'Calendar name', 'Sam — school')} + {@render childChips(calendar.child_ids)} +
+ Sources (none checked means all of them)
{#each h.sources as s (s.id)} - + {/each}
-
- +
+ @@ -197,61 +180,153 @@ {/snippet} -

Sources

-

Each paper you scan: the district calendar, a class newsletter, a lunch menu, a team schedule.

-
    - {#each h.sources as s (s.id)} -
  • - {#if editing?.kind === 'source' && editing.id === s.id} - {@render sourceForm()} - {:else} - - {/if} -
  • - {/each} -
-{#if editing?.kind === 'source' && editing.id === null} -
{@render sourceForm()}
-{:else} - -{/if} - {#snippet sourceForm()} -
-
-
- + +
+
+
- {@render childBoxes(source.child_ids)} - -
- + {@render childChips(source.child_ids)} + +
+ -

Items for other grades or teams start unchecked in review.

+

Items for other grades or teams start unchecked in review.

-
- +
+
-
- +
+
-
+
+ + +
{@render actions(`/sources/${editing?.id}`, `source-${editing?.id}`)} {/snippet} + + +
+
+ {@render heading(Palette, 'Appearance', 'Saved on this device.')} + +
+ +
+ {@render heading(Globe, 'Time zone', 'Times in exported calendars use this zone.')} +
+ {h.timezone} + {#if deviceZone && deviceZone !== h.timezone} + + {/if} +
+
+ +
+ {@render heading(Users, 'Children', 'A nickname or initials is enough.')} +
    + {#each h.children as c (c.id)} +
  • + {#if isEditing('child', c.id)} + {@render childForm()} + {:else} + + {/if} +
  • + {/each} +
+ {#if isEditing('child', null)}{@render childForm()}{:else}{/if} +
+ +
+ {@render heading(CalendarDays, 'Calendars', 'What you download into Apple or Google Calendar: one per child, or one for the family.')} +
    + {#each h.calendars as c (c.id)} +
  • + {#if isEditing('calendar', c.id)} + {@render calendarForm()} + {:else} + + {/if} +
  • + {/each} +
+ {#if isEditing('calendar', null)}{@render calendarForm()}{:else}{/if} +
+ +
+ {@render heading(ScrollText, 'Sources', 'Each paper you scan: the district calendar, a newsletter, a lunch menu, a team schedule.')} +
    + {#each h.sources as s (s.id)} + {@const Icon = LAYOUT_ICONS[s.layout_type]} +
  • + {#if isEditing('source', s.id)} + {@render sourceForm()} + {:else} + + {/if} +
  • + {/each} +
+ {#if isEditing('source', null)}{@render sourceForm()}{:else}{/if} +
+
+