Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x | 'use client';
import type { Skill } from '@shared/types/data';
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@web/components/ui/alert-dialog';
import { Checkbox } from '@web/components/ui/checkbox';
import { Label } from '@web/components/ui/label';
import type { ReactElement } from 'react';
import { useId, useState } from 'react';
interface ResetSkillDialogProps {
skill: Skill | null;
open: boolean;
onOpenChange: (open: boolean) => void;
onConfirm: (clearObservabilityCount: boolean) => void | Promise<void>;
isResetting?: boolean;
}
export function ResetSkillDialog({
skill,
open,
onOpenChange,
onConfirm,
isResetting = false,
}: ResetSkillDialogProps): ReactElement {
const [clearObservabilityCount, setClearObservabilityCount] = useState(false);
const checkboxId = useId();
const handleConfirm = async () => {
await onConfirm(clearObservabilityCount);
onOpenChange(false);
setClearObservabilityCount(false); // Reset checkbox for next time
};
return (
<AlertDialog open={open} onOpenChange={onOpenChange}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Reset Skill Optimization</AlertDialogTitle>
<AlertDialogDescription asChild>
<div className="space-y-3">
<p>
Are you sure you want to reset{' '}
<span className="font-semibold text-foreground">
{skill?.name}
</span>
?
</p>
<p className="font-medium text-foreground">This will:</p>
<ul className="list-disc pl-5 space-y-1 text-sm">
<li>Delete all partitions and configurations</li>
<li>Delete all evaluations</li>
<li>Reset all learning progress</li>
<li>
{clearObservabilityCount
? 'Reset skill observability request counts'
: 'Keep skill observability request counts'}
</li>
</ul>
<div className="flex items-center space-x-2 pt-2">
<Checkbox
id={checkboxId}
checked={clearObservabilityCount}
onCheckedChange={(checked) =>
setClearObservabilityCount(checked === true)
}
/>
<Label
htmlFor={checkboxId}
className="text-sm font-normal cursor-pointer"
>
Also reset observability request counts
</Label>
</div>
<p className="text-sm font-medium text-destructive">
Everything will be regenerated from scratch. This action cannot
be undone.
</p>
</div>
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel disabled={isResetting}>Cancel</AlertDialogCancel>
<AlertDialogAction
onClick={handleConfirm}
variant={'destructive'}
disabled={isResetting}
>
{isResetting ? 'Resetting...' : 'Reset Skill'}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
}
|