51 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2024-10-21 13:57:45 -06:00
"use client"
2024-05-07 21:19:32 -07:00
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
2024-10-21 13:57:45 -06:00
} from "@/components/ui/dialog"
2024-05-07 21:19:32 -07:00
2024-10-21 13:57:45 -06:00
import { Loader2 } from "lucide-react"
import { useRouter } from "next/navigation"
import { useEffect } from "react"
2024-05-07 21:19:32 -07:00
export default function DisableAccessModal({
open,
setOpen,
message,
}: {
2024-10-21 13:57:45 -06:00
open: boolean
setOpen: (open: boolean) => void
message: string
2024-05-07 21:19:32 -07:00
}) {
2024-10-21 13:57:45 -06:00
const router = useRouter()
useEffect(() => {
if (open) {
const timeout = setTimeout(() => {
2024-10-21 13:57:45 -06:00
router.push("/dashboard")
}, 5000)
return () => clearTimeout(timeout)
}
2024-10-21 13:57:45 -06:00
}, [])
2024-05-07 21:19:32 -07:00
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>Live Collaboration Disabled</DialogTitle>
</DialogHeader>
<div className="text-sm text-muted-foreground space-y-2">
<div>{message}</div>
<div className="flex items-center">
<Loader2 className="w-4 h-4 animate-spin mr-2" />
Redirecting you to dashboard...
</div>
</div>
2024-05-07 21:19:32 -07:00
</DialogContent>
</Dialog>
2024-10-21 13:57:45 -06:00
)
2024-05-07 21:19:32 -07:00
}