diff --git a/packages/svelte/src/lib/components/gun/account/AccountProfile.svelte b/packages/svelte/src/lib/components/gun/account/AccountProfile.svelte index af1f3f2..1ee0739 100644 --- a/packages/svelte/src/lib/components/gun/account/AccountProfile.svelte +++ b/packages/svelte/src/lib/components/gun/account/AccountProfile.svelte @@ -2,8 +2,8 @@ import { useAccount } from "$lib/gun/account"; import { onMount } from "svelte"; import { get } from "svelte/store"; - import ProfileDisplay from '../profile/ProfileDisplay.svelte'; import { useUser } from "$lib/gun/user"; + import AccountAvatar from "./AccountAvatar.svelte"; export let pub: string | undefined = ""; let { user } = useUser(); @@ -22,33 +22,47 @@ let { account } = useAccount(pub || user?.pub); $globalAccount = account; }); + + const fields = [ + { key: 'pub', label: 'Public Key' }, + { key: 'color', label: 'Color' }, + { key: 'pulse', label: 'Pulse' }, + { key: 'blink', label: 'Blink' }, + { key: 'lastSeen', label: 'Last Seen' } + ]; -{#if $globalAccount} -
-

Account Information

-
- {#each ['pub', 'Color', 'pulse', 'Blink', 'lastSeen'] as field} -
-
{field}
-
- {#if field === 'Color'} -
- {$globalAccount.color} - {:else if field === 'Blink'} -
{$globalAccount.blink ? 'Yes' : 'No'}
- {:else if field === 'lastSeen'} -
{get($globalAccount.lastSeen)}
- {:else if field === 'pulse'} -
{($globalAccount.pulse)}
- {:else} -
{$globalAccount[field.toLowerCase().replace(' ', '')]}
- {/if} -
+
+ + +
+

Account Information

+ {#if $globalAccount} + {#each fields as { key, label }} +
+ + {#if key === 'color'} +
+
+ {$globalAccount[key]} +
+ {:else if key === 'blink'} + {$globalAccount[key] ? 'Yes' : 'No'} + {:else if key === 'lastSeen'} + + {typeof $globalAccount[key] === 'number' ? `${$globalAccount[key]}s ago` : get($globalAccount[key])} + + {:else if key === 'pulse'} + {$globalAccount[key]} + {:else} + + {/if}
{/each} -
+ {:else} +

Caricamento account...

+ {/if}
-{:else} -

Caricamento account...

-{/if} \ No newline at end of file +
\ No newline at end of file diff --git a/packages/svelte/src/routes/auth/+page.svelte b/packages/svelte/src/routes/auth/+page.svelte index 248dd0b..af6126a 100644 --- a/packages/svelte/src/routes/auth/+page.svelte +++ b/packages/svelte/src/routes/auth/+page.svelte @@ -95,11 +95,9 @@

Benvenuto, {$user?.pub}!

-
- +
-
{#if userPair && Object.keys(userPair).length > 0}