From 4e9aecc30467a2a3eff622aaa051fe93b8da5f3d Mon Sep 17 00:00:00 2001 From: N Pex Date: Wed, 18 Oct 2023 15:05:50 +0000 Subject: [PATCH] Support chat backgrounds --- README.md | 13 ++++++ src/assets/css/chat.scss | 80 +++++++++++++---------------------- src/components/Chat.vue | 58 ++++++++++++++++++++++--- src/components/RoomExport.vue | 2 +- 4 files changed, 97 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index e100dcd..72b3262 100644 --- a/README.md +++ b/README.md @@ -59,5 +59,18 @@ The app loads runtime configutation from the server at "./config.json" and merge * Insert the resulting config blob into the "shortCodeStickers" value of the config file (assets/config.json) * Rearrange order of sticker packs by editing the config blob above. +### Chat backgrounds +Chat backgrounds can be set using the **chat_backgrounds** config value. It can be set per room type, "direct", "invite" and "public". If no background is set for the current room type, the app will also check if a default "all" value has any backgrounds specified. + Backgrounds are entered as an array. Which of the backgrounds in the array is used for a given room is calculated from the room ID, so that it is constant across the lifetime of the room. + +``` +chat_backgrounds: { + "direct": ["https://example.com/dm1.png", "data:image/png;base64,yadiyada..."], + "all": ["/default_background.png"] +} +``` + + + ### Attributions Sounds from [Notification Sounds](https://notificationsounds.com) \ No newline at end of file diff --git a/src/assets/css/chat.scss b/src/assets/css/chat.scss index 650e324..7a6bca8 100644 --- a/src/assets/css/chat.scss +++ b/src/assets/css/chat.scss @@ -8,7 +8,7 @@ $admin-fg: white; body { --v-app-background: $app-background; - --v-background-color: white; + --v-background-color: rgba(255, 255, 255, 0.8); --v-foreground-color: black; --v-secondary-color: #242424; --v-divider-color: #eeeeee; @@ -233,20 +233,15 @@ body { } } - .input-area { - background-color: #e2e2e2; - margin: 0; - padding-left: $chat-standard-padding-s; - padding-right: $chat-standard-padding-s; - } - .input-area-outer { position: relative; - background-color: #ffffff; + background-color: var(--v-background-color); margin: 0; + margin-bottom: -10px; padding-left: 2 * $chat-standard-padding-s; padding-right: 2 * $chat-standard-padding-s; padding-top: 0; + padding-bottom: 10px; &.reply-to { padding: 0; @@ -283,9 +278,9 @@ body { background-color: white; border: 1px solid #d4d4d4; border-radius: 32px; - + margin-bottom: 10px; @media #{map-get($display-breakpoints, 'sm-and-down')} { - margin-bottom: 2px; + margin-bottom: 12px; } } .input-area-button { @@ -423,7 +418,7 @@ body { } position: relative; .bubble { - background-color: #ededed; + background-color: rgba(#ededed,0.8); border-radius: 0px 10px 10px 10px; [dir="rtl"] & { border-radius: 10px 0px 10px 0px; @@ -437,7 +432,7 @@ body { max-width: 70%; } &.from-admin .bubble { - background-color: $admin-bg; + background-color: rgba($admin-bg,0.8); } .audio-bubble { width: 70%; @@ -516,7 +511,7 @@ body { } position: relative; .bubble { - background-color: #e5e5e5; + background-color: rgba(#e5e5e5,0.8); border-radius: 10px 10px 0 10px; [dir="rtl"] & { border-radius: 10px 10px 10px 0px; @@ -527,7 +522,7 @@ body { max-width: 70%; } .audio-bubble { - background-color: #e5e5e5; + background-color: rgba(#e5e5e5,0.8); border-radius: 10px 10px 0 10px; [dir="rtl"] & { border-radius: 10px 10px 10px 0px; @@ -539,13 +534,6 @@ body { width: 70%; height: 50px; } - .video2-bubble { - background-color: #e5e5e5; - border-radius: 10px 10px 0 10px; - [dir="rtl"] & { - border-radius: 10px 10px 10px 0px; - } - } .bubble.image-bubble { padding: 0px; display: inline-block; @@ -824,11 +812,8 @@ body { .read-marker { margin-left: 20px; margin-right: 20px; - height: 1px; width: calc(100% - 40px); line-height: var(--v-theme-title-featured-line-height); - position: absolute; - bottom: 0; font-family: sans-serif; font-style: normal; font-weight: normal; @@ -837,19 +822,18 @@ body { /* identical to box height, or 14px */ letter-spacing: 0.29px; color: #c0c0c0; - background-color: #c0c0c0; text-align: center; - &::after { - position: absolute; - top: -4px; - background: white; - transform: translate(-50%, 0); - [dir="rtl"] & { - transform: translate(50%, 0); - } - padding-left: 4px; - padding-right: 4px; - content: attr(title); + display: flex; + align-items: center; + & div.text { + flex: 0 0 auto; + padding-left: 10px; + padding-right: 10px; + } + & div.line { + background: #c0c0c0; + height: 1px; + flex: 1 1 auto; } } @@ -858,7 +842,6 @@ body { margin-right: 20px; margin-top: 20px; margin-bottom: 20px; - height: 1px; line-height: var(--v-theme-title-featured-line-height); font-family: sans-serif; font-style: normal; @@ -868,20 +851,17 @@ body { /* identical to box height, or 14px */ letter-spacing: 0.29px; color: black; - background-color: black; - text-align: center; - position: relative; - &::after { - position: absolute; - top: -8px; - background: white; - transform: translate(-50%, 0); - [dir="rtl"] & { - transform: translate(50%, 0); - } + display: flex; + align-items: center; + & div.text { + flex: 0 0 auto; padding-left: 10px; padding-right: 10px; - content: attr(title); + } + & div.line { + background: black; + height: 1px; + flex: 1 1 auto; } } diff --git a/src/components/Chat.vue b/src/components/Chat.vue index 64d365b..c21c6ed 100644 --- a/src/components/Chat.vue +++ b/src/components/Chat.vue @@ -1,5 +1,5 @@