From 26b32b40e2495878419a160316146e6755ff5016 Mon Sep 17 00:00:00 2001 From: sam Date: Sat, 14 Dec 2024 14:00:48 +0100 Subject: [PATCH] feat: show utc offset on profile --- .../components/profile/ProfileHeader.svelte | 5 ++++- .../lib/components/profile/TimeOffset.svelte | 19 +++++++++++++++++++ .../src/routes/@[username]/+page.svelte | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 Foxnouns.Frontend/src/lib/components/profile/TimeOffset.svelte diff --git a/Foxnouns.Frontend/src/lib/components/profile/ProfileHeader.svelte b/Foxnouns.Frontend/src/lib/components/profile/ProfileHeader.svelte index aa413db..9a0ebff 100644 --- a/Foxnouns.Frontend/src/lib/components/profile/ProfileHeader.svelte +++ b/Foxnouns.Frontend/src/lib/components/profile/ProfileHeader.svelte @@ -5,14 +5,16 @@ import ProfileLink from "./ProfileLink.svelte"; import ProfileFlag from "./ProfileFlag.svelte"; import Avatar from "$components/Avatar.svelte"; + import TimeOffset from "./TimeOffset.svelte"; type Props = { name: string; profile: User | Member; lazyLoadAvatar?: boolean; + offset?: number | null; }; - let { name, profile, lazyLoadAvatar }: Props = $props(); + let { name, profile, lazyLoadAvatar, offset }: Props = $props(); // renderMarkdown sanitizes the output HTML for us let bio = $derived(renderMarkdown(profile.bio)); @@ -45,6 +47,7 @@ {:else}

{name}

{/if} + {#if offset}{/if} {#if bio}
diff --git a/Foxnouns.Frontend/src/lib/components/profile/TimeOffset.svelte b/Foxnouns.Frontend/src/lib/components/profile/TimeOffset.svelte new file mode 100644 index 0000000..f6d2de4 --- /dev/null +++ b/Foxnouns.Frontend/src/lib/components/profile/TimeOffset.svelte @@ -0,0 +1,19 @@ + + + +{currentTime} (UTC{timezone}) diff --git a/Foxnouns.Frontend/src/routes/@[username]/+page.svelte b/Foxnouns.Frontend/src/routes/@[username]/+page.svelte index 903312d..cefd8bc 100644 --- a/Foxnouns.Frontend/src/routes/@[username]/+page.svelte +++ b/Foxnouns.Frontend/src/routes/@[username]/+page.svelte @@ -25,7 +25,7 @@ {/if} - + {#if data.members.length > 0}