diff --git a/src/components/modals/ClassInfo/ClassInfo.tsx b/src/components/modals/ClassInfo/ClassInfo.tsx index 2fabf825..a56a82db 100644 --- a/src/components/modals/ClassInfo/ClassInfo.tsx +++ b/src/components/modals/ClassInfo/ClassInfo.tsx @@ -16,11 +16,12 @@ import CalendarMonthIcon from "@mui/icons-material/CalendarMonth"; import LocationOnRoundedIcon from "@mui/icons-material/LocationOnRounded"; import PersonRoundedIcon from "@mui/icons-material/PersonRounded"; import LoadingButton from "@mui/lab/LoadingButton"; -import { Alert, AlertTitle, Box, Typography } from "@mui/material"; +import { Alert, AlertTitle, Box, Stack, Typography } from "@mui/material"; import Button from "@mui/material/Button"; import Image from "next/image"; import React, { useState } from "react"; +import ClassInfoEntry from "@/components/modals/ClassInfo/ClassInfoEntry"; import ClassInfoUsersGroup from "@/components/modals/ClassInfo/ClassInfoUsersGroup"; import ClassPopularityMeter from "@/components/schedule/class/ClassPopularityMeter"; import ConfirmCancellation from "@/components/schedule/class/ConfirmCancellation"; @@ -90,8 +91,6 @@ export default function ClassInfo({ setBookingLoading(false); } - const cancelledOpacity = 0.5; - return ( - + {_class.activity.name} - + {_class.isCancelled && ( }> {_class.cancelText ? ( @@ -147,96 +139,41 @@ export default function ClassInfo({ )} )} - - - - {_class.startTime.toFormat("EEEE d. LLLL")} - - - - - - {_class.startTime.toFormat("HH:mm")}–{_class.endTime.toFormat("HH:mm")} - - - - - - {_class.location.studio} - {_class.location.room && _class.location.room.length > 0 ? `, ${_class.location.room}` : ""} - - + } + label={_class.startTime.toFormat("EEEE d. LLLL")} + cancelled={_class.isCancelled} + /> + } + label={`${_class.startTime.toFormat("HH:mm")}–${_class.endTime.toFormat("HH:mm")}`} + cancelled={_class.isCancelled} + /> + } + label={`${_class.location.studio} ${_class.location.room && _class.location.room.length > 0 ? `, ${_class.location.room}` : ""}`} + cancelled={_class.isCancelled} + /> {_class.instructors.length > 0 && ( - - - - {_class.instructors.map((i) => i.name).join(", ")} - - + } + label={_class.instructors.map((i) => i.name).join(", ")} + cancelled={_class.isCancelled} + /> )} {_class.totalSlots !== null && ((!_class.isBookable && !isInThePast) || _class.isCancelled) && ( - - - - {_class.totalSlots} plasser - - + } + label={`${_class.totalSlots} plasser`} + cancelled={_class.isCancelled} + /> )} {!_class.isCancelled && _class.totalSlots !== null && _class.availableSlots !== null && ( - - - - {stringifyClassPopularity(_class, classPopularity)} - - + } + label={stringifyClassPopularity(_class, classPopularity) ?? ""} + cancelled={_class.isCancelled} + /> )} {!isInThePast && ( <> diff --git a/src/components/modals/ClassInfo/ClassInfoEntry.tsx b/src/components/modals/ClassInfo/ClassInfoEntry.tsx new file mode 100644 index 00000000..fe120873 --- /dev/null +++ b/src/components/modals/ClassInfo/ClassInfoEntry.tsx @@ -0,0 +1,22 @@ +import { Box, Typography } from "@mui/material"; +import React, { ReactNode } from "react"; + +function ClassInfoEntry({ icon, label, cancelled }: { icon: ReactNode; label: string; cancelled: boolean }) { + return ( + + {icon} + + {label} + + + ); +} +export default ClassInfoEntry;