From 66bdd7e06ff8e6ff7e292439199dae6eb044f684 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Tue, 26 Apr 2022 23:15:49 +0300 Subject: [PATCH] frontend: add message edit overlay --- frontend/src/components/Message.svelte | 22 +++++++ .../components/overlays/EditMessage.svelte | 65 +++++++++++++++++++ .../overlays/OverlayProvider.svelte | 4 ++ src/routes/api/v1/messages.ts | 3 +- 4 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 frontend/src/components/overlays/EditMessage.svelte diff --git a/frontend/src/components/Message.svelte b/frontend/src/components/Message.svelte index e107504..6398795 100644 --- a/frontend/src/components/Message.svelte +++ b/frontend/src/components/Message.svelte @@ -1,4 +1,7 @@ @@ -8,6 +11,18 @@ word-break: break-all; } + .message .edit-message { + visibility: hidden; + } + + .message:hover { + background-color: var(--background-color-2); + } + + .message:hover .edit-message { + visibility: visible; + } + .message-content { color: var(--foreground-color-2); } @@ -20,9 +35,16 @@ font-weight: bold; margin-right: var(--space-xxs); } + + .edit-message { + float: right; + }
{ message.author_username } { message.content } +
diff --git a/frontend/src/components/overlays/EditMessage.svelte b/frontend/src/components/overlays/EditMessage.svelte new file mode 100644 index 0000000..ffa3f62 --- /dev/null +++ b/frontend/src/components/overlays/EditMessage.svelte @@ -0,0 +1,65 @@ + + + + + diff --git a/frontend/src/components/overlays/OverlayProvider.svelte b/frontend/src/components/overlays/OverlayProvider.svelte index ab17ec1..d48b8f3 100644 --- a/frontend/src/components/overlays/OverlayProvider.svelte +++ b/frontend/src/components/overlays/OverlayProvider.svelte @@ -5,6 +5,7 @@ import Toast from "./Toast.svelte"; import Login from "./Login.svelte"; import CreateAccount from "./CreateAccount.svelte"; + import EditMessage from "./EditMessage.svelte"; {#if $overlayStore.createChannel} @@ -22,3 +23,6 @@ {#if $overlayStore.createAccount} {/if} +{#if $overlayStore.editMessage} + +{/if} diff --git a/src/routes/api/v1/messages.ts b/src/routes/api/v1/messages.ts index d80f28d..146b8e0 100644 --- a/src/routes/api/v1/messages.ts +++ b/src/routes/api/v1/messages.ts @@ -43,7 +43,8 @@ router.delete( dispatch(`channel:${permissionCheckResult.rows[0].channel_id}`, { t: GatewayPayloadType.MessageDelete, d: { - id + id, + channel_id: permissionCheckResult.rows[0].channel_id } });