feat: add about block in object detail page (#2028)
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
|
import { useTheme } from '@emotion/react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -13,12 +14,15 @@ import {
|
|||||||
} from '@/settings/objects/constants/mockObjects';
|
} from '@/settings/objects/constants/mockObjects';
|
||||||
import { objectSettingsWidth } from '@/settings/objects/constants/objectSettings';
|
import { objectSettingsWidth } from '@/settings/objects/constants/objectSettings';
|
||||||
import { AppPath } from '@/types/AppPath';
|
import { AppPath } from '@/types/AppPath';
|
||||||
import { IconPlus, IconSettings } from '@/ui/display/icon';
|
import { IconDotsVertical, IconPlus, IconSettings } from '@/ui/display/icon';
|
||||||
|
import { Tag } from '@/ui/display/tag/components/Tag';
|
||||||
import { H2Title } from '@/ui/display/typography/components/H2Title';
|
import { H2Title } from '@/ui/display/typography/components/H2Title';
|
||||||
import { Button } from '@/ui/input/button/components/Button';
|
import { Button } from '@/ui/input/button/components/Button';
|
||||||
import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer';
|
import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer';
|
||||||
import { Table } from '@/ui/layout/table/components/Table';
|
import { Table } from '@/ui/layout/table/components/Table';
|
||||||
|
import { TableCell } from '@/ui/layout/table/components/TableCell';
|
||||||
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
|
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
|
||||||
|
import { TableRow } from '@/ui/layout/table/components/TableRow';
|
||||||
import { TableSection } from '@/ui/layout/table/components/TableSection';
|
import { TableSection } from '@/ui/layout/table/components/TableSection';
|
||||||
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
|
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
|
||||||
|
|
||||||
@ -30,6 +34,11 @@ const StyledContainer = styled.div`
|
|||||||
width: ${objectSettingsWidth};
|
width: ${objectSettingsWidth};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const StyledFlexContainer = styled.div`
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
`;
|
||||||
|
|
||||||
const StyledBreadcrumb = styled(Breadcrumb)`
|
const StyledBreadcrumb = styled(Breadcrumb)`
|
||||||
margin-bottom: ${({ theme }) => theme.spacing(8)};
|
margin-bottom: ${({ theme }) => theme.spacing(8)};
|
||||||
`;
|
`;
|
||||||
@ -38,9 +47,34 @@ const StyledAddFieldButton = styled(Button)`
|
|||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
margin-top: ${({ theme }) => theme.spacing(2)};
|
margin-top: ${({ theme }) => theme.spacing(2)};
|
||||||
`;
|
`;
|
||||||
|
const StyledIconTableCell = styled(TableCell)`
|
||||||
|
justify-content: center;
|
||||||
|
padding-right: ${({ theme }) => theme.spacing(1)};
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledTableRow = styled(TableRow)`
|
||||||
|
background-color: ${({ theme }) => theme.background.secondary};
|
||||||
|
border: ${({ theme }) => theme.border.color.medium};
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledNameTableCell = styled(TableCell)`
|
||||||
|
color: ${({ theme }) => theme.font.color.primary};
|
||||||
|
gap: ${({ theme }) => theme.spacing(2)};
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledTag = styled(Tag)`
|
||||||
|
box-sizing: border-box;
|
||||||
|
height: ${({ theme }) => theme.spacing(4)};
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledIconDotsVertical = styled(IconDotsVertical)`
|
||||||
|
color: ${({ theme }) => theme.font.color.tertiary};
|
||||||
|
`;
|
||||||
|
|
||||||
export const SettingsObjectDetail = () => {
|
export const SettingsObjectDetail = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
const { pluralObjectName = '' } = useParams();
|
const { pluralObjectName = '' } = useParams();
|
||||||
const activeObject = activeObjectItems.find(
|
const activeObject = activeObjectItems.find(
|
||||||
(activeObject) => activeObject.name.toLowerCase() === pluralObjectName,
|
(activeObject) => activeObject.name.toLowerCase() === pluralObjectName,
|
||||||
@ -59,6 +93,35 @@ export const SettingsObjectDetail = () => {
|
|||||||
{ children: activeObject?.name ?? '' },
|
{ children: activeObject?.name ?? '' },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
<H2Title title="About" description={`Manage you object`} />
|
||||||
|
<StyledTableRow key={activeObject?.name}>
|
||||||
|
<StyledNameTableCell>
|
||||||
|
{activeObject ? (
|
||||||
|
<activeObject.Icon size={theme.icon.size.md} />
|
||||||
|
) : (
|
||||||
|
''
|
||||||
|
)}
|
||||||
|
{activeObject?.name}
|
||||||
|
</StyledNameTableCell>
|
||||||
|
<StyledFlexContainer>
|
||||||
|
<TableCell>
|
||||||
|
{activeObject?.type === 'standard' ? (
|
||||||
|
<StyledTag color="blue" text="Standard" />
|
||||||
|
) : (
|
||||||
|
<StyledTag color="orange" text="Custom" />
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
<StyledIconTableCell>
|
||||||
|
<StyledIconDotsVertical
|
||||||
|
size={theme.icon.size.md}
|
||||||
|
stroke={theme.icon.stroke.sm}
|
||||||
|
onClick={() =>
|
||||||
|
navigate(`/settings/objects/${pluralObjectName}/edit`)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</StyledIconTableCell>
|
||||||
|
</StyledFlexContainer>
|
||||||
|
</StyledTableRow>
|
||||||
<H2Title
|
<H2Title
|
||||||
title="Fields"
|
title="Fields"
|
||||||
description={`Customise the fields available in the ${activeObject?.singularName} views and their display order in the ${activeObject?.singularName} detail view and menus.`}
|
description={`Customise the fields available in the ${activeObject?.singularName} views and their display order in the ${activeObject?.singularName} detail view and menus.`}
|
||||||
|
|||||||
Reference in New Issue
Block a user