From 4c387fb5c911e075e39c82b66f796c0090d9a8f5 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Fri, 21 Oct 2022 11:39:25 +1100 Subject: [PATCH] implement requested changes in PR #10 --- src/assets/icons/index.ts | 3 - .../TableInformationDrawer/Details.tsx | 90 +++++-------------- ...eDrawer.tsx => TableInformationDrawer.tsx} | 2 +- .../TableInformationDrawer/index.ts | 4 +- .../TableInformationDrawer/withTemplate.tsx | 61 ------------- src/components/TableSettingsDialog/form.tsx | 2 +- .../TableToolbar/TableInformation.tsx | 10 +-- src/components/TableToolbar/TableToolbar.tsx | 7 +- src/components/Tables/TableGrid/TableCard.tsx | 14 ++- src/pages/Table/TablePage.tsx | 2 +- src/pages/TablesPage.tsx | 14 ++- 11 files changed, 47 insertions(+), 162 deletions(-) rename src/components/TableInformationDrawer/{SideDrawer.tsx => TableInformationDrawer.tsx} (98%) delete mode 100644 src/components/TableInformationDrawer/withTemplate.tsx diff --git a/src/assets/icons/index.ts b/src/assets/icons/index.ts index 4e60591f..3503e99b 100644 --- a/src/assets/icons/index.ts +++ b/src/assets/icons/index.ts @@ -103,9 +103,6 @@ export { FileTableBoxOutline as Project }; import { TableColumn } from "mdi-material-ui"; export { TableColumn }; -import { InformationOutline } from "mdi-material-ui"; -export { InformationOutline as TableInformation }; - export * from "./AddRow"; export * from "./AddRowTop"; export * from "./ChevronDown"; diff --git a/src/components/TableInformationDrawer/Details.tsx b/src/components/TableInformationDrawer/Details.tsx index a3d4640d..3f93721b 100644 --- a/src/components/TableInformationDrawer/Details.tsx +++ b/src/components/TableInformationDrawer/Details.tsx @@ -1,15 +1,9 @@ import { useMemo } from "react"; import { format } from "date-fns"; +import { find } from "lodash-es"; import MDEditor from "@uiw/react-md-editor"; -import { - Box, - Grid, - IconButton, - Stack, - Typography, - useTheme, -} from "@mui/material"; +import { Box, IconButton, Stack, Typography } from "@mui/material"; import EditIcon from "@mui/icons-material/EditOutlined"; @@ -21,13 +15,9 @@ import { tableSettingsDialogAtom, userRolesAtom, } from "@src/atoms/projectScope"; -import { find } from "lodash-es"; +import { DATE_TIME_FORMAT } from "@src/constants/dates"; -export interface IDetailsProps { - handleOpenTemplate?: any; -} - -export default function Details({ handleOpenTemplate }: IDetailsProps) { +export default function Details() { const [userRoles] = useAtom(userRolesAtom, projectScope); const [tableSettings] = useAtom(tableSettingsAtom, tableScope); const [tables] = useAtom(tablesAtom, projectScope); @@ -41,18 +31,13 @@ export default function Details({ handleOpenTemplate }: IDetailsProps) { [tables, tableSettings.id] ); - const theme = useTheme(); - if (!settings) { return null; } const editButton = userRoles.includes("ADMIN") && ( openTableSettingsDialog({ mode: "update", @@ -68,27 +53,26 @@ export default function Details({ handleOpenTemplate }: IDetailsProps) { const { description, details, _createdBy } = settings; return ( - .MuiGrid-root": { position: "relative", }, }} > {/* Description */} - + - + Description {editButton} @@ -96,16 +80,16 @@ export default function Details({ handleOpenTemplate }: IDetailsProps) { {description ? description : "No description"} - + {/* Details */} - + - + Details {editButton} @@ -123,16 +107,11 @@ export default function Details({ handleOpenTemplate }: IDetailsProps) { )} - + {/* Table Audits */} {_createdBy && ( - + {_createdBy.displayName} {" "} - at{" "} + on{" "} - {format(_createdBy.timestamp.toDate(), "LLL d, yyyy ยท p")} + {format(_createdBy.timestamp.toDate(), DATE_TIME_FORMAT)} - + )} - - {/* Template Settings */} - {/* {handleOpenTemplate && ( - -