From 3097b8a9dd17367184b5e1f2b5bfac037772b0ac Mon Sep 17 00:00:00 2001 From: Shibo Lyu Date: Tue, 15 Oct 2024 02:53:26 +0800 Subject: [PATCH] feat: basic settings layout --- src/lib/components/GroupedList.ts | 4 ++ .../GroupedList/GroupedListItem.svelte | 17 ++++++++ .../GroupedList/GroupedListSection.svelte | 17 ++++++++ src/lib/components/ProfilePicture.svelte | 2 +- src/routes/(app)/+layout.svelte | 38 ++++++++++++++++-- src/routes/(app)/CurrentAccountPicture.svelte | 4 +- .../chats/[server]/[chatId]/ChatHeader.svelte | 12 +----- src/routes/(app)/settings/SettingsList.svelte | 39 +++++++++++++++++++ 8 files changed, 118 insertions(+), 15 deletions(-) create mode 100644 src/lib/components/GroupedList.ts create mode 100644 src/lib/components/GroupedList/GroupedListItem.svelte create mode 100644 src/lib/components/GroupedList/GroupedListSection.svelte diff --git a/src/lib/components/GroupedList.ts b/src/lib/components/GroupedList.ts new file mode 100644 index 0000000..b89b3d3 --- /dev/null +++ b/src/lib/components/GroupedList.ts @@ -0,0 +1,4 @@ +import GroupedListItem from './GroupedList/GroupedListItem.svelte'; +import GroupedListSection from './GroupedList/GroupedListSection.svelte'; + +export { GroupedListItem, GroupedListSection }; diff --git a/src/lib/components/GroupedList/GroupedListItem.svelte b/src/lib/components/GroupedList/GroupedListItem.svelte new file mode 100644 index 0000000..00f845a --- /dev/null +++ b/src/lib/components/GroupedList/GroupedListItem.svelte @@ -0,0 +1,17 @@ + + + + {#if icon} + + {/if} + + diff --git a/src/lib/components/GroupedList/GroupedListSection.svelte b/src/lib/components/GroupedList/GroupedListSection.svelte new file mode 100644 index 0000000..185bb9a --- /dev/null +++ b/src/lib/components/GroupedList/GroupedListSection.svelte @@ -0,0 +1,17 @@ +
+ {#if $$slots.header} +

+ +

+ {/if} +
+ +
+ {#if $$slots.footer} +
+ +
+ {/if} +
diff --git a/src/lib/components/ProfilePicture.svelte b/src/lib/components/ProfilePicture.svelte index 1eb6436..cb27c46 100644 --- a/src/lib/components/ProfilePicture.svelte +++ b/src/lib/components/ProfilePicture.svelte @@ -14,7 +14,7 @@ {:else}
Account Unavailable diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 395755a..92cc8fa 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -15,9 +15,10 @@ }); }); - $: isSettings = $page.route.id?.startsWith('/settings'); + $: isSettings = $page.route.id?.startsWith('/(app)/settings'); $: mainVisible = - !!$page.params.chatId || (isSettings && !$page.route.id?.startsWith('/settings/_mobile_empty')); + !!$page.params.chatId || + (isSettings && !$page.route.id?.startsWith('/(app)/settings/_mobile_empty'));
{#if isSettings} - + {/if} {#if mainVisible} @@ -61,6 +62,27 @@ } } + @keyframes float-in { + from { + transform: scale(0.9); + opacity: 0; + } + to { + transform: scale(1); + opacity: 1; + } + } + @keyframes float-out { + from { + transform: scale(1); + opacity: 1; + } + to { + transform: scale(0.9); + opacity: 0; + } + } + :root::view-transition-old(root), :root::view-transition-new(root) { animation-duration: 250ms; @@ -71,4 +93,14 @@ :root::view-transition-new(main) { animation: 250ms ease-out slide-in; } + :root::view-transition-old(settings-list), + :root::view-transition-new(settings-list) { + transform-origin: top left; + } + :root::view-transition-old(settings-list) { + animation: 250ms ease-out float-out; + } + :root::view-transition-new(settings-list) { + animation: 250ms ease-out float-in; + } diff --git a/src/routes/(app)/CurrentAccountPicture.svelte b/src/routes/(app)/CurrentAccountPicture.svelte index 73f1029..2df354b 100644 --- a/src/routes/(app)/CurrentAccountPicture.svelte +++ b/src/routes/(app)/CurrentAccountPicture.svelte @@ -25,6 +25,8 @@ } -{#await getAccount($currentAccountStore) then currentAccount} +{#await getAccount($currentAccountStore)} + +{:then currentAccount} {/await} diff --git a/src/routes/(app)/chats/[server]/[chatId]/ChatHeader.svelte b/src/routes/(app)/chats/[server]/[chatId]/ChatHeader.svelte index cf1d3b0..3919e87 100644 --- a/src/routes/(app)/chats/[server]/[chatId]/ChatHeader.svelte +++ b/src/routes/(app)/chats/[server]/[chatId]/ChatHeader.svelte @@ -3,6 +3,7 @@ import { formatUnreadCount } from '$lib/formatters'; import type { Chat } from '$lib/types'; import { AvatarBeam } from 'svelte-boring-avatars'; + import { ChevronLeft, Icon } from 'svelte-hero-icons'; export let info: Chat; export let outsideUnreadCount = 0; @@ -12,16 +13,7 @@ class="relative z-10 box-border flex min-h-[calc(3rem+1px)] w-full items-center gap-2 border-b border-ss-secondary bg-sb-primary p-2 shadow-sm" > +

Settings

+
+
+ + Add Account + + + General + Notifications + Privacy and Security + Devices + + + About Blah & Weblah + Ask a Question + +
+