From c85657f8beb477225a8dabf4bd2d1f685f132e79 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Thu, 3 Feb 2022 02:43:11 +0200 Subject: [PATCH] add filter-based navigation between guilds and channels --- frontend/public/global.css | 16 ++++- frontend/src/components/App.svelte | 69 +++++++++++++++++++-- frontend/src/components/ChatView.svelte | 41 +++++------- frontend/src/components/FuzzyView.svelte | 55 ++++++++++++++++ frontend/src/components/Message.svelte | 12 +--- frontend/src/components/MessageEntry.svelte | 14 +++-- 6 files changed, 157 insertions(+), 50 deletions(-) create mode 100644 frontend/src/components/FuzzyView.svelte diff --git a/frontend/public/global.css b/frontend/public/global.css index 817499a..e633a7c 100644 --- a/frontend/public/global.css +++ b/frontend/public/global.css @@ -53,7 +53,7 @@ input, button, select, textarea { padding: 0.4em; margin: 0 0 0.5em 0; box-sizing: border-box; - border: 1px solid #ccc; + border: none; border-radius: 2px; } @@ -131,4 +131,16 @@ button:focus { outline: none; border-radius: var(--button-border-radius); padding: 12px; -} \ No newline at end of file +} + +.main-panel-header { + font-size: 1.1em; +} + +.error-text { + color: var(--color-red); +} + +.grayed-text { + color: var(--color-red); +} diff --git a/frontend/src/components/App.svelte b/frontend/src/components/App.svelte index a166374..d058fea 100644 --- a/frontend/src/components/App.svelte +++ b/frontend/src/components/App.svelte @@ -1,12 +1,15 @@ - + + +
+ {#if layer.type === "CHAT"} + + {:else if layer.type === "GUILD_FUZZY"} + + {:else if layer.type === "CHANNEL_FUZZY"} + + {/if} +
diff --git a/frontend/src/components/ChatView.svelte b/frontend/src/components/ChatView.svelte index e33e6ec..c39cd41 100644 --- a/frontend/src/components/ChatView.svelte +++ b/frontend/src/components/ChatView.svelte @@ -5,8 +5,11 @@ export let messageStore = {}; export let selectedChannel; export let selectedGuild; + let warningMessage = null; - $: selectedChannelMessages = selectedGuild ? ((messageStore[selectedGuild.id] || [])[selectedChannel.id] || []) : []; + // the mess below tries to get the messages for the selected channel from the message store + // if there are none or the channel isnt in the store, an empty array is returned + $: selectedChannelMessages = (selectedGuild && selectedChannel) ? ((messageStore[selectedGuild.id] || [])[selectedChannel.id] || []) : []; -
-
- {(selectedGuild ? selectedGuild.name : "[no guild]")} • {(selectedChannel ? selectedChannel.name : "[no channel]")} -
- -
-
- -
+
+ {(selectedGuild ? selectedGuild.name : "[no guild]")} • {(selectedChannel ? selectedChannel.name : "[no channel]")} + {#if selectedGuild && selectedChannel} +
+ +
+ {:else} + no channel selected + {/if} +
+ diff --git a/frontend/src/components/FuzzyView.svelte b/frontend/src/components/FuzzyView.svelte new file mode 100644 index 0000000..506d5a5 --- /dev/null +++ b/frontend/src/components/FuzzyView.svelte @@ -0,0 +1,55 @@ + + + + +
+ { title } + {#each displayedElements as element} + + {/each} + {#if displayedElements.length < 1} +
+

no results

+
+ {/if} +
+ diff --git a/frontend/src/components/Message.svelte b/frontend/src/components/Message.svelte index 6f11acc..1828168 100644 --- a/frontend/src/components/Message.svelte +++ b/frontend/src/components/Message.svelte @@ -4,9 +4,9 @@ let textClass; $: if (message._pendingStatus === "waiting") { - textClass = "content pending-waiting"; + textClass = "content grayed-text"; } else if (message._pendingStatus === "error") { - textClass = "content pending-error"; + textClass = "content error-text"; } else { textClass = "content"; } @@ -24,14 +24,6 @@ .content { margin-left: 4px; } - - .pending-waiting { - color: var(--grayed-text-color); - } - - .pending-error { - color: var(--color-red); - }
diff --git a/frontend/src/components/MessageEntry.svelte b/frontend/src/components/MessageEntry.svelte index 284f709..c8aacd6 100644 --- a/frontend/src/components/MessageEntry.svelte +++ b/frontend/src/components/MessageEntry.svelte @@ -1,19 +1,21 @@ - \ No newline at end of file + \ No newline at end of file