From 0c9c712ee021593e8cdedac0027fc32f96064884 Mon Sep 17 00:00:00 2001 From: trashtemp <96388163+trashtemp@users.noreply.github.com> Date: Fri, 14 Jan 2022 22:52:19 +0100 Subject: [PATCH] fix(msgbar): improved design, added actions --- .../messaging/bars/MessageOverlayBar.tsx | 153 +++++++++++++----- 1 file changed, 112 insertions(+), 41 deletions(-) diff --git a/src/components/common/messaging/bars/MessageOverlayBar.tsx b/src/components/common/messaging/bars/MessageOverlayBar.tsx index 848a1bff..3be9b684 100644 --- a/src/components/common/messaging/bars/MessageOverlayBar.tsx +++ b/src/components/common/messaging/bars/MessageOverlayBar.tsx @@ -1,9 +1,11 @@ +import { DotsHorizontalRounded, LinkAlt } from "@styled-icons/boxicons-regular"; import { - DotsHorizontalRounded, - Edit, - Reply, + Pencil, Trash, -} from "@styled-icons/boxicons-regular"; + Share, + InfoSquare, + Notification, +} from "@styled-icons/boxicons-solid"; import { observer } from "mobx-react-lite"; import { ChannelPermission } from "revolt.js"; import { Message as MessageObject } from "revolt.js/dist/maps/Messages"; @@ -21,6 +23,7 @@ import { } from "../../../../context/intermediate/Intermediate"; import { useClient } from "../../../../context/revoltjs/RevoltClient"; +import Tooltip from "../../../common/Tooltip"; import IconButton from "../../../ui/IconButton"; interface Props { @@ -29,7 +32,7 @@ interface Props { } const OverlayBar = styled.div` - display: inline-flex; + display: flex; position: absolute; justify-self: end; align-self: end; @@ -43,11 +46,15 @@ const OverlayBar = styled.div` border-radius: 5px; background: var(--primary-header); - border: 1px sold var(--background); + //border: 1px solid var(--background); `; const Entry = styled.div` - padding: 4px; + height: 30px; + width: 30px; + display: flex; + align-items: center; + justify-content: center; flex-shrink: 0; cursor: pointer; transition: 0.2s ease background-color; @@ -55,6 +62,18 @@ const Entry = styled.div` &:hover { background: var(--secondary-header); } + + &:active { + svg { + transform: translateY(1px); + } + } +`; + +const Divider = styled.div` + margin: 6px 4px; + width: 0.5px; + background: var(--tertiary-background); `; export const MessageOverlayBar = observer(({ message, queued }: Props) => { @@ -64,54 +83,106 @@ export const MessageOverlayBar = observer(({ message, queued }: Props) => { return ( - internalEmit("ReplyBar", "add", message)}> - - - - - {isAuthor && ( - - internalEmit( - "MessageRenderer", - "edit_message", - message._id, - ) - }> + + internalEmit("ReplyBar", "add", message)}> - + + + + {isAuthor && ( + + + internalEmit( + "MessageRenderer", + "edit_message", + message._id, + ) + }> + + + + + )} {isAuthor || (message.channel && message.channel.permission & ChannelPermission.ManageMessages) ? ( + + + openScreen({ + id: "special_prompt", + type: "delete_message", + target: message, + } as unknown as Screen) + }> + + + + + + ) : undefined} + - openScreen({ - id: "special_prompt", - type: "delete_message", - target: message, - } as unknown as Screen) + openContextMenu("Menu", { + message, + contextualChannel: message.channel_id, + queued, + }) }> - + - ) : undefined} - - openContextMenu("Menu", { - message, - contextualChannel: message.channel_id, - queued, - }) - }> - - - - + + + + + openContextMenu("Menu", { + message, + contextualChannel: message.channel_id, + queued, + }) + }> + + + + + + + + openContextMenu("Menu", { + message, + contextualChannel: message.channel_id, + queued, + }) + }> + + + + + + + + openContextMenu("Menu", { + message, + contextualChannel: message.channel_id, + queued, + }) + }> + + + + + ); });