This commit is contained in:
2025-11-18 20:56:21 -03:00
parent b439b1e038
commit 3a42e4c7d2
2 changed files with 25 additions and 5 deletions

View File

@@ -195,6 +195,7 @@ export function DataTable<TData, TValue>({
<TableRow
key={row.id}
data-state={row.getIsSelected() && 'selected'}
className="has-[[data-state=open]]:bg-muted/50"
>
{row.getVisibleCells().map((cell) => (
<TableCell

View File

@@ -329,7 +329,7 @@ function RemoveDedupItem({
onSuccess,
...props
}: ItemProps & {
lock?: { hash: string }
lock?: { hash: string; ttl?: number }
}) {
const [loading, { set }] = useToggle(false)
const [open, { set: setOpen }] = useToggle(false)
@@ -338,7 +338,7 @@ function RemoveDedupItem({
e.preventDefault()
set(true)
if (!lock) return
if (!lock) return null
const r = await fetch(`/~/api/enrollments/${id}/dedupwindow`, {
method: 'DELETE',
@@ -353,6 +353,20 @@ function RemoveDedupItem({
}
}
const getDaysRemaining = () => {
if (!lock?.ttl) return null
return new Date(lock.ttl * 1000).toLocaleString('pt-BR', {
hour: '2-digit',
minute: '2-digit',
day: '2-digit',
month: '2-digit',
year: '2-digit'
})
}
const daysRemaining = getDaysRemaining()
return (
<AlertDialog open={open} onOpenChange={setOpen}>
<AlertDialogTrigger asChild>
@@ -368,9 +382,14 @@ function RemoveDedupItem({
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Tem certeza absoluta?</AlertDialogTitle>
<AlertDialogDescription>
<AlertDialogDescription className="space-y-2.5">
<p>
Esta ação não pode ser desfeita. Isso remove a proteção contra
duplicação permanentemente desta matrícula.
</p>
{daysRemaining && (
<p>Proteção contra duplicação válida até {daysRemaining}</p>
)}
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter className="*:cursor-pointer">