From 18299fbb8d23cd90b3c5ceba95245ed7fcc6f745 Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Sun, 10 May 2026 01:53:13 +0800 Subject: [PATCH] refactor(manage): use shared ConfirmDialog in comments page --- .../manage/comments/comments-client.tsx | 89 +++++-------------- 1 file changed, 24 insertions(+), 65 deletions(-) diff --git a/app/(manage)/manage/comments/comments-client.tsx b/app/(manage)/manage/comments/comments-client.tsx index 0a71af4..11f9881 100644 --- a/app/(manage)/manage/comments/comments-client.tsx +++ b/app/(manage)/manage/comments/comments-client.tsx @@ -13,6 +13,7 @@ import { ChevronRightIcon, MessageSquareIcon, } from "lucide-react" +import { ConfirmDialog } from "@/components/ui/modal" interface Comment { id: string @@ -419,72 +420,30 @@ export function CommentsClient() { )} {/* Confirmation Dialogs */} - {confirmAction && ( -
-
- {confirmAction.type === "remove" && ( - <> -

- Confirm Remove -

-

- Are you sure you want to remove this comment? -

-
- - -
- - )} + {confirmAction?.type === "remove" && ( + setConfirmAction(null)} + onConfirm={() => handleRemove(confirmAction.comment)} + title="Confirm Remove" + message="Are you sure you want to remove this comment?" + confirmLabel="Remove" + variant="destructive" + loading={actionLoading[confirmAction.comment.id]} + /> + )} - {confirmAction.type === "restore" && ( - <> -

- Confirm Restore -

-

- Are you sure you want to restore this comment? -

-
- - -
- - )} -
-
+ {confirmAction?.type === "restore" && ( + setConfirmAction(null)} + onConfirm={() => handleRestore(confirmAction.comment)} + title="Confirm Restore" + message="Are you sure you want to restore this comment?" + confirmLabel="Restore" + variant="default" + loading={actionLoading[confirmAction.comment.id]} + /> )} )