mirror of
https://github.com/docmost/docmost
synced 2025-03-28 21:13:28 +00:00

* feat: support i18n * feat: wip support i18n * feat: complete space translation * feat: complete page translation * feat: update space translation * feat: update workspace translation * feat: update group translation * feat: update workspace translation * feat: update page translation * feat: update user translation * chore: update pnpm-lock * feat: add query translation * refactor: merge to single file * chore: remove necessary code * feat: save language to BE * fix: only load current language * feat: save language to locale column * fix: cleanups * add language menu to preferences page * new translations * translate editor * Translate editor placeholders * translate space selection component --------- Co-authored-by: Philip Okugbe <phil@docmost.com> Co-authored-by: Philip Okugbe <16838612+Philipinho@users.noreply.github.com>
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { ActionIcon, Menu } from "@mantine/core";
|
|
import { IconDots, IconEdit, IconTrash } from "@tabler/icons-react";
|
|
import { modals } from "@mantine/modals";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
type CommentMenuProps = {
|
|
onEditComment: () => void;
|
|
onDeleteComment: () => void;
|
|
};
|
|
|
|
function CommentMenu({ onEditComment, onDeleteComment }: CommentMenuProps) {
|
|
const { t } = useTranslation();
|
|
|
|
//@ts-ignore
|
|
const openDeleteModal = () =>
|
|
modals.openConfirmModal({
|
|
title: t("Are you sure you want to delete this comment?"),
|
|
centered: true,
|
|
labels: { confirm: t("Delete"), cancel: t("Cancel") },
|
|
confirmProps: { color: "red" },
|
|
onConfirm: onDeleteComment,
|
|
});
|
|
|
|
return (
|
|
<Menu shadow="md" width={200}>
|
|
<Menu.Target>
|
|
<ActionIcon variant="default" style={{ border: "none" }}>
|
|
<IconDots size={20} stroke={2} />
|
|
</ActionIcon>
|
|
</Menu.Target>
|
|
|
|
<Menu.Dropdown>
|
|
<Menu.Item onClick={onEditComment} leftSection={<IconEdit size={14} />}>
|
|
{t("Edit comment")}
|
|
</Menu.Item>
|
|
<Menu.Item
|
|
leftSection={<IconTrash size={14} />}
|
|
onClick={openDeleteModal}
|
|
>
|
|
{t("Delete comment")}
|
|
</Menu.Item>
|
|
</Menu.Dropdown>
|
|
</Menu>
|
|
);
|
|
}
|
|
|
|
export default CommentMenu;
|