Skip to content

Commit

Permalink
feat: Add admin config columns (thus far) for triptych app (#1841)
Browse files Browse the repository at this point in the history
  • Loading branch information
jzimbel-mbta authored Aug 31, 2023
1 parent 7731d29 commit 7437166
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
4 changes: 4 additions & 0 deletions assets/src/apps/admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
BusShelterV2ScreensTable,
PreFareV2ScreensTable,
DupV2ScreensTable,
TriptychV2ScreensTable
} from "Components/admin/admin_tables";
import ImageManager from "Components/admin/admin_image_manager";
import Devops from "Components/admin/devops";
Expand Down Expand Up @@ -77,6 +78,9 @@ const App = (): JSX.Element => {
<Route exact path="/pre-fare-v2-screens">
<PreFareV2ScreensTable />
</Route>
<Route exact path="/triptych-v2-screens">
<TriptychV2ScreensTable />
</Route>
<Route exact path="/json-editor">
<AdminForm />
</Route>
Expand Down
3 changes: 3 additions & 0 deletions assets/src/components/admin/admin_navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ const AdminNavbar = (): JSX.Element => {
<Link to="/pre-fare-v2-screens">
<button>Pre-Fare V2 Screens Table</button>
</Link>
<Link to="/triptych-v2-screens">
<button>Triptych V2 Screens Table</button>
</Link>
<Link to="/json-editor">
<button>JSON Editor</button>
</Link>
Expand Down
28 changes: 27 additions & 1 deletion assets/src/components/admin/admin_tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,24 @@ const shuttleBusInfoColumn = {
FormCell: FormTextarea,
};

const trainCrowdingColumn = {
Header: "Train Crowding",
accessor: buildAppParamAccessor("train_crowding"),
mutator: buildAppParamMutator("train_crowding"),
Cell: EditableTextarea,
disableFilters: true,
FormCell: FormTextarea,
};

const localEvergreenSetsColumn = {
Header: "Local Evergreen Content Sets",
accessor: buildAppParamAccessor("local_evergreen_sets"),
mutator: buildAppParamMutator("local_evergreen_sets"),
Cell: EditableTextarea,
disableFilters: true,
FormCell: FormTextarea,
};

const PreFareV2ScreensTable = (): JSX.Element => {
const dataFilter = ({ app_id }) => {
return app_id === "pre_fare_v2";
Expand Down Expand Up @@ -762,7 +780,15 @@ const TriptychV2ScreensTable = (): JSX.Element => {
return app_id === "triptych_v2";
};

return <AdminTable columns={[...v2Columns]} dataFilter={dataFilter} />;
return (
<AdminTable
columns={[
trainCrowdingColumn,
localEvergreenSetsColumn,
]}
dataFilter={dataFilter}
/>
);
};

export {
Expand Down

0 comments on commit 7437166

Please sign in to comment.