From 64b8e1eafa4f986912b8d3d82b0c9d0f37fb1d2b Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Sat, 12 Nov 2022 21:39:21 +0200 Subject: [PATCH] greatly improve ui --- frontend/public/global.css | 56 +++++------ frontend/src/components/Message.svelte | 134 ++++++++++--------------- frontend/src/stores.js | 1 + 3 files changed, 78 insertions(+), 113 deletions(-) diff --git a/frontend/public/global.css b/frontend/public/global.css index 9b40f63..ccd6106 100644 --- a/frontend/public/global.css +++ b/frontend/public/global.css @@ -25,10 +25,11 @@ --background-color-1: hsl(180, 11%, 7%); --background-color-2: hsl(180, 11%, 10%); --background-color-3: hsl(180, 11%, 12%); - --foreground-color-1: rgb(253, 254, 255); - --foreground-color-2: rgb(218, 219, 220); - --foreground-color-3: rgb(153, 154, 155); - --foreground-color-4: rgb(123, 124, 125); + --foreground-color-1: hsl(210, 100%, 100%); + --foreground-color-2: hsl(63, 10%, 82%); + --foreground-color-3: hsl(63, 2%, 60%); + --foreground-color-4: hsl(63, 2%, 49%); + --foreground-special-color-1: hsl(180, 18%, 70%); --colored-element-text-color: var(--foreground-color-1); --purple-1: hsl(280, 78%, 50%); @@ -88,7 +89,6 @@ body { background-color: var(--background-color-1); font-size: 100%; font-family: "Iosevka Waffle Web", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; - font-weight: 400; line-height: 1.75; display: flex; @@ -264,6 +264,8 @@ body { background-color: var(--red-2); } +/* icon buttons */ + .icon-button { display: flex; justify-content: center; @@ -276,6 +278,11 @@ body { font: inherit; } +.icon-button .material-icons, +.icon-button .material-icons-outlined { + color: currentColor; +} + .icon-button-auto { margin-left: auto; } @@ -286,29 +293,12 @@ body { /* text */ -.h1 { - font-size: 2.488rem; -} - -.h2 { - font-size: 2.074rem; -} - -.h3 { - font-size: 1.728rem; -} - -.h4 { - font-size: 1.44rem; -} - -.h5 { - font-size: 1.2rem; -} - -.text-small { - font-size: 0.833rem; -} +.h1 {font-size: 1.802rem;} +.h2 {font-size: 1.602rem;} +.h3 {font-size: 1.424rem;} +.h4 {font-size: 1.266rem;} +.h5 {font-size: 1.125rem;} +.text-small {font-size: 0.889rem;} /* sidebar */ @@ -347,11 +337,10 @@ body { background-color: var(--background-color-0); padding: var(--space-xs); margin-bottom: var(--space-xxs); - color: currentColor; + color: var(--foreground-special-color-1); font: inherit; border-radius: var(--radius-md); width: 100%; - max-height: 3.4em; } .sidebar-button .sidebar-button-text { @@ -375,16 +364,17 @@ body { } .sidebar-button.selected { - color: var(--colored-element-text-color); - background-color: var(--purple-2); + color: var(--foreground-color-1); + background-color: var(--background-color-3); } .sidebar-button.selected .icon-button { - color: var(--colored-element-text-color); + color: var(--foreground-color-1); } .material-icons-outlined, .material-icons { user-select: none; + color: var(--foreground-special-color-1); } /* badges */ diff --git a/frontend/src/components/Message.svelte b/frontend/src/components/Message.svelte index fd69a29..4af1b53 100644 --- a/frontend/src/components/Message.svelte +++ b/frontend/src/components/Message.svelte @@ -19,29 +19,17 @@ -
-
- { message._effectiveAuthor } - {#if message._viaBadge} - via { message._viaBadge } - {/if} -
+
+ {#if !message._clumped} +
+ { message._effectiveAuthor } + {#if message._viaBadge} + via { message._viaBadge } + {/if} + +
+ {/if} { message.content } - { message._createdAtTimeString } - - {#if message._editable} - - {/if} + {#if message._editable} + + {/if} +
diff --git a/frontend/src/stores.js b/frontend/src/stores.js index 7532dad..a7a4723 100644 --- a/frontend/src/stores.js +++ b/frontend/src/stores.js @@ -247,6 +247,7 @@ class MessageStore extends Store { } if (previous && (message._createdAtDate.getTime() - previous._createdAtDate.getTime()) <= 100 * 1000 && message.author_id === previous.author_id && message._effectiveAuthor === previous._effectiveAuthor && message._viaBadge === previous._viaBadge) { message._clumped = true; + previous._hasChildren = true; } if (!previous || (previous._createdAtDateString !== message._createdAtDateString && !message._aboveDateMarker)) { message._aboveDateMarker = new Intl.DateTimeFormat(getItem("ui:locale"), { month: "long", day: "numeric", year: "numeric" }).format(message._createdAtDate);