Skip to content

Commit

Permalink
feat: link to Inspector from admin tables
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalcora committed Aug 26, 2024
1 parent 4ffc113 commit 321d7ce
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
6 changes: 6 additions & 0 deletions assets/css/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
width: 240px;
}

.admin-table__inspector-link {
color: unset;
text-decoration: none;
border-bottom: 1px dotted;
}

.admin-modal__background {
position: fixed;
top: 0;
Expand Down
14 changes: 14 additions & 0 deletions assets/src/components/admin/admin_cells.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useRef, useMemo, useEffect } from "react";
import { Link } from "react-router-dom";
import _ from "lodash";

import { gatherSelectOptions } from "Util/admin";
Expand Down Expand Up @@ -168,6 +169,18 @@ const IndeterminateCheckbox = ({ indeterminate, ...rest }) => {
);
};

const InspectorLink = ({ value }) => {
return (
<Link
to={`/inspector?id=${value}`}
className="admin-table__inspector-link"
title="🔍 View in Inspector"
>
{value}
</Link>
);
};

export {
EditableCell,
EditableList,
Expand All @@ -176,4 +189,5 @@ export {
EditableCheckbox,
EditableTextarea,
IndeterminateCheckbox,
InspectorLink,
};
19 changes: 17 additions & 2 deletions assets/src/components/admin/admin_tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
EditableSelect,
EditableCheckbox,
EditableTextarea,
InspectorLink,
} from "Components/admin/admin_cells";

import {
Expand Down Expand Up @@ -42,6 +43,7 @@ const AllScreensTable = (): JSX.Element => {
{
Header: "Screen ID",
accessor: "id",
Cell: InspectorLink,
Filter: DefaultColumnFilter,
FormCell: FormStaticCell,
},
Expand Down Expand Up @@ -115,7 +117,12 @@ const AllScreensTable = (): JSX.Element => {

const SolariScreensTable = (): JSX.Element => {
const columns = [
{ Header: "Screen ID", accessor: "id", Filter: DefaultColumnFilter },
{
Header: "Screen ID",
accessor: "id",
Cell: InspectorLink,
Filter: DefaultColumnFilter,
},
{
Header: "Station Name",
accessor: buildAppParamAccessor("station_name"),
Expand Down Expand Up @@ -182,7 +189,12 @@ const SolariScreensTable = (): JSX.Element => {

const DupV2ScreensTable = (): JSX.Element => {
const columns = [
{ Header: "Screen ID", accessor: "id", Filter: DefaultColumnFilter },
{
Header: "Screen ID",
accessor: "id",
Cell: InspectorLink,
Filter: DefaultColumnFilter,
},
{
Header: "Header",
accessor: buildAppParamAccessor("header"),
Expand Down Expand Up @@ -235,6 +247,7 @@ const v2Columns = [
{
Header: "Screen ID",
accessor: "id",
Cell: InspectorLink,
Filter: DefaultColumnFilter,
FormCell: FormStaticCell,
},
Expand Down Expand Up @@ -282,6 +295,7 @@ const v2Columns = [
const screenIDColumn = {
Header: "Screen ID",
accessor: "id",
Cell: InspectorLink,
Filter: DefaultColumnFilter,
FormCell: FormStaticCell,
};
Expand Down Expand Up @@ -515,6 +529,7 @@ const BuswayV2ScreensTable = (): JSX.Element => {
{
Header: "Screen ID",
accessor: "id",
Cell: InspectorLink,
Filter: DefaultColumnFilter,
FormCell: FormStaticCell,
},
Expand Down

0 comments on commit 321d7ce

Please sign in to comment.