You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

61 lines
1.6 KiB

"use client";
import { useI18n } from "@/translations/provider";
import InformationSheet from "./information-sheet";
import SwipeButton from "./swipe-button";
export type TestCompletedSheetProps = {
isOpen: boolean;
onClose: () => void;
title?: string;
closeOnOutside?: boolean;
};
export function TestCompletedSheet({
isOpen,
onClose,
title,
closeOnOutside = true,
}: TestCompletedSheetProps) {
const { dictionary: t, locale } = useI18n();
if (!isOpen) {
return null;
}
const isFa = locale === "fa";
const sheetTitle =
title ||
(t as Record<string, string>)["Test Completed"] ||
(isFa ? "آزمون تکمیل شده است" : "Test Completed");
const message = isFa
? "شما این آزمون را قبلاً تکمیل کرده‌اید و امکان شرکت مجدد در آن وجود ندارد."
: (t as Record<string, string>)["You have already completed this test, and it cannot be retaken."] ||
"You have already completed this test, and it cannot be retaken.";
const buttonLabel = (t as Record<string, string>)["Got it"] || (isFa ? "متوجه شدم" : "Got it");
return (
<InformationSheet
icon="check"
title={sheetTitle}
description={
<p className="text-center mt-2 group-12 text-[#4D4D4D] leading-relaxed font-medium">
{message}
</p>
}
buttons={({ close }) => (
<SwipeButton
text={buttonLabel}
onSuccess={close}
/>
)}
closeOnOutside={closeOnOutside}
onClose={onClose}
/>
);
}
export default TestCompletedSheet;