diff --git a/src/lib/stores/settings.ts b/src/lib/stores/settings.ts index f066350..410014c 100644 --- a/src/lib/stores/settings.ts +++ b/src/lib/stores/settings.ts @@ -86,6 +86,37 @@ export const defaultVariablePrefs: VariablePrefs = { export const storedVariablePrefs = persisted('variable_prefs', defaultVariablePrefs); +/** Order of the hourly-table rows (visibility is the separate toggle above). */ +export const defaultTableRowOrder: string[] = [ + 'icons', + 'temperature', + 'feels', + 'dew_point', + 'wind', + 'gusts', + 'humidity', + 'clouds', + 'pressure', + 'uv', + 'visibility', + 'precipitation', + 'snowfall' +]; + +export const storedTableRowOrder = persisted('table_row_order_v1', defaultTableRowOrder); + +/** + * Normalizes a stored row order against the known rows: drops keys that no + * longer exist and appends new rows (added after the user last saved) at the + * end, so stored orders survive app updates. + */ +export function mergeTableRowOrder(stored: string[]): string[] { + return [ + ...stored.filter((k) => defaultTableRowOrder.includes(k)), + ...defaultTableRowOrder.filter((k) => !stored.includes(k)) + ]; +} + /** Hourly table interval: 3-hourly (default) or 1-hourly. */ export const storedHourlyInterval = persisted<1 | 3>('hourly_interval', 3); diff --git a/src/routes/weather/week/[location]/+page.svelte b/src/routes/weather/week/[location]/+page.svelte index 2a7acb2..a6a6c47 100644 --- a/src/routes/weather/week/[location]/+page.svelte +++ b/src/routes/weather/week/[location]/+page.svelte @@ -231,12 +231,12 @@ /> - +
{#if fetchedDaily}
{/if} - - {#if fetchedHourly} - - {:else} - -
- -
- {/if} + {#if fetchedHourly} + + {:else} + +
+ +
+ {/if} + diff --git a/src/routes/weather/week/[location]/DailyCards.svelte b/src/routes/weather/week/[location]/DailyCards.svelte index 43b0908..262da32 100644 --- a/src/routes/weather/week/[location]/DailyCards.svelte +++ b/src/routes/weather/week/[location]/DailyCards.svelte @@ -116,7 +116,7 @@ {#if canExtendPast && onExtendPast} + + {/each}