ERP-node/frontend/components/admin/UserStatusConfirmDialog.tsx

78 lines
2.5 KiB
TypeScript
Raw Permalink Normal View History

2025-08-21 09:41:46 +09:00
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
2025-08-26 11:10:34 +09:00
import { User, USER_STATUS_LABELS } from "@/types/user";
2025-08-21 09:41:46 +09:00
interface UserStatusConfirmDialogProps {
user: User | null;
newStatus: string;
isOpen: boolean;
onConfirm: () => void;
onCancel: () => void;
}
/**
*
*/
export function UserStatusConfirmDialog({
user,
newStatus,
isOpen,
onConfirm,
onCancel,
}: UserStatusConfirmDialogProps) {
if (!user) return null;
2025-08-26 11:10:34 +09:00
// 현재 상태와 새로운 상태의 텍스트 및 색상
const currentStatusText = USER_STATUS_LABELS[user.status as keyof typeof USER_STATUS_LABELS] || user.status;
const newStatusText = USER_STATUS_LABELS[newStatus as keyof typeof USER_STATUS_LABELS] || newStatus;
const currentStatusColor = user.status === "active" ? "text-primary" : "text-muted-foreground";
const newStatusColor = newStatus === "active" ? "text-primary" : "text-muted-foreground";
2025-08-21 09:41:46 +09:00
return (
<Dialog open={isOpen} onOpenChange={(open) => !open && onCancel()}>
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle> </DialogTitle>
<DialogDescription> ?</DialogDescription>
</DialogHeader>
<div className="py-4">
2025-08-26 11:10:34 +09:00
<div className="space-y-3">
2025-08-21 09:41:46 +09:00
<div className="flex items-center gap-2">
2025-08-26 11:10:34 +09:00
<span className="text-muted-foreground w-16 text-sm">:</span>
2025-08-21 09:41:46 +09:00
<span className="font-medium">
2025-08-26 11:10:34 +09:00
{user.userName} ({user.userId})
2025-08-21 09:41:46 +09:00
</span>
</div>
<div className="flex items-center gap-2">
2025-08-26 11:10:34 +09:00
<span className="text-muted-foreground w-16 text-sm"> :</span>
<div className="flex items-center gap-2">
<span className={`font-medium ${currentStatusColor}`}>{currentStatusText}</span>
<span className="text-muted-foreground"></span>
<span className={`font-medium ${newStatusColor}`}>{newStatusText}</span>
</div>
2025-08-21 09:41:46 +09:00
</div>
</div>
</div>
<DialogFooter>
<Button variant="outline" onClick={onCancel}>
</Button>
<Button onClick={onConfirm} variant="default">
2025-08-21 09:41:46 +09:00
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
);
}