From 79552dd57c2244bdec40904e7935243368b54e83 Mon Sep 17 00:00:00 2001 From: April Hall Date: Sat, 15 Feb 2025 16:44:17 -0500 Subject: [PATCH] feat: Frontend for Account Manager --- bun.lockb | Bin 222255 -> 222255 bytes package.json | 2 +- src/lib/components/mainLayout.svelte | 2 +- src/lib/components/ui/select/index.ts | 34 ++++++++ .../ui/select/select-content.svelte | 36 +++++++++ .../components/ui/select/select-item.svelte | 37 +++++++++ .../components/ui/select/select-label.svelte | 13 +++ .../ui/select/select-separator.svelte | 11 +++ .../ui/select/select-trigger.svelte | 24 ++++++ src/routes/(main)/account/+page.server.ts | 12 +++ src/routes/(main)/account/+page.svelte | 76 ++++++++++++++++++ 11 files changed, 245 insertions(+), 2 deletions(-) create mode 100644 src/lib/components/ui/select/index.ts create mode 100644 src/lib/components/ui/select/select-content.svelte create mode 100644 src/lib/components/ui/select/select-item.svelte create mode 100644 src/lib/components/ui/select/select-label.svelte create mode 100644 src/lib/components/ui/select/select-separator.svelte create mode 100644 src/lib/components/ui/select/select-trigger.svelte create mode 100644 src/routes/(main)/account/+page.server.ts create mode 100644 src/routes/(main)/account/+page.svelte diff --git a/bun.lockb b/bun.lockb index 8f677ae27bcdad3c23b99037f23c6fded5b46763..cefd2efbb2d09c92fcb5dde2a66163708441cd20 100755 GIT binary patch delta 45 zcmZ2~f_ME1-i8*&EleMR*bVfIjPwi`wto*|y1>NF7-ymfNF!~h2E=R%pbp9^J9 -
+
{@render children()}
diff --git a/src/lib/components/ui/select/index.ts b/src/lib/components/ui/select/index.ts new file mode 100644 index 0000000..10a33c5 --- /dev/null +++ b/src/lib/components/ui/select/index.ts @@ -0,0 +1,34 @@ +import { Select as SelectPrimitive } from "bits-ui"; + +import Label from "./select-label.svelte"; +import Item from "./select-item.svelte"; +import Content from "./select-content.svelte"; +import Trigger from "./select-trigger.svelte"; +import Separator from "./select-separator.svelte"; + +const Root = SelectPrimitive.Root; +const Group = SelectPrimitive.Group; +const Input = SelectPrimitive.Input; +const Value = SelectPrimitive.Value; + +export { + Root, + Item, + Group, + Input, + Label, + Value, + Content, + Trigger, + Separator, + // + Root as Select, + Item as SelectItem, + Group as SelectGroup, + Input as SelectInput, + Label as SelectLabel, + Value as SelectValue, + Content as SelectContent, + Trigger as SelectTrigger, + Separator as SelectSeparator, +}; diff --git a/src/lib/components/ui/select/select-content.svelte b/src/lib/components/ui/select/select-content.svelte new file mode 100644 index 0000000..7ed541c --- /dev/null +++ b/src/lib/components/ui/select/select-content.svelte @@ -0,0 +1,36 @@ + + + +
+ +
+
diff --git a/src/lib/components/ui/select/select-item.svelte b/src/lib/components/ui/select/select-item.svelte new file mode 100644 index 0000000..73cb954 --- /dev/null +++ b/src/lib/components/ui/select/select-item.svelte @@ -0,0 +1,37 @@ + + + + + + + + + + {label || value} + + diff --git a/src/lib/components/ui/select/select-label.svelte b/src/lib/components/ui/select/select-label.svelte new file mode 100644 index 0000000..29b319b --- /dev/null +++ b/src/lib/components/ui/select/select-label.svelte @@ -0,0 +1,13 @@ + + + + + diff --git a/src/lib/components/ui/select/select-separator.svelte b/src/lib/components/ui/select/select-separator.svelte new file mode 100644 index 0000000..78fc46d --- /dev/null +++ b/src/lib/components/ui/select/select-separator.svelte @@ -0,0 +1,11 @@ + + + diff --git a/src/lib/components/ui/select/select-trigger.svelte b/src/lib/components/ui/select/select-trigger.svelte new file mode 100644 index 0000000..cd958b7 --- /dev/null +++ b/src/lib/components/ui/select/select-trigger.svelte @@ -0,0 +1,24 @@ + + +span]:text-muted-foreground flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", + className + )} + {...$$restProps} +> + +
+ +
+
diff --git a/src/routes/(main)/account/+page.server.ts b/src/routes/(main)/account/+page.server.ts new file mode 100644 index 0000000..045674b --- /dev/null +++ b/src/routes/(main)/account/+page.server.ts @@ -0,0 +1,12 @@ +import { auth } from '$lib/server/db/auth'; +import { redirect } from '@sveltejs/kit'; + +export async function load({ request }): Promise { + const session = await auth.api.getSession({ + headers: request.headers, + }); + + if (!session) { + redirect(307, '/signup'); + } +} diff --git a/src/routes/(main)/account/+page.svelte b/src/routes/(main)/account/+page.svelte new file mode 100644 index 0000000..1a3c801 --- /dev/null +++ b/src/routes/(main)/account/+page.svelte @@ -0,0 +1,76 @@ + + +
+
+ +
+
+ Update Password +
+ + +
+
+ + +
+ +
+
+ +
+
+ Update Username +
+ + +
+
+ + +
+ +
+
+ +
+
+ Upload Profile Image + + +
+
+ +
+
+ Account Actions +
+ +
+ +
+
+
+
+ + + + + Are you sure absolutely sure? + + This action cannot be undone. This will permanently delete your account and remove your data from our database. +
+ + +
+
+
+
+