diff --git a/src/App.tsx b/src/App.tsx
index 7275da5..dcbf270 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -21,29 +21,6 @@ function App() {
- {/*
-
{t('helloWorld')}
-
-
-
-
- success
-
-
- warning
-
-
- info
-
-
- error
-
-
-
*/}
>
);
}
diff --git a/src/features/authentication/components/DateOfBirth.tsx b/src/features/authentication/components/DateOfBirth.tsx
index 11e0b64..c0bcf42 100644
--- a/src/features/authentication/components/DateOfBirth.tsx
+++ b/src/features/authentication/components/DateOfBirth.tsx
@@ -5,10 +5,14 @@ import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
import { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalali';
import { useTranslation } from 'react-i18next';
-export function DateOfBirth() {
+interface DateOfBirthProps {
+ value: Date | null;
+ onChange: (date: Date | null) => void;
+}
+export function DateOfBirth({ value, onChange }: DateOfBirthProps) {
const { t, i18n } = useTranslation('completionForm');
const isFarsi = i18n.language === 'fa' || i18n.language === 'fa-IR';
- const [birthDate, setBirthDate] = useState(null);
+ // const [birthDate, setBirthDate] = useState(null);
const Adapter = useMemo(() => {
return isFarsi ? AdapterDateFnsJalali : AdapterDateFns;
@@ -18,8 +22,8 @@ export function DateOfBirth() {
setBirthDate(newValue)}
+ value={value}
+ onChange={onChange}
slotProps={{
textField: {
fullWidth: true,
diff --git a/src/features/authentication/components/PersonalInfoFields.tsx b/src/features/authentication/components/PersonalInfoFields.tsx
index ecf7508..7ee8a46 100644
--- a/src/features/authentication/components/PersonalInfoFields.tsx
+++ b/src/features/authentication/components/PersonalInfoFields.tsx
@@ -9,18 +9,34 @@ import {
} from '@mui/material';
import { useTranslation } from 'react-i18next';
import { Woman, Man } from 'iconsax-react';
-import { useState } from 'react';
+import { useState, type Dispatch, type SetStateAction } from 'react';
import { DateOfBirth } from './DateOfBirth';
import { countries } from '../data/Countries';
interface PersonalInfoFieldsProps {
- sex: string;
- setSex: (sex: string) => void;
+ firstName: string;
+ setFirstName: (v: string) => void;
+ lastName: string;
+ setLastName: (v: string) => void;
+ sex: 'male' | 'female';
+ setSex: Dispatch>;
country: string;
setCountry: (country: string) => void;
+ nationalId: string;
+ setNationalId: (v: string) => void;
+ birthDate: Date | null;
+ setBirthDate: (d: Date | null) => void;
}
export function PersonalInfoFields({
+ firstName,
+ setFirstName,
+ lastName,
+ setLastName,
+ nationalId,
+ setNationalId,
+ birthDate,
+ setBirthDate,
sex,
setSex,
country,
@@ -30,7 +46,7 @@ export function PersonalInfoFields({
const [countryError, setCountryError] = useState(false);
const handleChangeSex = (e: any) => {
- setSex(e.target.value);
+ setSex(e.target.value as 'female' | 'male');
};
const handleChangeCountry = (_: any, newValue: any) => {
@@ -81,12 +97,16 @@ export function PersonalInfoFields({
label={t('completion.name')}
placeholder={t('completion.name')}
variant="outlined"
+ value={firstName}
+ onChange={(e) => setFirstName(e.target.value)}
sx={fieldSx}
/>
setLastName(e.target.value)}
sx={fieldSx}
/>
@@ -127,6 +147,8 @@ export function PersonalInfoFields({
setNationalId(e.target.value)}
variant="outlined"
sx={fieldSx}
/>
@@ -181,7 +203,7 @@ export function PersonalInfoFields({
/>
-
+
diff --git a/src/features/authentication/components/SubmitSection.tsx b/src/features/authentication/components/SubmitSection.tsx
index 8cbba50..7239e20 100644
--- a/src/features/authentication/components/SubmitSection.tsx
+++ b/src/features/authentication/components/SubmitSection.tsx
@@ -7,11 +7,15 @@ import {
Dialog,
DialogTitle,
DialogContent,
- DialogActions,
} from '@mui/material';
import { useTranslation } from 'react-i18next';
-
-export function SubmitSection() {
+interface Props {
+ onSubmit: () => void;
+ loading: boolean;
+ error: string | null;
+ success: boolean;
+}
+export function SubmitSection({ onSubmit, loading, error, success }: Props) {
const { t, i18n } = useTranslation('completionForm');
const [openDialog, setOpenDialog] = useState(false);
@@ -20,8 +24,6 @@ export function SubmitSection() {
setOpenDialog(true);
};
- const handleCloseDialog = () => setOpenDialog(false);
-
const agreementText = `۱. محرمانگی اطلاعات
هارمونی متعهد میشود تحت هیچ شرایطی اطلاعات هویتی کاربران نظیر شماره تلفن، ایمیل، رمز عبور، شناسه کاربری و هرگونه داده مرتبط را در اختیار اشخاص ثالث قرار ندهد. اطلاعات کاربران صرفاً در چارچوب ارائه خدمات احراز هویت مورد استفاده قرار گرفته و حتی پس از غیرفعالسازی حساب یا قطع همکاری، این اطلاعات محرمانه باقی خواهد ماند. هارمونی موظف به پیادهسازی تدابیر امنیتی لازم برای جلوگیری از هرگونه دسترسی غیرمجاز میباشد.
۲. مسئولیت حفظ اطلاعات ورود
کاربر موظف است از حساب کاربری خود محافظت کند و رمز عبوری ایمن و غیرقابل حدس انتخاب نماید. تغییر دورهای رمز عبور و اقدام فوری در صورت احساس خطر دسترسی غیرمجاز الزامی است. مسئولیت هرگونه سوءاستفاده از حساب کاربری به دلیل بیاحتیاطی کاربر، بر عهده خود وی خواهد بود.
۳. رخنههای امنیتی و حملات سایبری
هارمونی در برابر رخنههای امنیتی ناشی از حملات سایبری که خارج از کنترل سیستم است، مسئولیتی ندارد. با این حال، هارمونی از بهروزترین استانداردهای امنیتی و رمزنگاری برای جلوگیری از چنین حوادثی بهره میبرد.
@@ -72,7 +74,7 @@ export function SubmitSection() {
{t('completion.agreementPart2')}
- */}
+
+ {error && {error}}