add prettier formatter to all file

This commit is contained in:
Ehsan
2024-09-25 11:03:44 +03:30
parent fa38ee2b21
commit eda896e917
410 changed files with 47636 additions and 43842 deletions
+12 -12
View File
@@ -1,16 +1,16 @@
import { Button as ButtonMUI } from '@mui/material'
import React from 'react'
import { Button as ButtonMUI } from "@mui/material";
import React from "react";
function ButtonDate({ handleClick, id, text }) {
return (
<ButtonMUI
onClick={handleClick}
aria-describedby={id}
className="!border-[#E9ECEF] !text-[#6C757D]"
>
{text}
</ButtonMUI>
)
return (
<ButtonMUI
onClick={handleClick}
aria-describedby={id}
className="!border-[#E9ECEF] !text-[#6C757D]"
>
{text}
</ButtonMUI>
);
}
export default ButtonDate
export default ButtonDate;
+34 -28
View File
@@ -1,32 +1,38 @@
import { TextField } from "@mui/material"
import { TextField } from "@mui/material";
function Field({ title, handleClick }) {
return (
<div className="relative">
<TextField
label={title}
className="!w-full !mx-auto !bg-[#FFF]"
sx={{
borderRadius: '8px !important',
'& .MuiFormLabel-root': { transform: 'translate(16px, 50%) scale(1) !important' },
'& .MuiInputLabel-shrink': { transform: 'translate(14px, -9px) scale(0.75) !important' },
'& .MuiInputBase-input': { padding: '12.5px 14px' },
'& .MuiInputBase-root': { borderRadius: '8px !important' },
'& .MuiOutlinedInput-notchedOutline': { border: '1px solid #E9ECEF !important' },
".Mui-focused": {
'& .MuiOutlinedInput-notchedOutline': {
border: '1px solid #0FA1B3 !important',
transition: '0.5s all'
}
}
}}
/>
<span
className="absolute cursor-pointer left-0 top-0 w-full h-full"
onClick={handleClick}
></span>
</div>
)
return (
<div className="relative">
<TextField
label={title}
className="!w-full !mx-auto !bg-[#FFF]"
sx={{
borderRadius: "8px !important",
"& .MuiFormLabel-root": {
transform: "translate(16px, 50%) scale(1) !important",
},
"& .MuiInputLabel-shrink": {
transform: "translate(14px, -9px) scale(0.75) !important",
},
"& .MuiInputBase-input": { padding: "12.5px 14px" },
"& .MuiInputBase-root": { borderRadius: "8px !important" },
"& .MuiOutlinedInput-notchedOutline": {
border: "1px solid #E9ECEF !important",
},
".Mui-focused": {
"& .MuiOutlinedInput-notchedOutline": {
border: "1px solid #0FA1B3 !important",
transition: "0.5s all",
},
},
}}
/>
<span
className="absolute cursor-pointer left-0 top-0 w-full h-full"
onClick={handleClick}
></span>
</div>
);
}
export default Field
export default Field;
+83 -84
View File
@@ -1,98 +1,97 @@
'use client';
"use client";
import { useEffect, useRef, useState } from 'react';
import { useEffect, useRef, useState } from "react";
import { DatePicker as DatePickerJalali } from "jalaali-react-date-picker";
import Image from 'next/image';
import { Button, Skeleton } from '@mui/material';
import Image from "next/image";
import { Button, Skeleton } from "@mui/material";
function DatePicker({ date, updateDate }) {
const nextIconDatePicker = useRef();
const nextIconDatePicker = useRef();
const [startDate, setStartDate] = useState(null);
const [endDate, setEndDate] = useState();
const [loading, setLoading] = useState(true);
const [startDate, setStartDate] = useState(null);
const [endDate, setEndDate] = useState();
const [loading, setLoading] = useState(true);
const handleStartDateChange = (date) => {
if (date) {
setStartDate(date);
setEndDate(null); // Clear end date if start date is selected
// updateDate(date); // Notify parent about the selected date
}
};
const handleEndDateChange = (date) => {
if (date) {
setEndDate(date);
setStartDate(null); // Clear start date if end date is selected
// updateDate(date); // Notify parent about the selected date
}
};
const handleDisableDate = e => {
const today = new Date();
return today >= e._d
const handleStartDateChange = (date) => {
if (date) {
setStartDate(date);
setEndDate(null); // Clear end date if start date is selected
// updateDate(date); // Notify parent about the selected date
}
};
useEffect(() => {
if (nextIconDatePicker.current) {
nextIconDatePicker.current.click()
setLoading(false)
}
}, [nextIconDatePicker])
const handleEndDateChange = (date) => {
if (date) {
setEndDate(date);
setStartDate(null); // Clear start date if end date is selected
// updateDate(date); // Notify parent about the selected date
}
};
return (
<div className='flex items-start justify-evenly w-full'>
<div className='w-1/2 relative flex justify-center'>
<DatePickerJalali
value={startDate}
className={`w-full ${loading ? 'opacity-0' : 'opacity-100'}`}
timePicker={false}
onChange={handleStartDateChange}
disabledDates={e => handleDisableDate(e)}
const handleDisableDate = (e) => {
const today = new Date();
return today >= e._d;
};
useEffect(() => {
if (nextIconDatePicker.current) {
nextIconDatePicker.current.click();
setLoading(false);
}
}, [nextIconDatePicker]);
return (
<div className="flex items-start justify-evenly w-full">
<div className="w-1/2 relative flex justify-center">
<DatePickerJalali
value={startDate}
className={`w-full ${loading ? "opacity-0" : "opacity-100"}`}
timePicker={false}
onChange={handleStartDateChange}
disabledDates={(e) => handleDisableDate(e)}
/>
{loading && (
<Skeleton
variant="rectangular"
className="!w-[300px] !rounded-[6px] !absolute !top-0 !right-1/2 !translate-x-1/2 !z-10"
height={352}
/>
)}
</div>
<div className="w-1/2 hidden md:flex lg:hidden xl:flex">
<div className="w-full relative flex justify-center">
<DatePickerJalali
value={endDate}
timePicker={false}
className={`w-full ${loading ? "opacity-0" : "opacity-100"}`}
nextIcon={
<Button
className="!min-w-0 !p-0 !rounded-full"
ref={nextIconDatePicker}
onClick={(e) => e.preventDefault()}
>
<Image
src="/assets/icons/arrow-right.svg"
className="icon-left-datepicker"
height={24}
width={24}
/>
{loading && (
<Skeleton
variant="rectangular"
className='!w-[300px] !rounded-[6px] !absolute !top-0 !right-1/2 !translate-x-1/2 !z-10'
height={352}
/>
)}
</div>
<div className='w-1/2 hidden md:flex lg:hidden xl:flex'>
<div className='w-full relative flex justify-center'>
<DatePickerJalali
value={endDate}
timePicker={false}
className={`w-full ${loading ? 'opacity-0' : 'opacity-100'}`}
nextIcon={
<Button
className='!min-w-0 !p-0 !rounded-full'
ref={nextIconDatePicker}
onClick={e => e.preventDefault()}
>
<Image
src='/assets/icons/arrow-right.svg'
className='icon-left-datepicker'
height={24}
width={24}
/>
</Button>
}
onChange={handleEndDateChange}
disabledDates={e => handleDisableDate(e)}
/>
{loading && (
<Skeleton
variant="rectangular"
className='!w-[300px] !rounded-[6px] !absolute !top-0 !right-1/2 !translate-x-1/2 !z-10'
height={352}
/>
)}
</div>
</div>
</Button>
}
onChange={handleEndDateChange}
disabledDates={(e) => handleDisableDate(e)}
/>
{loading && (
<Skeleton
variant="rectangular"
className="!w-[300px] !rounded-[6px] !absolute !top-0 !right-1/2 !translate-x-1/2 !z-10"
height={352}
/>
)}
</div>
);
</div>
</div>
);
}
export default DatePicker;
+24 -24
View File
@@ -1,32 +1,32 @@
import { Button } from "@mui/material";
function Hours({ doctor, hour, setHour, value, nameHours }) {
return (
<ul
className="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-x-[16px] gap-y-[12px] sm:gap-y-[16px] md:gap-y-[20px] lg:gap-y-[24px] mt-[24px] mb-[40px]"
>
{doctor[nameHours[value]].map((item, idx) => (
<li
key={idx}
>
<Button
onClick={() => setHour(idx)}
disabled={!item.active}
className={`
return (
<ul className="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-x-[16px] gap-y-[12px] sm:gap-y-[16px] md:gap-y-[20px] lg:gap-y-[24px] mt-[24px] mb-[40px]">
{doctor[nameHours[value]].map((item, idx) => (
<li key={idx}>
<Button
onClick={() => setHour(idx)}
disabled={!item.active}
className={`
!w-full !rounded-[8px] !bg-[#EFEFEF] !grid !place-items-center !py-[10px] !px-[14px] !h-[40px] md:!h-[42px] lg:!h-[44px]
${idx === hour ? '!bg-[#F79463] ' : ''}
${idx === hour ? "!bg-[#F79463] " : ""}
`}
>
<p className={`
>
<p
className={`
text-[16px] font-semibold text-[#525252]
${item.active ? 'text-[#525252]' : 'text-[#D7D7D7]'}
${idx === hour ? '!text-[#FAFAFA] ' : ''}
`}>{item.hour}</p>
</Button>
</li>
))}
</ul>
)
${item.active ? "text-[#525252]" : "text-[#D7D7D7]"}
${idx === hour ? "!text-[#FAFAFA] " : ""}
`}
>
{item.hour}
</p>
</Button>
</li>
))}
</ul>
);
}
export default Hours;
export default Hours;
+19 -20
View File
@@ -1,4 +1,4 @@
'use client';
"use client";
import { useState } from "react";
import Hours from "./Hours";
@@ -6,11 +6,10 @@ import Tabs from "../../Tabs";
import { Button } from "@mui/material";
import ArrowLeftB from "@/components/icons/ArrowLeftB";
const listTab = ['صبح', 'بعد از ظهر'];
const nameHours = ['hours_morning', 'hours_afternoon']
const listTab = ["صبح", "بعد از ظهر"];
const nameHours = ["hours_morning", "hours_afternoon"];
function DateTime({ doctor, setStep, setIsError, locateVisit }) {
const [value, setValue] = useState(0);
const [hour, setHour] = useState(0);
@@ -21,21 +20,21 @@ function DateTime({ doctor, setStep, setIsError, locateVisit }) {
<Tabs
isSm={true}
style={{
'.MuiTabs-indicator': {
height: '4px',
borderRadius: '8px',
background: '#F17732'
".MuiTabs-indicator": {
height: "4px",
borderRadius: "8px",
background: "#F17732",
},
'& .MuiTabs-flexContainer': {
borderBottom: '2px solid #EFEFEF',
marginBottom: '1px'
"& .MuiTabs-flexContainer": {
borderBottom: "2px solid #EFEFEF",
marginBottom: "1px",
},
'& .mui-11pdt05-MuiButtonBase-root-MuiTab-root.Mui-selected': {
color: '#F17732 !important'
"& .mui-11pdt05-MuiButtonBase-root-MuiTab-root.Mui-selected": {
color: "#F17732 !important",
},
"& .MuiButtonBase-root.Mui-selected": {
color: "#F17732 !important",
},
'& .MuiButtonBase-root.Mui-selected': {
color: '#F17732 !important'
}
}}
value={value}
listTab={listTab}
@@ -53,8 +52,8 @@ function DateTime({ doctor, setStep, setIsError, locateVisit }) {
className="!gap-[4px] !shadow-none !px-[12px] !py-[8px] md:!py-[9px] !w-full md:!w-fit !min-w-[157px]"
onClick={() => {
if (locateVisit) {
localStorage.setItem('doctor-id', doctor?.id);
setStep(prev => prev + 1);
localStorage.setItem("doctor-id", doctor?.id);
setStep((prev) => prev + 1);
} else {
setIsError(true);
}
@@ -66,7 +65,7 @@ function DateTime({ doctor, setStep, setIsError, locateVisit }) {
</Button>
</div>
</div>
)
);
}
export default DateTime
export default DateTime;