import { Tooltip } from "@mui/joy"; import { toast } from "react-hot-toast"; import { useMemoStore } from "@/store/module"; import { useTranslate } from "@/utils/i18n"; import { getDateTimeString } from "@/helpers/datetime"; import Icon from "./Icon"; import MemoContent from "./MemoContent"; import MemoResourceListView from "./MemoResourceListView"; import { showCommonDialog } from "./Dialog/CommonDialog"; import "@/less/memo.less"; interface Props { memo: Memo; } const ArchivedMemo: React.FC = (props: Props) => { const { memo } = props; const t = useTranslate(); const memoStore = useMemoStore(); const handleDeleteMemoClick = async () => { showCommonDialog({ title: t("memo.delete-memo"), content: t("memo.delete-confirm"), style: "warning", dialogName: "delete-memo-dialog", onConfirm: async () => { await memoStore.deleteMemoById(memo.id); }, }); }; const handleRestoreMemoClick = async () => { try { await memoStore.patchMemo({ id: memo.id, rowStatus: "NORMAL", }); await memoStore.fetchMemos(); toast(t("message.restored-successfully")); } catch (error: any) { console.error(error); toast.error(error.response.data.message); } }; return (
{getDateTimeString(memo.updatedTs)}
); }; export default ArchivedMemo;