Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions services/frontend/react_app/src/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ import {MainLayout} from "../components/layouts";
import {
Box,
Button,
Card,
CardBody,
CardHeader,
Text,
Heading,
useDisclosure,
useToast,
Badge,
HStack,
Stack,
Card,
CardHeader,
CardBody,
StackDivider,
Text,
useDisclosure,
useToast,
} from "@chakra-ui/react";
import styles from "./home.module.css";

Expand All @@ -28,10 +29,18 @@ import {useGetRequestArrival} from "../hooks/useGetRequestArrival.tsx";
import Countdown, {CountdownRenderProps} from "react-countdown";

const countdownRenderer = ({minutes, seconds, driverName, driverPlate, props }: CountdownRenderProps & { driverName: string, driverPlate: string }) => {
const PlateDisplay = () => (
<Badge colorScheme="purple" px={2} py={1} borderRadius="md" fontSize="0.9em">{driverPlate}</Badge>
);

if (minutes === 0 && seconds === 0) {
return <Text>{driverName} arrived</Text>;
return <Text as="b">
The driver {driverName} <PlateDisplay/> arrived
</Text>;
} else {
return <Text as="b">The driver {driverName} ({driverPlate}) will arrive in {props.overtime ? "-" : ""}{minutes.toString().padStart(2, "0")}:{seconds.toString().padStart(2, "0")}</Text>;
return <Text as="b">
The driver {driverName} <PlateDisplay/> will arrive in {props.overtime ? "-" : ""}{minutes.toString().padStart(2, "0")}:{seconds.toString().padStart(2, "0")}
</Text>;
}
};

Expand Down
Loading
Loading