@ -1,8 +1,13 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { AppPath } from '@/types/AppPath';
|
||||
import { Breadcrumb } from '@/ui/breadcrumb/components/Breadcrumb';
|
||||
import { IconSettings } from '@/ui/icon';
|
||||
import { SubMenuTopBarContainer } from '@/ui/layout/components/SubMenuTopBarContainer';
|
||||
|
||||
import { activeObjectItems } from './constants/mockObjects';
|
||||
import { objectSettingsWidth } from './constants/objectSettings';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
@ -10,8 +15,27 @@ const StyledContainer = styled.div`
|
||||
width: ${objectSettingsWidth};
|
||||
`;
|
||||
|
||||
export const SettingsObjectDetail = () => (
|
||||
<SubMenuTopBarContainer Icon={IconSettings} title="Settings">
|
||||
<StyledContainer />
|
||||
</SubMenuTopBarContainer>
|
||||
);
|
||||
export const SettingsObjectDetail = () => {
|
||||
const navigate = useNavigate();
|
||||
const { pluralObjectName = '' } = useParams();
|
||||
const activeObject = activeObjectItems.find(
|
||||
(activeObject) => activeObject.name.toLowerCase() === pluralObjectName,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!activeObject) navigate(AppPath.NotFound);
|
||||
}, [activeObject, navigate]);
|
||||
|
||||
return (
|
||||
<SubMenuTopBarContainer Icon={IconSettings} title="Settings">
|
||||
<StyledContainer>
|
||||
<Breadcrumb
|
||||
links={[
|
||||
{ children: 'Objects', href: '/settings/objects' },
|
||||
{ children: activeObject?.name ?? '' },
|
||||
]}
|
||||
/>
|
||||
</StyledContainer>
|
||||
</SubMenuTopBarContainer>
|
||||
);
|
||||
};
|
||||
|
||||
@ -4,14 +4,10 @@ import styled from '@emotion/styled';
|
||||
|
||||
import { Button } from '@/ui/button/components/Button';
|
||||
import {
|
||||
IconBuildingSkyscraper,
|
||||
IconChevronRight,
|
||||
IconDotsVertical,
|
||||
IconLuggage,
|
||||
IconPlane,
|
||||
IconPlus,
|
||||
IconSettings,
|
||||
IconUser,
|
||||
} from '@/ui/icon';
|
||||
import { SubMenuTopBarContainer } from '@/ui/layout/components/SubMenuTopBarContainer';
|
||||
import { Table } from '@/ui/table/components/Table';
|
||||
@ -23,6 +19,10 @@ import { Tag } from '@/ui/tag/components/Tag';
|
||||
import { H1Title } from '@/ui/typography/components/H1Title';
|
||||
import { H2Title } from '@/ui/typography/components/H2Title';
|
||||
|
||||
import {
|
||||
activeObjectItems,
|
||||
disabledObjectItems,
|
||||
} from './constants/mockObjects';
|
||||
import { objectSettingsWidth } from './constants/objectSettings';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
@ -68,40 +68,6 @@ const StyledH1Title = styled(H1Title)`
|
||||
margin-bottom: 0;
|
||||
`;
|
||||
|
||||
const activeObjectItems = [
|
||||
{
|
||||
name: 'Companies',
|
||||
Icon: IconBuildingSkyscraper,
|
||||
type: 'standard',
|
||||
fields: 23,
|
||||
instances: 165,
|
||||
},
|
||||
{
|
||||
name: 'People',
|
||||
Icon: IconUser,
|
||||
type: 'standard',
|
||||
fields: 16,
|
||||
instances: 462,
|
||||
},
|
||||
];
|
||||
|
||||
const disabledObjectItems = [
|
||||
{
|
||||
name: 'Travels',
|
||||
Icon: IconLuggage,
|
||||
type: 'custom',
|
||||
fields: 23,
|
||||
instances: 165,
|
||||
},
|
||||
{
|
||||
name: 'Flights',
|
||||
Icon: IconPlane,
|
||||
type: 'custom',
|
||||
fields: 23,
|
||||
instances: 165,
|
||||
},
|
||||
];
|
||||
|
||||
export const SettingsObjects = () => {
|
||||
const theme = useTheme();
|
||||
const navigate = useNavigate();
|
||||
|
||||
@ -12,7 +12,10 @@ const meta: Meta<PageDecoratorArgs> = {
|
||||
title: 'Pages/Settings/SettingsObjectDetail',
|
||||
component: SettingsObjectDetail,
|
||||
decorators: [PageDecorator],
|
||||
args: { routePath: '/settings/objects/companies' },
|
||||
args: {
|
||||
routePath: '/settings/objects/:pluralObjectName',
|
||||
routeParams: { ':pluralObjectName': 'companies' },
|
||||
},
|
||||
parameters: {
|
||||
docs: { story: 'inline', iframeHeight: '500px' },
|
||||
msw: graphqlMocks,
|
||||
|
||||
40
front/src/pages/settings/constants/mockObjects.ts
Normal file
40
front/src/pages/settings/constants/mockObjects.ts
Normal file
@ -0,0 +1,40 @@
|
||||
import {
|
||||
IconBuildingSkyscraper,
|
||||
IconLuggage,
|
||||
IconPlane,
|
||||
IconUser,
|
||||
} from '@/ui/icon';
|
||||
|
||||
export const activeObjectItems = [
|
||||
{
|
||||
name: 'Companies',
|
||||
Icon: IconBuildingSkyscraper,
|
||||
type: 'standard',
|
||||
fields: 23,
|
||||
instances: 165,
|
||||
},
|
||||
{
|
||||
name: 'People',
|
||||
Icon: IconUser,
|
||||
type: 'standard',
|
||||
fields: 16,
|
||||
instances: 462,
|
||||
},
|
||||
];
|
||||
|
||||
export const disabledObjectItems = [
|
||||
{
|
||||
name: 'Travels',
|
||||
Icon: IconLuggage,
|
||||
type: 'custom',
|
||||
fields: 23,
|
||||
instances: 165,
|
||||
},
|
||||
{
|
||||
name: 'Flights',
|
||||
Icon: IconPlane,
|
||||
type: 'custom',
|
||||
fields: 23,
|
||||
instances: 165,
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user