diff --git a/assets/css/detours/_detour_table.scss b/assets/css/detours/_detour_table.scss index 51c6d5538..6ca9e1544 100644 --- a/assets/css/detours/_detour_table.scss +++ b/assets/css/detours/_detour_table.scss @@ -61,6 +61,12 @@ $table-border-radius: 0.5rem; td:last-child { border-bottom-right-radius: $table-border-radius; } + + @include media-breakpoint-down(md) { + td { + border-bottom: none; + } + } } } diff --git a/assets/src/components/detourListPage.tsx b/assets/src/components/detourListPage.tsx index f4122d959..c2808b6a0 100644 --- a/assets/src/components/detourListPage.tsx +++ b/assets/src/components/detourListPage.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useState } from "react" -import { DetoursTable } from "./detoursTable" +import { DetoursTable, DetourStatus } from "./detoursTable" import userInTestGroup, { TestGroups } from "../userInTestGroup" import { Button } from "react-bootstrap" import { PlusSquare } from "../helpers/bsIcons" @@ -61,15 +61,21 @@ export const DetourListPage = () => { )} {detours && ( <> - {detours.active && ( - - )} - {detours.draft && ( - - )} - {detours.past && ( - - )} + + + )} diff --git a/assets/src/components/detoursTable.tsx b/assets/src/components/detoursTable.tsx index e47c1f6ba..c2b22da38 100644 --- a/assets/src/components/detoursTable.tsx +++ b/assets/src/components/detoursTable.tsx @@ -4,10 +4,12 @@ import { RoutePill } from "./routePill" import { useCurrentTimeSeconds } from "../hooks/useCurrentTime" import { timeAgoLabel } from "../util/dateTime" import { SimpleDetour } from "../models/detoursList" +import { EmptyDetourTableIcon } from "../helpers/skateIcons" interface DetoursTableProps { - data: SimpleDetour[] + data: SimpleDetour[] | undefined onOpenDetour: (detourId: number) => void + status: DetourStatus } export enum DetourStatus { @@ -29,41 +31,76 @@ export const timestampLabelFromStatus = (status: DetourStatus) => { } } -export const DetoursTable = ({ data, onOpenDetour }: DetoursTableProps) => { +export const DetoursTable = ({ + data, + onOpenDetour, + status, +}: DetoursTableProps) => ( + + + + + + + + + + {data ? ( + + ) : ( + + )} + +
Route and directionStarting Intersection + {timestampLabelFromStatus(status)} +
+) + +const PopulatedDetourRows = ({ + data, + onOpenDetour, +}: { + data: SimpleDetour[] + onOpenDetour: (detourId: number) => void +}) => { const epochNowInSeconds = useCurrentTimeSeconds() return ( - - - - - - - - - - {data.map((detour, index) => ( - onOpenDetour(detour.id)}> - onOpenDetour(detour.id)}> + - - - - ))} - -
Route and directionStarting IntersectionOn detour since
-
- -
-
{detour.name}
-
- {detour.direction} -
+ <> + {data.map((detour, index) => ( +
+
+ +
+
{detour.name}
+
+ {detour.direction}
-
- {detour.intersection} - - {timeAgoLabel(epochNowInSeconds, detour.updatedAt)} -
+ + + + {detour.intersection} + + + {timeAgoLabel(epochNowInSeconds, detour.updatedAt)} + + + ))} + ) } + +const EmptyDetourRows = ({ message }: { message: string }) => ( + + +
+ +
+
+

{message}

+
+ + +) diff --git a/assets/tests/components/detours/__snapshots__/detourListPage.test.tsx.snap b/assets/tests/components/detours/__snapshots__/detourListPage.test.tsx.snap index 7fb587638..204c5f538 100644 --- a/assets/tests/components/detours/__snapshots__/detourListPage.test.tsx.snap +++ b/assets/tests/components/detours/__snapshots__/detourListPage.test.tsx.snap @@ -111,6 +111,72 @@ exports[`DetourListPage renders detour list page 1`] = ` + + + + + + + + + + + + + +
+ Route and direction + + Starting Intersection + + Last edited +
+
+ +
+
+

+ No draft detours. +

+
+
@@ -131,7 +197,7 @@ exports[`DetourListPage renders detour list page 1`] = `
- On detour since + Last used