From 694224d9230344c0491b5cb5dadcd03c613459dc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 15 Feb 2025 08:28:44 +0000 Subject: [PATCH 1/8] Bump elliptic from 6.5.5 to 6.6.1 Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.5 to 6.6.1. - [Commits](https://github.com/indutny/elliptic/compare/v6.5.5...v6.6.1) --- updated-dependencies: - dependency-name: elliptic dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index b104483..1787294 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8956,8 +8956,8 @@ __metadata: linkType: hard "elliptic@npm:^6.5.3, elliptic@npm:^6.5.5": - version: 6.5.5 - resolution: "elliptic@npm:6.5.5" + version: 6.6.1 + resolution: "elliptic@npm:6.6.1" dependencies: bn.js: "npm:^4.11.9" brorand: "npm:^1.1.0" @@ -8966,7 +8966,7 @@ __metadata: inherits: "npm:^2.0.4" minimalistic-assert: "npm:^1.0.1" minimalistic-crypto-utils: "npm:^1.0.1" - checksum: 10c0/3e591e93783a1b66f234ebf5bd3a8a9a8e063a75073a35a671e03e3b25253b6e33ac121f7efe9b8808890fffb17b40596cc19d01e6e8d1fa13b9a56ff65597c8 + checksum: 10c0/8b24ef782eec8b472053793ea1e91ae6bee41afffdfcb78a81c0a53b191e715cbe1292aa07165958a9bbe675bd0955142560b1a007ffce7d6c765bcaf951a867 languageName: node linkType: hard From 3caf192e46906fa06893e078c1baaef1ab2672cf Mon Sep 17 00:00:00 2001 From: Marcus Jackson <3435026+Markj89@users.noreply.github.com> Date: Wed, 21 May 2025 23:49:01 -0500 Subject: [PATCH 2/8] Potential fix for code scanning alert no. 12: DOM text reinterpreted as HTML Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- client/coverage/lcov-report/sorter.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/client/coverage/lcov-report/sorter.js b/client/coverage/lcov-report/sorter.js index 2bb296a..120aa14 100644 --- a/client/coverage/lcov-report/sorter.js +++ b/client/coverage/lcov-report/sorter.js @@ -1,4 +1,20 @@ /* eslint-disable */ +var escapeHTML = function(str) { + if (!str) return ''; + return str.replace(/[&<>"'`=\/]/g, function(s) { + return ({ + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '`': '`', + '=': '=', + '/': '/' + })[s]; + }); +}; + var addSorting = (function() { 'use strict'; var cols, @@ -88,6 +104,8 @@ var addSorting = (function() { val = colNode.getAttribute('data-value'); if (col.type === 'number') { val = Number(val); + } else { + val = escapeHTML(val); } data[col.key] = val; } From 6b97881d436a5405245e354f3ae8d7bc739fea92 Mon Sep 17 00:00:00 2001 From: Markj89 <3435026+Markj89@users.noreply.github.com> Date: Tue, 10 Jun 2025 15:11:52 -0500 Subject: [PATCH 3/8] #151 Update Marker Component --- client/src/App.tsx | 2 +- client/src/components/Map/Map.tsx | 12 ++- client/src/components/Marker/Marker.tsx | 103 ++++++++++++++++++- client/src/components/Marker/Markers.tsx | 25 +++-- client/src/components/Modal/StationModal.tsx | 16 +-- client/src/context/MapContext.provider.tsx | 12 ++- client/src/context/MapContext.tsx | 6 +- client/src/context/MapContext.types.ts | 4 + client/src/hooks/useArrivals.ts | 1 - client/tsconfig.json | 2 +- 10 files changed, 146 insertions(+), 37 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index c0e4d1e..3e369d7 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -60,7 +60,7 @@ function App() { + ) diff --git a/client/src/components/Map/Map.tsx b/client/src/components/Map/Map.tsx index 96c22a2..325e7cb 100644 --- a/client/src/components/Map/Map.tsx +++ b/client/src/components/Map/Map.tsx @@ -12,7 +12,7 @@ import { MapProps } from "./Map.types"; import Drawer from "../Drawer/Drawer"; import clsx from "clsx"; import Button from "./../Button"; -import { useNavigate, useLocation } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import Icon, { ICONS } from "./../Icon/Icon"; import { mapMarkers } from "./../../utils/map"; import StopCard from "./../StopCard/StopCard"; @@ -23,7 +23,7 @@ const Map = ({ width, height, currentLocation, nearbyLocations, nearbyLocationsI const navigate = useNavigate(); const mapRef = useRef(); const ref = useRef(); - const { showMap, setShowMap } = useContext(MapContext); + const { showMap, setShowMap, setDrawerOpen } = useContext(MapContext); const [map, setMap] = useState(null); const [filteredArrivals, setFilteredArrivals] = useState([]); const [drawerHeight, setDrawerHeight] = useState(0); @@ -38,6 +38,7 @@ const Map = ({ width, height, currentLocation, nearbyLocations, nearbyLocationsI zoom: 13, disableDefaultUI: true, clickableIcons: false, + mapId: `${process.env.GOOGLE_MAP_ID}` }) ); } @@ -69,7 +70,10 @@ const Map = ({ width, height, currentLocation, nearbyLocations, nearbyLocationsI } }, [filteredArrivals]); - const handleToggleDrawer = () => setDrawerShowing((prev) => !prev); + const handleToggleDrawer = () => { + setDrawerShowing((prev) => !prev); + setDrawerOpen(isDrawerShowing); + }; return ( <>
- + ))}
diff --git a/client/src/components/Marker/Marker.tsx b/client/src/components/Marker/Marker.tsx index a5d7c38..21af277 100644 --- a/client/src/components/Marker/Marker.tsx +++ b/client/src/components/Marker/Marker.tsx @@ -5,15 +5,108 @@ * @returns JSX.Element */ -import * as React from "react"; +import React, { FC, useContext, useEffect, useRef, useState } from "react"; import { Station } from "components/Map"; import clsx from 'clsx'; +import { MapContext } from "./../../context/MapContext"; +import StationModal from "./../Modal/StationModal"; +import { renderToString } from 'react-dom/server'; +import { createRoot } from 'react-dom/client'; +import Card from "./../Card/Card"; +import { CardContainer } from "./../CardContainer"; +import { formatArrivalTime, formatEstimatedTime } from "./..//Modal"; +import { error } from "console"; +import { title } from "process"; +import { data } from "react-router-dom"; +import useScreenSize from "./../../hooks/useScreenSize"; -type MarkerProps = google.maps.MarkerOptions & { - onClick?: () => void; +type MarkerProps = { + onClick?: (station: Station) => void; onHover?: () => void; station: Station; -} -const Marker: React.FC = ({ station, onClick, onHover }: MarkerProps) =>
; + gmpClickable?: boolean; + position: google.maps.LatLngLiteral; + map: google.maps.Map; + stops?: any; + scale?: number; +}; + +const Marker: FC = ({ + map, + station, + stops, + position, + onClick, + onHover, + gmpClickable = true, + scale = 1 +}) => { + const { setDrawerOpen } = useContext(MapContext); + const markerRef = useRef(null); + const pinRef = useRef(null); + const infoWindowRef = useRef(null); + const whatsTheScreenSize = useScreenSize(); + + useEffect(() => { + if (!map || markerRef?.current) return; + + const pin = new google.maps.marker.PinElement({ + scale, + background: "grey", + borderColor: "transparent" + }); + + pin.element.tabIndex = 0; + pin.element.setAttribute("role", "button"); + pin.element.setAttribute("title", station?.stop_name); + if (gmpClickable) { + pin.element.setAttribute("gmpClickable", "true"); + } + + const marker = new google.maps.marker.AdvancedMarkerElement({ + map, + position, + title: station?.stop_name, + content: pin.element, + gmpClickable + }); + + markerRef.current = marker; + pinRef.current = pin; + + const infoWindowDiv = document.createElement("div"); + const root = createRoot(infoWindowDiv); + root.render(); + const infoWindow = new google.maps.InfoWindow({ + content: infoWindowDiv, + ariaLabel: station?.stop_name + }); + + if (onHover && whatsTheScreenSize?.width <= 767) { + marker.content.addEventListener("mouseenter", () => { + infoWindow.setHeaderContent(station?.stop_name); + infoWindow.open(map, marker); + infoWindow.close(); + }); + } + + if (onClick && whatsTheScreenSize.width >= 767) + marker.addListener("click", () => { + onClick(station); + infoWindow.setHeaderContent(station?.stop_name); + infoWindow.open(map, marker); + infoWindow.close(); + }); + + + return () => { + infoWindow.close(); + marker.map = null; + markerRef.current = null; + }; + }, [map]); + + return null; +}; export default Marker; diff --git a/client/src/components/Marker/Markers.tsx b/client/src/components/Marker/Markers.tsx index f46066a..5c6470b 100644 --- a/client/src/components/Marker/Markers.tsx +++ b/client/src/components/Marker/Markers.tsx @@ -4,19 +4,21 @@ * @param MarkersProps * @returns JSX.Element */ -import React, { useEffect, useRef, useState } from "react"; -import { createPortal } from "react-dom"; +import React, { useEffect, useRef, useState, useContext } from "react"; import Marker from "./Marker"; import { Station } from "components/Map"; import StationModal from "./../Modal/StationModal"; +import { MapContext } from "./../../context/MapContext"; type MarkersProps = { station: Station; stops: Station[]; + map: any; } -const Markers = ({ station, stops }: MarkersProps) => { +const Markers = ({ station, stops, map }: MarkersProps) => { const [opened, setIsOpened] = useState(false); + const { setStation } = useContext(MapContext); const handleOnOpen = () => { setIsOpened(true); }; @@ -31,23 +33,28 @@ const Markers = ({ station, stops }: MarkersProps) => { } } - document.addEventListener("mouseover", handleClickOutside); + document.addEventListener("click", handleClickOutside); return () => { - document.removeEventListener("mouseout", handleClickOutside); + document.removeEventListener("click", handleClickOutside); }; }, [containerRef]); - const sidebarContentEl: HTMLElement = document.getElementById('app'); + const handleOnClick = (station) => { + setStation(station); + }; + + const sidebarContentEl = document.getElementById('app'); + if (!sidebarContentEl) return null; const modalPlacement = { top: `${position?.top}px`, left: `${position?.left}px`, } + return (
- {opened && createPortal( , sidebarContentEl )} - + setIsOpened(true)} onClick={(station) => handleOnClick(station)} gmpClickable={true} />
- ) + ); }; export default Markers; \ No newline at end of file diff --git a/client/src/components/Modal/StationModal.tsx b/client/src/components/Modal/StationModal.tsx index 364fcd1..1a4d6d1 100644 --- a/client/src/components/Modal/StationModal.tsx +++ b/client/src/components/Modal/StationModal.tsx @@ -12,22 +12,17 @@ import { Station } from "./../Map"; import React, { useEffect, useRef, useState } from "react"; import { formatArrivalTime, formatEstimatedTime } from "./StationModal.logic"; -interface Position { - top: number; - left: number; -} - export type StationCardProps = { station: Station; - stops: Station[]; - position?: Position; + stops: Station; + position?: google.maps.LatLngLiteral; isOpen?: boolean; children?: React.ReactNode; handleClose?: () => void; style?: React.CSSProperties; } -export default function StationModal({ station, position, style, isOpen, stops}: StationCardProps ): JSX.Element { +export default function StationModal({ station, position, isOpen }: StationCardProps ): JSX.Element { const { data, loading, error } = useArrivalById(station?.map_id, 30000); const titleRef = useRef(); const [title, setTitle] = useState(station?.stop_name?.replace(/ *\([^)]*\) */g, "")); @@ -42,7 +37,7 @@ export default function StationModal({ station, position, style, isOpen, stops}: } }, [fontSize, title]); - useEffect(() => { + useEffect(() => { if (data) { const now = new Date(); @@ -56,9 +51,8 @@ export default function StationModal({ station, position, style, isOpen, stops}: }); setFilteredArrivals(nearestArrivals); } - }, [data]); + }, [data]); - console.log('filteredArrivals', data); return (
diff --git a/client/src/context/MapContext.provider.tsx b/client/src/context/MapContext.provider.tsx index 69efd4f..e203618 100644 --- a/client/src/context/MapContext.provider.tsx +++ b/client/src/context/MapContext.provider.tsx @@ -4,22 +4,26 @@ import React, { useContext, useMemo, useState } from "react"; import { MapContext } from "./MapContext"; import { InitiCenerType } from "./MapContext.types"; -import { screenSizeProps } from "components/Map"; +import { screenSizeProps, Station } from "components/Map"; interface Props { children: React.ReactNode; locationValue?: InitiCenerType; screenSizeValue?: screenSizeProps; showMapValue: boolean; + stationValue: Station; + drawerValue: boolean; } const MapContextProvider: React.FunctionComponent = (props: Props): JSX.Element => { - const { children, showMapValue, locationValue = { lat: 0, lng: 0 } as InitiCenerType, screenSizeValue = { width: 0, height: 0 } as screenSizeProps } = props; + const { children, showMapValue, stationValue, drawerValue, locationValue = { lat: 0, lng: 0 } as InitiCenerType, screenSizeValue = { width: 0, height: 0 } as screenSizeProps } = props; const [location, setLocation] = useState(locationValue); const [screenSize, setScreenSize] = useState(screenSizeValue); const [showMap, setShowMap] = useState(showMapValue); - - const mapState = useMemo(() => ({ location, setLocation, screenSize, setScreenSize, showMap, setShowMap}), [location, setLocation, screenSize, setScreenSize, showMap, setShowMap ]); + const [station, setStation] = useState(stationValue); + const [drawer, setDrawer] = useState(drawerValue); + + const mapState = useMemo(() => ({ location, setLocation, screenSize, setScreenSize, showMap, setShowMap, station, setStation, drawer, setDrawer }), [location, setLocation, screenSize, setScreenSize, showMap, setShowMap, station, setStation, drawer, setDrawer ]); return ( diff --git a/client/src/context/MapContext.tsx b/client/src/context/MapContext.tsx index 86d71a1..4080f4e 100644 --- a/client/src/context/MapContext.tsx +++ b/client/src/context/MapContext.tsx @@ -13,10 +13,14 @@ const MapContextState: MapContextType = { setLocation: () => {}, stations: [], setStations: () => [], + station: [], + setStation: () => [], arrivals: [], setArrivals: () => [], showMap: false, - setShowMap: () => {} + setShowMap: () => {}, + drawerOpen: false, + setDrawerOpen: () => {}, }; export const MapContext = createContext(MapContextState); \ No newline at end of file diff --git a/client/src/context/MapContext.types.ts b/client/src/context/MapContext.types.ts index ee1d7c3..29603d1 100644 --- a/client/src/context/MapContext.types.ts +++ b/client/src/context/MapContext.types.ts @@ -8,10 +8,14 @@ export interface MapContextType { setLocation: React.Dispatch>; stations: string[]; setStations: React.Dispatch>; + station: string[]; + setStation: React.Dispatch>; arrivals: string[]; setArrivals: React.Dispatch>; showMap?: boolean; setShowMap?: React.Dispatch>; + drawerOpen: boolean; + setDrawerOpen: React.Dispatch>; } export interface InitiCenerType { diff --git a/client/src/hooks/useArrivals.ts b/client/src/hooks/useArrivals.ts index b96fb58..e53709b 100644 --- a/client/src/hooks/useArrivals.ts +++ b/client/src/hooks/useArrivals.ts @@ -10,7 +10,6 @@ const useArrivals = (stopIds, refreshInterval = 1000) => { const [data, setData] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(false); - console.log(stopIds) const getArrivals = useCallback(async (stopIds) => { try { setLoading(true); diff --git a/client/tsconfig.json b/client/tsconfig.json index 13ba606..874c267 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -25,7 +25,7 @@ "strict": true, "declaration": true, "noEmit": true, - "types": ["react", "node", "jest", "@testing-library/jest-dom"] + "types": ["react", "node", "jest", "@testing-library/jest-dom", "google.maps"] }, "include": ["src/**/*", "client/webpack.config.ts", "vite.config.js"], "exclude": ["node_modules", "src/**/*.test", "public"], From acca9dd8cd57159e259505d26cfd06d7d0ccba9a Mon Sep 17 00:00:00 2001 From: Markj89 <3435026+Markj89@users.noreply.github.com> Date: Tue, 1 Jul 2025 11:20:46 -0500 Subject: [PATCH 4/8] #151 Added Stations to Drawer --- client/src/App.tsx | 10 ++-- client/src/components/Drawer/Drawer.tsx | 5 +- client/src/components/Map/Map.tsx | 13 +++-- client/src/components/Map/Map.types.ts | 2 + client/src/components/Marker/Marker.tsx | 61 ++++---------------- client/src/components/Marker/Markers.tsx | 48 ++++++--------- client/src/components/Modal/StationModal.tsx | 13 +++-- client/src/context/MapContext.provider.tsx | 27 +++++++-- client/src/context/MapContext.tsx | 4 +- client/src/context/MapContext.types.ts | 10 ++-- client/src/hooks/useArrivalById.ts | 28 ++------- client/src/hooks/useGetStations.ts | 2 +- client/src/index.tsx | 2 +- server/routes/arrivals.mjs | 2 - 14 files changed, 94 insertions(+), 133 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 3e369d7..090cb0c 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -13,9 +13,10 @@ import ListPage from './Pages/ListPage'; import { mapMarkers, mapStations } from './utils/map'; import { findLocationsInRange } from './components/Map/Map.logic'; import useArrivals from './hooks/useArrivals'; +import useArrivalById from './hooks/useArrivalById'; function App() { - const {location, setLocation, setScreenSize } = useContext(MapContext); + const {location, setLocation, setScreenSize, station } = useContext(MapContext); const { height, width } = useWindowDimensions(); const { isLoading, currentLocation } = useGetCurrentPosition({initialCenter: {lat: 0, lng: 0}}); const render = (status: Status) => (

{status}

); @@ -32,7 +33,8 @@ function App() { 1 ); const nearbyLocationsIds = nearbyLocations?.map((location) => location?.map_id); - const { data: arrivalData, loading: dataLoading, error } = useArrivals(nearbyLocationsIds, 30000); + const { data: arrivalsData, loading: dataLoading, error } = useArrivals(nearbyLocationsIds, 30000); + const { data: arrivalData, loading: arrivalDataLoading } = useArrivalById(station?.map_id); useEffect(() => { if (currentLocation) { @@ -61,13 +63,13 @@ function App() { - + ) } /> } /> - } /> + } />
diff --git a/client/src/components/Drawer/Drawer.tsx b/client/src/components/Drawer/Drawer.tsx index c502a8a..5717f9f 100644 --- a/client/src/components/Drawer/Drawer.tsx +++ b/client/src/components/Drawer/Drawer.tsx @@ -5,8 +5,8 @@ */ import Card from "../Card/Card"; import { CardContainer } from "../CardContainer"; -import React, { useState, ReactNode, useRef, useEffect } from "react"; -import { useSpring, animated } from "react-spring"; +import React, { useState, ReactNode, useEffect } from "react"; +import { animated } from "react-spring"; import clsx from "clsx"; import DrawerHeader from "./DrawerHeader"; @@ -25,7 +25,6 @@ const Drawer = React.forwardRef( ref ) => { const [isOpen, setIsOpen] = useState(open); - const mounted = useRef(false); useEffect(() => { if (open) { diff --git a/client/src/components/Map/Map.tsx b/client/src/components/Map/Map.tsx index 325e7cb..504ad19 100644 --- a/client/src/components/Map/Map.tsx +++ b/client/src/components/Map/Map.tsx @@ -23,7 +23,7 @@ const Map = ({ width, height, currentLocation, nearbyLocations, nearbyLocationsI const navigate = useNavigate(); const mapRef = useRef(); const ref = useRef(); - const { showMap, setShowMap, setDrawerOpen } = useContext(MapContext); + const { setShowMap, setDrawerOpen, drawerOpen, setStation } = useContext(MapContext); const [map, setMap] = useState(null); const [filteredArrivals, setFilteredArrivals] = useState([]); const [drawerHeight, setDrawerHeight] = useState(0); @@ -74,6 +74,11 @@ const Map = ({ width, height, currentLocation, nearbyLocations, nearbyLocationsI setDrawerShowing((prev) => !prev); setDrawerOpen(isDrawerShowing); }; + + useEffect(() => { + if (!isDrawerShowing) setStation(null); + }, [setStation, isDrawerShowing]); + return ( <>
- + ))}
-
e.stopPropagation()}> diff --git a/client/src/components/Map/Map.types.ts b/client/src/components/Map/Map.types.ts index e0705cf..3314308 100644 --- a/client/src/components/Map/Map.types.ts +++ b/client/src/components/Map/Map.types.ts @@ -1,6 +1,8 @@ import { InitiCenerType } from "context"; export interface Stations { + _id: number; + station_name: string; stops: Station[]; } diff --git a/client/src/components/Marker/Marker.tsx b/client/src/components/Marker/Marker.tsx index 21af277..88d3071 100644 --- a/client/src/components/Marker/Marker.tsx +++ b/client/src/components/Marker/Marker.tsx @@ -5,24 +5,12 @@ * @returns JSX.Element */ -import React, { FC, useContext, useEffect, useRef, useState } from "react"; +import React, { FC, useContext, useEffect, useRef } from "react"; import { Station } from "components/Map"; -import clsx from 'clsx'; -import { MapContext } from "./../../context/MapContext"; -import StationModal from "./../Modal/StationModal"; -import { renderToString } from 'react-dom/server'; -import { createRoot } from 'react-dom/client'; -import Card from "./../Card/Card"; -import { CardContainer } from "./../CardContainer"; -import { formatArrivalTime, formatEstimatedTime } from "./..//Modal"; -import { error } from "console"; -import { title } from "process"; -import { data } from "react-router-dom"; -import useScreenSize from "./../../hooks/useScreenSize"; +import MapContext from "./../../context"; type MarkerProps = { - onClick?: (station: Station) => void; - onHover?: () => void; + onClick?: (event: MouseEvent) => void; station: Station; gmpClickable?: boolean; position: google.maps.LatLngLiteral; @@ -37,24 +25,17 @@ const Marker: FC = ({ stops, position, onClick, - onHover, gmpClickable = true, scale = 1 }) => { - const { setDrawerOpen } = useContext(MapContext); const markerRef = useRef(null); const pinRef = useRef(null); - const infoWindowRef = useRef(null); - const whatsTheScreenSize = useScreenSize(); + const { setDrawerOpen, setStation } = useContext(MapContext); useEffect(() => { if (!map || markerRef?.current) return; - const pin = new google.maps.marker.PinElement({ - scale, - background: "grey", - borderColor: "transparent" - }); + const pin = new google.maps.marker.PinElement({ scale }); pin.element.tabIndex = 0; pin.element.setAttribute("role", "button"); @@ -73,38 +54,20 @@ const Marker: FC = ({ markerRef.current = marker; pinRef.current = pin; - - const infoWindowDiv = document.createElement("div"); - const root = createRoot(infoWindowDiv); - root.render(); - const infoWindow = new google.maps.InfoWindow({ - content: infoWindowDiv, - ariaLabel: station?.stop_name - }); - if (onHover && whatsTheScreenSize?.width <= 767) { - marker.content.addEventListener("mouseenter", () => { - infoWindow.setHeaderContent(station?.stop_name); - infoWindow.open(map, marker); - infoWindow.close(); - }); + if (onClick) { + marker.addListener("click", () => { + setStation(station); + setDrawerOpen(true); + }); } - if (onClick && whatsTheScreenSize.width >= 767) - marker.addListener("click", () => { - onClick(station); - infoWindow.setHeaderContent(station?.stop_name); - infoWindow.open(map, marker); - infoWindow.close(); - }); - - return () => { - infoWindow.close(); marker.map = null; markerRef.current = null; + setStation(null); }; - }, [map]); + }, [map, position, station, scale, onClick, gmpClickable]); return null; }; diff --git a/client/src/components/Marker/Markers.tsx b/client/src/components/Marker/Markers.tsx index 5c6470b..de613b7 100644 --- a/client/src/components/Marker/Markers.tsx +++ b/client/src/components/Marker/Markers.tsx @@ -4,55 +4,45 @@ * @param MarkersProps * @returns JSX.Element */ -import React, { useEffect, useRef, useState, useContext } from "react"; +import React, { useRef, useState, useContext } from "react"; import Marker from "./Marker"; import { Station } from "components/Map"; import StationModal from "./../Modal/StationModal"; import { MapContext } from "./../../context/MapContext"; +import { createPortal } from "react-dom"; type MarkersProps = { - station: Station; + stationMarker: Station; stops: Station[]; - map: any; + map: google.maps.Map; } -const Markers = ({ station, stops, map }: MarkersProps) => { - const [opened, setIsOpened] = useState(false); - const { setStation } = useContext(MapContext); - const handleOnOpen = () => { - setIsOpened(true); - }; +const Markers = ({ stationMarker, stops, map }: MarkersProps) => { + const { drawerOpen, setStation } = useContext(MapContext); const containerRef = useRef(null); - const [position, getPosition] = useState({top: 0, left: 0}); + const [selectedStation, setSelectedStation] = useState(null); + const [position, setPosition] = useState({bottom: 10, left: 0}); - useEffect(() => { - function handleClickOutside(this: Document, event: MouseEvent) { - getPosition({ top: event?.clientX, left: event?.clientY }); - if (containerRef.current && !containerRef.current.contains(event.target as Node)) { - setIsOpened(false); - } - } - - document.addEventListener("click", handleClickOutside); - return () => { - document.removeEventListener("click", handleClickOutside); - }; - }, [containerRef]); + function handleOnClick(event: MouseEvent) { + const mobileEl = document.getElementById('app'); + let rect = mobileEl.offsetParent.getBoundingClientRect(); - const handleOnClick = (station) => { - setStation(station); + setPosition({ bottom: 1, left: rect.left }); + setSelectedStation(stationMarker); + setStation(selectedStation); }; - + const sidebarContentEl = document.getElementById('app'); - if (!sidebarContentEl) return null; const modalPlacement = { - top: `${position?.top}px`, + bottom: `10px`, left: `${position?.left}px`, } + if (!sidebarContentEl) return null; return (
- setIsOpened(true)} onClick={(station) => handleOnClick(station)} gmpClickable={true} /> + handleOnClick(event)} gmpClickable={true} /> + {/* {drawerOpen ? createPortal( , sidebarContentEl ) : handleOnClick(event)} gmpClickable={true} /> } */}
); }; diff --git a/client/src/components/Modal/StationModal.tsx b/client/src/components/Modal/StationModal.tsx index 1a4d6d1..29fb981 100644 --- a/client/src/components/Modal/StationModal.tsx +++ b/client/src/components/Modal/StationModal.tsx @@ -12,10 +12,15 @@ import { Station } from "./../Map"; import React, { useEffect, useRef, useState } from "react"; import { formatArrivalTime, formatEstimatedTime } from "./StationModal.logic"; +interface Position { + bottom: number; + left: number; +} + export type StationCardProps = { station: Station; - stops: Station; - position?: google.maps.LatLngLiteral; + stops: Station[]; + position?: Position; isOpen?: boolean; children?: React.ReactNode; handleClose?: () => void; @@ -54,11 +59,11 @@ export default function StationModal({ station, position, isOpen }: StationCardP }, [data]); return ( - +

{title}

- + {loading &&

Loading...

} {error &&

Error fetching arrivals

} {data && ( diff --git a/client/src/context/MapContext.provider.tsx b/client/src/context/MapContext.provider.tsx index e203618..3708b1d 100644 --- a/client/src/context/MapContext.provider.tsx +++ b/client/src/context/MapContext.provider.tsx @@ -3,8 +3,8 @@ */ import React, { useContext, useMemo, useState } from "react"; import { MapContext } from "./MapContext"; -import { InitiCenerType } from "./MapContext.types"; -import { screenSizeProps, Station } from "components/Map"; +import { InitiCenerType, MapContextType } from "./MapContext.types"; +import { screenSizeProps, Station, Stations } from "./../components/Map"; interface Props { children: React.ReactNode; @@ -12,18 +12,35 @@ interface Props { screenSizeValue?: screenSizeProps; showMapValue: boolean; stationValue: Station; + stationsValue: Stations; drawerValue: boolean; } const MapContextProvider: React.FunctionComponent = (props: Props): JSX.Element => { - const { children, showMapValue, stationValue, drawerValue, locationValue = { lat: 0, lng: 0 } as InitiCenerType, screenSizeValue = { width: 0, height: 0 } as screenSizeProps } = props; + const { children, showMapValue, stationsValue, stationValue, drawerValue, locationValue = { lat: 0, lng: 0 } as InitiCenerType, screenSizeValue = { width: 0, height: 0 } as screenSizeProps } = props; const [location, setLocation] = useState(locationValue); const [screenSize, setScreenSize] = useState(screenSizeValue); const [showMap, setShowMap] = useState(showMapValue); const [station, setStation] = useState(stationValue); - const [drawer, setDrawer] = useState(drawerValue); + const [stations, setStations] = useState(stationsValue); + const [drawerOpen, setDrawerOpen] = useState(drawerValue); - const mapState = useMemo(() => ({ location, setLocation, screenSize, setScreenSize, showMap, setShowMap, station, setStation, drawer, setDrawer }), [location, setLocation, screenSize, setScreenSize, showMap, setShowMap, station, setStation, drawer, setDrawer ]); + const mapState: MapContextType = useMemo(() => ({ + location, + setLocation, + screenSize, + setScreenSize, + showMap, + setShowMap, + station, + setStation, + stations, + setStations, + arrivals: [], + setArrivals: () => [], + drawerOpen, + setDrawerOpen, + }), [location, setLocation, screenSize, setScreenSize, showMap, setShowMap, station, setStation, drawerOpen, setDrawerOpen, stations, setStations ]); return ( diff --git a/client/src/context/MapContext.tsx b/client/src/context/MapContext.tsx index 4080f4e..04440ba 100644 --- a/client/src/context/MapContext.tsx +++ b/client/src/context/MapContext.tsx @@ -11,9 +11,9 @@ const MapContextState: MapContextType = { screenSize: { width: 0, height: 0 }, setScreenSize: () => {}, setLocation: () => {}, - stations: [], + stations: null, setStations: () => [], - station: [], + station: null, setStation: () => [], arrivals: [], setArrivals: () => [], diff --git a/client/src/context/MapContext.types.ts b/client/src/context/MapContext.types.ts index 29603d1..97d8efa 100644 --- a/client/src/context/MapContext.types.ts +++ b/client/src/context/MapContext.types.ts @@ -1,15 +1,15 @@ import React from "react"; -import { screenSizeProps } from "components/Map"; +import { screenSizeProps, Station, Stations } from "./../components/Map"; export interface MapContextType { location: Partial; screenSize: Partial; setScreenSize: React.Dispatch>; setLocation: React.Dispatch>; - stations: string[]; - setStations: React.Dispatch>; - station: string[]; - setStation: React.Dispatch>; + stations?: Stations; + setStations?: React.Dispatch>; + station: Station; + setStation: React.Dispatch>; arrivals: string[]; setArrivals: React.Dispatch>; showMap?: boolean; diff --git a/client/src/hooks/useArrivalById.ts b/client/src/hooks/useArrivalById.ts index 380dfb7..98e60a8 100644 --- a/client/src/hooks/useArrivalById.ts +++ b/client/src/hooks/useArrivalById.ts @@ -4,9 +4,7 @@ */ import React, { useState, useEffect, useRef, useCallback } from "react"; -const useArrivals = (stopId, refreshInterval = 1000) => { - const isFetching = useRef(true); - const intervalRef = useRef(null); +const useArrivals = (stopId) => { const [data, setData] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(false); @@ -44,28 +42,10 @@ const useArrivals = (stopId, refreshInterval = 1000) => { } }, [stopId]); - const refreshData = useCallback((payload) => { - setLoading(true); - setError(false); - isFetching.current = true; - getArrivalById(payload); - }, [getArrivalById, stopId]); - useEffect(() => { - if (isFetching.current) { - isFetching.current = false; - getArrivalById(stopId); - } - - intervalRef.current = setInterval(() => { - getArrivalById(stopId); - }, refreshInterval); - - return () => { - if (intervalRef.current) clearInterval(intervalRef.current); - }; - }, [getArrivalById, refreshInterval, stopId]); + getArrivalById(stopId); + }, [getArrivalById, stopId]); - return { data, loading, error, refetch: refreshData }; + return { data, loading, error }; }; export default useArrivals; diff --git a/client/src/hooks/useGetStations.ts b/client/src/hooks/useGetStations.ts index 5b4fb6a..070526b 100644 --- a/client/src/hooks/useGetStations.ts +++ b/client/src/hooks/useGetStations.ts @@ -21,6 +21,6 @@ export default function useGetStations(url) { useEffect(() => { return getData(url); - }, [url]); + }, []); return { stations }; } \ No newline at end of file diff --git a/client/src/index.tsx b/client/src/index.tsx index 76a50af..07d3c70 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -11,7 +11,7 @@ const container = document.getElementById('app'); const root = createRoot(container!); root.render( - + , diff --git a/server/routes/arrivals.mjs b/server/routes/arrivals.mjs index 5f75c1b..3dcc051 100644 --- a/server/routes/arrivals.mjs +++ b/server/routes/arrivals.mjs @@ -39,8 +39,6 @@ router.post("/", async( req, res) => { router.post("/:_id", async(req, res) => { try { - - console.log(req.body) const { stopId } = req.body; // if (!stopId) { // return res.status(400).json({ error: "Invalid stop IDs" }); From a9850cfcae1db2fb2b72569d8a48cf4d722291d4 Mon Sep 17 00:00:00 2001 From: Markj89 <3435026+Markj89@users.noreply.github.com> Date: Sun, 6 Jul 2025 13:05:15 -0500 Subject: [PATCH 5/8] Update --- client/src/App.tsx | 8 +++++++- client/src/hooks/useArrivalById.ts | 17 +++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 090cb0c..503421d 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -34,7 +34,7 @@ function App() { ); const nearbyLocationsIds = nearbyLocations?.map((location) => location?.map_id); const { data: arrivalsData, loading: dataLoading, error } = useArrivals(nearbyLocationsIds, 30000); - const { data: arrivalData, loading: arrivalDataLoading } = useArrivalById(station?.map_id); + const { data: arrivalData, loading: arrivalDataLoading, executeHook } = useArrivalById(station?.map_id); useEffect(() => { if (currentLocation) { @@ -50,6 +50,12 @@ function App() { setTimeout(() => setLoading(false), 3300) }, []); + useEffect(() => { + if (station) { + executeHook(station?.map_id); + } + }, [station]); + if (loading && dataLoading) { return diff --git a/client/src/hooks/useArrivalById.ts b/client/src/hooks/useArrivalById.ts index 98e60a8..4710138 100644 --- a/client/src/hooks/useArrivalById.ts +++ b/client/src/hooks/useArrivalById.ts @@ -2,9 +2,9 @@ * Arrival By ID * @type {Hooks} */ -import React, { useState, useEffect, useRef, useCallback } from "react"; +import React, { useState, useEffect, useCallback } from "react"; -const useArrivals = (stopId) => { +const useArrivalById = (stopId) => { const [data, setData] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(false); @@ -42,10 +42,19 @@ const useArrivals = (stopId) => { } }, [stopId]); + const executeHook = useCallback((payload) => { + setLoading(true); + setError(false); + + if (payload?.length !== 0) { + getArrivalById(payload); + } + }, [getArrivalById]); + useEffect(() => { getArrivalById(stopId); }, [getArrivalById, stopId]); - return { data, loading, error }; + return { data, loading, error, executeHook }; }; -export default useArrivals; +export default useArrivalById; From a4c99fcf5a7124899fbfa5cc9a03065e415ca6b5 Mon Sep 17 00:00:00 2001 From: Markj89 <3435026+Markj89@users.noreply.github.com> Date: Sun, 6 Jul 2025 22:41:36 -0500 Subject: [PATCH 6/8] Updated Station title --- client/src/App.tsx | 1 - client/src/components/Map/Map.tsx | 3 ++- client/src/components/StopCard/StopCard.tsx | 4 ++-- client/src/hooks/useArrivalById.ts | 2 +- server/routes/arrivals.mjs | 7 ++++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 503421d..4054b8f 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -55,7 +55,6 @@ function App() { executeHook(station?.map_id); } }, [station]); - if (loading && dataLoading) { return diff --git a/client/src/components/Map/Map.tsx b/client/src/components/Map/Map.tsx index 504ad19..5134118 100644 --- a/client/src/components/Map/Map.tsx +++ b/client/src/components/Map/Map.tsx @@ -121,7 +121,8 @@ const Map = ({ width, height, currentLocation, nearbyLocations, nearbyLocationsI
))} diff --git a/client/src/components/StopCard/StopCard.tsx b/client/src/components/StopCard/StopCard.tsx index e48adca..ae55d80 100644 --- a/client/src/components/StopCard/StopCard.tsx +++ b/client/src/components/StopCard/StopCard.tsx @@ -3,14 +3,14 @@ import { formatArrivalTime } from "./../Modal/StationModal.logic"; import React, { useState } from "react"; import Button from "./../Button"; -const StopCard = ({ destinationName, stops, routeNumber = null }) => { +const StopCard = ({ destinationName, stops, stopName, routeNumber = null }) => { const [showAll, setShowAll] = useState(false); const displayedStops = showAll ? stops : stops.slice(0, 3); return (
-
{destinationName}
+
{stopName}
diff --git a/client/src/hooks/useArrivalById.ts b/client/src/hooks/useArrivalById.ts index 4710138..45ce955 100644 --- a/client/src/hooks/useArrivalById.ts +++ b/client/src/hooks/useArrivalById.ts @@ -46,7 +46,7 @@ const useArrivalById = (stopId) => { setLoading(true); setError(false); - if (payload?.length !== 0) { + if (payload) { getArrivalById(payload); } }, [getArrivalById]); diff --git a/server/routes/arrivals.mjs b/server/routes/arrivals.mjs index 3dcc051..5b0f8cf 100644 --- a/server/routes/arrivals.mjs +++ b/server/routes/arrivals.mjs @@ -40,11 +40,12 @@ router.post("/", async( req, res) => { router.post("/:_id", async(req, res) => { try { const { stopId } = req.body; - // if (!stopId) { - // return res.status(400).json({ error: "Invalid stop IDs" }); - // } + if (!stopId) { + return res.status(400).json({ error: "Invalid stop IDs" }); + } console.log('Arrivals by Id', Date.now()); + console.log(`StopId for arrivals ${stopId}`) const url = `${process.env.TRAIN_ARRIVALS}?key=${process.env.CTA_TRAIN_API_KEY}&mapid=${stopId}&outputType=json`; const response = await fetch(url) From 40d20e4686fa2aa90c4cffd05cbf6d8bfa1cf810 Mon Sep 17 00:00:00 2001 From: Markj89 <3435026+Markj89@users.noreply.github.com> Date: Thu, 12 Mar 2026 22:00:37 -0500 Subject: [PATCH 7/8] Stop tracking coverage folder --- client/coverage/clover.xml | 6 - client/coverage/coverage-final.json | 1 - client/coverage/lcov-report/Button.tsx.html | 244 --------------- .../lcov-report/Button/Button.tsx.html | 244 --------------- client/coverage/lcov-report/Button/index.html | 116 ------- client/coverage/lcov-report/Card.tsx.html | 178 ----------- .../coverage/lcov-report/Card/Card.tsx.html | 178 ----------- client/coverage/lcov-report/Card/index.html | 116 ------- client/coverage/lcov-report/Icon.tsx.html | 169 ---------- .../coverage/lcov-report/Icon/Icon.tsx.html | 169 ---------- .../lcov-report/Icon/StationsIcon.tsx.html | 121 ------- .../lcov-report/Icon/TrainIcon.tsx.html | 172 ---------- client/coverage/lcov-report/Icon/index.html | 146 --------- client/coverage/lcov-report/Loader.tsx.html | 112 ------- .../lcov-report/StationsIcon.tsx.html | 121 ------- .../coverage/lcov-report/TrainIcon.tsx.html | 172 ---------- client/coverage/lcov-report/base.css | 224 ------------- .../coverage/lcov-report/block-navigation.js | 87 ------ client/coverage/lcov-report/color.ts.html | 181 ----------- .../components/Button/Button.tsx.html | 244 --------------- .../lcov-report/components/Button/index.html | 116 ------- .../lcov-report/components/Card/Card.tsx.html | 178 ----------- .../lcov-report/components/Card/index.html | 116 ------- .../CardContainer/CardContainer.tsx.html | 139 --------- .../components/CardContainer/index.html | 131 -------- .../components/CardContainer/index.ts.html | 88 ------ .../lcov-report/components/Icon/Icon.tsx.html | 169 ---------- .../components/Icon/StationsIcon.tsx.html | 121 ------- .../components/Icon/TrainIcon.tsx.html | 172 ---------- .../lcov-report/components/Icon/index.html | 146 --------- .../components/Loader/Loader.tsx.html | 112 ------- .../lcov-report/components/Loader/index.html | 116 ------- .../lcov-report/components/Map/Map.tsx.html | 280 ----------------- .../lcov-report/components/Map/index.html | 116 ------- .../components/Marker/Marker.tsx.html | 142 --------- .../components/Marker/Markers.tsx.html | 241 -------------- .../lcov-report/components/Marker/index.html | 131 -------- .../Modal/StationModal.logic.ts.html | 103 ------ .../components/Modal/StationModal.tsx.html | 283 ----------------- .../lcov-report/components/Modal/index.html | 131 -------- .../components/Overlay/Overlay.logic.ts.html | 103 ------ .../components/Overlay/Overlay.tsx.html | 295 ------------------ .../lcov-report/components/Overlay/index.html | 131 -------- client/coverage/lcov-report/favicon.png | Bin 445 -> 0 bytes client/coverage/lcov-report/hooks/index.html | 131 -------- .../lcov-report/hooks/useArrivals.ts.html | 268 ---------------- .../hooks/useGetStationsLocally.ts.html | 160 ---------- client/coverage/lcov-report/index.html | 101 ------ .../coverage/lcov-report/jest.config.ts.html | 193 ------------ client/coverage/lcov-report/prettify.css | 1 - client/coverage/lcov-report/prettify.js | 2 - .../lcov-report/sort-arrow-sprite.png | Bin 138 -> 0 bytes client/coverage/lcov-report/sorter.js | 214 ------------- .../coverage/lcov-report/useArrivals.ts.html | 268 ---------------- .../coverage/lcov-report/utils/color.ts.html | 181 ----------- client/coverage/lcov-report/utils/index.html | 131 -------- client/coverage/lcov-report/utils/map.ts.html | 160 ---------- client/coverage/lcov.info | 0 58 files changed, 8371 deletions(-) delete mode 100644 client/coverage/clover.xml delete mode 100644 client/coverage/coverage-final.json delete mode 100644 client/coverage/lcov-report/Button.tsx.html delete mode 100644 client/coverage/lcov-report/Button/Button.tsx.html delete mode 100644 client/coverage/lcov-report/Button/index.html delete mode 100644 client/coverage/lcov-report/Card.tsx.html delete mode 100644 client/coverage/lcov-report/Card/Card.tsx.html delete mode 100644 client/coverage/lcov-report/Card/index.html delete mode 100644 client/coverage/lcov-report/Icon.tsx.html delete mode 100644 client/coverage/lcov-report/Icon/Icon.tsx.html delete mode 100644 client/coverage/lcov-report/Icon/StationsIcon.tsx.html delete mode 100644 client/coverage/lcov-report/Icon/TrainIcon.tsx.html delete mode 100644 client/coverage/lcov-report/Icon/index.html delete mode 100644 client/coverage/lcov-report/Loader.tsx.html delete mode 100644 client/coverage/lcov-report/StationsIcon.tsx.html delete mode 100644 client/coverage/lcov-report/TrainIcon.tsx.html delete mode 100644 client/coverage/lcov-report/base.css delete mode 100644 client/coverage/lcov-report/block-navigation.js delete mode 100644 client/coverage/lcov-report/color.ts.html delete mode 100644 client/coverage/lcov-report/components/Button/Button.tsx.html delete mode 100644 client/coverage/lcov-report/components/Button/index.html delete mode 100644 client/coverage/lcov-report/components/Card/Card.tsx.html delete mode 100644 client/coverage/lcov-report/components/Card/index.html delete mode 100644 client/coverage/lcov-report/components/CardContainer/CardContainer.tsx.html delete mode 100644 client/coverage/lcov-report/components/CardContainer/index.html delete mode 100644 client/coverage/lcov-report/components/CardContainer/index.ts.html delete mode 100644 client/coverage/lcov-report/components/Icon/Icon.tsx.html delete mode 100644 client/coverage/lcov-report/components/Icon/StationsIcon.tsx.html delete mode 100644 client/coverage/lcov-report/components/Icon/TrainIcon.tsx.html delete mode 100644 client/coverage/lcov-report/components/Icon/index.html delete mode 100644 client/coverage/lcov-report/components/Loader/Loader.tsx.html delete mode 100644 client/coverage/lcov-report/components/Loader/index.html delete mode 100644 client/coverage/lcov-report/components/Map/Map.tsx.html delete mode 100644 client/coverage/lcov-report/components/Map/index.html delete mode 100644 client/coverage/lcov-report/components/Marker/Marker.tsx.html delete mode 100644 client/coverage/lcov-report/components/Marker/Markers.tsx.html delete mode 100644 client/coverage/lcov-report/components/Marker/index.html delete mode 100644 client/coverage/lcov-report/components/Modal/StationModal.logic.ts.html delete mode 100644 client/coverage/lcov-report/components/Modal/StationModal.tsx.html delete mode 100644 client/coverage/lcov-report/components/Modal/index.html delete mode 100644 client/coverage/lcov-report/components/Overlay/Overlay.logic.ts.html delete mode 100644 client/coverage/lcov-report/components/Overlay/Overlay.tsx.html delete mode 100644 client/coverage/lcov-report/components/Overlay/index.html delete mode 100644 client/coverage/lcov-report/favicon.png delete mode 100644 client/coverage/lcov-report/hooks/index.html delete mode 100644 client/coverage/lcov-report/hooks/useArrivals.ts.html delete mode 100644 client/coverage/lcov-report/hooks/useGetStationsLocally.ts.html delete mode 100644 client/coverage/lcov-report/index.html delete mode 100644 client/coverage/lcov-report/jest.config.ts.html delete mode 100644 client/coverage/lcov-report/prettify.css delete mode 100644 client/coverage/lcov-report/prettify.js delete mode 100644 client/coverage/lcov-report/sort-arrow-sprite.png delete mode 100644 client/coverage/lcov-report/sorter.js delete mode 100644 client/coverage/lcov-report/useArrivals.ts.html delete mode 100644 client/coverage/lcov-report/utils/color.ts.html delete mode 100644 client/coverage/lcov-report/utils/index.html delete mode 100644 client/coverage/lcov-report/utils/map.ts.html delete mode 100644 client/coverage/lcov.info diff --git a/client/coverage/clover.xml b/client/coverage/clover.xml deleted file mode 100644 index 50372a4..0000000 --- a/client/coverage/clover.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/client/coverage/coverage-final.json b/client/coverage/coverage-final.json deleted file mode 100644 index 0967ef4..0000000 --- a/client/coverage/coverage-final.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/client/coverage/lcov-report/Button.tsx.html b/client/coverage/lcov-report/Button.tsx.html deleted file mode 100644 index a0206d6..0000000 --- a/client/coverage/lcov-report/Button.tsx.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - Code coverage report for Button.tsx - - - - - - - - - -
-
-

All files Button.tsx

-
- -
- 50% - Statements - 4/8 -
- - -
- 100% - Branches - 0/0 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 50% - Lines - 4/8 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54  -  -  -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -1x
/**
- * Button Component
- * 
- * @type {Component} Button
- */
- 
-import React, { MouseEvent, ReactNode, Ref, forwardRef, PropsWithChildren, ButtonHTMLAttributes } from 'react';
- 
-interface ButtonProps {
-    children: ReactNode;
-    className: string;
-    onClick: (event: MouseEvent<HTMLButtonElement, MouseEvent>) => void;
-    active?: boolean;
-    isLoading?: boolean;
-    isCompleted?: boolean;
-    disabled?: boolean;
-    [key: string]: any;
-}
-type OrNull<T> = T | null
- 
-const Button = forwardRef(
-    (
-        { 
-            className, 
-            children, 
-            onClick, 
-            reversed,
-            active,
-            disabled,
-            ...props 
-        }: PropsWithChildren<
-            { 
-                active: boolean, 
-                reversed: boolean,
-                'aria-disabled': boolean
-            } & ButtonProps
-        >, 
-        ref: Ref<OrNull<HTMLButtonElement>>
-    ) => {
-    
-    function clickHandler(event: any) {
-        event.preventDefault();
-        onClick(event);
-        return false;
-    }
- 
-    return (
-        <button {...props} ref={ref as React.RefObject<HTMLButtonElement>} disabled={disabled} onMouseDown={(e) => clickHandler(e)} data-testid="button-component">
-            {children}
-        </button>
-    );
-});
- 
-export default Button;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/Button/Button.tsx.html b/client/coverage/lcov-report/Button/Button.tsx.html deleted file mode 100644 index ace3176..0000000 --- a/client/coverage/lcov-report/Button/Button.tsx.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - Code coverage report for Button/Button.tsx - - - - - - - - - -
-
-

All files / Button Button.tsx

-
- -
- 50% - Statements - 4/8 -
- - -
- 100% - Branches - 0/0 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 50% - Lines - 4/8 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54  -  -  -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -1x
/**
- * Button Component
- * 
- * @type {Component} Button
- */
- 
-import React, { MouseEvent, ReactNode, Ref, forwardRef, PropsWithChildren, ButtonHTMLAttributes } from 'react';
- 
-interface ButtonProps {
-    children: ReactNode;
-    className: string;
-    onClick: (event: MouseEvent<HTMLButtonElement, MouseEvent>) => void;
-    active?: boolean;
-    isLoading?: boolean;
-    isCompleted?: boolean;
-    disabled?: boolean;
-    [key: string]: any;
-}
-type OrNull<T> = T | null
- 
-const Button = forwardRef(
-    (
-        { 
-            className, 
-            children, 
-            onClick, 
-            reversed,
-            active,
-            disabled,
-            ...props 
-        }: PropsWithChildren<
-            { 
-                active: boolean, 
-                reversed: boolean,
-                'aria-disabled': boolean
-            } & ButtonProps
-        >, 
-        ref: Ref<OrNull<HTMLButtonElement>>
-    ) => {
-    
-    function clickHandler(event: any) {
-        event.preventDefault();
-        onClick(event);
-        return false;
-    }
- 
-    return (
-        <button {...props} ref={ref as React.RefObject<HTMLButtonElement>} disabled={disabled} onMouseDown={(e) => clickHandler(e)} data-testid="button-component">
-            {children}
-        </button>
-    );
-});
- 
-export default Button;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/Button/index.html b/client/coverage/lcov-report/Button/index.html deleted file mode 100644 index 6351fe8..0000000 --- a/client/coverage/lcov-report/Button/index.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - Code coverage report for Button - - - - - - - - - -
-
-

All files Button

-
- -
- 50% - Statements - 4/8 -
- - -
- 100% - Branches - 0/0 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 50% - Lines - 4/8 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
Button.tsx -
-
50%4/8100%0/033.33%1/350%4/8
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/Card.tsx.html b/client/coverage/lcov-report/Card.tsx.html deleted file mode 100644 index 07c686e..0000000 --- a/client/coverage/lcov-report/Card.tsx.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - Code coverage report for Card.tsx - - - - - - - - - -
-
-

All files Card.tsx

-
- -
- 77.77% - Statements - 7/9 -
- - -
- 75% - Branches - 3/4 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 77.77% - Lines - 7/9 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32  -  -  -  -  -  -  -1x -  -1x -  -1x -1x -  -1x -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -  -1x
/**
- * Card Component
- * Creates a dynamic div element
- * @type {Component} Card
- * @param CardProps
- * @returns JSX.Element
- */
-import React, { useImperativeHandle, useRef } from "react";
-import { CardProps } from "./Card.types";
-import clsx from 'clsx';
- 
-const Card = React.forwardRef(({ children, style, className = '', station, onClick, orientation = 'vertical' }: CardProps, ref) => {
-    const cardRef = useRef(null);
-    
-    useImperativeHandle(
-        ref,
-        () => ({
-            focus: () => {
-                cardRef?.current.focus();
-            }
-        }),
-        []
-    );
-    return (
-        <div ref={cardRef} className={clsx(orientation === 'vertical' ? 'card-vertical' : 'card-horizontal', className)}
-         style={style}>
-            {children}
-        </div>
-    );
-});
- 
-export default Card;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/Card/Card.tsx.html b/client/coverage/lcov-report/Card/Card.tsx.html deleted file mode 100644 index f18d700..0000000 --- a/client/coverage/lcov-report/Card/Card.tsx.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - Code coverage report for Card/Card.tsx - - - - - - - - - -
-
-

All files / Card Card.tsx

-
- -
- 77.77% - Statements - 7/9 -
- - -
- 75% - Branches - 3/4 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 77.77% - Lines - 7/9 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32  -  -  -  -  -  -  -1x -  -1x -  -1x -1x -  -1x -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -  -1x
/**
- * Card Component
- * Creates a dynamic div element
- * @type {Component} Card
- * @param CardProps
- * @returns JSX.Element
- */
-import React, { useImperativeHandle, useRef } from "react";
-import { CardProps } from "./Card.types";
-import clsx from 'clsx';
- 
-const Card = React.forwardRef(({ children, style, className = '', station, onClick, orientation = 'vertical' }: CardProps, ref) => {
-    const cardRef = useRef(null);
-    
-    useImperativeHandle(
-        ref,
-        () => ({
-            focus: () => {
-                cardRef?.current.focus();
-            }
-        }),
-        []
-    );
-    return (
-        <div ref={cardRef} className={clsx(orientation === 'vertical' ? 'card-vertical' : 'card-horizontal', className)}
-         style={style}>
-            {children}
-        </div>
-    );
-});
- 
-export default Card;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/Card/index.html b/client/coverage/lcov-report/Card/index.html deleted file mode 100644 index 8caa1c3..0000000 --- a/client/coverage/lcov-report/Card/index.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - Code coverage report for Card - - - - - - - - - -
-
-

All files Card

-
- -
- 77.77% - Statements - 7/9 -
- - -
- 75% - Branches - 3/4 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 77.77% - Lines - 7/9 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
Card.tsx -
-
77.77%7/975%3/433.33%1/377.77%7/9
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/Icon.tsx.html b/client/coverage/lcov-report/Icon.tsx.html deleted file mode 100644 index 4da928b..0000000 --- a/client/coverage/lcov-report/Icon.tsx.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - Code coverage report for Icon.tsx - - - - - - - - - -
-
-

All files Icon.tsx

-
- -
- 100% - Statements - 12/12 -
- - -
- 100% - Branches - 2/2 -
- - -
- 100% - Functions - 3/3 -
- - -
- 100% - Lines - 11/11 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29  -  -  -  -1x -1x -1x -  -1x -1x -1x -  -  -2x -  -  -  -  -  -  -  -  -  -1x -2x -2x -  -  -1x
/**
- * Icon Component
- * @type {Component}
- */
-import React, { SVGProps } from "react";
-import StationsIcon from './StationsIcon';
-import TrainIcon from "./TrainIcon";
- 
-export enum ICONS {
-    Stations = 'Stations',
-    Train = 'Train'
-}
- 
-const getIcons = (props: SVGProps<SVGSVGElement>) => ({
-    Station: <StationsIcon {...props} />,
-    Train: <TrainIcon {...props} />
-});
- 
-interface IconProps extends SVGProps<SVGSVGElement> {
-    icon: ICONS;
-    [key: string]: any;
-}
- 
-const Icon: React.FC<IconProps> = ({ icon, ...props }) => {
-    const iconComponent = getIcons(props)[icon];
-    return <>{iconComponent}</>;
-};
- 
-export default Icon;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/Icon/Icon.tsx.html b/client/coverage/lcov-report/Icon/Icon.tsx.html deleted file mode 100644 index a79dfaf..0000000 --- a/client/coverage/lcov-report/Icon/Icon.tsx.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - Code coverage report for Icon/Icon.tsx - - - - - - - - - -
-
-

All files / Icon Icon.tsx

-
- -
- 100% - Statements - 12/12 -
- - -
- 100% - Branches - 2/2 -
- - -
- 100% - Functions - 3/3 -
- - -
- 100% - Lines - 11/11 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29  -  -  -  -1x -1x -1x -  -1x -1x -1x -  -  -2x -  -  -  -  -  -  -  -  -  -1x -2x -2x -  -  -1x
/**
- * Icon Component
- * @type {Component}
- */
-import React, { SVGProps } from "react";
-import StationsIcon from './StationsIcon';
-import TrainIcon from "./TrainIcon";
- 
-export enum ICONS {
-    Stations = 'Stations',
-    Train = 'Train'
-}
- 
-const getIcons = (props: SVGProps<SVGSVGElement>) => ({
-    Station: <StationsIcon {...props} />,
-    Train: <TrainIcon {...props} />
-});
- 
-interface IconProps extends SVGProps<SVGSVGElement> {
-    icon: ICONS;
-    [key: string]: any;
-}
- 
-const Icon: React.FC<IconProps> = ({ icon, ...props }) => {
-    const iconComponent = getIcons(props)[icon];
-    return <>{iconComponent}</>;
-};
- 
-export default Icon;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/Icon/StationsIcon.tsx.html b/client/coverage/lcov-report/Icon/StationsIcon.tsx.html deleted file mode 100644 index e5eb5a0..0000000 --- a/client/coverage/lcov-report/Icon/StationsIcon.tsx.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - Code coverage report for Icon/StationsIcon.tsx - - - - - - - - - -
-
-

All files / Icon StationsIcon.tsx

-
- -
- 80% - Statements - 4/5 -
- - -
- 100% - Branches - 0/0 -
- - -
- 0% - Functions - 0/1 -
- - -
- 80% - Lines - 4/5 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13  -  -  -  -1x -1x -  -  -1x -  -  -  -1x
/**
- * Station Icon 
- * @type {Component}
- */
-import React, { SVGProps } from "react";
-import { ReactComponent as Station } from './../../assets/img/stationPoint.svg';
- 
- 
-const StationsIcon = (props: SVGProps<SVGSVGElement>) => (
-    <Station />
-);
- 
-export default StationsIcon;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/Icon/TrainIcon.tsx.html b/client/coverage/lcov-report/Icon/TrainIcon.tsx.html deleted file mode 100644 index 629596a..0000000 --- a/client/coverage/lcov-report/Icon/TrainIcon.tsx.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - Code coverage report for Icon/TrainIcon.tsx - - - - - - - - - -
-
-

All files / Icon TrainIcon.tsx

-
- -
- 100% - Statements - 5/5 -
- - -
- 100% - Branches - 0/0 -
- - -
- 100% - Functions - 1/1 -
- - -
- 100% - Lines - 5/5 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30  -  -  -  -1x -  -1x -2x -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x
/**
- * Train Icon 
- * @type {Component}
- */
-import React, { SVGProps } from "react";
- 
-const TrainIcon = (props: SVGProps<SVGSVGElement>) => {
-    const { color } = props;
-    return (
-        <svg 
-            width="238" 
-            height="122"
-            viewBox="0 0 238 122"
-            fill="none" 
-            version="1.1"
-            xmlns="http://www.w3.org/2000/svg"
-            aria-hidden="true">
-            <path d="M55.2834 97.1758C55.3415 99.4208 54.9567 101.644 54.1509 103.718C53.3452 105.793 52.1343 107.678 50.5874 109.266C49.0405 110.854 47.1878 112.114 45.1353 112.974C43.0827 113.834 40.8704 114.277 38.6247 114.278C36.379 114.279 34.1438 113.837 32.0468 112.979C29.9498 112.121 28.032 110.862 26.403 109.275C24.7739 107.688 23.4655 105.804 22.5525 103.731C21.6394 101.657 21.1396 99.434 21.0815 97.189L38.1825 97.1825L55.2834 97.1758Z" fill={color} />
-            <path d="M208.285 97.1758C208.343 99.4208 207.959 101.644 207.153 103.718C206.347 105.793 205.136 107.678 203.589 109.266C202.042 110.854 200.19 112.114 198.137 112.974C196.085 113.834 193.872 114.277 191.627 114.278C189.381 114.279 187.146 113.837 185.049 112.979C182.952 112.121 181.034 110.862 179.405 109.275C177.776 107.688 176.467 105.804 175.554 103.731C174.641 101.657 174.142 99.434 174.083 97.189L191.184 97.1825L208.285 97.1758Z" fill={color} />
-            <path d="M138.285 97.1758C138.343 99.4208 137.959 101.644 137.153 103.718C136.347 105.793 135.136 107.678 133.589 109.266C132.042 110.854 130.19 112.114 128.137 112.974C126.085 113.834 123.872 114.277 121.627 114.278C119.381 114.279 117.146 113.837 115.049 112.979C112.952 112.121 111.034 110.862 109.405 109.275C107.776 107.688 106.467 105.804 105.554 103.731C104.641 101.657 104.142 99.434 104.083 97.189L121.184 97.1825L138.285 97.1758Z" fill={color} />
-            <path d="M214 74.3085L214.05 74.2528" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M4 54H234V89C234 91.7615 228.279 94 221.222 94H16.7778C9.72087 94 4 91.7615 4 89V54Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M234 34V24C234 12.9543 211.116 4 182.889 4H55.1111C26.8832 4 4 12.9543 4 24V34" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M36.0916 19H60.0929C67.3229 19 73.1845 24.8613 73.1845 32.0916C73.1845 33.1762 72.3053 34.0553 71.2208 34.0553H24.9637C23.8792 34.0553 23 33.1762 23 32.0916C23 24.8613 28.8613 19 36.0916 19Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M107.092 19H131.093C138.323 19 144.184 24.8613 144.184 32.0916C144.184 33.1762 143.305 34.0553 142.221 34.0553H95.9637C94.8792 34.0553 94 33.1762 94 32.0916C94 24.8613 99.8613 19 107.092 19Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M178.043 19H201.957C209.16 19 215 24.8397 215 32.0435C215 33.124 214.124 34 213.043 34H166.957C165.876 34 165 33.124 165 32.0435C165 24.8397 170.84 19 178.043 19Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-        </svg>
-    );
-}
-export default TrainIcon;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/Icon/index.html b/client/coverage/lcov-report/Icon/index.html deleted file mode 100644 index 21d3985..0000000 --- a/client/coverage/lcov-report/Icon/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - Code coverage report for Icon - - - - - - - - - -
-
-

All files Icon

-
- -
- 95.45% - Statements - 21/22 -
- - -
- 100% - Branches - 2/2 -
- - -
- 80% - Functions - 4/5 -
- - -
- 95.23% - Lines - 20/21 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
Icon.tsx -
-
100%12/12100%2/2100%3/3100%11/11
StationsIcon.tsx -
-
80%4/5100%0/00%0/180%4/5
TrainIcon.tsx -
-
100%5/5100%0/0100%1/1100%5/5
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/Loader.tsx.html b/client/coverage/lcov-report/Loader.tsx.html deleted file mode 100644 index 3866d1f..0000000 --- a/client/coverage/lcov-report/Loader.tsx.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - Code coverage report for Loader.tsx - - - - - - - - - -
-
-

All files Loader.tsx

-
- -
- 100% - Statements - 4/4 -
- - -
- 100% - Branches - 0/0 -
- - -
- 100% - Functions - 1/1 -
- - -
- 100% - Lines - 3/3 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10  -  -  -  -1x -  -1x -  -1x - 
/**
- * Loading Component
- * @type {Component}
- */
-import React from "react";
- 
-export const Loader = () => {
-    
-    return <>Loading...</>;
-};
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/StationsIcon.tsx.html b/client/coverage/lcov-report/StationsIcon.tsx.html deleted file mode 100644 index d18bcb8..0000000 --- a/client/coverage/lcov-report/StationsIcon.tsx.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - Code coverage report for StationsIcon.tsx - - - - - - - - - -
-
-

All files StationsIcon.tsx

-
- -
- 80% - Statements - 4/5 -
- - -
- 100% - Branches - 0/0 -
- - -
- 0% - Functions - 0/1 -
- - -
- 80% - Lines - 4/5 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13  -  -  -  -1x -1x -  -  -1x -  -  -  -1x
/**
- * Station Icon 
- * @type {Component}
- */
-import React, { SVGProps } from "react";
-import { ReactComponent as Station } from './../../assets/img/stationPoint.svg';
- 
- 
-const StationsIcon = (props: SVGProps<SVGSVGElement>) => (
-    <Station />
-);
- 
-export default StationsIcon;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/TrainIcon.tsx.html b/client/coverage/lcov-report/TrainIcon.tsx.html deleted file mode 100644 index 9ba6d5f..0000000 --- a/client/coverage/lcov-report/TrainIcon.tsx.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - Code coverage report for TrainIcon.tsx - - - - - - - - - -
-
-

All files TrainIcon.tsx

-
- -
- 100% - Statements - 5/5 -
- - -
- 100% - Branches - 0/0 -
- - -
- 100% - Functions - 1/1 -
- - -
- 100% - Lines - 5/5 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30  -  -  -  -1x -  -1x -2x -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x
/**
- * Train Icon 
- * @type {Component}
- */
-import React, { SVGProps } from "react";
- 
-const TrainIcon = (props: SVGProps<SVGSVGElement>) => {
-    const { color } = props;
-    return (
-        <svg 
-            width="238" 
-            height="122"
-            viewBox="0 0 238 122"
-            fill="none" 
-            version="1.1"
-            xmlns="http://www.w3.org/2000/svg"
-            aria-hidden="true">
-            <path d="M55.2834 97.1758C55.3415 99.4208 54.9567 101.644 54.1509 103.718C53.3452 105.793 52.1343 107.678 50.5874 109.266C49.0405 110.854 47.1878 112.114 45.1353 112.974C43.0827 113.834 40.8704 114.277 38.6247 114.278C36.379 114.279 34.1438 113.837 32.0468 112.979C29.9498 112.121 28.032 110.862 26.403 109.275C24.7739 107.688 23.4655 105.804 22.5525 103.731C21.6394 101.657 21.1396 99.434 21.0815 97.189L38.1825 97.1825L55.2834 97.1758Z" fill={color} />
-            <path d="M208.285 97.1758C208.343 99.4208 207.959 101.644 207.153 103.718C206.347 105.793 205.136 107.678 203.589 109.266C202.042 110.854 200.19 112.114 198.137 112.974C196.085 113.834 193.872 114.277 191.627 114.278C189.381 114.279 187.146 113.837 185.049 112.979C182.952 112.121 181.034 110.862 179.405 109.275C177.776 107.688 176.467 105.804 175.554 103.731C174.641 101.657 174.142 99.434 174.083 97.189L191.184 97.1825L208.285 97.1758Z" fill={color} />
-            <path d="M138.285 97.1758C138.343 99.4208 137.959 101.644 137.153 103.718C136.347 105.793 135.136 107.678 133.589 109.266C132.042 110.854 130.19 112.114 128.137 112.974C126.085 113.834 123.872 114.277 121.627 114.278C119.381 114.279 117.146 113.837 115.049 112.979C112.952 112.121 111.034 110.862 109.405 109.275C107.776 107.688 106.467 105.804 105.554 103.731C104.641 101.657 104.142 99.434 104.083 97.189L121.184 97.1825L138.285 97.1758Z" fill={color} />
-            <path d="M214 74.3085L214.05 74.2528" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M4 54H234V89C234 91.7615 228.279 94 221.222 94H16.7778C9.72087 94 4 91.7615 4 89V54Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M234 34V24C234 12.9543 211.116 4 182.889 4H55.1111C26.8832 4 4 12.9543 4 24V34" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M36.0916 19H60.0929C67.3229 19 73.1845 24.8613 73.1845 32.0916C73.1845 33.1762 72.3053 34.0553 71.2208 34.0553H24.9637C23.8792 34.0553 23 33.1762 23 32.0916C23 24.8613 28.8613 19 36.0916 19Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M107.092 19H131.093C138.323 19 144.184 24.8613 144.184 32.0916C144.184 33.1762 143.305 34.0553 142.221 34.0553H95.9637C94.8792 34.0553 94 33.1762 94 32.0916C94 24.8613 99.8613 19 107.092 19Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M178.043 19H201.957C209.16 19 215 24.8397 215 32.0435C215 33.124 214.124 34 213.043 34H166.957C165.876 34 165 33.124 165 32.0435C165 24.8397 170.84 19 178.043 19Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-        </svg>
-    );
-}
-export default TrainIcon;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/base.css b/client/coverage/lcov-report/base.css deleted file mode 100644 index f418035..0000000 --- a/client/coverage/lcov-report/base.css +++ /dev/null @@ -1,224 +0,0 @@ -body, html { - margin:0; padding: 0; - height: 100%; -} -body { - font-family: Helvetica Neue, Helvetica, Arial; - font-size: 14px; - color:#333; -} -.small { font-size: 12px; } -*, *:after, *:before { - -webkit-box-sizing:border-box; - -moz-box-sizing:border-box; - box-sizing:border-box; - } -h1 { font-size: 20px; margin: 0;} -h2 { font-size: 14px; } -pre { - font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; - margin: 0; - padding: 0; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; -} -a { color:#0074D9; text-decoration:none; } -a:hover { text-decoration:underline; } -.strong { font-weight: bold; } -.space-top1 { padding: 10px 0 0 0; } -.pad2y { padding: 20px 0; } -.pad1y { padding: 10px 0; } -.pad2x { padding: 0 20px; } -.pad2 { padding: 20px; } -.pad1 { padding: 10px; } -.space-left2 { padding-left:55px; } -.space-right2 { padding-right:20px; } -.center { text-align:center; } -.clearfix { display:block; } -.clearfix:after { - content:''; - display:block; - height:0; - clear:both; - visibility:hidden; - } -.fl { float: left; } -@media only screen and (max-width:640px) { - .col3 { width:100%; max-width:100%; } - .hide-mobile { display:none!important; } -} - -.quiet { - color: #7f7f7f; - color: rgba(0,0,0,0.5); -} -.quiet a { opacity: 0.7; } - -.fraction { - font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; - font-size: 10px; - color: #555; - background: #E8E8E8; - padding: 4px 5px; - border-radius: 3px; - vertical-align: middle; -} - -div.path a:link, div.path a:visited { color: #333; } -table.coverage { - border-collapse: collapse; - margin: 10px 0 0 0; - padding: 0; -} - -table.coverage td { - margin: 0; - padding: 0; - vertical-align: top; -} -table.coverage td.line-count { - text-align: right; - padding: 0 5px 0 20px; -} -table.coverage td.line-coverage { - text-align: right; - padding-right: 10px; - min-width:20px; -} - -table.coverage td span.cline-any { - display: inline-block; - padding: 0 5px; - width: 100%; -} -.missing-if-branch { - display: inline-block; - margin-right: 5px; - border-radius: 3px; - position: relative; - padding: 0 4px; - background: #333; - color: yellow; -} - -.skip-if-branch { - display: none; - margin-right: 10px; - position: relative; - padding: 0 4px; - background: #ccc; - color: white; -} -.missing-if-branch .typ, .skip-if-branch .typ { - color: inherit !important; -} -.coverage-summary { - border-collapse: collapse; - width: 100%; -} -.coverage-summary tr { border-bottom: 1px solid #bbb; } -.keyline-all { border: 1px solid #ddd; } -.coverage-summary td, .coverage-summary th { padding: 10px; } -.coverage-summary tbody { border: 1px solid #bbb; } -.coverage-summary td { border-right: 1px solid #bbb; } -.coverage-summary td:last-child { border-right: none; } -.coverage-summary th { - text-align: left; - font-weight: normal; - white-space: nowrap; -} -.coverage-summary th.file { border-right: none !important; } -.coverage-summary th.pct { } -.coverage-summary th.pic, -.coverage-summary th.abs, -.coverage-summary td.pct, -.coverage-summary td.abs { text-align: right; } -.coverage-summary td.file { white-space: nowrap; } -.coverage-summary td.pic { min-width: 120px !important; } -.coverage-summary tfoot td { } - -.coverage-summary .sorter { - height: 10px; - width: 7px; - display: inline-block; - margin-left: 0.5em; - background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; -} -.coverage-summary .sorted .sorter { - background-position: 0 -20px; -} -.coverage-summary .sorted-desc .sorter { - background-position: 0 -10px; -} -.status-line { height: 10px; } -/* yellow */ -.cbranch-no { background: yellow !important; color: #111; } -/* dark red */ -.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } -.low .chart { border:1px solid #C21F39 } -.highlighted, -.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{ - background: #C21F39 !important; -} -/* medium red */ -.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } -/* light red */ -.low, .cline-no { background:#FCE1E5 } -/* light green */ -.high, .cline-yes { background:rgb(230,245,208) } -/* medium green */ -.cstat-yes { background:rgb(161,215,106) } -/* dark green */ -.status-line.high, .high .cover-fill { background:rgb(77,146,33) } -.high .chart { border:1px solid rgb(77,146,33) } -/* dark yellow (gold) */ -.status-line.medium, .medium .cover-fill { background: #f9cd0b; } -.medium .chart { border:1px solid #f9cd0b; } -/* light yellow */ -.medium { background: #fff4c2; } - -.cstat-skip { background: #ddd; color: #111; } -.fstat-skip { background: #ddd; color: #111 !important; } -.cbranch-skip { background: #ddd !important; color: #111; } - -span.cline-neutral { background: #eaeaea; } - -.coverage-summary td.empty { - opacity: .5; - padding-top: 4px; - padding-bottom: 4px; - line-height: 1; - color: #888; -} - -.cover-fill, .cover-empty { - display:inline-block; - height: 12px; -} -.chart { - line-height: 0; -} -.cover-empty { - background: white; -} -.cover-full { - border-right: none !important; -} -pre.prettyprint { - border: none !important; - padding: 0 !important; - margin: 0 !important; -} -.com { color: #999 !important; } -.ignore-none { color: #999; font-weight: normal; } - -.wrapper { - min-height: 100%; - height: auto !important; - height: 100%; - margin: 0 auto -48px; -} -.footer, .push { - height: 48px; -} diff --git a/client/coverage/lcov-report/block-navigation.js b/client/coverage/lcov-report/block-navigation.js deleted file mode 100644 index cc12130..0000000 --- a/client/coverage/lcov-report/block-navigation.js +++ /dev/null @@ -1,87 +0,0 @@ -/* eslint-disable */ -var jumpToCode = (function init() { - // Classes of code we would like to highlight in the file view - var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no']; - - // Elements to highlight in the file listing view - var fileListingElements = ['td.pct.low']; - - // We don't want to select elements that are direct descendants of another match - var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > ` - - // Selecter that finds elements on the page to which we can jump - var selector = - fileListingElements.join(', ') + - ', ' + - notSelector + - missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b` - - // The NodeList of matching elements - var missingCoverageElements = document.querySelectorAll(selector); - - var currentIndex; - - function toggleClass(index) { - missingCoverageElements - .item(currentIndex) - .classList.remove('highlighted'); - missingCoverageElements.item(index).classList.add('highlighted'); - } - - function makeCurrent(index) { - toggleClass(index); - currentIndex = index; - missingCoverageElements.item(index).scrollIntoView({ - behavior: 'smooth', - block: 'center', - inline: 'center' - }); - } - - function goToPrevious() { - var nextIndex = 0; - if (typeof currentIndex !== 'number' || currentIndex === 0) { - nextIndex = missingCoverageElements.length - 1; - } else if (missingCoverageElements.length > 1) { - nextIndex = currentIndex - 1; - } - - makeCurrent(nextIndex); - } - - function goToNext() { - var nextIndex = 0; - - if ( - typeof currentIndex === 'number' && - currentIndex < missingCoverageElements.length - 1 - ) { - nextIndex = currentIndex + 1; - } - - makeCurrent(nextIndex); - } - - return function jump(event) { - if ( - document.getElementById('fileSearch') === document.activeElement && - document.activeElement != null - ) { - // if we're currently focused on the search input, we don't want to navigate - return; - } - - switch (event.which) { - case 78: // n - case 74: // j - goToNext(); - break; - case 66: // b - case 75: // k - case 80: // p - goToPrevious(); - break; - } - }; -})(); -window.addEventListener('keydown', jumpToCode); diff --git a/client/coverage/lcov-report/color.ts.html b/client/coverage/lcov-report/color.ts.html deleted file mode 100644 index a192cd2..0000000 --- a/client/coverage/lcov-report/color.ts.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - Code coverage report for color.ts - - - - - - - - - -
-
-

All files color.ts

-
- -
- 27.27% - Statements - 6/22 -
- - -
- 11.11% - Branches - 1/9 -
- - -
- 100% - Functions - 1/1 -
- - -
- 23.8% - Lines - 5/21 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -331x -  -1x -  -1x -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x - 
export const getColorByStation = (stationColor: string) => {
-    let color;
-    switch (stationColor) {
-        case "pink":
-            color = '#e27ea6';
-            break;
-        case 'blue':
-            color = '#00a1de';
-            break;
-        case 'g':
-            color = '#009b3a';
-            break;
-        case 'brn':
-            color = '#62361b';
-            break;
-        case 'p':
-            color = '#522398';
-            break;
-        case 'y':
-            color = '#f9e300';
-            break;
-        case 'red':
-            color = '#c60c30';
-            break;
-        case 'org':
-            color = '#f9461c';
-            break;
-        default:
-            color = '#565a5c';
-            break;
-    }
-    return color;
-};
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Button/Button.tsx.html b/client/coverage/lcov-report/components/Button/Button.tsx.html deleted file mode 100644 index 307f342..0000000 --- a/client/coverage/lcov-report/components/Button/Button.tsx.html +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - Code coverage report for components/Button/Button.tsx - - - - - - - - - -
-
-

All files / components/Button Button.tsx

-
- -
- 50% - Statements - 4/8 -
- - -
- 100% - Branches - 0/0 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 50% - Lines - 4/8 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54  -  -  -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -1x
/**
- * Button Component
- * 
- * @type {Component} Button
- */
- 
-import React, { MouseEvent, ReactNode, Ref, forwardRef, PropsWithChildren, ButtonHTMLAttributes } from 'react';
- 
-interface ButtonProps {
-    children: ReactNode;
-    className: string;
-    onClick: (event: MouseEvent<HTMLButtonElement, MouseEvent>) => void;
-    active?: boolean;
-    isLoading?: boolean;
-    isCompleted?: boolean;
-    disabled?: boolean;
-    [key: string]: any;
-}
-type OrNull<T> = T | null
- 
-const Button = forwardRef(
-    (
-        { 
-            className, 
-            children, 
-            onClick, 
-            reversed,
-            active,
-            disabled,
-            ...props 
-        }: PropsWithChildren<
-            { 
-                active: boolean, 
-                reversed: boolean,
-                'aria-disabled': boolean
-            } & ButtonProps
-        >, 
-        ref: Ref<OrNull<HTMLButtonElement>>
-    ) => {
-    
-    function clickHandler(event: any) {
-        event.preventDefault();
-        onClick(event);
-        return false;
-    }
- 
-    return (
-        <button {...props} ref={ref as React.RefObject<HTMLButtonElement>} disabled={disabled} onMouseDown={(e) => clickHandler(e)} data-testid="button-component">
-            {children}
-        </button>
-    );
-});
- 
-export default Button;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Button/index.html b/client/coverage/lcov-report/components/Button/index.html deleted file mode 100644 index 82c90ae..0000000 --- a/client/coverage/lcov-report/components/Button/index.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - Code coverage report for components/Button - - - - - - - - - -
-
-

All files components/Button

-
- -
- 50% - Statements - 4/8 -
- - -
- 100% - Branches - 0/0 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 50% - Lines - 4/8 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
Button.tsx -
-
50%4/8100%0/033.33%1/350%4/8
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Card/Card.tsx.html b/client/coverage/lcov-report/components/Card/Card.tsx.html deleted file mode 100644 index ac3a54a..0000000 --- a/client/coverage/lcov-report/components/Card/Card.tsx.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - Code coverage report for components/Card/Card.tsx - - - - - - - - - -
-
-

All files / components/Card Card.tsx

-
- -
- 77.77% - Statements - 7/9 -
- - -
- 75% - Branches - 3/4 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 77.77% - Lines - 7/9 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32  -  -  -  -  -  -  -2x -  -2x -  -2x -1x -  -1x -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -  -2x
/**
- * Card Component
- * Creates a dynamic div element
- * @type {Component} Card
- * @param CardProps
- * @returns JSX.Element
- */
-import React, { useImperativeHandle, useRef } from "react";
-import { CardProps } from "./Card.types";
-import clsx from 'clsx';
- 
-const Card = React.forwardRef(({ children, style, className = '', station, onClick, orientation = 'vertical' }: CardProps, ref) => {
-    const cardRef = useRef(null);
-    
-    useImperativeHandle(
-        ref,
-        () => ({
-            focus: () => {
-                cardRef?.current.focus();
-            }
-        }),
-        []
-    );
-    return (
-        <div ref={cardRef} className={clsx(orientation === 'vertical' ? 'card-vertical' : 'card-horizontal', className)}
-         style={style}>
-            {children}
-        </div>
-    );
-});
- 
-export default Card;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Card/index.html b/client/coverage/lcov-report/components/Card/index.html deleted file mode 100644 index 61ce276..0000000 --- a/client/coverage/lcov-report/components/Card/index.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - Code coverage report for components/Card - - - - - - - - - -
-
-

All files components/Card

-
- -
- 77.77% - Statements - 7/9 -
- - -
- 75% - Branches - 3/4 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 77.77% - Lines - 7/9 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
Card.tsx -
-
77.77%7/975%3/433.33%1/377.77%7/9
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/CardContainer/CardContainer.tsx.html b/client/coverage/lcov-report/components/CardContainer/CardContainer.tsx.html deleted file mode 100644 index e9afd91..0000000 --- a/client/coverage/lcov-report/components/CardContainer/CardContainer.tsx.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - Code coverage report for components/CardContainer/CardContainer.tsx - - - - - - - - - -
-
-

All files / components/CardContainer CardContainer.tsx

-
- -
- 66.66% - Statements - 4/6 -
- - -
- 0% - Branches - 0/4 -
- - -
- 0% - Functions - 0/1 -
- - -
- 66.66% - Lines - 4/6 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19  -  -  -  -1x -  -1x -  -1x -  -  -  -  -  -  -  -  -  -1x
/**
- * Container (Card)
- * @type {Component} CardContainer
- */
-import React, { useRef } from 'react';
-import { CardContainerProps } from './CardContainer.types';
-import clsx from 'clsx';
- 
-const CardContainer = React.forwardRef(({ children, style, className = '', orientation = 'vertical' }: CardContainerProps, ref) => {
-    const containerRef = useRef(null);
- 
-    return (
-        <div ref={containerRef} className={clsx(orientation === 'vertical' ? 'card-vertical' : 'card-horizontal', className)}>
-            {children}
-        </div>
-    );
-});
- 
-export default CardContainer;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/CardContainer/index.html b/client/coverage/lcov-report/components/CardContainer/index.html deleted file mode 100644 index f131c7c..0000000 --- a/client/coverage/lcov-report/components/CardContainer/index.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - Code coverage report for components/CardContainer - - - - - - - - - -
-
-

All files components/CardContainer

-
- -
- 77.77% - Statements - 7/9 -
- - -
- 0% - Branches - 0/4 -
- - -
- 0% - Functions - 0/2 -
- - -
- 75% - Lines - 6/8 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
CardContainer.tsx -
-
66.66%4/60%0/40%0/166.66%4/6
index.ts -
-
100%3/3100%0/00%0/1100%2/2
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/CardContainer/index.ts.html b/client/coverage/lcov-report/components/CardContainer/index.ts.html deleted file mode 100644 index e649e86..0000000 --- a/client/coverage/lcov-report/components/CardContainer/index.ts.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - Code coverage report for components/CardContainer/index.ts - - - - - - - - - -
-
-

All files / components/CardContainer index.ts

-
- -
- 100% - Statements - 3/3 -
- - -
- 100% - Branches - 0/0 -
- - -
- 0% - Functions - 0/1 -
- - -
- 100% - Lines - 2/2 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -21x -1x
export { default as CardContainer } from './CardContainer';
-export * from './CardContainer.types';
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Icon/Icon.tsx.html b/client/coverage/lcov-report/components/Icon/Icon.tsx.html deleted file mode 100644 index e61aaa8..0000000 --- a/client/coverage/lcov-report/components/Icon/Icon.tsx.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - Code coverage report for components/Icon/Icon.tsx - - - - - - - - - -
-
-

All files / components/Icon Icon.tsx

-
- -
- 100% - Statements - 12/12 -
- - -
- 100% - Branches - 2/2 -
- - -
- 100% - Functions - 3/3 -
- - -
- 100% - Lines - 11/11 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29  -  -  -  -1x -1x -1x -  -1x -1x -1x -  -  -2x -  -  -  -  -  -  -  -  -  -1x -2x -2x -  -  -1x
/**
- * Icon Component
- * @type {Component}
- */
-import React, { SVGProps } from "react";
-import StationsIcon from './StationsIcon';
-import TrainIcon from "./TrainIcon";
- 
-export enum ICONS {
-    Stations = 'Stations',
-    Train = 'Train'
-}
- 
-const getIcons = (props: SVGProps<SVGSVGElement>) => ({
-    Station: <StationsIcon {...props} />,
-    Train: <TrainIcon {...props} />
-});
- 
-interface IconProps extends SVGProps<SVGSVGElement> {
-    icon: ICONS;
-    [key: string]: any;
-}
- 
-const Icon: React.FC<IconProps> = ({ icon, ...props }) => {
-    const iconComponent = getIcons(props)[icon];
-    return <>{iconComponent}</>;
-};
- 
-export default Icon;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Icon/StationsIcon.tsx.html b/client/coverage/lcov-report/components/Icon/StationsIcon.tsx.html deleted file mode 100644 index 465a23a..0000000 --- a/client/coverage/lcov-report/components/Icon/StationsIcon.tsx.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - Code coverage report for components/Icon/StationsIcon.tsx - - - - - - - - - -
-
-

All files / components/Icon StationsIcon.tsx

-
- -
- 80% - Statements - 4/5 -
- - -
- 100% - Branches - 0/0 -
- - -
- 0% - Functions - 0/1 -
- - -
- 80% - Lines - 4/5 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13  -  -  -  -1x -1x -  -  -1x -  -  -  -1x
/**
- * Station Icon 
- * @type {Component}
- */
-import React, { SVGProps } from "react";
-import { ReactComponent as Station } from './../../assets/img/stationPoint.svg';
- 
- 
-const StationsIcon = (props: SVGProps<SVGSVGElement>) => (
-    <Station />
-);
- 
-export default StationsIcon;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Icon/TrainIcon.tsx.html b/client/coverage/lcov-report/components/Icon/TrainIcon.tsx.html deleted file mode 100644 index f55bd7c..0000000 --- a/client/coverage/lcov-report/components/Icon/TrainIcon.tsx.html +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - Code coverage report for components/Icon/TrainIcon.tsx - - - - - - - - - -
-
-

All files / components/Icon TrainIcon.tsx

-
- -
- 100% - Statements - 5/5 -
- - -
- 100% - Branches - 0/0 -
- - -
- 100% - Functions - 1/1 -
- - -
- 100% - Lines - 5/5 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30  -  -  -  -1x -  -1x -2x -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x
/**
- * Train Icon 
- * @type {Component}
- */
-import React, { SVGProps } from "react";
- 
-const TrainIcon = (props: SVGProps<SVGSVGElement>) => {
-    const { color } = props;
-    return (
-        <svg 
-            width="238" 
-            height="122"
-            viewBox="0 0 238 122"
-            fill="none" 
-            version="1.1"
-            xmlns="http://www.w3.org/2000/svg"
-            aria-hidden="true">
-            <path d="M55.2834 97.1758C55.3415 99.4208 54.9567 101.644 54.1509 103.718C53.3452 105.793 52.1343 107.678 50.5874 109.266C49.0405 110.854 47.1878 112.114 45.1353 112.974C43.0827 113.834 40.8704 114.277 38.6247 114.278C36.379 114.279 34.1438 113.837 32.0468 112.979C29.9498 112.121 28.032 110.862 26.403 109.275C24.7739 107.688 23.4655 105.804 22.5525 103.731C21.6394 101.657 21.1396 99.434 21.0815 97.189L38.1825 97.1825L55.2834 97.1758Z" fill={color} />
-            <path d="M208.285 97.1758C208.343 99.4208 207.959 101.644 207.153 103.718C206.347 105.793 205.136 107.678 203.589 109.266C202.042 110.854 200.19 112.114 198.137 112.974C196.085 113.834 193.872 114.277 191.627 114.278C189.381 114.279 187.146 113.837 185.049 112.979C182.952 112.121 181.034 110.862 179.405 109.275C177.776 107.688 176.467 105.804 175.554 103.731C174.641 101.657 174.142 99.434 174.083 97.189L191.184 97.1825L208.285 97.1758Z" fill={color} />
-            <path d="M138.285 97.1758C138.343 99.4208 137.959 101.644 137.153 103.718C136.347 105.793 135.136 107.678 133.589 109.266C132.042 110.854 130.19 112.114 128.137 112.974C126.085 113.834 123.872 114.277 121.627 114.278C119.381 114.279 117.146 113.837 115.049 112.979C112.952 112.121 111.034 110.862 109.405 109.275C107.776 107.688 106.467 105.804 105.554 103.731C104.641 101.657 104.142 99.434 104.083 97.189L121.184 97.1825L138.285 97.1758Z" fill={color} />
-            <path d="M214 74.3085L214.05 74.2528" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M4 54H234V89C234 91.7615 228.279 94 221.222 94H16.7778C9.72087 94 4 91.7615 4 89V54Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M234 34V24C234 12.9543 211.116 4 182.889 4H55.1111C26.8832 4 4 12.9543 4 24V34" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M36.0916 19H60.0929C67.3229 19 73.1845 24.8613 73.1845 32.0916C73.1845 33.1762 72.3053 34.0553 71.2208 34.0553H24.9637C23.8792 34.0553 23 33.1762 23 32.0916C23 24.8613 28.8613 19 36.0916 19Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M107.092 19H131.093C138.323 19 144.184 24.8613 144.184 32.0916C144.184 33.1762 143.305 34.0553 142.221 34.0553H95.9637C94.8792 34.0553 94 33.1762 94 32.0916C94 24.8613 99.8613 19 107.092 19Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-            <path d="M178.043 19H201.957C209.16 19 215 24.8397 215 32.0435C215 33.124 214.124 34 213.043 34H166.957C165.876 34 165 33.124 165 32.0435C165 24.8397 170.84 19 178.043 19Z" stroke={color} stroke-width="7.52767" stroke-linecap="round" stroke-linejoin="round"/>
-        </svg>
-    );
-}
-export default TrainIcon;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Icon/index.html b/client/coverage/lcov-report/components/Icon/index.html deleted file mode 100644 index 9aa10b4..0000000 --- a/client/coverage/lcov-report/components/Icon/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - Code coverage report for components/Icon - - - - - - - - - -
-
-

All files components/Icon

-
- -
- 95.45% - Statements - 21/22 -
- - -
- 100% - Branches - 2/2 -
- - -
- 80% - Functions - 4/5 -
- - -
- 95.23% - Lines - 20/21 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
Icon.tsx -
-
100%12/12100%2/2100%3/3100%11/11
StationsIcon.tsx -
-
80%4/5100%0/00%0/180%4/5
TrainIcon.tsx -
-
100%5/5100%0/0100%1/1100%5/5
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Loader/Loader.tsx.html b/client/coverage/lcov-report/components/Loader/Loader.tsx.html deleted file mode 100644 index 3c1f5a8..0000000 --- a/client/coverage/lcov-report/components/Loader/Loader.tsx.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - Code coverage report for components/Loader/Loader.tsx - - - - - - - - - -
-
-

All files / components/Loader Loader.tsx

-
- -
- 100% - Statements - 4/4 -
- - -
- 100% - Branches - 0/0 -
- - -
- 100% - Functions - 1/1 -
- - -
- 100% - Lines - 3/3 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10  -  -  -  -1x -  -1x -  -1x - 
/**
- * Loading Component
- * @type {Component}
- */
-import React from "react";
- 
-export const Loader = () => {
-    
-    return <>Loading...</>;
-};
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Loader/index.html b/client/coverage/lcov-report/components/Loader/index.html deleted file mode 100644 index f59aa58..0000000 --- a/client/coverage/lcov-report/components/Loader/index.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - Code coverage report for components/Loader - - - - - - - - - -
-
-

All files components/Loader

-
- -
- 100% - Statements - 4/4 -
- - -
- 100% - Branches - 0/0 -
- - -
- 100% - Functions - 1/1 -
- - -
- 100% - Lines - 3/3 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
Loader.tsx -
-
100%4/4100%0/0100%1/1100%3/3
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Map/Map.tsx.html b/client/coverage/lcov-report/components/Map/Map.tsx.html deleted file mode 100644 index d9a026e..0000000 --- a/client/coverage/lcov-report/components/Map/Map.tsx.html +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - Code coverage report for components/Map/Map.tsx - - - - - - - - - -
-
-

All files / components/Map Map.tsx

-
- -
- 82.35% - Statements - 14/17 -
- - -
- 0% - Branches - 0/4 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 82.35% - Lines - 14/17 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66  -  -  -  -  -  -  -1x -1x -  -1x -1x -1x -  -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -1x -1x -1x -1x -1x -  -1x -  -  -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x - 
/**
- * Map Component
- * Creates a Google Maps with geocoding UI and marker are received from mongo databnase.
- * @type {Component} Map
- * @param MapProps
- * @returns JSX.Element
- */
-import React, { useState, useRef, useEffect } from "react";
-import useGetStationsLocally from "../../hooks/useGetStationsLocally";
-import { InitiCenerType } from "../../context";
-import OverlayContainer from "./../Overlay/Overlay";
-import Markers from "./../Marker/Markers";
-import { mapMarkers, mapStations } from "./../../utils/map";
- 
-export interface MapProps {
-  [key: string]: any;
-  width: number;
-  height: number;
-  currentLocation?: Partial<InitiCenerType>;
-  zoom?: number;
-}
- 
-const Map = ({
-  width,
-  height,
-  currentLocation,
-  zoom = 15,
-}: MapProps) => {
-  const mapRef = useRef<HTMLDivElement>();
-  const [map, setMap] = useState<google.maps.Map>(null);
-  const { stations } = useGetStationsLocally(`${process.env.SERVER_URL}/stations`);
-  const markers = mapMarkers(stations);
-  const mappedStations = mapStations(markers);
- 
-  useEffect(() => {
-    Iif (mapRef.current && !map) {
-      setMap(new window.google.maps.Map(mapRef.current, {
-        center: { lat: currentLocation?.lat, lng: currentLocation?.lng },
-        zoom: 15,
-        disableDefaultUI: true,
-        clickableIcons: false
-      }));
-    }
-  }, [map, zoom]);
- 
-  return (
-        <div
-          className="MapWrapper"
-          style={{
-            height: `${height}px`,
-            width: `${width}px`,
-            minHeight: `${height}px`,
-          }}
-          ref={mapRef as any}
-        >
-          {mappedStations?.map((marker, index) => (
-            <OverlayContainer map={map} position={{ lat: marker?.lat, lng: marker?.lng }} key={index}>
-              <Markers station={marker} stops={markers} />
-            </OverlayContainer>
-          ))}
-        </div>
-  );
-};
- 
-export default Map;
- 
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Map/index.html b/client/coverage/lcov-report/components/Map/index.html deleted file mode 100644 index cd2d8f0..0000000 --- a/client/coverage/lcov-report/components/Map/index.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - Code coverage report for components/Map - - - - - - - - - -
-
-

All files components/Map

-
- -
- 82.35% - Statements - 14/17 -
- - -
- 0% - Branches - 0/4 -
- - -
- 33.33% - Functions - 1/3 -
- - -
- 82.35% - Lines - 14/17 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
Map.tsx -
-
82.35%14/170%0/433.33%1/382.35%14/17
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Marker/Marker.tsx.html b/client/coverage/lcov-report/components/Marker/Marker.tsx.html deleted file mode 100644 index 7b721c4..0000000 --- a/client/coverage/lcov-report/components/Marker/Marker.tsx.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - Code coverage report for components/Marker/Marker.tsx - - - - - - - - - -
-
-

All files / components/Marker Marker.tsx

-
- -
- 80% - Statements - 4/5 -
- - -
- 100% - Branches - 0/0 -
- - -
- 0% - Functions - 0/1 -
- - -
- 100% - Lines - 4/4 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20  -  -  -  -  -  -  -1x -  -1x -  -  -  -  -  -  -1x -  -1x - 
/**
- * Marker
- * A Marker point to show over the Overlay Container
- * @type {Component} Marker
- * @returns JSX.Element
- */
- 
-import * as React from "react";
-import { Station } from "components/Map";
-import clsx from 'clsx';
- 
-type MarkerProps = google.maps.MarkerOptions & {
-  onClick?: () => void;
-  onHover?: () => void;
-  station: Station;
-}
-const Marker: React.FC<MarkerProps> = ({ station, onClick, onHover }: MarkerProps) => <div onMouseOver={onHover} className={clsx('Marker-component bubble-marker')} style={{ backgroundColor: `${station?.color}`}}></div>;
- 
-export default Marker;
- 
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Marker/Markers.tsx.html b/client/coverage/lcov-report/components/Marker/Markers.tsx.html deleted file mode 100644 index 9d3f4ca..0000000 --- a/client/coverage/lcov-report/components/Marker/Markers.tsx.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - Code coverage report for components/Marker/Markers.tsx - - - - - - - - - -
-
-

All files / components/Marker Markers.tsx

-
- -
- 28.57% - Statements - 6/21 -
- - -
- 0% - Branches - 0/5 -
- - -
- 0% - Functions - 0/5 -
- - -
- 28.57% - Lines - 6/21 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53  -  -  -  -  -  -1x -1x -1x -  -1x -  -  -  -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x
/**
- * Markers
- * @type {Component} Markers
- * @param MarkersProps
- * @returns JSX.Element
- */
-import React, { useEffect, useRef, useState } from "react";
-import { createPortal } from "react-dom";
-import Marker from "./Marker";
-import { Station } from "components/Map";
-import StationModal from "./../Modal/StationModal";
- 
-type MarkersProps = {
-    station: Station;
-    stops: Station[];
-}
- 
-const Markers = ({ station, stops }: MarkersProps) => {
-    const [opened, setIsOpened] = useState<boolean>(false);
-    const handleOnOpen = () => {
-        setIsOpened(true);
-    };
-    const containerRef = useRef<HTMLDivElement>(null);
-    const [position, getPosition] = useState({top: 0, left: 0});
- 
-    useEffect(() => {
-        function handleClickOutside(this: Document, event: MouseEvent) {
-            getPosition({ top: event?.clientX, left: event?.clientY });
-            Iif (containerRef.current && !containerRef.current.contains(event.target as Node)) {
-                setIsOpened(false);
-            }
-        }
-    
-        document.addEventListener("mouseover", handleClickOutside);
-        return () => {
-            document.removeEventListener("mouseout", handleClickOutside);
-        };
-    }, [containerRef]);
- 
-    const sidebarContentEl: HTMLElement = document.getElementById('app');
-    const modalPlacement = {
-        top: `${position?.top}px`,
-        left:  `${position?.left}px`,
-    }
-    return (
-        <div ref={containerRef}>
-             {opened && createPortal( <StationModal station={station} style={modalPlacement} stops={stops} position={position} />, sidebarContentEl )}
-             <Marker station={station} onHover={handleOnOpen} />
-        </div>
-    )
-};
- 
-export default Markers;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Marker/index.html b/client/coverage/lcov-report/components/Marker/index.html deleted file mode 100644 index 5568a3a..0000000 --- a/client/coverage/lcov-report/components/Marker/index.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - Code coverage report for components/Marker - - - - - - - - - -
-
-

All files components/Marker

-
- -
- 38.46% - Statements - 10/26 -
- - -
- 0% - Branches - 0/5 -
- - -
- 0% - Functions - 0/6 -
- - -
- 40% - Lines - 10/25 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
Marker.tsx -
-
80%4/5100%0/00%0/1100%4/4
Markers.tsx -
-
28.57%6/210%0/50%0/528.57%6/21
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Modal/StationModal.logic.ts.html b/client/coverage/lcov-report/components/Modal/StationModal.logic.ts.html deleted file mode 100644 index a376be6..0000000 --- a/client/coverage/lcov-report/components/Modal/StationModal.logic.ts.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - Code coverage report for components/Modal/StationModal.logic.ts - - - - - - - - - -
-
-

All files / components/Modal StationModal.logic.ts

-
- -
- 50% - Statements - 4/8 -
- - -
- 0% - Branches - 0/2 -
- - -
- 0% - Functions - 0/2 -
- - -
- 40% - Lines - 2/5 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -71x -  -  -  -  -  -1x
export const formatArrivalTime = (arrivalTime: string) => {
-    let presentTime = new Date()?.getTime();
-    const difference = (new Date(arrivalTime).getTime() - presentTime);
-    return new Date(difference).getMinutes();
-};
- 
-export const formatEstimatedTime = (arrivalTime: string) => arrivalTime && new Date(arrivalTime)?.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Modal/StationModal.tsx.html b/client/coverage/lcov-report/components/Modal/StationModal.tsx.html deleted file mode 100644 index 53f181a..0000000 --- a/client/coverage/lcov-report/components/Modal/StationModal.tsx.html +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - Code coverage report for components/Modal/StationModal.tsx - - - - - - - - - -
-
-

All files / components/Modal StationModal.tsx

-
- -
- 33.33% - Statements - 6/18 -
- - -
- 0% - Branches - 0/9 -
- - -
- 0% - Functions - 0/3 -
- - -
- 33.33% - Lines - 6/18 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67  -  -  -  -  -  -  -1x -1x -1x -  -1x -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 
/**
- * Modal (Station)
- * 
- * @param StationCardProps
- * @type {Component} StationModal
- */
- 
-import useArrivals from "../../hooks/useArrivals";
-import Card from "./../Card/Card";
-import { CardContainer } from "./../CardContainer";
-import { Station } from "./../Map";
-import React, { useEffect, useRef, useState } from "react";
-import { formatArrivalTime, formatEstimatedTime } from "./StationModal.logic";
- 
-interface Position {
-    top: number;
-    left: number;
-}
- 
-export type StationCardProps = {
-    station: Station;
-    stops: Station[];
-    position?: Position;
-    isOpen?: boolean;
-    children?: React.ReactNode;
-    handleClose?: () => void;
-    style?: React.CSSProperties;
-}
- 
-export default function StationModal({ station, position, style, isOpen, stops}: StationCardProps ): JSX.Element {
-    console.log(station);
-    const { data, loading, error } = useArrivals(station);
-    const titleRef = useRef();
-    const [title, setTitle] = useState<string>(station?.stop_name?.replace(/ *\([^)]*\) */g, ""));
-    const [fontSize, setFontSize] = useState<string>('text-4xl');
-    useEffect(() => {
-        const width = document.getElementById('station-title').getBoundingClientRect()?.width;
-        const height = document.getElementById('station-title').getBoundingClientRect()?.height;
-        Iif (width >= 290 || height > 80) {
-            setFontSize('text-2xl');
-        }
-    }, [fontSize, title]);
-    return (
-        <Card orientation="vertical" style={{ top: `${position?.left}px`, left: `${position?.top}px` }} className={"modal z-10 rounded-lg shadow-xl mx-auto p-6 bg-slate"}>
-            <div className='text-base text-slate-900 font-semibold dark:text-slate-300 rounded-lg overflow-hidden mb-2'>
-                <h1 ref={titleRef} id="station-title" className={`font-interTight mb-1.5 ${fontSize}`}>{title}</h1>
-            </div>
-            <CardContainer className="text-base overflow-y-auto" orientation={"vertical"}>
-                { data !== null && loading === false ? (
-                    <div className="space-y-4 station mb-1">
-                        {data?.map((item) => (
-                            <ul className="w-72 list-inside station-list-item flex align-middle arrival-list-item px-3.5" style={{ backgroundColor: `${station?.color}`}}>
-                                <li className="text-left flex-none w-24 text-white text-base">{item?.stpDe?.replace('Service toward ', '')}</li>
-                                <ul className="flex-auto w-32 arrival-list-item-times">
-                                    <li className="text-right arrival-time text-white my-0 text-sm">{formatArrivalTime(item?.arrT).toString() === '0' ? 'Due' : `${formatArrivalTime(item?.arrT).toString()} mins`}</li>
-                                    <li className="text-right estimated-time text-white">{formatEstimatedTime(item?.arrT)}</li>
-                                </ul>
-                            </ul>
-                        ))}
-                    </div>
-                ) : (
-                    <p>Loading</p>
-                )}
-            </CardContainer>
-        </Card>
-    );
-}
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Modal/index.html b/client/coverage/lcov-report/components/Modal/index.html deleted file mode 100644 index 5231335..0000000 --- a/client/coverage/lcov-report/components/Modal/index.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - Code coverage report for components/Modal - - - - - - - - - -
-
-

All files components/Modal

-
- -
- 38.46% - Statements - 10/26 -
- - -
- 0% - Branches - 0/11 -
- - -
- 0% - Functions - 0/5 -
- - -
- 34.78% - Lines - 8/23 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
StationModal.logic.ts -
-
50%4/80%0/20%0/240%2/5
StationModal.tsx -
-
33.33%6/180%0/90%0/333.33%6/18
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Overlay/Overlay.logic.ts.html b/client/coverage/lcov-report/components/Overlay/Overlay.logic.ts.html deleted file mode 100644 index 5f707e6..0000000 --- a/client/coverage/lcov-report/components/Overlay/Overlay.logic.ts.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - Code coverage report for components/Overlay/Overlay.logic.ts - - - - - - - - - -
-
-

All files / components/Overlay Overlay.logic.ts

-
- -
- 16.66% - Statements - 1/6 -
- - -
- 100% - Branches - 0/0 -
- - -
- 0% - Functions - 0/1 -
- - -
- 16.66% - Lines - 1/6 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -71x -  -  -  -  -  - 
export function createOverlayElement() {
-    const el = document.createElement('div');
-    el.style.position = 'absolute';
-    el.style.display = 'inline-block';
-    el.style.width = '9999px';
-    return el;
-}
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Overlay/Overlay.tsx.html b/client/coverage/lcov-report/components/Overlay/Overlay.tsx.html deleted file mode 100644 index dd73deb..0000000 --- a/client/coverage/lcov-report/components/Overlay/Overlay.tsx.html +++ /dev/null @@ -1,295 +0,0 @@ - - - - - - Code coverage report for components/Overlay/Overlay.tsx - - - - - - - - - -
-
-

All files / components/Overlay Overlay.tsx

-
- -
- 15.15% - Statements - 5/33 -
- - -
- 0% - Branches - 0/13 -
- - -
- 0% - Functions - 0/7 -
- - -
- 16.12% - Lines - 5/31 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71  -  -  -  -  -  -  -1x -1x -1x -  -  -  -  -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x
/**
- * OverlayContainer
- * An Overlay container to customize markers.
- * @type {Component} Overlay
- * @param Props
- * @returns JSX.Element
- */
-import * as React from "react";
-import ReactDOM from 'react-dom';
-import { createOverlayElement } from "./Overlay.logic";
- 
-export type Props = {
-    map: any;
-    position: { lat: number, lng: number };
-    children?: React.ReactNode;
-}
- 
-const  OverlayContainer = (props: Props) => {
-    const overlay = React.useRef<google.maps.OverlayView | null>(null);
-    const element = React.useRef<Element | null>(null);
- 
-    class OverlayView extends window.google.maps.OverlayView {
-        position: google.maps.LatLng | null = null;
-        content: any = null;
-      
-        constructor(props: any) {
-            super();
-            props.position && (this.position = props.position);
-            props.content && (this.content = props.content);
-        }
-      
-        onAdd = () => {
-            Iif (this.content) this.getPanes().floatPane.appendChild(this.content);
-        };
-      
-        onRemove = () => {
-            Iif (this.content?.parentElement) {
-                this.content.parentElement.removeChild(this.content);
-            }
-        };
-      
-        draw = () => {
-            Iif (this.position) {
-                const divPosition = this.getProjection().fromLatLngToDivPixel(this.position);
-                this.content.style.left = divPosition.x + 'px';
-                this.content.style.top = divPosition.y + 'px';
-            }
-        };
-    }
-      
-    React.useEffect(() => {
-        return () => {
-            Iif (overlay.current) overlay.current.setMap(null);
-        }
-    }, []);
-    
-    Iif (props.map) {
-        element.current = element?.current || createOverlayElement();
-        overlay.current = overlay.current || new OverlayView(
-            {
-                position: new google.maps.LatLng(props.position.lat, props.position.lng),
-                content: element?.current
-            }
-        )
-        overlay.current.setMap(props.map)
-        return ReactDOM.createPortal(props.children, element?.current);
-    }
-    return null;
-};
- 
-export default OverlayContainer;
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/components/Overlay/index.html b/client/coverage/lcov-report/components/Overlay/index.html deleted file mode 100644 index c2a9df2..0000000 --- a/client/coverage/lcov-report/components/Overlay/index.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - Code coverage report for components/Overlay - - - - - - - - - -
-
-

All files components/Overlay

-
- -
- 15.38% - Statements - 6/39 -
- - -
- 0% - Branches - 0/13 -
- - -
- 0% - Functions - 0/8 -
- - -
- 16.21% - Lines - 6/37 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
Overlay.logic.ts -
-
16.66%1/6100%0/00%0/116.66%1/6
Overlay.tsx -
-
15.15%5/330%0/130%0/716.12%5/31
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/favicon.png b/client/coverage/lcov-report/favicon.png deleted file mode 100644 index c1525b811a167671e9de1fa78aab9f5c0b61cef7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 445 zcmV;u0Yd(XP))rP{nL}Ln%S7`m{0DjX9TLF* zFCb$4Oi7vyLOydb!7n&^ItCzb-%BoB`=x@N2jll2Nj`kauio%aw_@fe&*}LqlFT43 z8doAAe))z_%=P%v^@JHp3Hjhj^6*Kr_h|g_Gr?ZAa&y>wxHE99Gk>A)2MplWz2xdG zy8VD2J|Uf#EAw*bo5O*PO_}X2Tob{%bUoO2G~T`@%S6qPyc}VkhV}UifBuRk>%5v( z)x7B{I~z*k<7dv#5tC+m{km(D087J4O%+<<;K|qwefb6@GSX45wCK}Sn*> - - - - Code coverage report for hooks - - - - - - - - - -
-
-

All files hooks

-
- -
- 60.41% - Statements - 29/48 -
- - -
- 33.33% - Branches - 1/3 -
- - -
- 46.15% - Functions - 6/13 -
- - -
- 60.41% - Lines - 29/48 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
useArrivals.ts -
-
56.75%21/3733.33%1/342.85%3/756.75%21/37
useGetStationsLocally.ts -
-
72.72%8/11100%0/050%3/672.72%8/11
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/hooks/useArrivals.ts.html b/client/coverage/lcov-report/hooks/useArrivals.ts.html deleted file mode 100644 index ec49523..0000000 --- a/client/coverage/lcov-report/hooks/useArrivals.ts.html +++ /dev/null @@ -1,268 +0,0 @@ - - - - - - Code coverage report for hooks/useArrivals.ts - - - - - - - - - -
-
-

All files / hooks useArrivals.ts

-
- -
- 56.75% - Statements - 21/37 -
- - -
- 33.33% - Branches - 1/3 -
- - -
- 42.85% - Functions - 3/7 -
- - -
- 56.75% - Lines - 21/37 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62  -  -  -  -2x -  -2x -2x -2x -2x -2x -2x -  -1x -1x -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x -1x -1x -1x -  -  -  -2x -  -  -  -  -  -  -2x -2x -1x -1x -  -  -2x -  -2x - 
/**
- * Arrival
- * @type {Hooks}
- */
-import React, { useState, useEffect, useRef, useCallback } from "react";
- 
-const useArrivals = (initialState) => {
-  const isFetching = useRef(true);
-  const [data, setData] = useState(null);
-  const [loading, setLoading] = useState(true);
-  const [error, setError] = useState(false);
-  const getArrivals = useCallback(async (initialState) => {
- 
-    try {
-      const headers = {
-        "Access-Control-Allow-Origin": "*",
-        "Content-Type": "application/json",
-      };
-      await fetch(`${process.env.SERVER_URL}/arrivals/${initialState?.map_id}`, { headers })
-      .then((response) => response.json())
-      .then((res) => {
-        if (res?.ctatt.errNm != null) {
-          setData(res?.ctatt.errNm);
-          setLoading(false); 
-          setError(false);
-        } else {
-          setData(res?.ctatt.eta);
-          setLoading(false);
-          setError(true);
-        }
-      })
-      .catch((error) => {
-        console.log(`Error: ${error}`);
-        setData(error);
-        setLoading(false);
-        setError(true);
-      });
-    } catch (error) {
-      console.log(error);
-      setData(error);
-      setLoading(false);
-      setError(true);
-    }
-  }, []);
- 
-  const refreshData = useCallback((payload) => {
-    setData(null);
-    setLoading(null);
-    setError(null);
-    isFetching.current = true;
-  }, []);
- 
-  useEffect(() => {
-    if (isFetching.current) {
-      isFetching.current = false;
-      getArrivals(initialState);
-    }
-  }, [isFetching.current]);
-  return { data, loading, error, refetch: refreshData };
-};
-export default useArrivals;
- 
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/hooks/useGetStationsLocally.ts.html b/client/coverage/lcov-report/hooks/useGetStationsLocally.ts.html deleted file mode 100644 index 9240946..0000000 --- a/client/coverage/lcov-report/hooks/useGetStationsLocally.ts.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - Code coverage report for hooks/useGetStationsLocally.ts - - - - - - - - - -
-
-

All files / hooks useGetStationsLocally.ts

-
- -
- 72.72% - Statements - 8/11 -
- - -
- 100% - Branches - 0/0 -
- - -
- 50% - Functions - 3/6 -
- - -
- 72.72% - Lines - 8/11 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26  -  -  -  -1x -  -  -1x -1x -  -1x -1x -  -  -  -  -  -  -  -  -  -1x -1x -  -1x - 
/**
- * Find stations locally
- * @type {Hooks}
- */
-import { useState, useEffect } from 'react';
-import { Stations } from 'components/Map';
- 
-export default function useGetStationsLocally(url) {
-    const [stations, getStations] = useState<Stations[]>([]);
- 
-    const getData = (url: string) => {
-        fetch(url, {
-            method: 'GET',
-        })
-        .then(response => response.json())
-        .then(result => {
-            getStations(result);
-        })
-        .catch(error => console.log('error', error));
-    };
- 
-    useEffect(() => {
-        return getData(url);
-    }, [url]);
-    return { stations };
-}
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/index.html b/client/coverage/lcov-report/index.html deleted file mode 100644 index fe0d101..0000000 --- a/client/coverage/lcov-report/index.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - Code coverage report for All files - - - - - - - - - -
-
-

All files

-
- -
- Unknown% - Statements - 0/0 -
- - -
- Unknown% - Branches - 0/0 -
- - -
- Unknown% - Functions - 0/0 -
- - -
- Unknown% - Lines - 0/0 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/jest.config.ts.html b/client/coverage/lcov-report/jest.config.ts.html deleted file mode 100644 index 92f2ff8..0000000 --- a/client/coverage/lcov-report/jest.config.ts.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - Code coverage report for jest.config.ts - - - - - - - - - -
-
-

All files jest.config.ts

-
- -
- 0% - Statements - 0/1 -
- - -
- 100% - Branches - 0/0 -
- - -
- 100% - Functions - 0/0 -
- - -
- 0% - Lines - 0/1 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 
/** @type {import('jest').Config} */
- 
-const config = {
-  testEnvironment: "jsdom",
-  moduleFileExtensions: ["js", "json", "ts", "tsx", "jsx", "node", "mjs"],
-  clearMocks: true,
-  collectCoverage: true,
-  transform: {
-    "^.+\\.(j|t)sx?$": "babel-jest",
-  },
-  testMatch: [
-    "<rootDir>/src/**/*.test.{js,jsx,ts,tsx}",
-    "<rootDir>/src/test/**/*.test.{js,jsx,ts,tsx}",
-  ],
-  collectCoverageFrom: [
-    "<rootDir>/src/components/**/*.{ts,tsx,js,jsx}",
-    "!<rootDir>/src/components/index.ts",
-  ],
-  testPathIgnorePatterns: ["/node_modules/"],
-  coverageThreshold: {
-    global: {
-      branches: 80,
-      statements: 80,
-      functions: 80,
-      lines: 80,
-    },
-  },
-  moduleNameMapper: {
-    "^@components/(.*)$": "<rootDir>/src/components/$1",
-    "^@hooks/(.*)$": "<rootDir>/src/hooks/$1",
-    "\\.(css|scss|sass)$": "identity-obj-proxy",
-  },
-  setupFilesAfterEnv: ["<rootDir>/setupTest.ts"],
-};
- 
-export default config;
- 
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/prettify.css b/client/coverage/lcov-report/prettify.css deleted file mode 100644 index b317a7c..0000000 --- a/client/coverage/lcov-report/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/client/coverage/lcov-report/prettify.js b/client/coverage/lcov-report/prettify.js deleted file mode 100644 index b322523..0000000 --- a/client/coverage/lcov-report/prettify.js +++ /dev/null @@ -1,2 +0,0 @@ -/* eslint-disable */ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/client/coverage/lcov-report/sort-arrow-sprite.png b/client/coverage/lcov-report/sort-arrow-sprite.png deleted file mode 100644 index 6ed68316eb3f65dec9063332d2f69bf3093bbfab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 138 zcmeAS@N?(olHy`uVBq!ia0vp^>_9Bd!3HEZxJ@+%Qh}Z>jv*C{$p!i!8j}?a+@3A= zIAGwzjijN=FBi!|L1t?LM;Q;gkwn>2cAy-KV{dn nf0J1DIvEHQu*n~6U}x}qyky7vi4|9XhBJ7&`njxgN@xNA8m%nc diff --git a/client/coverage/lcov-report/sorter.js b/client/coverage/lcov-report/sorter.js deleted file mode 100644 index 120aa14..0000000 --- a/client/coverage/lcov-report/sorter.js +++ /dev/null @@ -1,214 +0,0 @@ -/* eslint-disable */ -var escapeHTML = function(str) { - if (!str) return ''; - return str.replace(/[&<>"'`=\/]/g, function(s) { - return ({ - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`', - '=': '=', - '/': '/' - })[s]; - }); -}; - -var addSorting = (function() { - 'use strict'; - var cols, - currentSort = { - index: 0, - desc: false - }; - - // returns the summary table element - function getTable() { - return document.querySelector('.coverage-summary'); - } - // returns the thead element of the summary table - function getTableHeader() { - return getTable().querySelector('thead tr'); - } - // returns the tbody element of the summary table - function getTableBody() { - return getTable().querySelector('tbody'); - } - // returns the th element for nth column - function getNthColumn(n) { - return getTableHeader().querySelectorAll('th')[n]; - } - - function onFilterInput() { - const searchValue = document.getElementById('fileSearch').value; - const rows = document.getElementsByTagName('tbody')[0].children; - for (let i = 0; i < rows.length; i++) { - const row = rows[i]; - if ( - row.textContent - .toLowerCase() - .includes(searchValue.toLowerCase()) - ) { - row.style.display = ''; - } else { - row.style.display = 'none'; - } - } - } - - // loads the search box - function addSearchBox() { - var template = document.getElementById('filterTemplate'); - var templateClone = template.content.cloneNode(true); - templateClone.getElementById('fileSearch').oninput = onFilterInput; - template.parentElement.appendChild(templateClone); - } - - // loads all columns - function loadColumns() { - var colNodes = getTableHeader().querySelectorAll('th'), - colNode, - cols = [], - col, - i; - - for (i = 0; i < colNodes.length; i += 1) { - colNode = colNodes[i]; - col = { - key: colNode.getAttribute('data-col'), - sortable: !colNode.getAttribute('data-nosort'), - type: colNode.getAttribute('data-type') || 'string' - }; - cols.push(col); - if (col.sortable) { - col.defaultDescSort = col.type === 'number'; - colNode.innerHTML = - colNode.innerHTML + ''; - } - } - return cols; - } - // attaches a data attribute to every tr element with an object - // of data values keyed by column name - function loadRowData(tableRow) { - var tableCols = tableRow.querySelectorAll('td'), - colNode, - col, - data = {}, - i, - val; - for (i = 0; i < tableCols.length; i += 1) { - colNode = tableCols[i]; - col = cols[i]; - val = colNode.getAttribute('data-value'); - if (col.type === 'number') { - val = Number(val); - } else { - val = escapeHTML(val); - } - data[col.key] = val; - } - return data; - } - // loads all row data - function loadData() { - var rows = getTableBody().querySelectorAll('tr'), - i; - - for (i = 0; i < rows.length; i += 1) { - rows[i].data = loadRowData(rows[i]); - } - } - // sorts the table using the data for the ith column - function sortByIndex(index, desc) { - var key = cols[index].key, - sorter = function(a, b) { - a = a.data[key]; - b = b.data[key]; - return a < b ? -1 : a > b ? 1 : 0; - }, - finalSorter = sorter, - tableBody = document.querySelector('.coverage-summary tbody'), - rowNodes = tableBody.querySelectorAll('tr'), - rows = [], - i; - - if (desc) { - finalSorter = function(a, b) { - return -1 * sorter(a, b); - }; - } - - for (i = 0; i < rowNodes.length; i += 1) { - rows.push(rowNodes[i]); - tableBody.removeChild(rowNodes[i]); - } - - rows.sort(finalSorter); - - for (i = 0; i < rows.length; i += 1) { - tableBody.appendChild(rows[i]); - } - } - // removes sort indicators for current column being sorted - function removeSortIndicators() { - var col = getNthColumn(currentSort.index), - cls = col.className; - - cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); - col.className = cls; - } - // adds sort indicators for current column being sorted - function addSortIndicators() { - getNthColumn(currentSort.index).className += currentSort.desc - ? ' sorted-desc' - : ' sorted'; - } - // adds event listeners for all sorter widgets - function enableUI() { - var i, - el, - ithSorter = function ithSorter(i) { - var col = cols[i]; - - return function() { - var desc = col.defaultDescSort; - - if (currentSort.index === i) { - desc = !currentSort.desc; - } - sortByIndex(i, desc); - removeSortIndicators(); - currentSort.index = i; - currentSort.desc = desc; - addSortIndicators(); - }; - }; - for (i = 0; i < cols.length; i += 1) { - if (cols[i].sortable) { - // add the click event handler on the th so users - // dont have to click on those tiny arrows - el = getNthColumn(i).querySelector('.sorter').parentElement; - if (el.addEventListener) { - el.addEventListener('click', ithSorter(i)); - } else { - el.attachEvent('onclick', ithSorter(i)); - } - } - } - } - // adds sorting functionality to the UI - return function() { - if (!getTable()) { - return; - } - cols = loadColumns(); - loadData(); - addSearchBox(); - addSortIndicators(); - enableUI(); - }; -})(); - -window.addEventListener('load', addSorting); diff --git a/client/coverage/lcov-report/useArrivals.ts.html b/client/coverage/lcov-report/useArrivals.ts.html deleted file mode 100644 index 03fab1f..0000000 --- a/client/coverage/lcov-report/useArrivals.ts.html +++ /dev/null @@ -1,268 +0,0 @@ - - - - - - Code coverage report for useArrivals.ts - - - - - - - - - -
-
-

All files useArrivals.ts

-
- -
- 56.75% - Statements - 21/37 -
- - -
- 33.33% - Branches - 1/3 -
- - -
- 42.85% - Functions - 3/7 -
- - -
- 56.75% - Lines - 21/37 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62  -  -  -  -1x -  -1x -2x -2x -2x -2x -2x -  -1x -1x -  -  -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x -1x -1x -1x -  -  -  -2x -  -  -  -  -  -  -2x -2x -1x -1x -  -  -2x -  -1x - 
/**
- * Arrival
- * @type {Hooks}
- */
-import React, { useState, useEffect, useRef, useCallback } from "react";
- 
-const useArrivals = (initialState) => {
-  const isFetching = useRef(true);
-  const [data, setData] = useState(null);
-  const [loading, setLoading] = useState(true);
-  const [error, setError] = useState(false);
-  const getArrivals = useCallback(async (initialState) => {
- 
-    try {
-      const headers = {
-        "Access-Control-Allow-Origin": "*",
-        "Content-Type": "application/json",
-      };
-      await fetch(`${process.env.SERVER_URL}/arrivals/${initialState?.map_id}`, { headers })
-      .then((response) => response.json())
-      .then((res) => {
-        if (res?.ctatt.errNm != null) {
-          setData(res?.ctatt.errNm);
-          setLoading(false); 
-          setError(false);
-        } else {
-          setData(res?.ctatt.eta);
-          setLoading(false);
-          setError(true);
-        }
-      })
-      .catch((error) => {
-        console.log(`Error: ${error}`);
-        setData(error);
-        setLoading(false);
-        setError(true);
-      });
-    } catch (error) {
-      console.log(error);
-      setData(error);
-      setLoading(false);
-      setError(true);
-    }
-  }, []);
- 
-  const refreshData = useCallback((payload) => {
-    setData(null);
-    setLoading(null);
-    setError(null);
-    isFetching.current = true;
-  }, []);
- 
-  useEffect(() => {
-    if (isFetching.current) {
-      isFetching.current = false;
-      getArrivals(initialState);
-    }
-  }, [isFetching.current]);
-  return { data, loading, error, refetch: refreshData };
-};
-export default useArrivals;
- 
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/utils/color.ts.html b/client/coverage/lcov-report/utils/color.ts.html deleted file mode 100644 index 1d74b73..0000000 --- a/client/coverage/lcov-report/utils/color.ts.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - Code coverage report for utils/color.ts - - - - - - - - - -
-
-

All files / utils color.ts

-
- -
- 36.36% - Statements - 8/22 -
- - -
- 22.22% - Branches - 2/9 -
- - -
- 100% - Functions - 1/1 -
- - -
- 33.33% - Lines - 7/21 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -332x -  -2x -  -1x -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x -1x -  -2x - 
export const getColorByStation = (stationColor: string) => {
-    let color;
-    switch (stationColor) {
-        case "pink":
-            color = '#e27ea6';
-            break;
-        case 'blue':
-            color = '#00a1de';
-            break;
-        case 'g':
-            color = '#009b3a';
-            break;
-        case 'brn':
-            color = '#62361b';
-            break;
-        case 'p':
-            color = '#522398';
-            break;
-        case 'y':
-            color = '#f9e300';
-            break;
-        case 'red':
-            color = '#c60c30';
-            break;
-        case 'org':
-            color = '#f9461c';
-            break;
-        default:
-            color = '#565a5c';
-            break;
-    }
-    return color;
-};
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/utils/index.html b/client/coverage/lcov-report/utils/index.html deleted file mode 100644 index baeff31..0000000 --- a/client/coverage/lcov-report/utils/index.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - Code coverage report for utils - - - - - - - - - -
-
-

All files utils

-
- -
- 44.11% - Statements - 15/34 -
- - -
- 40% - Branches - 6/15 -
- - -
- 37.5% - Functions - 3/8 -
- - -
- 40% - Lines - 10/25 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
color.ts -
-
36.36%8/2222.22%2/9100%1/133.33%7/21
map.ts -
-
58.33%7/1266.66%4/628.57%2/775%3/4
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov-report/utils/map.ts.html b/client/coverage/lcov-report/utils/map.ts.html deleted file mode 100644 index 1d67eff..0000000 --- a/client/coverage/lcov-report/utils/map.ts.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - Code coverage report for utils/map.ts - - - - - - - - - -
-
-

All files / utils map.ts

-
- -
- 58.33% - Statements - 7/12 -
- - -
- 66.66% - Branches - 4/6 -
- - -
- 28.57% - Functions - 2/7 -
- - -
- 75% - Lines - 3/4 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

- -
-
-

-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -261x -  -1x -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1x
import { getColorByStation } from "./color";
- 
-export const mapMarkers = (stations) => stations && stations?.map((station, i) => station?.stops.map((stop) => ({
-    color: getColorByStation(Object.keys(stop).find((key, i) => stop[key] === true && key !== 'ada')),
-    lat: stop?.lat,
-    lng: stop?.lng,
-    title: stop?.stop_name,
-    ada: stop?.ada,
-    blue: stop?.blue,
-    brn: stop?.brn,
-    direction: stop?.direction,
-    g: stop?.g,
-    map_id: stop?.map_id,
-    org: stop?.org,
-    p: stop?.p,
-    pink: stop?.pink,
-    purple_express: stop?.purple_express,
-    red: stop?.red,
-    station_descriptive_name: stop?.station_descriptive_name,
-    stop_id: stop?.stop_id,
-    stop_name: stop?.stop_name,
-    y: stop?.y,
-}))).flat();
- 
- 
-export const mapStations = (stations) => stations && stations?.filter((obj1, i, station) => station.findIndex(obj2 => (obj2.station_descriptive_name === obj1.station_descriptive_name)) === i);
- -
-
- - - - - - - - \ No newline at end of file diff --git a/client/coverage/lcov.info b/client/coverage/lcov.info deleted file mode 100644 index e69de29..0000000 From 8d456d4f6183e7110317d94e460caabeaf629a96 Mon Sep 17 00:00:00 2001 From: Markj89 <3435026+Markj89@users.noreply.github.com> Date: Thu, 12 Mar 2026 22:08:12 -0500 Subject: [PATCH 8/8] testcase changes --- .gitignore | 24 +-- client/jest.config.ts | 16 +- client/package.json | 7 +- client/setupTest.ts | 23 ++- client/src/App.tsx | 22 ++- client/src/assets/img/List.svg | 2 +- client/src/assets/img/Train-Icon.svg | 12 +- .../Button/__tests__/Button.test.tsx | 13 +- .../__snapshots__/Button.test.tsx.snap | 9 -- .../components/Card/__tests__/Card.test.tsx | 2 +- .../__snapshots__/Card.test.tsx.snap | 9 -- client/src/components/Drawer/Drawer.tsx | 32 ++-- .../Drawer/__tests__/Drawer.logic.test.ts | 0 .../Drawer/__tests__/Drawer.test.tsx | 17 +-- client/src/components/Header/Header.tsx | 27 ++++ client/src/components/Header/index.ts | 1 + client/src/components/Icon/Icon.tsx | 3 + client/src/components/Icon/ListIcon.tsx | 14 +- client/src/components/Icon/StationsIcon.tsx | 15 +- client/src/components/Icon/TrainIcon.tsx | 12 +- client/src/components/Icon/TrainsIcon.tsx | 25 ++++ .../components/Icon/__tests__/Icon.test.tsx | 11 +- .../__snapshots__/Icon.test.tsx.snap | 61 -------- client/src/components/Loader/LoadingPage.tsx | 2 +- .../Loader/__tests__/LoadingPage.test.tsx | 6 +- client/src/components/Map/Map.logic.ts | 19 ++- .../src/components/Map/__tests__/Map.test.tsx | 39 ++++- client/src/components/Marker/Marker.tsx | 16 +- .../components/SearchInput/SearchInput.tsx | 140 ++++++++---------- .../SearchInput/SearchInputOptions.tsx | 71 +++++++++ client/src/context/MapContext.provider.tsx | 4 +- client/src/context/MapContext.types.ts | 4 +- .../src/hooks/__tests__/useArrivals.test.ts | 91 +++++++----- client/src/hooks/useArrivals.ts | 2 +- client/src/index.tsx | 12 +- client/src/styles/components/_buttons.scss | 73 --------- client/src/styles/components/_colors.scss | 8 - client/src/styles/components/_dropdown.scss | 70 --------- client/src/styles/components/_list.scss | 32 ---- client/src/styles/components/_section.scss | 42 ------ client/src/styles/components/header.css | 5 + client/src/styles/components/icons.css | 82 ++++++++++ client/src/styles/components/search.css | 7 + client/src/styles/components/searchinput.css | 19 +++ client/src/utils/index.ts | 4 + client/src/utils/keyboard.ts | 13 ++ client/tsconfig.json | 18 ++- settings.json | 3 + 48 files changed, 626 insertions(+), 513 deletions(-) delete mode 100644 client/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap delete mode 100644 client/src/components/Card/__tests__/__snapshots__/Card.test.tsx.snap delete mode 100644 client/src/components/Drawer/__tests__/Drawer.logic.test.ts create mode 100644 client/src/components/Header/Header.tsx create mode 100644 client/src/components/Header/index.ts create mode 100644 client/src/components/Icon/TrainsIcon.tsx delete mode 100644 client/src/components/Icon/__tests__/__snapshots__/Icon.test.tsx.snap create mode 100644 client/src/components/SearchInput/SearchInputOptions.tsx delete mode 100644 client/src/styles/components/_buttons.scss delete mode 100644 client/src/styles/components/_colors.scss delete mode 100644 client/src/styles/components/_dropdown.scss delete mode 100644 client/src/styles/components/_list.scss delete mode 100644 client/src/styles/components/_section.scss create mode 100644 client/src/styles/components/header.css create mode 100644 client/src/styles/components/icons.css create mode 100644 client/src/styles/components/search.css create mode 100644 client/src/styles/components/searchinput.css create mode 100644 client/src/utils/index.ts create mode 100644 client/src/utils/keyboard.ts create mode 100644 settings.json diff --git a/.gitignore b/.gitignore index 6edb907..649f96b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,14 +2,14 @@ # dependencies /node_modules -/client/node_modules/ -/client/package-lock.json -/client/.env -/client/yarn.lock -/server/node_modules/ -/server/package-lock.json -/server/yarn.lock -/server/stations.txt +client/node_modules/ +client/package-lock.json +client/.env +client/yarn.lock +server/node_modules/ +server/package-lock.json +server/yarn.lock +server/stations.txt .env /.pnp .pnp.js @@ -23,7 +23,6 @@ keytmp.pem # testing /coverage -/inspiration # production /client/public @@ -42,3 +41,10 @@ public npm-debug.log* yarn-debug.log* yarn-error.log* + +# Testing +/coverage +.coverage +.coverage.* +/client/coverage +/inspiration diff --git a/client/jest.config.ts b/client/jest.config.ts index 7ad03d9..c267280 100644 --- a/client/jest.config.ts +++ b/client/jest.config.ts @@ -2,19 +2,18 @@ import type { Config } from "jest"; const config: Config = { - testEnvironment: "jsdom", preset: "ts-jest", // ✅ Ensures Jest uses ts-jest to process TypeScript - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', + testEnvironment: "jsdom", moduleFileExtensions: ["js", "json", "ts", "tsx", "jsx", "json", "node", "mjs"], clearMocks: true, - collectCoverage: true, + collectCoverage: false, transform: { - "^.+\\.(j|t)sx?$": "babel-jest", - '^.+\\.tsx?$': 'ts-jest', + "^.+\\.tsx?$": ["ts-jest", { tsconfig: "tsconfig.json" }], + // diagnostics: { ignoreCodes: [1343] }, }, testMatch: [ "/src/**/*.test.{js,jsx,ts,tsx}", - "/src/test/**/*.test.{js,jsx,ts,tsx}", + "/src/__tests__/**/*.test.{js,jsx,ts,tsx}", ], collectCoverageFrom: [ "/src/components/**/*.{ts,tsx,js,jsx}", @@ -34,7 +33,10 @@ const config: Config = { "^@hooks/(.*)$": "/src/hooks/$1", "\\.(css|scss|sass)$": "identity-obj-proxy", }, - setupFilesAfterEnv: ["/setupTest.ts"], + setupFilesAfterEnv: [ + "jest-extended/all", + "/setupTest.ts" + ] }; module.exports = config; diff --git a/client/package.json b/client/package.json index 6bbf7bc..aad500a 100644 --- a/client/package.json +++ b/client/package.json @@ -5,6 +5,7 @@ "private": true, "description": "A React based Transit tracker for Chicago Transit Authority (CTA)", "dependencies": { + "@auth0/auth0-react": "^2.15.0", "@babel/preset-typescript": "^7.23.3", "@googlemaps/markerclusterer": "^2.5.3", "@googlemaps/react-wrapper": "^1.1.35", @@ -30,7 +31,9 @@ "react-dom": "^18.2.0", "react-select": "^5.8.0", "resolve-url-loader": "^4.0.0", + "text-encoding": "^0.7.0", "ts-node": "^10.9.1", + "tsconfig-paths": "^4.2.0", "typescript": "^5.3.3", "vite": "^6.0.7", "webpack-merge": "^5.10.0" @@ -45,8 +48,7 @@ "prettier": "prettier \"**/*.js,jsx,ts,tsx,json,css,md}\" --write", "format": "prettier", "format-staged": "git-format-staged --formattter 'prettier --stdin-filepath \"{}\"' src/*.js src/*.js src/*.jsx src/*.ts src/*.tsx", - "check-format": "prettier --check", - "coverage": "cross-en BABEL_ENV=test jest --coverage --maxWorkers 2" + "check-format": "prettier --check" }, "browserslist": { "production": [ @@ -112,6 +114,7 @@ "http-proxy-middleware": "^2.0.9", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", + "jest-extended": "^7.0.0", "jest-multiple-result-processors": "^0.0.4", "jest-svg-transformer": "^1.0.0", "mini-css-extract-plugin": "^2.7.6", diff --git a/client/setupTest.ts b/client/setupTest.ts index e8b556e..e1e543c 100644 --- a/client/setupTest.ts +++ b/client/setupTest.ts @@ -1,10 +1,21 @@ +import { jest } from '@jest/globals' import "@testing-library/jest-dom"; -import "jest-extended"; +import "jest-extended/all"; +import { TextEncoder } from 'text-encoding'; -global.matchMedia = global.matchMedia || (() => ({ - matches: false, - addListener: jest.fn(), - removeListener: jest.fn(), -})); +global.TextEncoder = TextEncoder; +Object.defineProperty(window, 'matchMedia', { + writable: true, + value: jest.fn().mockImplementation(query => ({ + matches: false, + media: query, + onchange: null, + addListener: jest.fn(), // Deprecated + removeListener: jest.fn(), // Deprecated + addEventListener: jest.fn(), + removeEventListener: jest.fn(), + dispatchEvent: jest.fn(), + })), +}); window.HTMLElement.prototype.scrollIntoView = jest.fn(); diff --git a/client/src/App.tsx b/client/src/App.tsx index 4054b8f..50ab804 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -4,19 +4,20 @@ import { MapContext } from './context/MapContext'; import useGetCurrentPosition from './hooks/useGetCurrentPosition'; import useGetStations from './hooks/useGetStations'; import useWindowDimensions from './hooks/useWindowDimensions'; -import { LoadingPage } from './components/Loader'; +import { Loader, LoadingPage } from './components/Loader'; import { Status, Wrapper } from '@googlemaps/react-wrapper'; import useScreenSize from './hooks/useScreenSize'; -import { BrowserRouter, Routes, Route } from 'react-router-dom'; +import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; import NotFound from './Pages/404'; import ListPage from './Pages/ListPage'; import { mapMarkers, mapStations } from './utils/map'; import { findLocationsInRange } from './components/Map/Map.logic'; import useArrivals from './hooks/useArrivals'; import useArrivalById from './hooks/useArrivalById'; +import Header from './components/Header/Header'; function App() { - const {location, setLocation, setScreenSize, station } = useContext(MapContext); + const {location, setLocation, setScreenSize, station, setStations } = useContext(MapContext); const { height, width } = useWindowDimensions(); const { isLoading, currentLocation } = useGetCurrentPosition({initialCenter: {lat: 0, lng: 0}}); const render = (status: Status) => (

{status}

); @@ -48,7 +49,8 @@ function App() { const [loading, setLoading] = useState(true) useEffect(() => { setTimeout(() => setLoading(false), 3300) - }, []); + setStations(stations); + }, [stations]); useEffect(() => { if (station) { @@ -63,7 +65,8 @@ function App() { return (
- + +
} /> - } /> + + ) : ( + + )} /> - +
); diff --git a/client/src/assets/img/List.svg b/client/src/assets/img/List.svg index fd16bf0..e3bf9b4 100644 --- a/client/src/assets/img/List.svg +++ b/client/src/assets/img/List.svg @@ -1,6 +1,6 @@ - + diff --git a/client/src/assets/img/Train-Icon.svg b/client/src/assets/img/Train-Icon.svg index 8468cda..9ac297a 100644 --- a/client/src/assets/img/Train-Icon.svg +++ b/client/src/assets/img/Train-Icon.svg @@ -2,10 +2,10 @@ - - - - - - + + + + + + diff --git a/client/src/components/Button/__tests__/Button.test.tsx b/client/src/components/Button/__tests__/Button.test.tsx index 4dc09ff..7d44aa4 100644 --- a/client/src/components/Button/__tests__/Button.test.tsx +++ b/client/src/components/Button/__tests__/Button.test.tsx @@ -1,4 +1,4 @@ -import { render } from '@testing-library/react'; +import { render, fireEvent } from '@testing-library/react'; import { screen } from '@testing-library/dom'; import Button from '../Button'; @@ -9,6 +9,15 @@ describe('Button', () => { , ); const buttonElement = screen.getByTestId("button-component"); - expect(buttonElement).toMatchSnapshot(); + expect(buttonElement).toBeInTheDocument(); + }); + + it('should call onClick when the button is clicked', () => { + const onClickFn = jest.fn(); + render(); + const buttonMock = screen.getByText(/click me/i); + fireEvent.mouseDown(buttonMock); + expect(onClickFn).toHaveBeenCalled(); + expect(onClickFn).toHaveBeenCalledTimes(1); }); }); \ No newline at end of file diff --git a/client/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap b/client/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap deleted file mode 100644 index 57e6fbf..0000000 --- a/client/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Button should render button component 1`] = ` - -`; diff --git a/client/src/components/Card/__tests__/Card.test.tsx b/client/src/components/Card/__tests__/Card.test.tsx index 6445808..8ec9a3a 100644 --- a/client/src/components/Card/__tests__/Card.test.tsx +++ b/client/src/components/Card/__tests__/Card.test.tsx @@ -8,6 +8,6 @@ describe('Card', () => { Hello World ); - expect(wrapper.container.firstChild).toMatchSnapshot(); + expect(wrapper.container.firstChild).toBeInTheDocument(); }); }); \ No newline at end of file diff --git a/client/src/components/Card/__tests__/__snapshots__/Card.test.tsx.snap b/client/src/components/Card/__tests__/__snapshots__/Card.test.tsx.snap deleted file mode 100644 index e051db9..0000000 --- a/client/src/components/Card/__tests__/__snapshots__/Card.test.tsx.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Card should render card component and match snapshot 1`] = ` -
- Hello World -
-`; diff --git a/client/src/components/Drawer/Drawer.tsx b/client/src/components/Drawer/Drawer.tsx index 5717f9f..365c26e 100644 --- a/client/src/components/Drawer/Drawer.tsx +++ b/client/src/components/Drawer/Drawer.tsx @@ -5,10 +5,13 @@ */ import Card from "../Card/Card"; import { CardContainer } from "../CardContainer"; -import React, { useState, ReactNode, useEffect } from "react"; +import React, { useState, ReactNode, useEffect, useContext} from "react"; import { animated } from "react-spring"; import clsx from "clsx"; import DrawerHeader from "./DrawerHeader"; +import { MapContext } from "./../../context/MapContext"; +import { getStationsNames } from './../Map/Map.logic' +import SearchInput from "./../SearchInput/SearchInput"; interface DrawerProps { children: ReactNode; @@ -16,16 +19,21 @@ interface DrawerProps { onBackdropClick: () => void; side: string; open: boolean; - headline: string; + headline?: string; + ariaLabel?: string; + searchBar?: boolean; } const Drawer = React.forwardRef( ( - { children, className, onBackdropClick, headline, side = "bottom", open = false }: DrawerProps, + { children, className, onBackdropClick, headline, side = "bottom", open = false, searchBar = false, ariaLabel = "Search Bar" }: DrawerProps, ref ) => { const [isOpen, setIsOpen] = useState(open); - + const [isLoading, setIsLoading] = useState(true); + const { stations } = useContext(MapContext); + const stationNames = getStationsNames(stations); + useEffect(() => { if (open) { setIsOpen(open); @@ -34,7 +42,7 @@ const Drawer = React.forwardRef( return ( onBackdropClick()} id={`dialog-${side}`} role="dialog" aria-labelledby="slide-over" @@ -47,17 +55,23 @@ const Drawer = React.forwardRef(
{ headline && (
+
)} - -
- {children} + +
e.stopPropagation()}> + {searchBar && ( + + )} + <> + {children} +
diff --git a/client/src/components/Drawer/__tests__/Drawer.logic.test.ts b/client/src/components/Drawer/__tests__/Drawer.logic.test.ts deleted file mode 100644 index e69de29..0000000 diff --git a/client/src/components/Drawer/__tests__/Drawer.test.tsx b/client/src/components/Drawer/__tests__/Drawer.test.tsx index cc9ae5c..926bd6f 100644 --- a/client/src/components/Drawer/__tests__/Drawer.test.tsx +++ b/client/src/components/Drawer/__tests__/Drawer.test.tsx @@ -1,24 +1,23 @@ import React from "react"; import { render, fireEvent } from "@testing-library/react"; -import "@testing-library/jest-dom/extend-expect"; import Drawer from "../Drawer"; describe("Drawer Component", () => { test("renders Drawer component correctly", () => { const { getByRole } = render( - jest.fn()}> + jest.fn()}>

Drawer Content

); // Drawer should be rendered but hidden expect(getByRole("dialog")).toBeInTheDocument(); - expect(getByRole("dialog")).toHaveClass("fixed z-10"); + expect(getByRole("dialog")).toHaveClass("fixed z-40"); }); test("shows drawer when open is true", () => { const { getByRole } = render( - jest.fn()}> + jest.fn()}>

Drawer Content

); @@ -29,19 +28,19 @@ describe("Drawer Component", () => { test("hides drawer when open is false", () => { const { getByRole } = render( - jest.fn()}> + jest.fn()}>

Drawer Content

); // Drawer should be present but not visible - expect(getByRole("dialog")).toHaveClass("fixed z-10"); + expect(getByRole("dialog")).toHaveClass("fixed z-40"); }); test("calls onClick when clicked", () => { const handleClick = jest.fn(); const { getByRole } = render( - +

Drawer Content

); @@ -54,7 +53,7 @@ describe("Drawer Component", () => { test("renders children inside the drawer", () => { const { getByText } = render( - jest.fn()}> + jest.fn()}>

Drawer Content

); @@ -64,7 +63,7 @@ describe("Drawer Component", () => { test("displays the correct headline", () => { const { getByText } = render( - jest.fn()}> + jest.fn()}>

Drawer Content

); diff --git a/client/src/components/Header/Header.tsx b/client/src/components/Header/Header.tsx new file mode 100644 index 0000000..c9e0e63 --- /dev/null +++ b/client/src/components/Header/Header.tsx @@ -0,0 +1,27 @@ +/** + * Header Component + * Create a Header Component + * @type {Component} + * @returns JSX.Element + */ + +import React from 'react'; +import white_logo from './../../assets/img/logo (white).png'; +import clsx from 'clsx'; + +const Header: React.FC = ({ }) => { + return ( +
+ +
+ ); +} + +export default Header; \ No newline at end of file diff --git a/client/src/components/Header/index.ts b/client/src/components/Header/index.ts new file mode 100644 index 0000000..64f7c87 --- /dev/null +++ b/client/src/components/Header/index.ts @@ -0,0 +1 @@ +export * from './Header'; \ No newline at end of file diff --git a/client/src/components/Icon/Icon.tsx b/client/src/components/Icon/Icon.tsx index 150376c..4c5fd43 100644 --- a/client/src/components/Icon/Icon.tsx +++ b/client/src/components/Icon/Icon.tsx @@ -5,17 +5,20 @@ import React, { SVGProps } from "react"; import StationsIcon from './StationsIcon'; import TrainIcon from "./TrainIcon"; +import TrainsIcon from "./TrainsIcon"; import ListIcon from "./ListIcon"; export enum ICONS { Stations = 'Stations', Train = 'Train', + Trains = 'Trains', List = 'List' } const getIcons = (props: SVGProps) => ({ Station: , Train: , + Trains: , List: }); diff --git a/client/src/components/Icon/ListIcon.tsx b/client/src/components/Icon/ListIcon.tsx index 9f09338..f7dc02f 100644 --- a/client/src/components/Icon/ListIcon.tsx +++ b/client/src/components/Icon/ListIcon.tsx @@ -2,9 +2,13 @@ * List Icon * @type {Component} */ -import React, { SVGProps } from "react"; +import React from "react"; -const ListIcon = (props: SVGProps) => { +interface IconProps extends React.SVGProps { + size?: number | string; +} + +const ListIcon = (props: IconProps) => { const { color, size } = props; return ( ) => { id="Icon" d="M13 9.75H34.125M13 19.5H34.125M13 29.25H34.125M4.875 9.75H4.89125M4.875 19.5H4.89125M4.875 29.25H4.89125" stroke="#F5F5F5" - stroke-width="4" - stroke-linecap="round" - stroke-linejoin="round" + strokeWidth="4" + strokeLinecap="round" + strokeLinejoin="round" /> diff --git a/client/src/components/Icon/StationsIcon.tsx b/client/src/components/Icon/StationsIcon.tsx index b044d56..778fcc2 100644 --- a/client/src/components/Icon/StationsIcon.tsx +++ b/client/src/components/Icon/StationsIcon.tsx @@ -7,7 +7,20 @@ import { ReactComponent as Station } from './../../assets/img/stationPoint.svg'; const StationsIcon = (props: SVGProps) => ( - + + + + + + + + + + + + + + ); export default StationsIcon; \ No newline at end of file diff --git a/client/src/components/Icon/TrainIcon.tsx b/client/src/components/Icon/TrainIcon.tsx index e71a7f9..80a2818 100644 --- a/client/src/components/Icon/TrainIcon.tsx +++ b/client/src/components/Icon/TrainIcon.tsx @@ -18,12 +18,12 @@ const TrainIcon = (props: SVGProps) => { - - - - - - + + + + + + ); } diff --git a/client/src/components/Icon/TrainsIcon.tsx b/client/src/components/Icon/TrainsIcon.tsx new file mode 100644 index 0000000..9d149e8 --- /dev/null +++ b/client/src/components/Icon/TrainsIcon.tsx @@ -0,0 +1,25 @@ +/** + * Train Icon (Search) + * @type {Component} + * @param {color} + */ +import React, { SVGProps } from "react"; + +const TrainsIcon = (props: SVGProps): React.ReactElement => ( + + + + + +); + +export default TrainsIcon; \ No newline at end of file diff --git a/client/src/components/Icon/__tests__/Icon.test.tsx b/client/src/components/Icon/__tests__/Icon.test.tsx index ecf5b02..8b6918d 100644 --- a/client/src/components/Icon/__tests__/Icon.test.tsx +++ b/client/src/components/Icon/__tests__/Icon.test.tsx @@ -3,11 +3,10 @@ import Icon, { ICONS } from '../Icon'; describe('Icon', () => { it('should render Train Icon', () => { - const wrapper = render( ); - expect(wrapper.container.firstChild).toMatchSnapshot(); - }); - it('should render Station Icon', () => { - const wrapper = render( ); - expect(wrapper.container.firstChild).toMatchSnapshot(); + render( ); }); + // it('should render Station Icon', () => { + // const wrapper = render( ); + // expect(wrapper.container.firstChild).toBeInTheDocument(); + // }); }); \ No newline at end of file diff --git a/client/src/components/Icon/__tests__/__snapshots__/Icon.test.tsx.snap b/client/src/components/Icon/__tests__/__snapshots__/Icon.test.tsx.snap deleted file mode 100644 index 100c517..0000000 --- a/client/src/components/Icon/__tests__/__snapshots__/Icon.test.tsx.snap +++ /dev/null @@ -1,61 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Icon should render Station Icon 1`] = `null`; - -exports[`Icon should render Train Icon 1`] = ` - -`; diff --git a/client/src/components/Loader/LoadingPage.tsx b/client/src/components/Loader/LoadingPage.tsx index 237de04..98bc947 100644 --- a/client/src/components/Loader/LoadingPage.tsx +++ b/client/src/components/Loader/LoadingPage.tsx @@ -6,7 +6,7 @@ import React from 'react'; import Icon, { ICONS } from './../Icon/Icon'; export const LoadingPage = () => ( -
+
diff --git a/client/src/components/Loader/__tests__/LoadingPage.test.tsx b/client/src/components/Loader/__tests__/LoadingPage.test.tsx index 77b754a..76b301d 100644 --- a/client/src/components/Loader/__tests__/LoadingPage.test.tsx +++ b/client/src/components/Loader/__tests__/LoadingPage.test.tsx @@ -1,10 +1,10 @@ import { render, screen } from "@testing-library/react"; -import { Loader } from "../Loader"; +import { LoadingPage } from "../LoadingPage"; describe('LoadingPage', () => { it('should render Loader component', () => { - render(); + render(); const loaderElement = screen.getByTestId("loading-page-container"); - expect(loaderElement).toMatchSnapshot(); + expect(loaderElement).toBeInTheDocument(); }); }); \ No newline at end of file diff --git a/client/src/components/Map/Map.logic.ts b/client/src/components/Map/Map.logic.ts index d6a5b90..fe9d557 100644 --- a/client/src/components/Map/Map.logic.ts +++ b/client/src/components/Map/Map.logic.ts @@ -1,3 +1,4 @@ +import { Stations } from "./Map.types"; function haversine(lat1, lon1, lat2, lon2) { const R = 3958.8; // Radius of Earth in miles (use 6371 for kilometers) const dLat = toRad(lat2 - lat1); @@ -71,4 +72,20 @@ export const getGroupedDuplicateStops = (data) => { return duplicateGroups; }; - \ No newline at end of file + +export const getStationsNames = (stations: Stations[]) => { + if (!stations) return []; + + return stations.flatMap((station) => { + // find all colors that are true + const activeColors = Object.keys(station.stops) + .filter((key) => (station.stops as any)[key] === true); + + // expand into multiple objects: one per color + return activeColors.map((color) => ({ + label: station.station_name, + value: station._id + "-" + color, // ensure uniqueness + color, + })); + }); +}; \ No newline at end of file diff --git a/client/src/components/Map/__tests__/Map.test.tsx b/client/src/components/Map/__tests__/Map.test.tsx index d802acb..d63688e 100644 --- a/client/src/components/Map/__tests__/Map.test.tsx +++ b/client/src/components/Map/__tests__/Map.test.tsx @@ -1,15 +1,50 @@ import { render } from "@testing-library/react"; +import { MemoryRouter } from "react-router-dom"; import Map from "../Map"; +// Mock Google Maps +const mockMap = { + setCenter: jest.fn(), + setZoom: jest.fn(), + // Add other methods as needed +}; + +const mockGoogleMaps = { + Map: jest.fn(() => mockMap), + // Add other Google Maps classes as needed +}; + +(global as any).google = { + maps: mockGoogleMaps, +}; + describe("Map", () => { const location = { lat: 41.8786956, lng: -87.6835597, }; + it("should render Map Component", async () => { + const mockStations = []; + const mockArrivals = []; + const mockNearbyLocations = []; + const mockNearbyLocationsIds: string[] = []; + const wrapper = render( - + + + ); - expect(wrapper.container.firstChild).toMatchSnapshot(); + expect(wrapper.container.firstChild).toBeInTheDocument(); }); }); diff --git a/client/src/components/Marker/Marker.tsx b/client/src/components/Marker/Marker.tsx index 88d3071..279f038 100644 --- a/client/src/components/Marker/Marker.tsx +++ b/client/src/components/Marker/Marker.tsx @@ -33,7 +33,7 @@ const Marker: FC = ({ const { setDrawerOpen, setStation } = useContext(MapContext); useEffect(() => { - if (!map || markerRef?.current) return; + if (!map || markerRef?.current) return undefined; const pin = new google.maps.marker.PinElement({ scale }); @@ -43,20 +43,30 @@ const Marker: FC = ({ if (gmpClickable) { pin.element.setAttribute("gmpClickable", "true"); } + const infoWindow = new google.maps.InfoWindow(); const marker = new google.maps.marker.AdvancedMarkerElement({ map, position, title: station?.stop_name, content: pin.element, - gmpClickable + gmpClickable: true }); markerRef.current = marker; pinRef.current = pin; if (onClick) { - marker.addListener("click", () => { + marker.addListener("click", (event: google.maps.marker.AdvancedMarkerClickEvent, position) => { + const { target } = event; + infoWindow.close(); + + infoWindow.setContent("Test"); + infoWindow.open(marker.map, marker); + + if (marker.element) { + marker.element.focus(); + } setStation(station); setDrawerOpen(true); }); diff --git a/client/src/components/SearchInput/SearchInput.tsx b/client/src/components/SearchInput/SearchInput.tsx index e9517f5..2fe4188 100644 --- a/client/src/components/SearchInput/SearchInput.tsx +++ b/client/src/components/SearchInput/SearchInput.tsx @@ -1,86 +1,70 @@ -/** - * Search Input Component - * - * @type {Component} SearchInput - * @param - * @returns JSX.Element - */ +import React, { useState } from 'react'; +import SearchInputOptions from './SearchInputOptions'; +import clsx from 'clsx'; -import React, { useCallback, useRef } from 'react'; -import Select from 'react-select'; -import { SearchInputProps } from "./SearchInput.type"; -import { IndicatorSeparator, LoadingIndicator } from 'react-select/dist/declarations/src/components/indicators'; -import SingleValue from 'react-select/dist/declarations/src/components/SingleValue'; -import { merge } from 'lodash'; -import AsyncSelect, { AsyncProps } from 'react-select/dist/declarations/src/Async'; +const SearchInput = ({ suggestions }) => { + const [filteredSuggestion, setFilteredSuggestions] = useState([]); + const [activeSuggestionIndex, setActiveSuggestionIndex] = useState(0); + const [showSuggestions, setShowSuggestions] = useState(false); + const [input, setInput] = useState(""); + + const onChange = (e) => { + const userInput = e.target.value; -export const SearchInput = ({ - syncProps, - asyncProps, - optionComponent, - hasError = false, - onErrorHandler, - renderAnchors = true, - ariaLabel = "Search Bar", - variant = 'default' -}: SearchInputProps) => { - const hideUIElement = useCallback(() => null, []); + // Filter our suggestions that don't contain the user's input + // const unLinked = suggestions.filter( + // (suggestion) => + // suggestion.toLowerCase().indexOf(userInput.toLowerCase()) > -1 + // ); + const unLinked = suggestions?.filter((suggestion) => suggestion.label.toLowerCase().indexOf(userInput.toLowerCase()) > -1); - const commonProps = { - components: { - IndicatorSeparator: hideUIElement, - LoadingIndicator: hideUIElement, - SingleValue: hideUIElement, - Option: (optionProps) => renderAnchors? ( -
- {optionComponent(optionProps)} -
- ) : ( -
- {optionComponent({ - ...optionProps, - className: '' - })} -
- ), - } + setInput(e.target.value); + setFilteredSuggestions(unLinked); + setActiveSuggestionIndex(0); + setShowSuggestions(true); }; - const mergedSyncProps = merge(commonProps, syncProps); - if (syncProps) { - return ( - - ); - } -}; \ No newline at end of file + {showSuggestions && input && } +
+ ); +} + +export default SearchInput; \ No newline at end of file diff --git a/client/src/components/SearchInput/SearchInputOptions.tsx b/client/src/components/SearchInput/SearchInputOptions.tsx new file mode 100644 index 0000000..90781ee --- /dev/null +++ b/client/src/components/SearchInput/SearchInputOptions.tsx @@ -0,0 +1,71 @@ +import clsx from 'clsx'; +import Icon, { ICONS } from './../Icon/Icon'; +import React, { useEffect, useRef, useState } from 'react'; +import useArrivalById from './../../hooks/useArrivalById'; + +export interface OptionProps { + filteredSuggestions: any[]; + index: number; +} + +const SearchInputOptions = ({ filteredSuggestions, index}) => { + const [isSending, setIsSending] = useState(false); + const isMounted = useRef(true); + + useEffect(() => { + return () => { + isMounted.current = false + } + }, []); + + return filteredSuggestions.length ? ( +
+
+
+
    + {filteredSuggestions.map((suggestion, i) => { + let className = ""; + const { executeHook } = useArrivalById(suggestion?.stopId); + + // Flag the active suggestion with a class + if (i === index) { + className = "suggestion-active"; + } + + return ( + <> +
  • executeHook(suggestion?.stopId)}> +
    +
    + +
    +
    + + {suggestion?.label} + +
    +
    + +
  • + + ); + })} +
+
+
+
+ ) : ( +
+ + 😪 + {" "} + sorry no suggestions +
+ ); +} + +export default SearchInputOptions; \ No newline at end of file diff --git a/client/src/context/MapContext.provider.tsx b/client/src/context/MapContext.provider.tsx index 3708b1d..66ed8c3 100644 --- a/client/src/context/MapContext.provider.tsx +++ b/client/src/context/MapContext.provider.tsx @@ -12,7 +12,7 @@ interface Props { screenSizeValue?: screenSizeProps; showMapValue: boolean; stationValue: Station; - stationsValue: Stations; + stationsValue: Stations[]; drawerValue: boolean; } @@ -22,7 +22,7 @@ const MapContextProvider: React.FunctionComponent = (props: Props): JSX.E const [screenSize, setScreenSize] = useState(screenSizeValue); const [showMap, setShowMap] = useState(showMapValue); const [station, setStation] = useState(stationValue); - const [stations, setStations] = useState(stationsValue); + const [stations, setStations] = useState(stationsValue); const [drawerOpen, setDrawerOpen] = useState(drawerValue); const mapState: MapContextType = useMemo(() => ({ diff --git a/client/src/context/MapContext.types.ts b/client/src/context/MapContext.types.ts index 97d8efa..9d240db 100644 --- a/client/src/context/MapContext.types.ts +++ b/client/src/context/MapContext.types.ts @@ -6,8 +6,8 @@ export interface MapContextType { screenSize: Partial; setScreenSize: React.Dispatch>; setLocation: React.Dispatch>; - stations?: Stations; - setStations?: React.Dispatch>; + stations?: Stations[]; + setStations?: React.Dispatch>; station: Station; setStation: React.Dispatch>; arrivals: string[]; diff --git a/client/src/hooks/__tests__/useArrivals.test.ts b/client/src/hooks/__tests__/useArrivals.test.ts index dc396ab..bc4f6ff 100644 --- a/client/src/hooks/__tests__/useArrivals.test.ts +++ b/client/src/hooks/__tests__/useArrivals.test.ts @@ -1,43 +1,68 @@ -import { renderHook, waitFor } from "@testing-library/react"; +import { renderHook, act, waitFor } from "@testing-library/react"; import useArrivals from "../../hooks/useArrivals"; -// we will need this mock on our next test -global.fetch = jest.fn(); + describe("useArrivals", () => { - const mockStation = { - color: "#009b3a", - lat: 41.88422, - lng: -87.696234, - title: "California (63rd-bound)", - ada: true, - blue: false, - brn: false, - direction: "E", - g: true, - map_id: 41360, - org: false, - p: false, - pink: false, - purple_express: false, - red: false, - station_descriptive_name: "California (green Line)", - stop_id: 30265, - stop_name: "California (63rd-bound)", - y: false, - }; - it("should initially return true and then false", async () => { - const { result } = renderHook(() => useArrivals(mockStation)); - const { loading } = result.current; + const originalFetch = global.fetch; + let mockStation + beforeAll(() => { + // we will need this mock on our next test + global.fetch = jest.fn(() => + Promise.resolve({ + ok: true, + json: () => Promise.resolve({ + data: { + color: "#009b3a", + lat: 41.88422, + lng: -87.696234, + title: "California (63rd-bound)", + ada: true, + blue: false, + brn: false, + direction: "E", + g: true, + map_id: 41360, + org: false, + p: false, + pink: false, + purple_express: false, + red: false, + station_descriptive_name: "California (green Line)", + stop_id: 30265, + stop_name: "California (63rd-bound)", + y: false, + }, + error: null, + loading: false + }), // Must return a promise + }) + ) as jest.Mock>; + }); + afterAll(() => { + // Restore the original fetch after all tests in this suite + global.fetch = originalFetch; + }); + + it("should keep loading at true", () => { + const { result } = renderHook(() => useArrivals(30265, 30000)); + const { data, loading } = result.current; + expect(data).toBe(null); + expect(loading).toBe(true); + }); - // asserting that the initial value of loading is true - // before the re-render - expect(loading).toBe(false); + it('should return data successfully', async () => { + const { result } = renderHook(() => useArrivals(30265, 30000)); - await waitFor(() => { - const { loading } = result.current; + await act(async () => { + await result.current.getArrivals(30265); + }); - expect(loading).toBe(false); + await waitFor(() => { + expect(result.current.data).not.toBeNull(); + expect(result.current.error).toBe(false); + expect(result.current.data).toEqual(mockStation); }); + expect(result.current.data).toEqual(mockStation); }); }); diff --git a/client/src/hooks/useArrivals.ts b/client/src/hooks/useArrivals.ts index e53709b..575c599 100644 --- a/client/src/hooks/useArrivals.ts +++ b/client/src/hooks/useArrivals.ts @@ -67,6 +67,6 @@ const useArrivals = (stopIds, refreshInterval = 1000) => { }; }, [getArrivals, refreshInterval, stopIds]); - return { data, loading, error, refetch: refreshData }; + return { data, loading, error, refetch: refreshData, getArrivals }; }; export default useArrivals; diff --git a/client/src/index.tsx b/client/src/index.tsx index 07d3c70..95a27d7 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -5,15 +5,21 @@ import { createRoot } from 'react-dom/client'; import './styles/index.css'; import App from './App'; import { MapContextProvider } from './context'; +import { Auth0Provider } from "@auth0/auth0-react"; const container = document.getElementById('app'); const root = createRoot(container!); root.render( - - - + + + + + , ); diff --git a/client/src/styles/components/_buttons.scss b/client/src/styles/components/_buttons.scss deleted file mode 100644 index d2188f7..0000000 --- a/client/src/styles/components/_buttons.scss +++ /dev/null @@ -1,73 +0,0 @@ -.btn { - outline: none; - margin: 0 auto; - display: block; - width: 200px; - cursor: pointer; - position: relative; - @include box-sizing(border-box); - - &.train { - display: flex; - border-radius: 3px; - background-color: $white; - padding: 0px 35px 0px 0px; - height: 57px; - list-style: none; - text-decoration: none; - margin: 10px auto; - cursor: pointer; - line-height: 1.2; - border: none; - box-shadow: 0 2px 8px -1px rgba(10, 22, 50, .24); - text-decoration: none; - @include mobile { - width: 100%; - } - .red, .blue, .org, .pink, .brn, .g { - width: 60px; - text-decoration: none; - color: $white; - position: relative; - &::before { - font-family: $fontAwesome; - content: "\f238"; - border-radius: 1px; - width: 2px; - top: 50%; - left: 10%; - height: 50px; - margin: 20px 20px -8px -6px; - position: absolute; - top: auto; - bottom: 0; - left: auto; - right: auto; - } - } - ul { - margin: 0 auto; - list-style: none; - padding: 16px 40px; - text-align: center; - position: relative; - -webkit-backface-visibility: hidden; - backface-visibility: hidden; - font-size: 16px; - font-weight: 500; - line-height: 28px; - color: $black_almost; - li { - margin: auto; - padding-left: 5px; - font-weight: 500; - } - button { - text-decoration: none; - color: $black_almost; - display: inline-flex; - height: -webkit-fill-available; - } - } - } -} diff --git a/client/src/styles/components/_colors.scss b/client/src/styles/components/_colors.scss deleted file mode 100644 index 88f6e94..0000000 --- a/client/src/styles/components/_colors.scss +++ /dev/null @@ -1,8 +0,0 @@ -.red, .Red { background-color: $red; } -.blue, .Blue { background-color: $blue; } -.pink, .Pink { background-color: $pink; } -.org, .Org { background-color: $orange; } -.brn, .Brn { background-color: $brown; } -.g, .G { background-color: $green; } -.p, .P { background-color: $purple; } -.y, .Y { background-color: $yellow; } diff --git a/client/src/styles/components/_dropdown.scss b/client/src/styles/components/_dropdown.scss deleted file mode 100644 index cfb3c9a..0000000 --- a/client/src/styles/components/_dropdown.scss +++ /dev/null @@ -1,70 +0,0 @@ -.dropdown { - display: block; - border-radius: 3px; - background-color: $white; - height: 57px; - list-style: none; - text-decoration: none; - cursor: pointer; - line-height: 1.2; - border: none; - box-shadow: 0 2px 8px -1px rgba(10, 22, 50, .24); - text-decoration: none; - @include box-sizing(border-box); - ul { - padding: 0; - margin: 0; - .dropdown_trigger { - list-style: none; - width: 100%; - margin: 0 auto; - display: inline-flex; - .train_wrapper { - display: inline-flex; - flex:1; - width: 100%; - .view_route { - margin: 0 auto; - padding: 20px 10px 0px 15px; - display: inline-flex; - flex: 1; - justify-content: space-between; - span { - font-size: 1rem; - font-weight: 500; - } - svg { - position: relative; - bottom: 10px; - } - } - } - } - } -} -.train { - width: 60px; - height: 57px; - text-decoration: none; - &.routes { - color: #fff; - background-color: #000; - } - display: flex; - border-radius: 3px 0px 0px 3px; - &::before { - background-image: url("../assets/img/train.png"); - background-repeat: no-repeat; - background-position: top center; - background-size: contain; - overflow: auto; - content: " "; - width: 100%; - left: -15%; - height: 40px; - margin: 14px -4px 9px 16px; - position: relative; - top: -5%; - bottom: 0; - } -} diff --git a/client/src/styles/components/_list.scss b/client/src/styles/components/_list.scss deleted file mode 100644 index 22c7510..0000000 --- a/client/src/styles/components/_list.scss +++ /dev/null @@ -1,32 +0,0 @@ - -aside { - float: left; - overflow: visible; - ul { - margin: 0 auto; - display: contents; - width: auto; - li { - &.train { - padding: 10px 35px; - list-style: none; - font-weight: 500; - line-height: 1.2; - &.red { - background-color: $red; - a { - text-decoration: none; - color: $white; - } - } - &.blue { - background-color: $blue; - a { - text-decoration: none; - color: $white; - } - } - } - } - } -} diff --git a/client/src/styles/components/_section.scss b/client/src/styles/components/_section.scss deleted file mode 100644 index 1285be3..0000000 --- a/client/src/styles/components/_section.scss +++ /dev/null @@ -1,42 +0,0 @@ -.location { - background-color: $white; -} -.station { - background-color: $white; - padding: 15px 35px; - box-shadow: 0 2px 8px -1px rgba(10, 22, 50, .24); - border-radius: 3px; - display: block; - position: relative; - top: 200px; - left: 0; - @include mobile { - padding: 10px 15px; - } - z-index: 100; - @extend .col-md-6; - @extend .col-lg-6; - @extend .col-xl-4; - .body { - width: 100%; - @extend .text-left; - .service { - width: 100%; - display: inline-flex; - border-radius: 3px; - margin: 7px auto; - color: $white; - height: 57px; - .destination { - font-size: 12px; - line-height: 1.2; - margin: 5px 0 0 15px; - } - .arrivalTime { - font-size: 16px; - float: right; - line-height: initial; - } - } - } -} diff --git a/client/src/styles/components/header.css b/client/src/styles/components/header.css new file mode 100644 index 0000000..56f8ee1 --- /dev/null +++ b/client/src/styles/components/header.css @@ -0,0 +1,5 @@ +@layer header { + .header-wrapper { + padding: 5px 10px; + } +} \ No newline at end of file diff --git a/client/src/styles/components/icons.css b/client/src/styles/components/icons.css new file mode 100644 index 0000000..3a6a94b --- /dev/null +++ b/client/src/styles/components/icons.css @@ -0,0 +1,82 @@ +@layer icon { + .icon { + width: 32px; + height: 32px; + } + + .train-icon { + width: 30px; + } + + .blue-train > rect { + fill: #17A0DB; + } + + .blue-train > path { + fill: white; + } + + .red-train > rect { + fill: #c60c30; + } + + .red-train > path { + fill: white; + } + + .g-train > rect { + fill: #009b3a; + } + + .g-train > path { + fill: white; + } + + .y-train > rect { + fill: #f9e300; + } + + .y-train > path { + fill: white; + } + + .org-train > rect { + fill: #f9461c; + } + + .org-train > path { + fill: white; + } + + .p-train > rect { + fill: #522398; + } + + .p-train > path { + fill: white; + } + + .purple_express-train > rect { + fill: #522398; + } + + .purple_express-train > path { + fill: white; + } + + .pink-train > rect { + fill: #e27ea6; + } + + .pink-train > path { + fill: white; + } + + .brn-train > rect { + fill: #62361b; + } + + .brn-train > path { + fill: white; + } +} \ No newline at end of file diff --git a/client/src/styles/components/search.css b/client/src/styles/components/search.css new file mode 100644 index 0000000..2af7d2b --- /dev/null +++ b/client/src/styles/components/search.css @@ -0,0 +1,7 @@ + +@layer search { + + .suggestion-active { + display: flex; + } +} \ No newline at end of file diff --git a/client/src/styles/components/searchinput.css b/client/src/styles/components/searchinput.css new file mode 100644 index 0000000..aca644c --- /dev/null +++ b/client/src/styles/components/searchinput.css @@ -0,0 +1,19 @@ +.SearchInput { + border: 1px solid #D9D9D9; + border-radius: 14px; + padding: 5px; +} + +.SearchInputOption { + display: flex; + align-items: flex-start; + justify-content: space-between; + padding: 8px 12px; +} + +.SearchInputOption_content { + display: grid; + align-items: start; + width: 100%; + cursor: none; +} \ No newline at end of file diff --git a/client/src/utils/index.ts b/client/src/utils/index.ts new file mode 100644 index 0000000..6f3018f --- /dev/null +++ b/client/src/utils/index.ts @@ -0,0 +1,4 @@ +export { keyboardUtils } from './keyboard'; +export { getColorByStation } from './color'; +export { mapMarkers, mapStations } from './map'; +export { findStopDuplicate } from './stops'; \ No newline at end of file diff --git a/client/src/utils/keyboard.ts b/client/src/utils/keyboard.ts new file mode 100644 index 0000000..42abebc --- /dev/null +++ b/client/src/utils/keyboard.ts @@ -0,0 +1,13 @@ +import { KeyboardEvent as ReactKeyBoardEvent } from "react"; + +const isKey = (key:string) => (e: KeyboardEvent | ReactKeyBoardEvent) => e?.key === key; + +const KEYS = { + Escape: "Escape", + Space: ' ' +}; + +export const keyboardUtils = { + isEscape: isKey(KEYS.Escape), + isSpaceKey: isKey(KEYS?.Space) +} \ No newline at end of file diff --git a/client/tsconfig.json b/client/tsconfig.json index 874c267..c6550da 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -9,6 +9,14 @@ "allowJs": true, "jsx": "react-jsx", "baseUrl": "./src", + "paths": { + "@/*": ["./src/*"], + "@hooks/*": ["./src/hooks/*"], + "@components/*": ["./src/components/*"], + "@utils/*": ["./src/utils/*"], + "@Pages/*": ["./src/Pages/*"], + "@context/*": ["./src/context/*"] + }, "moduleResolution": "node", "forceConsistentCasingInFileNames": true, "noImplicitReturns": true, @@ -21,12 +29,16 @@ "pretty": true, "resolveJsonModule": true, "allowSyntheticDefaultImports": true, - "isolatedModules": false, + "isolatedModules": true, "strict": true, "declaration": true, "noEmit": true, - "types": ["react", "node", "jest", "@testing-library/jest-dom", "google.maps"] + "types": ["react", "node", "jest", "@testing-library/jest-dom", "jest-extended", "google.maps"] }, - "include": ["src/**/*", "client/webpack.config.ts", "vite.config.js"], + "include": ["src/**/*", "client/webpack.config.ts", "vite.config.js", "setupTest.ts"], "exclude": ["node_modules", "src/**/*.test", "public"], + "ts-node": { + // Do not forget to `npm i -D tsconfig-paths` + "require": ["tsconfig-paths/register"] + } } \ No newline at end of file diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..67d9a7b --- /dev/null +++ b/settings.json @@ -0,0 +1,3 @@ +"files.associations": { + "*.css": "tailwindcss" +}, \ No newline at end of file