123
This commit is contained in:
86
pages/_app.tsx
Normal file
86
pages/_app.tsx
Normal file
@ -0,0 +1,86 @@
|
||||
import '@mantine/core/styles.css';
|
||||
import 'mantine-datatable/styles.layer.css';
|
||||
import '@mantine/notifications/styles.css';
|
||||
import '@mantine/dates/styles.css';
|
||||
|
||||
import type { AppProps } from 'next/app';
|
||||
import Head from 'next/head';
|
||||
import { AppShell, Box, Flex, MantineProvider, rem } from '@mantine/core';
|
||||
import { useDisclosure } from '@mantine/hooks';
|
||||
import Header from '@/components/Layout/Header/Header';
|
||||
import { Navbar } from '@/components/Layout/Navbar/Navbar';
|
||||
import { client } from '@/lib/client/client.gen';
|
||||
import { ReactQueryProvider } from '@/providers/ReactQueryProvider';
|
||||
import { theme } from '@/theme';
|
||||
|
||||
client.setConfig({
|
||||
baseURL: process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3000/api',
|
||||
});
|
||||
export default function App({ Component, pageProps }: AppProps) {
|
||||
const [mobileOpened, { toggle: toggleMobile }] = useDisclosure();
|
||||
const [desktopOpened, { toggle: toggleDesktop }] = useDisclosure(true);
|
||||
|
||||
return (
|
||||
<ReactQueryProvider>
|
||||
<MantineProvider theme={theme}>
|
||||
<Head>
|
||||
<title>Mantine Template</title>
|
||||
<meta
|
||||
name="viewport"
|
||||
content="minimum-scale=1, initial-scale=1, width=device-width, user-scalable=no"
|
||||
/>
|
||||
<link rel="shortcut icon" href="/favicon.svg" />
|
||||
</Head>
|
||||
<AppShell
|
||||
padding="md"
|
||||
header={{ height: '60px' }}
|
||||
navbar={{
|
||||
width: 250,
|
||||
breakpoint: 'sm',
|
||||
collapsed: { mobile: !mobileOpened, desktop: !desktopOpened },
|
||||
}}
|
||||
>
|
||||
<AppShell.Header>
|
||||
<Header
|
||||
desktopOpened={desktopOpened}
|
||||
mobileOpened={mobileOpened}
|
||||
toggleDesktop={toggleDesktop}
|
||||
toggleMobile={toggleMobile}
|
||||
/>
|
||||
</AppShell.Header>
|
||||
<AppShell.Navbar>
|
||||
<Navbar />
|
||||
</AppShell.Navbar>
|
||||
<AppShell.Main
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
height: '100dvh',
|
||||
minHeight: 0,
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
style={{
|
||||
flex: 1,
|
||||
minHeight: 0,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
style={{
|
||||
flex: 1,
|
||||
minHeight: 0,
|
||||
display: 'flex',
|
||||
}}
|
||||
>
|
||||
<Component {...pageProps} />
|
||||
</Box>
|
||||
</Box>
|
||||
</AppShell.Main>
|
||||
</AppShell>
|
||||
</MantineProvider>
|
||||
</ReactQueryProvider>
|
||||
);
|
||||
}
|
||||
16
pages/_document.tsx
Normal file
16
pages/_document.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import { Head, Html, Main, NextScript } from 'next/document';
|
||||
import { ColorSchemeScript, mantineHtmlProps } from '@mantine/core';
|
||||
|
||||
export default function Document() {
|
||||
return (
|
||||
<Html lang="en" {...mantineHtmlProps}>
|
||||
<Head>
|
||||
<ColorSchemeScript />
|
||||
</Head>
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
</Html>
|
||||
);
|
||||
}
|
||||
4
pages/deal-requests/index.tsx
Normal file
4
pages/deal-requests/index.tsx
Normal file
@ -0,0 +1,4 @@
|
||||
const DealRequestsPage = () => {
|
||||
return <div>Deal Requests Page</div>;
|
||||
};
|
||||
export default DealRequestsPage;
|
||||
22
pages/index.tsx
Normal file
22
pages/index.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useRouter } from 'next/router';
|
||||
import { Flex } from '@mantine/core';
|
||||
import { AuthenticationForm } from '@/components/Forms/AuthenticationForm';
|
||||
|
||||
export default function HomePage() {
|
||||
const router = useRouter();
|
||||
// const [checking, setChecking] = useState(true);
|
||||
// useEffect(() => {
|
||||
// router.replace('/login').then(() => setChecking(false));
|
||||
// }, [router]);
|
||||
//
|
||||
// if (checking) {
|
||||
// return <p>Checking login status...</p>;
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
</>
|
||||
);
|
||||
}
|
||||
2
pages/layout.css
Normal file
2
pages/layout.css
Normal file
@ -0,0 +1,2 @@
|
||||
/* 👇 Make sure the styles are applied in the correct order */
|
||||
@layer mantine, mantine-datatable;
|
||||
4
pages/legal-entities/index.tsx
Normal file
4
pages/legal-entities/index.tsx
Normal file
@ -0,0 +1,4 @@
|
||||
const LegalEntitiesPage = () => {
|
||||
return <div>Юр лица</div>;
|
||||
};
|
||||
export default LegalEntitiesPage;
|
||||
11
pages/login/index.tsx
Normal file
11
pages/login/index.tsx
Normal file
@ -0,0 +1,11 @@
|
||||
import { Flex } from '@mantine/core';
|
||||
import { AuthenticationForm } from '@/components/Forms/AuthenticationForm';
|
||||
|
||||
const LoginPage = () => {
|
||||
return (
|
||||
<Flex justify="center" align="center" h="100vh">
|
||||
<AuthenticationForm />
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
export default LoginPage;
|
||||
@ -0,0 +1,11 @@
|
||||
import { Avatar, Image, ThemeIcon } from '@mantine/core';
|
||||
import { BaseMarketplaceSchema } from '@/lib/client';
|
||||
|
||||
type Props = {
|
||||
object: BaseMarketplaceSchema;
|
||||
};
|
||||
const BaseMarketplaceColumnRender = ({ object }: Props) => {
|
||||
return <Avatar src={object.iconUrl} radius={"xs"} />;
|
||||
};
|
||||
|
||||
export default BaseMarketplaceColumnRender;
|
||||
@ -0,0 +1,41 @@
|
||||
import { IconCirclePlus } from '@tabler/icons-react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { ActionIcon, Affix, Tooltip } from '@mantine/core';
|
||||
|
||||
import BaseTable from '@/components/BaseTable/BaseTable';
|
||||
import { MarketplaceSchema } from '@/lib/client';
|
||||
import { getMarketplacesOptions } from '@/lib/client/@tanstack/react-query.gen';
|
||||
import useMarketplacesTableColumns from '@/pages/marketplaces/components/MarketplacesTable/columns';
|
||||
import { CRUDTableProps } from '@/types/CrudTable/CrudTable';
|
||||
|
||||
type Props = CRUDTableProps<MarketplaceSchema>;
|
||||
const MarketplacesTable = (props: Props) => {
|
||||
const { data, isLoading } = useQuery({
|
||||
...getMarketplacesOptions({ path: { clientId: 5 } }),
|
||||
});
|
||||
const onCreateClick = ()=>{
|
||||
|
||||
}
|
||||
|
||||
const columns = useMarketplacesTableColumns();
|
||||
return (
|
||||
<>
|
||||
<BaseTable
|
||||
scrollAreaProps={{ type: 'auto' }}
|
||||
style={{ width: '100%', height: '100%' }}
|
||||
records={data?.items || []}
|
||||
columns={columns}
|
||||
fetching={isLoading}
|
||||
/>
|
||||
<Affix position={{ bottom: 40, right: 40 }}>
|
||||
<Tooltip label="Создать маркетплейс" withArrow>
|
||||
<ActionIcon onClick={() => {}} size="xl" variant="gradient" radius="xl">
|
||||
<IconCirclePlus />
|
||||
</ActionIcon>
|
||||
</Tooltip>
|
||||
</Affix>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default MarketplacesTable;
|
||||
57
pages/marketplaces/components/MarketplacesTable/columns.tsx
Normal file
57
pages/marketplaces/components/MarketplacesTable/columns.tsx
Normal file
@ -0,0 +1,57 @@
|
||||
import { useMemo } from 'react';
|
||||
import { IconSettings } from '@tabler/icons-react';
|
||||
import { DataTableColumn } from 'mantine-datatable';
|
||||
import { Center } from '@mantine/core';
|
||||
import BaseTableActions from '@/components/Tables/Actions/BaseTableActions';
|
||||
import { MarketplaceSchema } from '@/lib/client';
|
||||
import { zMarketplaceSchema } from '@/lib/client/zod.gen';
|
||||
import BaseMarketplaceColumnRender from '@/pages/marketplaces/components/BaseMarketplaceColumnRender/BaseMarketplaceColumnRender';
|
||||
|
||||
const useMarketplacesTableColumns = () => {
|
||||
return useMemo(
|
||||
() =>
|
||||
[
|
||||
{
|
||||
accessor: 'id',
|
||||
title: 'ID',
|
||||
width: '0%',
|
||||
},
|
||||
{
|
||||
accessor: 'baseMarketplace',
|
||||
title: 'Базовый маркетплейс',
|
||||
render: ({ baseMarketplace }: MarketplaceSchema) => (
|
||||
<BaseMarketplaceColumnRender object={baseMarketplace} />
|
||||
),
|
||||
width: '0%',
|
||||
},
|
||||
{
|
||||
accessor: 'name',
|
||||
title: 'Название',
|
||||
},
|
||||
{
|
||||
width: '0%',
|
||||
accessor: 'actions',
|
||||
title: (
|
||||
<Center>
|
||||
<IconSettings size={16} />
|
||||
</Center>
|
||||
),
|
||||
render: (element) => (
|
||||
<BaseTableActions
|
||||
element={element}
|
||||
onChange={async () => {
|
||||
// const zodSchema = await zMarketplaceSchema.parseAsync(element)
|
||||
Object.entries(zMarketplaceSchema.shape).forEach(([key, val], index, arr) => {
|
||||
console.log(val.type);
|
||||
});
|
||||
}}
|
||||
onDelete={async () => {}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
] as DataTableColumn<MarketplaceSchema>[],
|
||||
[]
|
||||
);
|
||||
};
|
||||
|
||||
export default useMarketplacesTableColumns;
|
||||
22
pages/marketplaces/index.tsx
Normal file
22
pages/marketplaces/index.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
import ObjectForm from '@/components/ObjectForm/ObjectForm';
|
||||
import { MarketplaceSchema } from '@/lib/client';
|
||||
import { zMarketplaceSchema } from '@/lib/client/zod.gen';
|
||||
|
||||
const MarketplacesPage = () => {
|
||||
return (
|
||||
<>
|
||||
<ObjectForm<MarketplaceSchema, typeof zMarketplaceSchema>
|
||||
schema={zMarketplaceSchema}
|
||||
includeKeys={['name']}
|
||||
onCreate={(marketplace) => {}}
|
||||
labels={{
|
||||
name: 'Название',
|
||||
authData: 'Данные для авторизации',
|
||||
}}
|
||||
/>
|
||||
{/*<MarketplacesTable />*/}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default MarketplacesPage;
|
||||
@ -0,0 +1,8 @@
|
||||
import { ContextModalProps } from '@mantine/modals';
|
||||
|
||||
type Props = {};
|
||||
|
||||
const MarketplaceFormModal = ({ context, id, innerProps }: ContextModalProps<Props>) => {
|
||||
return <div>MarketplaceFormModal</div>;
|
||||
};
|
||||
export default MarketplaceFormModal
|
||||
4
pages/products/index.tsx
Normal file
4
pages/products/index.tsx
Normal file
@ -0,0 +1,4 @@
|
||||
const ProductsPage = () => {
|
||||
return <div>Товары</div>;
|
||||
};
|
||||
export default ProductsPage;
|
||||
Reference in New Issue
Block a user