From 3b0b6b5f2c48222f80891b91516f1fd7171cb8b1 Mon Sep 17 00:00:00 2001 From: ImJustChew Date: Wed, 1 Nov 2023 08:39:41 +0000 Subject: [PATCH] Shortened BusDelayReportAlert to 10s and show BusDelayAlert on main bus page --- src/app/[lang]/bus/{stop/[stopId] => }/BusDelayAlert.tsx | 0 src/app/[lang]/bus/page.tsx | 2 ++ src/app/[lang]/bus/stop/[stopId]/BusDelayReportAlert.tsx | 2 +- src/app/[lang]/bus/stop/[stopId]/page.tsx | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) rename src/app/[lang]/bus/{stop/[stopId] => }/BusDelayAlert.tsx (100%) diff --git a/src/app/[lang]/bus/stop/[stopId]/BusDelayAlert.tsx b/src/app/[lang]/bus/BusDelayAlert.tsx similarity index 100% rename from src/app/[lang]/bus/stop/[stopId]/BusDelayAlert.tsx rename to src/app/[lang]/bus/BusDelayAlert.tsx diff --git a/src/app/[lang]/bus/page.tsx b/src/app/[lang]/bus/page.tsx index 619560b7..8a4c6453 100644 --- a/src/app/[lang]/bus/page.tsx +++ b/src/app/[lang]/bus/page.tsx @@ -4,6 +4,7 @@ import { useSettings } from "@/hooks/contexts/settings"; import Link from "next/link"; import { stops } from "@/const/bus"; import { Alert } from "@mui/joy"; +import BusDelayAlert from "./BusDelayAlert"; const BusPage = () => { //北校門口 綜二館 楓林小徑 奕園停車場 南門停車場 台積館 人社院/生科館 楓林小徑 綜二館 北校門口 @@ -31,6 +32,7 @@ const BusPage = () => { return (

校内公車

+

diff --git a/src/app/[lang]/bus/stop/[stopId]/BusDelayReportAlert.tsx b/src/app/[lang]/bus/stop/[stopId]/BusDelayReportAlert.tsx index 30e35343..e1727ed0 100644 --- a/src/app/[lang]/bus/stop/[stopId]/BusDelayReportAlert.tsx +++ b/src/app/[lang]/bus/stop/[stopId]/BusDelayReportAlert.tsx @@ -10,7 +10,7 @@ const BusDelayReportAlert = () => { const [openModal, closeModal] = useModal(); // Wait for 30 seconds before showing the alert useEffect(() => { - const WAIT_TIME = 30 * 1000; + const WAIT_TIME = 10 * 1000; // const WAIT_TIME = 1 * 1000; const timeout = setTimeout(() => setShow(true), WAIT_TIME); return () => clearTimeout(timeout); diff --git a/src/app/[lang]/bus/stop/[stopId]/page.tsx b/src/app/[lang]/bus/stop/[stopId]/page.tsx index 31cdd090..ca4d4abf 100644 --- a/src/app/[lang]/bus/stop/[stopId]/page.tsx +++ b/src/app/[lang]/bus/stop/[stopId]/page.tsx @@ -14,7 +14,7 @@ import useSWR from 'swr' import RouteIcon from '@/components/BusIcons/RouteIcon'; import RoutesFilterChips from './RoutesFilterChips'; import useTime from '@/hooks/useTime'; -import BusDelayAlert from './BusDelayAlert'; +import BusDelayAlert from '../../BusDelayAlert'; import BusDelayReportAlert from './BusDelayReportAlert'; type PageProps = {