mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-04 00:28:33 +00:00
- document folder - full-text search - blob storage - basic edgeless support Co-authored-by: tzhangchi <terry.zhangchi@outlook.com> Co-authored-by: QiShaoXuan <qishaoxuan777@gmail.com> Co-authored-by: DiamondThree <diamond.shx@gmail.com> Co-authored-by: MingLiang Wang <mingliangwang0o0@gmail.com> Co-authored-by: JimmFly <yangjinfei001@gmail.com> Co-authored-by: Yifeng Wang <doodlewind@toeverything.info> Co-authored-by: Himself65 <himself65@outlook.com> Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com> Co-authored-by: Qi <474021214@qq.com>
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { Button } from '@/ui/button';
|
|
import { usePageHelper } from '@/hooks/use-page-helper';
|
|
import { useAppState } from '@/providers/app-state-provider';
|
|
import { useConfirm } from '@/providers/confirm-provider';
|
|
import { useRouter } from 'next/router';
|
|
import useCurrentPageMeta from '@/hooks/use-current-page-meta';
|
|
|
|
export const TrashButtonGroup = () => {
|
|
const { permanentlyDeletePage } = usePageHelper();
|
|
const { currentWorkspaceId } = useAppState();
|
|
const { toggleDeletePage } = usePageHelper();
|
|
const { confirm } = useConfirm();
|
|
const router = useRouter();
|
|
const { id = '' } = useCurrentPageMeta() || {};
|
|
|
|
return (
|
|
<>
|
|
<Button
|
|
bold={true}
|
|
shape="round"
|
|
style={{ marginRight: '24px' }}
|
|
onClick={() => {
|
|
toggleDeletePage(id);
|
|
}}
|
|
>
|
|
Restore it
|
|
</Button>
|
|
<Button
|
|
bold={true}
|
|
shape="round"
|
|
type="danger"
|
|
onClick={() => {
|
|
confirm({
|
|
title: 'Permanently delete',
|
|
content:
|
|
"Once deleted, you can't undo this action. Do you confirm?",
|
|
confirmText: 'Delete',
|
|
confirmType: 'danger',
|
|
}).then(confirm => {
|
|
if (confirm) {
|
|
router.push(`/workspace/${currentWorkspaceId}/all`);
|
|
permanentlyDeletePage(id);
|
|
}
|
|
});
|
|
}}
|
|
>
|
|
Delete permanently
|
|
</Button>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default TrashButtonGroup;
|