Skip to content

Commit

Permalink
fix: unable to add elevator screens in admin
Browse files Browse the repository at this point in the history
When we added a few additional required fields to elevator screen
configuration, we neglected to update the admin UI with these fields.
  • Loading branch information
digitalcora committed Dec 13, 2024
1 parent 2148794 commit cfbe173
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 11 deletions.
6 changes: 5 additions & 1 deletion assets/src/components/admin/admin_add_modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ const defaultAppParamsByAppId = {
evergreen_content: [],
},
elevator_v2: {
elevator_id: "ELEVATOR_ID",
elevator_id: "",
alternate_direction_text: "",
accessible_path_direction_arrow: "n",
accessible_path_image_here_coordinates: { x: 0, y: 0 },
evergreen_content: [],
},
};

Expand Down
68 changes: 58 additions & 10 deletions assets/src/components/admin/admin_tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,6 @@ const PreFareV2ScreensTable = (): JSX.Element => {
return <AdminTable columns={columns} dataFilter={dataFilter} />;
};

const elevatorIdColumn = {
Header: "Elevator ID",
accessor: buildAppParamAccessor("elevator_id"),
mutator: buildAppParamMutator("elevator_id"),
Cell: EditableCell,
disableFilters: true,
FormCell: FormTextCell,
};

const ElevatorV2ScreensTable = (): JSX.Element => {
const dataFilter = ({ app_id }) => {
return app_id === "elevator_v2";
Expand All @@ -385,6 +376,64 @@ const ElevatorV2ScreensTable = (): JSX.Element => {
Filter: DefaultColumnFilter,
FormCell: FormTextCell,
},
{
Header: "Elevator ID",
accessor: buildAppParamAccessor("elevator_id"),
mutator: buildAppParamMutator("elevator_id"),
Cell: EditableCell,
disableFilters: true,
FormCell: FormTextCell,
},
{
Header: "Accessible Path Arrow",
accessor: buildAppParamAccessor("accessible_path_direction_arrow"),
mutator: buildAppParamMutator("accessible_path_direction_arrow"),
Cell: EditableCell,
disableFilters: true,
FormCell: FormTextCell,
},
{
Header: "Accessible Path Text",
accessor: buildAppParamAccessor("alternate_direction_text"),
mutator: buildAppParamMutator("alternate_direction_text"),
Cell: EditableCell,
disableFilters: true,
FormCell: FormTextCell,
},
{
Header: "Accessible Path Image",
accessor: buildAppParamAccessor("accessible_path_image_url"),
mutator: buildAppParamMutator("accessible_path_image_url"),
Cell: EditableCell,
disableFilters: true,
FormCell: FormTextCell,
},
{
Header: "Dot X",
accessor: (row) =>
row.app_params.accessible_path_image_here_coordinates.x,
mutator: (row, value) => {
const newRow = structuredClone(row);
newRow.app_params.accessible_path_image_here_coordinates.x = value;
return newRow;
},
Cell: EditableCell,
disableFilters: true,
FormCell: FormTextCell,
},
{
Header: "Dot Y",
accessor: (row) =>
row.app_params.accessible_path_image_here_coordinates.y,
mutator: (row, value) => {
const newRow = structuredClone(row);
newRow.app_params.accessible_path_image_here_coordinates.y = value;
return newRow;
},
Cell: EditableCell,
disableFilters: true,
FormCell: FormTextCell,
},
{
Header: "Evergreen Content",
accessor: buildAppParamAccessor("evergreen_content"),
Expand All @@ -393,7 +442,6 @@ const ElevatorV2ScreensTable = (): JSX.Element => {
disableFilters: true,
FormCell: FormTextarea,
},
elevatorIdColumn,
]}
dataFilter={dataFilter}
/>
Expand Down

0 comments on commit cfbe173

Please sign in to comment.