From c9e49bb769733bcab5e32192d1b84d3c27461827 Mon Sep 17 00:00:00 2001 From: tone Date: Wed, 17 Dec 2025 20:30:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=86=99=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E5=8D=8A=E7=9A=84=E4=BA=BA=E6=9C=BA=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E9=80=9A=E7=94=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/human-verification.tsx | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 apps/frontend/components/human-verification.tsx diff --git a/apps/frontend/components/human-verification.tsx b/apps/frontend/components/human-verification.tsx new file mode 100644 index 0000000..56c88ee --- /dev/null +++ b/apps/frontend/components/human-verification.tsx @@ -0,0 +1,53 @@ +"use client" + +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog" +import { ReactNode, useEffect, useState } from "react" + +interface HumanVerificationProps { + open?: boolean; + onOpenChange?: (open: boolean) => void; + onSuccess?: () => void; + onFail?: (reason?: string) => void; + children: ReactNode; +} + +export function HumanVerification({ open, onOpenChange, onSuccess, onFail, children }: HumanVerificationProps) { + const [i_open, i_setOpen] = useState(false); + const setOpen = (o: boolean) => { + i_setOpen(o); + onOpenChange?.(o); + }; + + useEffect(() => { + if (i_open) { + setOpen(false); + onSuccess?.(); + } + }, [i_open]); + + return ( + + + {children} + + + + 人机验证 + + 请拖动滑块以使得图片水平 + + +
+ +
+
+
+ ) +} \ No newline at end of file