Add Svelte web client and service worker
Mobile-first PWA: groups via key-in-fragment links, encrypted outbox and sync over SSE, all split modes, currencies with ECB rate prefill, photos, comments, history and rewind, stats, recurring expenses, CSV and backup, EN/CS, dark/light theme, Web Push decrypted in the service worker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013FYo6JSV1fDU1fm3LU77iF
This commit is contained in:
parent
f67add3660
commit
8fbbb4933e
53 changed files with 4558 additions and 37 deletions
37
apps/web/src/components/CurrencySelect.svelte
Normal file
37
apps/web/src/components/CurrencySelect.svelte
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<script lang="ts">
|
||||
import { currencyList } from '../lib/rates.ts';
|
||||
import { currencyName } from '../lib/format.ts';
|
||||
|
||||
let { value = $bindable(), disabled = false, id }: { value: string; disabled?: boolean; id?: string } = $props();
|
||||
let lists = $state<{ ecb: string[]; other: string[] }>({ ecb: [], other: [] });
|
||||
currencyList().then((l) => (lists = l));
|
||||
|
||||
const recent = (() => {
|
||||
try {
|
||||
return JSON.parse(localStorage.getItem('oweme.recentCurrencies') ?? '[]') as string[];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
})();
|
||||
// Keep the current value selectable even before the lists load, or if
|
||||
// it's a code this browser doesn't know.
|
||||
const ecb = $derived(
|
||||
[...lists.ecb, ...lists.other, ...recent].includes(value) ? lists.ecb : [value, ...lists.ecb],
|
||||
);
|
||||
</script>
|
||||
|
||||
<select bind:value {disabled} {id}>
|
||||
{#if recent.length}
|
||||
<optgroup label="★">
|
||||
{#each recent as c}<option value={c}>{c} · {currencyName(c)}</option>{/each}
|
||||
</optgroup>
|
||||
{/if}
|
||||
<optgroup label="ECB">
|
||||
{#each ecb as c}<option value={c}>{c} · {currencyName(c)}</option>{/each}
|
||||
</optgroup>
|
||||
{#if lists.other.length}
|
||||
<optgroup label="…">
|
||||
{#each lists.other as c}<option value={c}>{c} · {currencyName(c)}</option>{/each}
|
||||
</optgroup>
|
||||
{/if}
|
||||
</select>
|
||||
Loading…
Add table
Add a link
Reference in a new issue