From 67b9cb7d05438b7477d9805965019b2cf87f84d5 Mon Sep 17 00:00:00 2001 From: Law Wai Chun Date: Wed, 29 May 2024 17:45:27 +0800 Subject: [PATCH] UI fix for succinct eta --- src/ErrorFallback.tsx | 11 ++++----- src/components/home/SuccinctEtas.tsx | 35 +++++++++++----------------- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/src/ErrorFallback.tsx b/src/ErrorFallback.tsx index e759f5f37f68..d29d1472e438 100644 --- a/src/ErrorFallback.tsx +++ b/src/ErrorFallback.tsx @@ -4,18 +4,15 @@ interface Props { error: Error; } - -const ErrorFallback = ({error}: Props) => { - +const ErrorFallback = ({ error }: Props) => { useEffect(() => { if (error.name === "ChunkLoadError" || error.name === "TypeError") { setTimeout(() => { window.location.reload(); }, 500); } - }, [error]) - - + }, [error]); + if (error.name === "ChunkLoadError" || error.name === "TypeError") { return (
@@ -36,6 +33,6 @@ const ErrorFallback = ({error}: Props) => {
{error.stack ?? "Unknown error"}
); -} +}; export default ErrorFallback; diff --git a/src/components/home/SuccinctEtas.tsx b/src/components/home/SuccinctEtas.tsx index 12726f9f6200..fea8d7c1000c 100644 --- a/src/components/home/SuccinctEtas.tsx +++ b/src/components/home/SuccinctEtas.tsx @@ -1,5 +1,5 @@ import { useContext } from "react"; -import { Box, ListItemText, SxProps, Theme, Typography } from "@mui/material"; +import { Box, SxProps, Theme, Typography } from "@mui/material"; import { useTranslation } from "react-i18next"; import { useEtas } from "../../hooks/useEtas"; import AppContext from "../../context/AppContext"; @@ -107,21 +107,17 @@ const SuccinctEtas = ({ }; return ( - - {etas ? getEtaString(etas[0], 0, true) : ""} - - } - secondary={ - - {etas ? getEtaString(etas[1], 1) : ""} -
- {etas ? getEtaString(etas[2], 2) : ""} -
- } - sx={rootSx} - /> + + + {etas ? getEtaString(etas[0], 0, true) : ""} + + + {etas ? getEtaString(etas[1], 1) : ""} + + + {etas ? getEtaString(etas[2], 2) : ""} + + ); }; @@ -158,16 +154,13 @@ export const DoubleTrainIcon = () => ( export default SuccinctEtas; -const rootSx: SxProps = { - textAlign: "right", -}; - const primarySx: SxProps = { whiteSpace: "nowrap", + fontSize: "1em", }; const secondarySx: SxProps = { - fontSize: "0.875rem !important", + fontSize: "0.875em", fontWeight: "400", lineHeight: "1.43", whiteSpace: "nowrap",