feat(ai-character): 리소스 관리 기반 정비

This commit is contained in:
Yu Sung
2026-08-01 01:30:24 +09:00
parent 55ba0df77a
commit a1cae336d9
73 changed files with 5162 additions and 816 deletions

View File

@@ -1,14 +1,17 @@
import { useModalFocus } from "@/shared/ui/use-modal-focus";
export type ConfirmDeactivateDialogProps = {
readonly confirmLabel?: string;
readonly errorMessage?: string;
readonly impactDescription: string;
readonly isPending?: boolean;
readonly onCancel: () => void;
readonly onConfirm: () => void;
readonly open: boolean;
readonly targetName: string;
};
export function ConfirmDeactivateDialog({ impactDescription, onCancel, onConfirm, open, targetName }: ConfirmDeactivateDialogProps) {
export function ConfirmDeactivateDialog({ confirmLabel = "비활성화", errorMessage, impactDescription, isPending = false, onCancel, onConfirm, open, targetName }: ConfirmDeactivateDialogProps) {
const { dialogRef, trapFocus } = useModalFocus<HTMLElement>(open);
if (!open) {
@@ -19,17 +22,18 @@ export function ConfirmDeactivateDialog({ impactDescription, onCancel, onConfirm
return (
<div className="fixed inset-0 z-modal grid place-items-center bg-background/80 p-4">
<section aria-modal="true" className="flex w-full max-w-sm flex-col gap-4 rounded-lg border border-border bg-card p-6" onKeyDown={trapFocus} ref={dialogRef} role="alertdialog" aria-label={title}>
<section aria-busy={isPending ? true : undefined} aria-modal="true" className="flex w-full max-w-sm flex-col gap-4 rounded-lg border border-border bg-card p-6" onKeyDown={trapFocus} ref={dialogRef} role="alertdialog" aria-label={title}>
<div className="flex flex-col gap-2">
<h2 className="text-xl font-semibold">{title}</h2>
<p className="text-sm text-muted-foreground">{impactDescription}</p>
</div>
{errorMessage === undefined ? null : <p className="rounded-md border border-destructive bg-card p-3 text-sm font-semibold text-destructive" role="alert">{errorMessage}</p>}
<div className="flex justify-end gap-2">
<button className="rounded-md border border-input bg-card px-4 py-2 font-semibold hover:bg-accent" onClick={onCancel} type="button">
<button className="rounded-md border border-input bg-card px-4 py-2 font-semibold hover:bg-accent disabled:opacity-60" disabled={isPending} onClick={onCancel} type="button">
</button>
<button className="rounded-md border border-input bg-primary px-4 py-2 font-semibold text-primary-foreground hover:bg-[var(--button-bg-hover)] active:bg-[var(--button-bg-active)]" onClick={onConfirm} type="button">
<button className="rounded-md border border-destructive bg-destructive px-4 py-2 font-semibold text-white hover:bg-destructive/90 active:bg-destructive disabled:opacity-60" disabled={isPending} onClick={onConfirm} type="button">
{isPending ? "처리 중" : confirmLabel}
</button>
</div>
</section>