From 653239357874b24722ed8ce0abb1896224f6bb71 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 27 Mar 2023 00:44:55 +0200 Subject: [PATCH] feat: show prompt to fill profile/members if profile/member list is empty --- frontend/src/routes/@[username]/+page.svelte | 41 ++++++++++++++++--- .../@[username]/[memberName]/+page.svelte | 18 +++++++- 2 files changed, 52 insertions(+), 7 deletions(-) diff --git a/frontend/src/routes/@[username]/+page.svelte b/frontend/src/routes/@[username]/+page.svelte index 5d9c72e..265465f 100644 --- a/frontend/src/routes/@[username]/+page.svelte +++ b/frontend/src/routes/@[username]/+page.svelte @@ -83,6 +83,13 @@ const favNames = data.names.filter((entry) => entry.status === WordStatus.Favourite); const favPronouns = data.pronouns.filter((entry) => entry.status === WordStatus.Favourite); + + let profileEmpty = false; + $: profileEmpty = + data.names.length === 0 && + data.pronouns.length === 0 && + data.fields.length === 0 && + (!data.bio || data.bio.length === 0);
@@ -106,7 +113,16 @@ {:else}

@{data.name}

{/if} - {#if bio} + {#if profileEmpty && $userStore?.id === data.id} +
+

+ + Your profile is empty! You can customize it by going to the edit profile page. (only you can see this) +

+ {:else if bio}

{@html bio}

{/if} @@ -183,11 +199,24 @@
-
- {#each memberSlice as member} - - {/each} -
+ {#if data.members.length > 0} +
+ {#each memberSlice as member} + + {/each} +
+ {:else} +
+

+ You don't have any members yet. +
+ Members are sub-profiles that can have their own avatar, + names, pronouns, and preferred terms. (only you can see this) +

+
+ {/if} {/if} diff --git a/frontend/src/routes/@[username]/[memberName]/+page.svelte b/frontend/src/routes/@[username]/[memberName]/+page.svelte index 70865d8..ff064ef 100644 --- a/frontend/src/routes/@[username]/[memberName]/+page.svelte +++ b/frontend/src/routes/@[username]/[memberName]/+page.svelte @@ -20,6 +20,13 @@ const favNames = data.names.filter((entry) => entry.status === WordStatus.Favourite); const favPronouns = data.pronouns.filter((entry) => entry.status === WordStatus.Favourite); + + let profileEmpty = false; + $: profileEmpty = + data.names.length === 0 && + data.pronouns.length === 0 && + data.fields.length === 0 && + (!data.bio || data.bio.length === 0);
@@ -43,7 +50,16 @@

{data.display_name ?? data.name}

{data.name} (@{data.user.name})
- {#if bio} + {#if profileEmpty && $userStore?.id === data.user.id} +
+

+ + This member's profile is empty! You can customize it by going to the edit member page. (only you can see this) +

+ {:else if bio}

{@html bio}

{/if}