This commit is contained in:
Delta 2026-05-18 20:38:36 +05:30 committed by GitHub
commit 3e39bb0efc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 4 deletions

View File

@ -10,6 +10,9 @@ import {
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Label } from "@/components/ui/label";
import { Input } from "@/components/ui/input";
import { useState } from "react";
const REQUIRED_CONFIRMATION_TEXT = "DELETE";
export function DeleteProjectDialog({
isOpen,
@ -25,6 +28,8 @@ export function DeleteProjectDialog({
const count = projectNames.length;
const isSingle = count === 1;
const singleName = isSingle ? projectNames[0] : null;
const [confirmationInput, setConfirmationInput] = useState<string>("");
return (
<Dialog open={isOpen} onOpenChange={onOpenChange}>
@ -59,12 +64,15 @@ export function DeleteProjectDialog({
</AlertDescription>
</Alert>
<div className="flex flex-col gap-3">
<Label className="text-xs font-semibold text-slate-500">
Type "DELETE" to confirm
<Label htmlFor="confirmation-input" className="text-xs font-semibold text-slate-500">
{`Type "${REQUIRED_CONFIRMATION_TEXT}" to confirm`}
</Label>
<Input
id={"confirmation-input"}
onChange={(e) => {setConfirmationInput(e.target.value)}}
value={confirmationInput}
type="text"
placeholder="DELETE"
placeholder={REQUIRED_CONFIRMATION_TEXT}
size="lg"
variant="destructive"
/>
@ -74,7 +82,7 @@ export function DeleteProjectDialog({
<Button variant="outline" onClick={() => onOpenChange(false)}>
Cancel
</Button>
<Button variant="destructive" onClick={onConfirm}>
<Button variant="destructive" onClick={onConfirm} disabled={confirmationInput !== REQUIRED_CONFIRMATION_TEXT}>
Delete project
</Button>
</DialogFooter>