diff --git a/assets/css/dashboard/new-pa-message/select-zones-page.scss b/assets/css/dashboard/new-pa-message/select-zones-page.scss index ad4a26f7..94796723 100644 --- a/assets/css/dashboard/new-pa-message/select-zones-page.scss +++ b/assets/css/dashboard/new-pa-message/select-zones-page.scss @@ -127,6 +127,12 @@ .btn { padding: 6px 12px; height: fit-content; + + &:disabled:not(.button-active) { + background-color: inherit; + border-color: inherit; + color: $text-secondary; + } } } } @@ -222,6 +228,12 @@ .btn { padding: 6px 12px; height: fit-content; + + &:disabled:not(.button-active) { + background-color: inherit; + border-color: inherit; + color: $text-secondary; + } } } } diff --git a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/PlaceZonesRow.tsx b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/PlaceZonesRow.tsx index 16594161..b9a870b5 100644 --- a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/PlaceZonesRow.tsx +++ b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/PlaceZonesRow.tsx @@ -17,6 +17,7 @@ interface PlaceZonesRow { rightZones: Screen[]; route: string; branches?: string[]; + disabled?: boolean; } const PlaceZonesRow = ({ @@ -29,6 +30,7 @@ const PlaceZonesRow = ({ rightZones, route, branches = [], + disabled = false, }: PlaceZonesRow) => { if (allSignsForRouteAtPlace.length === 0) return null; @@ -76,6 +78,7 @@ const PlaceZonesRow = ({ ); } }} + disabled={disabled} > All @@ -86,6 +89,7 @@ const PlaceZonesRow = ({ onSignButtonClick={onSignButtonClick} leftIcon={} allSelectedSigns={allSelectedSigns} + disabled={disabled} /> @@ -93,6 +97,7 @@ const PlaceZonesRow = ({ signs={middleZones} onSignButtonClick={onSignButtonClick} allSelectedSigns={allSelectedSigns} + disabled={disabled} /> @@ -101,6 +106,7 @@ const PlaceZonesRow = ({ onSignButtonClick={onSignButtonClick} rightIcon={} allSelectedSigns={allSelectedSigns} + disabled={disabled} /> diff --git a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/RouteColumn.tsx b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/RouteColumn.tsx index 77b723f0..6c87ecfa 100644 --- a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/RouteColumn.tsx +++ b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/RouteColumn.tsx @@ -12,6 +12,7 @@ const RouteColumn = ({ value, onChange, reverse = false, + disabled = false, }: { label: string; routeIds: string[]; @@ -20,6 +21,7 @@ const RouteColumn = ({ value: string[]; onChange: (signIds: string[]) => void; reverse?: boolean; + disabled?: boolean; }) => { const signsIdsAtRoutes = places.flatMap((place) => place.screens @@ -46,6 +48,7 @@ const RouteColumn = ({ } }} checked={signsIdsAtRoutes.every((signId) => value.includes(signId))} + disabled={disabled} />
@@ -74,6 +77,7 @@ const RouteColumn = ({ checked={value.some((signId) => signIdsAtPlace.includes(signId), )} + disabled={disabled} />
); diff --git a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectStationsAndZones.tsx b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectStationsAndZones.tsx index f6f7c188..0bc10415 100644 --- a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectStationsAndZones.tsx +++ b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectStationsAndZones.tsx @@ -13,6 +13,7 @@ interface Props { page: Page; busRoutes: string[]; onError: (message: string | null) => void; + isReadOnly?: boolean; } const SelectStationsAndZones = ({ @@ -23,6 +24,7 @@ const SelectStationsAndZones = ({ page, busRoutes, onError, + isReadOnly = false, }: Props) => { const dispatch = useScreenplayDispatchContext(); const [signIds, setSignIds] = useState(value); @@ -41,6 +43,7 @@ const SelectStationsAndZones = ({ onChange={setSignIds} busRoutes={busRoutes} onError={onError} + isReadOnly={isReadOnly} /> ) : ( ); }; diff --git a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectStationsPage.tsx b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectStationsPage.tsx index 03fdb557..971c0f68 100644 --- a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectStationsPage.tsx +++ b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectStationsPage.tsx @@ -36,6 +36,7 @@ interface Props { navigateTo: (page: Page) => void; busRoutes: string[]; onError: (message: string | null) => void; + isReadOnly?: boolean; } const SelectStationsPage = ({ @@ -45,6 +46,7 @@ const SelectStationsPage = ({ navigateTo, busRoutes, onError, + isReadOnly = false, }: Props) => { const routeNameToRouteIds = useRouteToRouteIDsMap(); @@ -85,13 +87,13 @@ const SelectStationsPage = ({ return (
-
Select Stations
+
{isReadOnly ? "Stations" : "Select Stations"}
@@ -198,6 +208,7 @@ const SelectStationsPage = ({ stations={ORANGE_NORTH} value={value} onChange={onChange} + disabled={isReadOnly} />
@@ -225,6 +237,7 @@ const SelectStationsPage = ({ } }} checked={greenLineSignIds.every((signId) => value.includes(signId))} + disabled={isReadOnly} />
@@ -241,6 +254,7 @@ const SelectStationsPage = ({ places={placesByRoute[route]} value={value} onChange={onChange} + disabled={isReadOnly} /> ); })} @@ -260,6 +274,7 @@ const SelectStationsPage = ({ value={value} onChange={onChange} reverse={route === "Blue"} + disabled={isReadOnly} />
))} @@ -271,6 +286,7 @@ const SelectStationsPage = ({ places={placesByRoute["Bus"]} value={value} onChange={onChange} + disabled={isReadOnly} /> diff --git a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectZonesPage.tsx b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectZonesPage.tsx index 459e3069..9c454837 100644 --- a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectZonesPage.tsx +++ b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectZonesPage.tsx @@ -32,6 +32,7 @@ interface Props { onSubmit: (signIds: string[]) => void; navigateTo: (page: Page) => void; places: Place[]; + isReadOnly?: boolean; } const SelectZonesPage = ({ @@ -40,6 +41,7 @@ const SelectZonesPage = ({ onSubmit, navigateTo, places, + isReadOnly = false, }: Props) => { const routeToRouteIDMap = useRouteToRouteIDsMap(); const getInitialPlacesWithSelectedSigns = () => @@ -190,17 +192,19 @@ const SelectZonesPage = ({ className="edit-button" onClick={() => navigateTo(Page.STATIONS)} > - Edit Stations + {isReadOnly ? "Return to Select" : "Edit"} Stations
- + {!isReadOnly && ( + + )} @@ -284,6 +289,7 @@ const SelectZonesPage = ({ "button-active": isLeftSelected, })} onClick={() => selectDirectionGroup(0)} + disabled={isReadOnly} > {massSelectButtonLabels.middle} @@ -292,6 +298,7 @@ const SelectZonesPage = ({ "button-active": isRightSelected, })} onClick={() => selectDirectionGroup(1)} + disabled={isReadOnly} > {massSelectButtonLabels.right} @@ -350,6 +357,7 @@ const SelectZonesPage = ({ rightZones={signsGroupedByZone.right} route={selectedRouteFilter} branches={branches} + disabled={isReadOnly} /> {selectedRouteFilter !== "Bus" && ( )} diff --git a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectedStationsSummary.tsx b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectedStationsSummary.tsx index 2a34528a..848ef76e 100644 --- a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectedStationsSummary.tsx +++ b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SelectedStationsSummary.tsx @@ -8,6 +8,7 @@ interface Props { onChange: (signIds: string[]) => void; places: Place[]; busRoutes: string[]; + isReadOnly?: boolean; } const SelectedStationsSummary = ({ @@ -15,6 +16,7 @@ const SelectedStationsSummary = ({ places, busRoutes, onChange, + isReadOnly = false, }: Props) => { return (
@@ -29,6 +31,7 @@ const SelectedStationsSummary = ({ value={value} onChange={onChange} busRoutes={busRoutes} + isReadOnly={isReadOnly} />
)} diff --git a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SignButtonGroup.tsx b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SignButtonGroup.tsx index 37d8c7d7..360a512d 100644 --- a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SignButtonGroup.tsx +++ b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/SignButtonGroup.tsx @@ -7,17 +7,20 @@ import cx from "classnames"; type SelectSignButtonProps = React.PropsWithChildren<{ isSelected: boolean; onClick: () => void; + disabled?: boolean; }>; const SelectSignButton = ({ isSelected, onClick, children, + disabled = false, }: SelectSignButtonProps) => { return ( @@ -30,6 +33,7 @@ interface SignButtonGroupProps { leftIcon?: ReactElement; rightIcon?: ReactElement; allSelectedSigns: string[]; + disabled?: boolean; } const SignButtonGroup = ({ @@ -38,6 +42,7 @@ const SignButtonGroup = ({ leftIcon, rightIcon, allSelectedSigns, + disabled = false, }: SignButtonGroupProps) => { return (
@@ -49,6 +54,7 @@ const SignButtonGroup = ({ onSignButtonClick(sign.id); }} isSelected={allSelectedSigns.includes(sign.id)} + disabled={disabled} > {leftIcon} {sign.label ?? getZoneLabel(sign.zone ?? "")} {rightIcon} diff --git a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/StationGroupCheckbox.tsx b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/StationGroupCheckbox.tsx index a9a0f6fd..6ead6b12 100644 --- a/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/StationGroupCheckbox.tsx +++ b/assets/js/components/Dashboard/PaMessageForm/SelectStationsAndZones/StationGroupCheckbox.tsx @@ -12,6 +12,7 @@ interface Props { stations: string[]; value: string[]; onChange: (signIds: string[]) => void; + disabled?: boolean; } const StationGroupCheckbox = ({ @@ -22,6 +23,7 @@ const StationGroupCheckbox = ({ stations, value, onChange, + disabled = false, }: Props) => { const signIds = places .filter((place) => stations.includes(place.id)) @@ -50,6 +52,7 @@ const StationGroupCheckbox = ({ } }} checked={signIds.every((signId) => value.includes(signId))} + disabled={disabled} />
); diff --git a/assets/js/components/Dashboard/PaMessageForm/SelectedSignsByRouteTags.tsx b/assets/js/components/Dashboard/PaMessageForm/SelectedSignsByRouteTags.tsx index 797436b0..a3d9df42 100644 --- a/assets/js/components/Dashboard/PaMessageForm/SelectedSignsByRouteTags.tsx +++ b/assets/js/components/Dashboard/PaMessageForm/SelectedSignsByRouteTags.tsx @@ -13,11 +13,13 @@ const SelectedGroupTag = ({ routeId, onRemove, onTagClick, + isReadOnly = false, }: { numPlaces: number; routeId: string; onRemove: () => void; onTagClick: () => void; + isReadOnly?: boolean; }) => { if (numPlaces === 0) return null; @@ -28,10 +30,12 @@ const SelectedGroupTag = ({ {routeId}: {pluralize("Station", numPlaces, true)} - + {!isReadOnly && ( + + )}
); }; @@ -42,6 +46,7 @@ interface Props { places: Place[]; busRoutes: string[]; onTagClick?: () => void; + isReadOnly?: boolean; } const SelectedSignsByRouteTags = ({ @@ -50,6 +55,7 @@ const SelectedSignsByRouteTags = ({ onChange, busRoutes, onTagClick = () => {}, + isReadOnly = false, }: Props) => { const placesWithSelectedScreens = usePlacesWithSelectedScreens(places, value); const removeFilteredScreens = (filterFn: (routeId: string) => boolean) => { @@ -81,6 +87,7 @@ const SelectedSignsByRouteTags = ({ removeFilteredScreens((r) => r.startsWith(routeId)); }} onTagClick={onTagClick} + isReadOnly={isReadOnly} /> ))} );