reset token and fix toggle button placement

This commit is contained in:
Evan
2026-01-21 16:28:00 +05:00
parent f0e95dd962
commit 5ea9c54b14
2 changed files with 9 additions and 2 deletions
@@ -11,7 +11,11 @@ export function LanguageSwitcher({
onLanguageChange, onLanguageChange,
}: LanguageSwitcherProps) { }: LanguageSwitcherProps) {
return ( return (
<div className="flex gap-1 justify-end mb-6"> <div
className={`flex gap-1 mb-6 ${
language === "en" ? "justify-end" : "justify-start"
}`}
>
<div className="bg-slate-100 p-1 rounded-full inline-flex border border-slate-200"> <div className="bg-slate-100 p-1 rounded-full inline-flex border border-slate-200">
<Button <Button
variant={language === "en" ? "default" : "ghost"} variant={language === "en" ? "default" : "ghost"}
@@ -5,7 +5,7 @@ import { Label } from "@/components/ui/label";
import { Checkbox } from "@/components/ui/checkbox"; import { Checkbox } from "@/components/ui/checkbox";
import { Alert, AlertDescription } from "@/components/ui/alert"; import { Alert, AlertDescription } from "@/components/ui/alert";
import { SignaturePad, type SignaturePadRef } from "./SignaturePad"; import { SignaturePad, type SignaturePadRef } from "./SignaturePad";
import { Turnstile } from "@marsidev/react-turnstile"; import { Turnstile, type TurnstileInstance } from "@marsidev/react-turnstile";
import { Eraser, Check, CheckCircle, AlertCircle } from "lucide-react"; import { Eraser, Check, CheckCircle, AlertCircle } from "lucide-react";
import type { Language } from "@/types/petition"; import type { Language } from "@/types/petition";
@@ -31,6 +31,7 @@ export function SignatureForm({ language, onSubmit }: SignatureFormProps) {
const [isSubmitting, setIsSubmitting] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false);
const signaturePadRef = useRef<SignaturePadRef>(null); const signaturePadRef = useRef<SignaturePadRef>(null);
const turnstileRef = useRef<TurnstileInstance>(null);
const isRtl = language === "dv"; const isRtl = language === "dv";
const handleClear = () => { const handleClear = () => {
@@ -126,6 +127,8 @@ export function SignatureForm({ language, onSubmit }: SignatureFormProps) {
: "ސޮއި ހުށަހެޅުމުން ކުށެއް ދިމާވެއްޖެ.", : "ސޮއި ހުށަހެޅުމުން ކުށެއް ދިމާވެއްޖެ.",
"error", "error",
); );
turnstileRef.current?.reset();
setTurnstileToken(null);
} finally { } finally {
setIsSubmitting(false); setIsSubmitting(false);
} }