diff --git a/src/lib/components/molecules/GiftModal.svelte b/src/lib/components/molecules/GiftModal.svelte index 53a0854..568ba1d 100644 --- a/src/lib/components/molecules/GiftModal.svelte +++ b/src/lib/components/molecules/GiftModal.svelte @@ -7,13 +7,14 @@ let { personId, personName } = $props(); let isOpen = $state(false); - let gift: Omit = $state({ + const initGift = { name: '', price: 0, url: '', description: '', status: 'PLANNED' - }); + } as const; + let gift: Omit = $state(initGift); const open = () => { isOpen = true; @@ -34,6 +35,8 @@ status: gift.status } }).then(close); + + gift = initGift; }; const inputClasses = [ diff --git a/src/lib/components/molecules/PersonModal.svelte b/src/lib/components/molecules/PersonModal.svelte index 5da06c2..cfcca56 100644 --- a/src/lib/components/molecules/PersonModal.svelte +++ b/src/lib/components/molecules/PersonModal.svelte @@ -15,8 +15,13 @@ isOpen = false; }; - const handleAddYear = () => { - addPerson({ year, name }).then(close); + const handleAddYear = (shouldClose = true) => { + addPerson({ year, name }).then(() => { + if (shouldClose) { + close(); + } + }); + name = ''; }; @@ -37,8 +42,9 @@ ]} /> -
- +
+ +
{/if} diff --git a/src/lib/components/molecules/SearchBar.svelte b/src/lib/components/molecules/SearchBar.svelte new file mode 100644 index 0000000..d969841 --- /dev/null +++ b/src/lib/components/molecules/SearchBar.svelte @@ -0,0 +1,20 @@ + + +
+ {#if showSearch} + + {/if} + (showSearch = !showSearch)} /> +
diff --git a/src/lib/components/organisms/YearDashboard.svelte b/src/lib/components/organisms/YearDashboard.svelte index e8ff1b8..96d1960 100644 --- a/src/lib/components/organisms/YearDashboard.svelte +++ b/src/lib/components/organisms/YearDashboard.svelte @@ -1,9 +1,11 @@
@@ -49,8 +79,14 @@
- Wydane: {formatCurrency(totalSpent)} - Zostało: {formatCurrency(remainingBudget)} + + Wydane: {formatCurrency(totalBought)} + Planowane: {formatCurrency(totalSpent)} + + + Pozostało: {formatCurrency(remainingBudget)} + Bufor: {formatCurrency(totalBudget - totalSpent)} +
@@ -63,10 +99,13 @@ Osoby - +
+ + +
- {#each people as person (person.id)} + {#each filteredPeople as person (person.id)} {:else}
diff --git a/src/lib/store/search.svelte.ts b/src/lib/store/search.svelte.ts new file mode 100644 index 0000000..f8c2736 --- /dev/null +++ b/src/lib/store/search.svelte.ts @@ -0,0 +1,3 @@ +export const searchStore = $state({ + value: '' +});