From 6fc39007863b0df88045b6dfe63536af5faf840e Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Fri, 11 Oct 2024 13:02:48 -0700 Subject: [PATCH] Show warning when inbox relays aren't configured --- src/app.css | 28 ++++++++- src/app/components/ChatItem.svelte | 56 +++++++++++++++++ src/app/components/ProfileDetail.svelte | 11 +++- src/app/components/SpaceJoin.svelte | 2 +- src/lib/components/Drawer.svelte | 2 +- src/lib/components/Page.svelte | 2 +- src/routes/+layout.svelte | 4 +- src/routes/home/+layout.svelte | 39 +++--------- src/routes/home/[chat]/+page.svelte | 83 +++++++++++++++++++------ src/routes/home/chats/+page.svelte | 32 ++-------- 10 files changed, 170 insertions(+), 89 deletions(-) create mode 100644 src/app/components/ChatItem.svelte diff --git a/src/app.css b/src/app.css index 3c08973c..0f6b1c9e 100644 --- a/src/app.css +++ b/src/app.css @@ -56,7 +56,7 @@ .hover\:bg-alt:hover, .bg-alt .bg-alt .hover\:bg-alt:hover, .bg-alt .bg-alt.hover\:bg-alt:hover { - @apply bg-base-100 transition-colors text-base-content; + @apply bg-base-100 text-base-content transition-colors; } .bg-alt .bg-alt, @@ -65,7 +65,7 @@ .bg-alt .bg-alt .bg-alt .hover\:bg-alt:hover, .bg-alt.hover\:bg-alt:hover, .bg-alt .bg-alt .bg-alt.hover\:bg-alt:hover { - @apply bg-base-300 transition-colors text-base-content; + @apply bg-base-300 text-base-content transition-colors; } .card2 { @@ -84,6 +84,30 @@ @apply flex items-center justify-center; } +.row-2 { + @apply flex items-center gap-2; +} + +.row-3 { + @apply flex items-center gap-3; +} + +.row-4 { + @apply flex items-center gap-4; +} + +.col-2 { + @apply flex flex-col gap-2; +} + +.col-3 { + @apply flex flex-col gap-3; +} + +.col-4 { + @apply flex flex-col gap-4; +} + .content { @apply m-auto w-full max-w-3xl p-4 sm:p-8 md:p-12; } diff --git a/src/app/components/ChatItem.svelte b/src/app/components/ChatItem.svelte new file mode 100644 index 00000000..be9658c4 --- /dev/null +++ b/src/app/components/ChatItem.svelte @@ -0,0 +1,56 @@ + + +
+ +
+
+ {#if others.length === 1} + + + {:else} + +

+ + and {others.length - 1} + {others.length > 2 ? "others" : "other"} +

+ {/if} +
+ {#if $missingInbox} + + {/if} +
+

+ {message.content} +

+ +
diff --git a/src/app/components/ProfileDetail.svelte b/src/app/components/ProfileDetail.svelte index ab0471a3..11e313a6 100644 --- a/src/app/components/ProfileDetail.svelte +++ b/src/app/components/ProfileDetail.svelte @@ -1,16 +1,19 @@ -
+
{#if others.length > 0} -
-
-
- {#if others.length === 1} - + +
+ {#if others.length === 1} + + + {:else} + +

- {:else} - -

- - and {others.length - 1} - {others.length > 2 ? "others" : "other"} -

- {/if} -
+ and {others.length - 1} + {others.length > 2 ? "others" : "other"} +

+ {/if}
-
+
+ {#if $missingInboxes.length > 0} + {@const plural = $missingInboxes.length > 0} +
+ + {$missingInboxes.length} +
+ {/if} +
+ {/if}
+ {#if $missingInboxes.includes(assertNotNil($pubkey))} +
+
+

+ + Your inbox is not configured. +

+

+ In order to deliver messages, Flotilla needs to know where to send them. Please visit + your relay settings page to set up your + inbox. +

+
+
+ {/if} {#each elements as { type, id, value, showPubkey } (id)} {#if type === "date"} {value} diff --git a/src/routes/home/chats/+page.svelte b/src/routes/home/chats/+page.svelte index 9e96b32c..fb4f08df 100644 --- a/src/routes/home/chats/+page.svelte +++ b/src/routes/home/chats/+page.svelte @@ -1,14 +1,11 @@