73 lines
1.9 KiB
TypeScript
73 lines
1.9 KiB
TypeScript
"use client";
|
|
|
|
import { Camera } from "lucide-react";
|
|
import { Button } from "@/components/ui/button";
|
|
import {
|
|
Dialog,
|
|
DialogContent,
|
|
DialogDescription,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
DialogTrigger,
|
|
} from "@/components/ui/dialog";
|
|
import { useState, type ReactNode } from "react";
|
|
import useAppStore from "@/stores/use-app-store";
|
|
|
|
interface CameraNotificationModalProps {
|
|
onClose?: () => void;
|
|
children?: ReactNode;
|
|
}
|
|
|
|
export function CameraNotificationModal({
|
|
children,
|
|
onClose,
|
|
}: CameraNotificationModalProps) {
|
|
const [open, setOpen] = useState(false);
|
|
|
|
const { setIsCountDown } = useAppStore();
|
|
|
|
const handleClose = () => {
|
|
setOpen(false);
|
|
onClose?.();
|
|
};
|
|
|
|
const handleContinue = () => {
|
|
setIsCountDown(true);
|
|
handleClose();
|
|
};
|
|
|
|
return (
|
|
<Dialog open={open} onOpenChange={setOpen}>
|
|
<DialogTrigger asChild>{children}</DialogTrigger>
|
|
<DialogContent className="w-[95vw] max-w-md sm:max-w-md">
|
|
<DialogHeader>
|
|
<div className="flex items-center justify-center mb-4">
|
|
<div className="rounded-full border p-3">
|
|
<Camera className="w-6 h-6 " />
|
|
</div>
|
|
</div>
|
|
<DialogTitle className="text-center text-lg">
|
|
Thông báo quan trọng
|
|
</DialogTitle>
|
|
<DialogDescription className="text-center text-base pt-2">
|
|
Để có kết quả tốt nhất bạn hay nhìn thẳng vào camera nhé
|
|
</DialogDescription>
|
|
</DialogHeader>
|
|
|
|
<div className="flex justify-center gap-3 pt-4">
|
|
<Button
|
|
variant="outline"
|
|
onClick={handleClose}
|
|
className="min-w-32 bg-transparent"
|
|
>
|
|
Hủy
|
|
</Button>
|
|
<Button onClick={handleContinue} className="min-w-32">
|
|
Tiếp tục
|
|
</Button>
|
|
</div>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|