From cf918e45a57894bb7c982970fcaa0ea9f83fd264 Mon Sep 17 00:00:00 2001 From: Salihu <91833785+salihudickson@users.noreply.github.com> Date: Fri, 14 Nov 2025 16:09:24 +0100 Subject: [PATCH] custom emoji menu (#10631) --- app/actions/sections.ts | 2 + app/menus/EmojisMenu.tsx | 73 +++++++++++++++++++ .../Settings/components/EmojisTable.tsx | 8 +- shared/i18n/locales/en_US/translation.json | 4 +- 4 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 app/menus/EmojisMenu.tsx diff --git a/app/actions/sections.ts b/app/actions/sections.ts index 60b54095ed..7c20e77565 100644 --- a/app/actions/sections.ts +++ b/app/actions/sections.ts @@ -38,6 +38,8 @@ export const NotificationSection = ({ t }: ActionContext) => t("Notification"); export const GroupSection = ({ t }: ActionContext) => t("Groups"); +export const EmojiSecion = ({ t }: ActionContext) => t("Emoji"); + export const UserSection = ({ t }: ActionContext) => t("People"); UserSection.priority = 0.5; diff --git a/app/menus/EmojisMenu.tsx b/app/menus/EmojisMenu.tsx new file mode 100644 index 0000000000..d6fdeb4752 --- /dev/null +++ b/app/menus/EmojisMenu.tsx @@ -0,0 +1,73 @@ +import { TrashIcon } from "outline-icons"; +import { Trans, useTranslation } from "react-i18next"; +import ConfirmationDialog from "~/components/ConfirmationDialog"; +import { IconButton } from "~/components/IconPicker/components/IconButton"; +import Tooltip from "~/components/Tooltip"; +import usePolicy from "~/hooks/usePolicy"; +import useStores from "~/hooks/useStores"; +import Emoji from "~/models/Emoji"; + +const EmojisMenu = ({ emoji }: { emoji: Emoji }) => { + const { t } = useTranslation(); + const { dialogs } = useStores(); + const can = usePolicy(emoji); + + const handleDelete = () => { + dialogs.openModal({ + title: t("Delete Emoji"), + content: ( + + ), + }); + }; + + if (!can.delete) { + return null; + } + + return ( + + + + + + ); +}; + +const DeleteEmojiDialog = ({ + emoji, + onSubmit, +}: { + emoji: Emoji; + onSubmit: () => void; +}) => { + const { t } = useTranslation(); + + const handleSubmit = async () => { + if (emoji) { + await emoji.delete(); + onSubmit(); + } + }; + + return ( + + , + }} + /> + + ); +}; + +export default EmojisMenu; diff --git a/app/scenes/Settings/components/EmojisTable.tsx b/app/scenes/Settings/components/EmojisTable.tsx index 7f77782331..bc18ae5f20 100644 --- a/app/scenes/Settings/components/EmojisTable.tsx +++ b/app/scenes/Settings/components/EmojisTable.tsx @@ -14,6 +14,7 @@ import { type Column as TableColumn } from "~/components/Table"; import Time from "~/components/Time"; import { FILTER_HEIGHT } from "./StickyFilters"; import { EmojiImage, EmojiPreview } from "@shared/components/customEmojis"; +import EmojisMenu from "~/menus/EmojisMenu"; const ROW_HEIGHT = 60; const STICKY_OFFSET = HEADER_HEIGHT + FILTER_HEIGHT; @@ -70,7 +71,12 @@ const EmojisTable = observer(function EmojisTable({ component: (emoji) =>