reset token and fix toggle button placement

This commit is contained in:
Evan
2026-01-21 16:26:45 +05:00
parent f0e95dd962
commit 5ea9c54b14
2 changed files with 9 additions and 2 deletions

View File

@@ -11,7 +11,11 @@ export function LanguageSwitcher({
onLanguageChange,
}: LanguageSwitcherProps) {
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">
<Button
variant={language === "en" ? "default" : "ghost"}

View File

@@ -5,7 +5,7 @@ import { Label } from "@/components/ui/label";
import { Checkbox } from "@/components/ui/checkbox";
import { Alert, AlertDescription } from "@/components/ui/alert";
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 type { Language } from "@/types/petition";
@@ -31,6 +31,7 @@ export function SignatureForm({ language, onSubmit }: SignatureFormProps) {
const [isSubmitting, setIsSubmitting] = useState(false);
const signaturePadRef = useRef<SignaturePadRef>(null);
const turnstileRef = useRef<TurnstileInstance>(null);
const isRtl = language === "dv";
const handleClear = () => {
@@ -126,6 +127,8 @@ export function SignatureForm({ language, onSubmit }: SignatureFormProps) {
: "ސޮއި ހުށަހެޅުމުން ކުށެއް ދިމާވެއްޖެ.",
"error",
);
turnstileRef.current?.reset();
setTurnstileToken(null);
} finally {
setIsSubmitting(false);
}