From e978d0df970a4dd22e9c991ceebdf874d4dc2308 Mon Sep 17 00:00:00 2001 From: June Date: Wed, 11 Feb 2026 20:51:45 +1300 Subject: [PATCH] Redesign entry summary view and more importantly rearchitected that awful state management --- src/lib/components/entrySummaryView.svelte | 44 +++++++++----- src/lib/components/ui/item/index.ts | 34 +++++++++++ .../components/ui/item/item-actions.svelte | 20 +++++++ .../components/ui/item/item-content.svelte | 20 +++++++ .../ui/item/item-description.svelte | 24 ++++++++ src/lib/components/ui/item/item-footer.svelte | 20 +++++++ src/lib/components/ui/item/item-group.svelte | 21 +++++++ src/lib/components/ui/item/item-header.svelte | 20 +++++++ src/lib/components/ui/item/item-media.svelte | 42 +++++++++++++ .../components/ui/item/item-separator.svelte | 19 ++++++ src/lib/components/ui/item/item-title.svelte | 20 +++++++ src/lib/components/ui/item/item.svelte | 60 +++++++++++++++++++ src/lib/components/ui/separator/index.ts | 7 +++ .../components/ui/separator/separator.svelte | 21 +++++++ src/routes/+page.svelte | 6 +- 15 files changed, 358 insertions(+), 20 deletions(-) create mode 100644 src/lib/components/ui/item/index.ts create mode 100644 src/lib/components/ui/item/item-actions.svelte create mode 100644 src/lib/components/ui/item/item-content.svelte create mode 100644 src/lib/components/ui/item/item-description.svelte create mode 100644 src/lib/components/ui/item/item-footer.svelte create mode 100644 src/lib/components/ui/item/item-group.svelte create mode 100644 src/lib/components/ui/item/item-header.svelte create mode 100644 src/lib/components/ui/item/item-media.svelte create mode 100644 src/lib/components/ui/item/item-separator.svelte create mode 100644 src/lib/components/ui/item/item-title.svelte create mode 100644 src/lib/components/ui/item/item.svelte create mode 100644 src/lib/components/ui/separator/index.ts create mode 100644 src/lib/components/ui/separator/separator.svelte diff --git a/src/lib/components/entrySummaryView.svelte b/src/lib/components/entrySummaryView.svelte index f0e0a75..06e9166 100644 --- a/src/lib/components/entrySummaryView.svelte +++ b/src/lib/components/entrySummaryView.svelte @@ -1,24 +1,36 @@ - + \ No newline at end of file diff --git a/src/lib/components/ui/item/index.ts b/src/lib/components/ui/item/index.ts new file mode 100644 index 0000000..168bc3e --- /dev/null +++ b/src/lib/components/ui/item/index.ts @@ -0,0 +1,34 @@ +import Root from "./item.svelte"; +import Group from "./item-group.svelte"; +import Separator from "./item-separator.svelte"; +import Header from "./item-header.svelte"; +import Footer from "./item-footer.svelte"; +import Content from "./item-content.svelte"; +import Title from "./item-title.svelte"; +import Description from "./item-description.svelte"; +import Actions from "./item-actions.svelte"; +import Media from "./item-media.svelte"; + +export { + Root, + Group, + Separator, + Header, + Footer, + Content, + Title, + Description, + Actions, + Media, + // + Root as Item, + Group as ItemGroup, + Separator as ItemSeparator, + Header as ItemHeader, + Footer as ItemFooter, + Content as ItemContent, + Title as ItemTitle, + Description as ItemDescription, + Actions as ItemActions, + Media as ItemMedia, +}; diff --git a/src/lib/components/ui/item/item-actions.svelte b/src/lib/components/ui/item/item-actions.svelte new file mode 100644 index 0000000..83a6bb2 --- /dev/null +++ b/src/lib/components/ui/item/item-actions.svelte @@ -0,0 +1,20 @@ + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/item/item-content.svelte b/src/lib/components/ui/item/item-content.svelte new file mode 100644 index 0000000..55516f2 --- /dev/null +++ b/src/lib/components/ui/item/item-content.svelte @@ -0,0 +1,20 @@ + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/item/item-description.svelte b/src/lib/components/ui/item/item-description.svelte new file mode 100644 index 0000000..65e6e7d --- /dev/null +++ b/src/lib/components/ui/item/item-description.svelte @@ -0,0 +1,24 @@ + + +

a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4", + className + )} + {...restProps} +> + {@render children?.()} +

diff --git a/src/lib/components/ui/item/item-footer.svelte b/src/lib/components/ui/item/item-footer.svelte new file mode 100644 index 0000000..c998caa --- /dev/null +++ b/src/lib/components/ui/item/item-footer.svelte @@ -0,0 +1,20 @@ + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/item/item-group.svelte b/src/lib/components/ui/item/item-group.svelte new file mode 100644 index 0000000..57ebbd5 --- /dev/null +++ b/src/lib/components/ui/item/item-group.svelte @@ -0,0 +1,21 @@ + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/item/item-header.svelte b/src/lib/components/ui/item/item-header.svelte new file mode 100644 index 0000000..1afe1fa --- /dev/null +++ b/src/lib/components/ui/item/item-header.svelte @@ -0,0 +1,20 @@ + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/item/item-media.svelte b/src/lib/components/ui/item/item-media.svelte new file mode 100644 index 0000000..78490fd --- /dev/null +++ b/src/lib/components/ui/item/item-media.svelte @@ -0,0 +1,42 @@ + + + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/item/item-separator.svelte b/src/lib/components/ui/item/item-separator.svelte new file mode 100644 index 0000000..6f2f51a --- /dev/null +++ b/src/lib/components/ui/item/item-separator.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/ui/item/item-title.svelte b/src/lib/components/ui/item/item-title.svelte new file mode 100644 index 0000000..8d13d5e --- /dev/null +++ b/src/lib/components/ui/item/item-title.svelte @@ -0,0 +1,20 @@ + + +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/item/item.svelte b/src/lib/components/ui/item/item.svelte new file mode 100644 index 0000000..77f8ce6 --- /dev/null +++ b/src/lib/components/ui/item/item.svelte @@ -0,0 +1,60 @@ + + + + +{#if child} + {@render child({ props: mergedProps })} +{:else} +
+ {@render mergedProps.children?.()} +
+{/if} diff --git a/src/lib/components/ui/separator/index.ts b/src/lib/components/ui/separator/index.ts new file mode 100644 index 0000000..82442d2 --- /dev/null +++ b/src/lib/components/ui/separator/index.ts @@ -0,0 +1,7 @@ +import Root from "./separator.svelte"; + +export { + Root, + // + Root as Separator, +}; diff --git a/src/lib/components/ui/separator/separator.svelte b/src/lib/components/ui/separator/separator.svelte new file mode 100644 index 0000000..f40999f --- /dev/null +++ b/src/lib/components/ui/separator/separator.svelte @@ -0,0 +1,21 @@ + + + diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 818a691..6327e74 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -15,8 +15,6 @@ let selectedDate = $state(today()); let dateValue = $state(new CalendarDate(2026, 2, 1)); - - let selectEntry = async (hasEntry: boolean, data: string | null) => { // data should be the entryID if hasEntry == true, or the date if there is no entry @@ -51,11 +49,11 @@
-
    +
      {#each data.all as entry} await selectEntry(true, entry.id)} {entry} + bind:value={dateValue} /> {/each}