From 02be55ae58c91a5ca57b96c05e6d18547a68e4c5 Mon Sep 17 00:00:00 2001 From: Carter Mintey Date: Mon, 27 Nov 2023 20:43:49 -0600 Subject: [PATCH] add popup to view full item name and notes --- src/lib/components/Drawer.svelte | 16 ++++++ src/lib/components/navigation/NavBar.svelte | 12 +++-- .../navigation/NavigationDrawer.svelte | 52 +++++++++---------- src/lib/components/navigation/navigation.ts | 17 ++++++ .../wishlists/ItemCard/ApprovalButtons.svelte | 18 +++++-- .../wishlists/ItemCard/ClaimButtons.svelte | 8 ++- .../wishlists/ItemCard/ItemCard.svelte | 36 +++++++++++-- .../components/wishlists/ItemDrawer.svelte | 32 ++++++++++++ src/routes/+layout.svelte | 23 ++------ 9 files changed, 152 insertions(+), 62 deletions(-) create mode 100644 src/lib/components/Drawer.svelte create mode 100644 src/lib/components/navigation/navigation.ts create mode 100644 src/lib/components/wishlists/ItemDrawer.svelte diff --git a/src/lib/components/Drawer.svelte b/src/lib/components/Drawer.svelte new file mode 100644 index 0000000..bb84fd9 --- /dev/null +++ b/src/lib/components/Drawer.svelte @@ -0,0 +1,16 @@ + + + + {#if $drawerStore.id === "nav"} + + {:else} + + {/if} + diff --git a/src/lib/components/navigation/NavBar.svelte b/src/lib/components/navigation/NavBar.svelte index a0d9d8e..cdb6d95 100644 --- a/src/lib/components/navigation/NavBar.svelte +++ b/src/lib/components/navigation/NavBar.svelte @@ -1,5 +1,5 @@ @@ -20,10 +25,7 @@ {#if user} diff --git a/src/lib/components/navigation/NavigationDrawer.svelte b/src/lib/components/navigation/NavigationDrawer.svelte index bc11318..1afc84f 100644 --- a/src/lib/components/navigation/NavigationDrawer.svelte +++ b/src/lib/components/navigation/NavigationDrawer.svelte @@ -1,5 +1,5 @@ - -
- Wishlist - -
- -
+
+ Wishlist + +
+ diff --git a/src/lib/components/navigation/navigation.ts b/src/lib/components/navigation/navigation.ts new file mode 100644 index 0000000..a455833 --- /dev/null +++ b/src/lib/components/navigation/navigation.ts @@ -0,0 +1,17 @@ +export const navItems = [ + { + label: "Home", + href: "/", + icon: "ion:home" + }, + { + label: "My Wishes", + href: "/wishlists/me", + icon: "ion:gift" + }, + { + label: "My Claims", + href: "/claims", + icon: "ion:albums" + } +] satisfies NavItem[]; diff --git a/src/lib/components/wishlists/ItemCard/ApprovalButtons.svelte b/src/lib/components/wishlists/ItemCard/ApprovalButtons.svelte index e409f50..a6ed3aa 100644 --- a/src/lib/components/wishlists/ItemCard/ApprovalButtons.svelte +++ b/src/lib/components/wishlists/ItemCard/ApprovalButtons.svelte @@ -12,20 +12,30 @@
{#if !item.approved} - - {:else if user.username === item.user?.username || user.username === item.addedBy?.username} - {/if} diff --git a/src/lib/components/wishlists/ItemCard/ClaimButtons.svelte b/src/lib/components/wishlists/ItemCard/ClaimButtons.svelte index 2d0d293..aeafb2e 100644 --- a/src/lib/components/wishlists/ItemCard/ClaimButtons.svelte +++ b/src/lib/components/wishlists/ItemCard/ClaimButtons.svelte @@ -16,7 +16,7 @@
@@ -26,6 +26,7 @@ type="checkbox" bind:checked={item.purchased} on:change={(event) => dispatch("purchase", { purchased: event.currentTarget?.checked })} + on:click|stopPropagation /> Purchased @@ -34,7 +35,10 @@ Claimed by {item.pledgedBy?.name} {/if} {:else} - {/if} diff --git a/src/lib/components/wishlists/ItemCard/ItemCard.svelte b/src/lib/components/wishlists/ItemCard/ItemCard.svelte index cf26be0..7edb217 100644 --- a/src/lib/components/wishlists/ItemCard/ItemCard.svelte +++ b/src/lib/components/wishlists/ItemCard/ItemCard.svelte @@ -12,7 +12,13 @@ -
+ diff --git a/src/lib/components/wishlists/ItemDrawer.svelte b/src/lib/components/wishlists/ItemDrawer.svelte new file mode 100644 index 0000000..850dae5 --- /dev/null +++ b/src/lib/components/wishlists/ItemDrawer.svelte @@ -0,0 +1,32 @@ + + +
+
+
+
+ + {item.name} + +
+ {#if item.price} + {item.price} + ยท + {/if} + + + {#if showFor} + For {item.user?.name} + {:else} + Added by {item.addedBy?.name} + {/if} + +
+

{item.note}

+
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 1923e3b..247f197 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -16,7 +16,6 @@ import NavBar from "$lib/components/navigation/NavBar.svelte"; import NavigationLoadingBar from "$lib/components/navigation/NavigationLoadingBar.svelte"; - import NavigationDrawer from "$lib/components/navigation/NavigationDrawer.svelte"; import AddUserModal from "$lib/components/modals/AddUserModal.svelte"; import GroupSelectModal from "$lib/components/modals/GroupSelectModal.svelte"; import InviteUserModal from "$lib/components/modals/InviteUserModal.svelte"; @@ -25,6 +24,8 @@ import BottomTabs from "$lib/components/navigation/BottomTabs.svelte"; import { isInstalled } from "$lib/stores/is-installed"; import PullToRefresh from "pulltorefreshjs"; + import { navItems } from "$lib/components/navigation/navigation"; + import Drawer from "$lib/components/Drawer.svelte"; export let data: LayoutData; @@ -75,24 +76,6 @@ } }); - $: navItems = [ - { - label: "Home", - href: "/", - icon: "ion:home" - }, - { - label: "My Wishes", - href: "/wishlists/me", - icon: "ion:gift" - }, - { - label: "My Claims", - href: "/claims", - icon: "ion:albums" - } - ] satisfies NavItem[]; - storePopup.set({ computePosition, autoUpdate, flip, shift, offset, arrow }); const modalComponentRegistry: Record = { @@ -108,7 +91,7 @@ }; - +