refactor(dateTime): streamline slot handling and improve session management
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { Button } from "@mui/material";
|
||||
import React from "react";
|
||||
|
||||
function List({ appo, hour, setHour, value }) {
|
||||
const list = appo && appo[value ? "evening" : "morning"];
|
||||
function List({ slots, hour, setHour }) {
|
||||
const list = slots;
|
||||
const checkHour = (item) => JSON.stringify(item) === JSON.stringify(hour);
|
||||
const isSelectable = (item) =>
|
||||
item.is_available && !(item?.start && item.start * 1000 < Date.now());
|
||||
@@ -30,8 +30,7 @@ function List({ appo, hour, setHour, value }) {
|
||||
} else {
|
||||
return (
|
||||
<p className="text-[#525252] text-[14px] md:text-[16px] font-medium py-[56px]">
|
||||
در حال حاضر، نوبتی برای ساعتهای {[value ? "بعد از ظهر" : "صبح"]} موجود
|
||||
نمیباشد.
|
||||
در حال حاضر، نوبتی برای این شیفت موجود نمیباشد.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import List from "./List";
|
||||
import Loading from "./Loading";
|
||||
|
||||
function Hours({ appo, doctor, hour, setHour, value, nameHours, locationAddress }) {
|
||||
function Hours({ appo, slots, hour, setHour, locationAddress }) {
|
||||
if (appo === "loading") {
|
||||
return <Loading />;
|
||||
} else if (typeof appo === "string") {
|
||||
@@ -13,7 +13,7 @@ function Hours({ appo, doctor, hour, setHour, value, nameHours, locationAddress
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
<List appo={appo} hour={hour} value={value} setHour={setHour} />
|
||||
<List slots={slots} hour={hour} setHour={setHour} />
|
||||
{locationAddress && (
|
||||
<div className="mt-4 p-3 bg-[#F5F5F5] dark:bg-[#2A2A2A] rounded-lg">
|
||||
<p className="text-[#616161] dark:text-[#A1A1A1] text-[14px] font-medium mb-1">
|
||||
|
||||
Reference in New Issue
Block a user