From 35407d69b9fad6f16b267d692602d0f9c87961ef Mon Sep 17 00:00:00 2001 From: Matt Grogan Date: Tue, 2 Jan 2024 17:04:34 +0000 Subject: [PATCH] Remove link previews (#5085) --- frontend/app/src/components/AreYouSure.svelte | 32 +-- .../app/src/components/ModalContent.svelte | 9 +- .../app/src/components/home/ChatEvent.svelte | 5 + .../src/components/home/ChatMessage.svelte | 1 + .../components/home/ChatMessageContent.svelte | 2 +- .../src/components/home/CurrentChat.svelte | 35 ++- .../home/CurrentChatMessages.svelte | 1 + .../src/components/home/GenericPreview.svelte | 103 ++++----- .../src/components/home/LinkPreview.svelte | 80 ------- .../src/components/home/LinkPreviews.svelte | 199 ++++++++++++++++++ .../app/src/components/home/Markdown.svelte | 10 +- .../src/components/home/MessageEntry.svelte | 69 +++--- .../src/components/home/TextContent.svelte | 32 ++- .../src/components/home/YouTubePreview.svelte | 32 +-- frontend/app/src/i18n/cn.json | 7 +- frontend/app/src/i18n/de.json | 5 +- frontend/app/src/i18n/en.json | 5 +- frontend/app/src/i18n/es.json | 5 +- frontend/app/src/i18n/fr.json | 5 +- frontend/app/src/i18n/it.json | 5 +- frontend/app/src/i18n/iw.json | 5 +- frontend/app/src/i18n/jp.json | 5 +- frontend/app/src/i18n/ru.json | 5 +- frontend/app/src/i18n/vi.json | 5 +- frontend/openchat-client/src/openchat.ts | 42 ++++ .../src/stores/localMessageUpdates.ts | 10 +- frontend/openchat-client/src/utils/chat.ts | 4 +- .../openchat-client/src/utils/linkPreviews.ts | 48 +++++ .../openchat-shared/src/domain/chat/chat.ts | 1 + 29 files changed, 545 insertions(+), 222 deletions(-) delete mode 100644 frontend/app/src/components/home/LinkPreview.svelte create mode 100644 frontend/app/src/components/home/LinkPreviews.svelte create mode 100644 frontend/openchat-client/src/utils/linkPreviews.ts diff --git a/frontend/app/src/components/AreYouSure.svelte b/frontend/app/src/components/AreYouSure.svelte index 92f5ee614d..027c46fd40 100644 --- a/frontend/app/src/components/AreYouSure.svelte +++ b/frontend/app/src/components/AreYouSure.svelte @@ -7,7 +7,7 @@ import Input from "./Input.svelte"; import Markdown from "./home/Markdown.svelte"; - export let message: string; + export let message: string | undefined = undefined; export let action: (yes: boolean) => Promise; export let doubleCheck: { challenge: string; response: string } | undefined = undefined; export let title: string | undefined = undefined; @@ -31,23 +31,25 @@ - + {title ?? $_("areYouSure")} - + {#if message !== undefined} + - {#if doubleCheck !== undefined} -

- -

- + {#if doubleCheck !== undefined} +

+ +

+ + {/if} {/if}
diff --git a/frontend/app/src/components/ModalContent.svelte b/frontend/app/src/components/ModalContent.svelte index fb6bd807d3..011ff74c49 100644 --- a/frontend/app/src/components/ModalContent.svelte +++ b/frontend/app/src/components/ModalContent.svelte @@ -15,6 +15,7 @@ export let fill: boolean = false; export let large: boolean = false; export let hideHeader: boolean = false; + export let hideBody: boolean = false; export let hideFooter: boolean = false; export let compactFooter: boolean = false; export let fadeDuration = 100; @@ -106,9 +107,11 @@ {/if} {/if} -
- -
+ {#if !hideBody} +
+ +
+ {/if} {#if !hideFooter}