diff --git a/src/pages/LibraryPage.jsx b/src/pages/LibraryPage.jsx index 1065de2..6382432 100644 --- a/src/pages/LibraryPage.jsx +++ b/src/pages/LibraryPage.jsx @@ -36,179 +36,190 @@ */ -import { Flex, Box, Text, Button, useColorModeValue,Switch } from "@chakra-ui/react"; +import { Flex, Box, Text, Button, useColorModeValue, Switch, VStack, HStack, Icon, Badge } from "@chakra-ui/react"; import i18n from "../i18n"; -import { TimeIcon, PhoneIcon } from "@chakra-ui/icons"; +import { TimeIcon, PhoneIcon, CalendarIcon } from "@chakra-ui/icons"; import { useState } from "react"; import { LIBRARY_OPENING_HOURS, LIBRARY_PHONE_LIST } from "../assets/data/Library"; + export default function LibraryPage() { const [isExamPeriod, setisExamPeriod] = useState(false); const currentPeriod = isExamPeriod ? "InExams" : "InSemester"; + // Theme colors + const cardBg = useColorModeValue("#0050e0", "#f3f3f3"); + const cardBorder = useColorModeValue("#0050e0", "#f3f3f3"); + const textColor = useColorModeValue("#f3f3f3", "black"); + const highlightBg = useColorModeValue("whiteAlpha.200", "blackAlpha.100"); + const iconColor = useColorModeValue("#f3f3f3", "black"); + + // Get current day index + const currentDayIndex = new Date().getDay(); + + const isToday = (dayType) => { + if (dayType === 'weekdays' && currentDayIndex >= 1 && currentDayIndex <= 5) return true; + if (dayType === 'saturday' && currentDayIndex === 6) return true; + if (dayType === 'sunday' && currentDayIndex === 0) return true; + return false; + }; + + const ScheduleRow = ({ label, time, dayType }) => { + const active = isToday(dayType); + const isOpen = time && time.start; + + return ( + + + + {label} + + {isOpen ? ( + + {time.start} - {time.end} + + ) : ( + + {i18n.t("kleista")} + + )} + + ); + }; + + const allowedDaysIcons = { + weekdays: CalendarIcon, + saturday: TimeIcon, + sunday: TimeIcon + }; + return ( {/* Wrapper container */} - {/* Ωράριο */} + {/* Ωράριο Card */} - - - - - {i18n.t("orario")}{" "} - ({isExamPeriod ? i18n.t("exams_period") : i18n.t("semester_period") }) - - - - - - {i18n.t("defPar")} - {" "} -
- {LIBRARY_OPENING_HOURS[currentPeriod].on_weekdays.start}- - {LIBRARY_OPENING_HOURS[currentPeriod].on_weekdays.end} -
- - - - {i18n.t("savvato")} - {" "} -
- - {LIBRARY_OPENING_HOURS[currentPeriod].on_saturday.start - ? `${LIBRARY_OPENING_HOURS[currentPeriod].on_saturday.start}-${LIBRARY_OPENING_HOURS[currentPeriod].on_saturday.end}` - : i18n.t("kleista")} -
- - - {i18n.t("kyriaki")} - {" "} -
- {LIBRARY_OPENING_HOURS[currentPeriod].on_sunday.start - ? `${LIBRARY_OPENING_HOURS[currentPeriod].on_sunday.start}-${LIBRARY_OPENING_HOURS[currentPeriod].on_sunday.end}` - : i18n.t("kleista")} -
+ + + + + {isExamPeriod ? i18n.t("exams_period") : i18n.t("semester_period")} + + setisExamPeriod(e.target.checked)} + colorScheme="whiteAlpha" + size="lg" + sx={{ + 'span.chakra-switch__track': { + bg: useColorModeValue('whiteAlpha.400', 'blackAlpha.300'), + }, + 'span.chakra-switch__track[data-checked]': { + bg: useColorModeValue('white', 'black'), + }, + 'span.chakra-switch__thumb': { + bg: useColorModeValue('#0050e0', '#f3f3f3'), + } + }} + /> -
-
- + + + + + +
- {/* Επικοινωνία */} + + {/* Επικοινωνία Card */} - - - - - {i18n.t("epikoinonia")} - - + - - - {LIBRARY_PHONE_LIST[0]}
- {LIBRARY_PHONE_LIST[1]} -
- - {" "} - {LIBRARY_PHONE_LIST[2]}
{LIBRARY_PHONE_LIST[3]}{" "} -
- {i18n.t("imiorofos")} -
-
+ + + {i18n.t("imiorofos")}: + + {LIBRARY_PHONE_LIST.map((phone, index) => ( + {phone} + ))} + + +
+
); } + +const HeadingWithIcon = ({ icon, title, mb, color }) => ( + + + + {title} + + +);