chore: hide actions for comment

pull/4614/head
Johnny 3 months ago
parent aa8cf44c41
commit f5d5ebea6f

@ -49,9 +49,10 @@ const MemoActionMenu = (props: Props) => {
const location = useLocation(); const location = useLocation();
const navigateTo = useNavigateTo(); const navigateTo = useNavigateTo();
const memoStore = useMemoStore(); const memoStore = useMemoStore();
const isArchived = memo.state === State.ARCHIVED;
const hasCompletedTaskList = checkHasCompletedTaskList(memo); const hasCompletedTaskList = checkHasCompletedTaskList(memo);
const isInMemoDetailPage = location.pathname.startsWith(`/${memo.name}`); const isInMemoDetailPage = location.pathname.startsWith(`/${memo.name}`);
const isComment = Boolean(memo.parent);
const isArchived = memo.state === State.ARCHIVED;
const memoUpdatedCallback = () => { const memoUpdatedCallback = () => {
// Refresh user stats. // Refresh user stats.
@ -170,7 +171,7 @@ const MemoActionMenu = (props: Props) => {
</span> </span>
</MenuButton> </MenuButton>
<Menu className="text-sm" size="sm" placement="bottom-end"> <Menu className="text-sm" size="sm" placement="bottom-end">
{!readonly && !isArchived && ( {!readonly && !isArchived && !isComment && (
<> <>
<MenuItem onClick={handleTogglePinMemoBtnClick}> <MenuItem onClick={handleTogglePinMemoBtnClick}>
{memo.pinned ? <BookmarkMinusIcon className="w-4 h-auto" /> : <BookmarkPlusIcon className="w-4 h-auto" />} {memo.pinned ? <BookmarkMinusIcon className="w-4 h-auto" /> : <BookmarkPlusIcon className="w-4 h-auto" />}
@ -190,16 +191,18 @@ const MemoActionMenu = (props: Props) => {
)} )}
{!readonly && ( {!readonly && (
<> <>
{!isArchived && hasCompletedTaskList && ( {!isArchived && !isComment && hasCompletedTaskList && (
<MenuItem color="warning" onClick={handleRemoveCompletedTaskListItemsClick}> <MenuItem color="warning" onClick={handleRemoveCompletedTaskListItemsClick}>
<SquareCheckIcon className="w-4 h-auto" /> <SquareCheckIcon className="w-4 h-auto" />
{t("memo.remove-completed-task-list-items")} {t("memo.remove-completed-task-list-items")}
</MenuItem> </MenuItem>
)} )}
<MenuItem color="warning" onClick={handleToggleMemoStatusClick}> {!isComment && (
{isArchived ? <ArchiveRestoreIcon className="w-4 h-auto" /> : <ArchiveIcon className="w-4 h-auto" />} <MenuItem color="warning" onClick={handleToggleMemoStatusClick}>
{isArchived ? t("common.restore") : t("common.archive")} {isArchived ? <ArchiveRestoreIcon className="w-4 h-auto" /> : <ArchiveIcon className="w-4 h-auto" />}
</MenuItem> {isArchived ? t("common.restore") : t("common.archive")}
</MenuItem>
)}
<MenuItem color="danger" onClick={handleDeleteMemoClick}> <MenuItem color="danger" onClick={handleDeleteMemoClick}>
<TrashIcon className="w-4 h-auto" /> <TrashIcon className="w-4 h-auto" />
{t("common.delete")} {t("common.delete")}

Loading…
Cancel
Save