diff --git a/src/app.html b/src/app.html index 75766da..e646026 100644 --- a/src/app.html +++ b/src/app.html @@ -14,7 +14,6 @@ height: 100vh; width: 100vw; margin: 0; - background-color: black; } diff --git a/src/lib/components/notifications.svelte b/src/lib/components/notifications.svelte index 5a2166c..cbe119f 100644 --- a/src/lib/components/notifications.svelte +++ b/src/lib/components/notifications.svelte @@ -1,14 +1,15 @@ diff --git a/src/lib/components/secret-context.svelte b/src/lib/components/secret-context.svelte new file mode 100644 index 0000000..94b4f87 --- /dev/null +++ b/src/lib/components/secret-context.svelte @@ -0,0 +1,44 @@ + + + + + + + Are you absolutely sure? + + This action cannot be undone. + + + + Cancel + deleteSecret(secret.id)}> + Continue + + + + + + + + + + + + {secret.name} + + (deleteSecretDialogOpen = true)}> + + Delete + + + diff --git a/src/lib/stores/theme.ts b/src/lib/stores/theme.ts index b2eb8ac..be21ca0 100644 --- a/src/lib/stores/theme.ts +++ b/src/lib/stores/theme.ts @@ -11,9 +11,11 @@ function initialTheme() { export const theme: Writable<'light' | 'dark'> = persisted('theme', initialTheme()); -theme.subscribe((theme) => { +export function updateTheme(theme: 'light' | 'dark') { if (!browser) return; if (theme === 'light') document.documentElement.classList.remove('dark'); else document.documentElement.classList.add('dark'); -}); +} + +theme.subscribe((value) => updateTheme(value)); diff --git a/src/routes/(auth)/channels/(components)/(channel)/text-field.svelte b/src/routes/(auth)/channels/(components)/(channel)/text-field.svelte index 6672110..10a76eb 100644 --- a/src/routes/(auth)/channels/(components)/(channel)/text-field.svelte +++ b/src/routes/(auth)/channels/(components)/(channel)/text-field.svelte @@ -32,7 +32,7 @@
diff --git a/src/routes/(auth)/channels/(components)/(sidebar)/sidebar-header.svelte b/src/routes/(auth)/channels/(components)/(sidebar)/sidebar-header.svelte index 97a761d..51d5d85 100644 --- a/src/routes/(auth)/channels/(components)/(sidebar)/sidebar-header.svelte +++ b/src/routes/(auth)/channels/(components)/(sidebar)/sidebar-header.svelte @@ -11,31 +11,6 @@ import { getAllNotifications, seenNotification } from '$lib/api/notification'; export let createChannelForm: SuperValidated; - - let notifications: Notification[] = []; - - getAllNotifications().then((data) => { - if (!isErrorResponse(data)) { - notifications = data; - } - }); - - appWebsocket.on_autoDispose('createNotification', (data) => { - const typedNotification = data as Notification; - - notifications = [typedNotification, ...notifications]; - }); - - appWebsocket.on_autoDispose('seenNotification', (data) => { - const typedId = data as { id: number }; - - notifications = notifications.map((notification) => { - if (notification.id === typedId.id) { - notification.seen = true; - } - return notification; - }); - });
@@ -49,7 +24,6 @@
seenNotification(notification.id)} />
diff --git a/src/routes/(auth)/channels/(forms)/add-user-to-channel/add-user-to-channel-form.svelte b/src/routes/(auth)/channels/(forms)/add-user-to-channel/add-user-to-channel-form.svelte index 0820c31..e894530 100644 --- a/src/routes/(auth)/channels/(forms)/add-user-to-channel/add-user-to-channel-form.svelte +++ b/src/routes/(auth)/channels/(forms)/add-user-to-channel/add-user-to-channel-form.svelte @@ -4,10 +4,11 @@ export const addUserToChannelFormSchema = z.object({ name: z .string() - .min(6, { message: 'Name must be at least 6 characters' }) - .regex(/^[a-zA-Z_][a-zA-Z0-9_]*$/, { - message: 'Name can only contain letters, numbers, and underscores' - }) + .min(6, 'Name must be at least 6 characters') + .regex( + /^[a-zA-Z_][a-zA-Z0-9_]*$/, + 'Name can only contain letters, numbers, and underscores' + ) }); export type AddUserToChannelFormSchema = z.infer; @@ -36,6 +37,4 @@ const { form: formData, enhance } = form; -
- -
\ No newline at end of file +
diff --git a/src/routes/(auth)/channels/(forms)/create-channel/create-channel-form.svelte b/src/routes/(auth)/channels/(forms)/create-channel/create-channel-form.svelte index 57a2580..87a08e0 100644 --- a/src/routes/(auth)/channels/(forms)/create-channel/create-channel-form.svelte +++ b/src/routes/(auth)/channels/(forms)/create-channel/create-channel-form.svelte @@ -4,10 +4,11 @@ export const createChannelFormSchema = z.object({ name: z .string() - .min(6, { message: 'Name must be at least 6 characters' }) - .regex(/^[a-zA-Z_][a-zA-Z0-9_]*$/, { - message: 'Name can only contain letters, numbers, and underscores' - }) + .min(6, 'Name must be at least 6 characters') + .regex( + /^[a-zA-Z_][a-zA-Z0-9_]*$/, + 'Name can only contain letters, numbers, and underscores' + ) }); export type CreateChannelFormSchema = z.infer; diff --git a/src/routes/(auth)/secrets/(components)/secrets-list-item.svelte b/src/routes/(auth)/secrets/(components)/secrets-list-item.svelte index 5434fa2..9f3cb60 100644 --- a/src/routes/(auth)/secrets/(components)/secrets-list-item.svelte +++ b/src/routes/(auth)/secrets/(components)/secrets-list-item.svelte @@ -1,18 +1,21 @@ -
- -
+ +
+ +
+
diff --git a/src/routes/(auth)/secrets/(components)/secrets-list.svelte b/src/routes/(auth)/secrets/(components)/secrets-list.svelte index 87a7341..4646573 100644 --- a/src/routes/(auth)/secrets/(components)/secrets-list.svelte +++ b/src/routes/(auth)/secrets/(components)/secrets-list.svelte @@ -16,23 +16,27 @@ } -
+
-
- + +
+ {#each secrets as secret} +
+ +
+ {/each}
- {#each secrets as secret} -
- -
- {/each}
diff --git a/src/routes/(auth)/secrets/(forms)/secret-form.svelte b/src/routes/(auth)/secrets/(forms)/secret-form.svelte index 58a2d38..400ad8c 100644 --- a/src/routes/(auth)/secrets/(forms)/secret-form.svelte +++ b/src/routes/(auth)/secrets/(forms)/secret-form.svelte @@ -6,7 +6,8 @@ content: z.string().min(1, 'Message is required'), timeoutSeconds: z.number().int().nonnegative(), recipients: z.array(z.number().int().nonnegative()) - }); + }) + .refine((data) => data.recipients.length > 0, 'At least one recipient is required'); export type SecretFormSchema = z.infer; @@ -22,12 +23,16 @@ import { afterUpdate, beforeUpdate, onMount } from 'svelte'; import { Textarea } from '$lib/components/ui/textarea'; import { getFollowedUsers } from '$lib/api/user'; + import { ScrollArea } from '$lib/components/ui/scroll-area'; + import * as Avatar from '$lib/components/ui/avatar'; + import { cn } from '$lib/utils'; export let data: SuperValidated; export let defaultSecret: Secret | undefined = undefined; export let followedUsers: User[] = []; export let recipients: User[] = []; export let reset: boolean = false; + export let name: string = 'Create Secret'; const form = superForm(data, { validators: zodClient(secretFormSchema), @@ -61,54 +66,105 @@ }); -
- - - Name - - - - - - - Message -