new.tsx40 lines · main
| 1 | import { useParams } from 'common' |
| 2 | import { useRouter } from 'next/router' |
| 3 | |
| 4 | import { SidePanelEditor } from '@/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor' |
| 5 | import { DefaultLayout } from '@/components/layouts/DefaultLayout' |
| 6 | import { EditorBaseLayout } from '@/components/layouts/editors/EditorBaseLayout' |
| 7 | import { TableEditorLayout } from '@/components/layouts/TableEditorLayout/TableEditorLayout' |
| 8 | import { TableEditorMenu } from '@/components/layouts/TableEditorLayout/TableEditorMenu' |
| 9 | import { NewTab } from '@/components/layouts/Tabs/NewTab' |
| 10 | import type { NextPageWithLayout } from '@/types' |
| 11 | |
| 12 | const EditorNewPage: NextPageWithLayout = () => { |
| 13 | const router = useRouter() |
| 14 | const { ref: projectRef } = useParams() |
| 15 | |
| 16 | const onTableCreated = (table: { id: number }) => { |
| 17 | router.push(`/project/${projectRef}/editor/${table.id}`) |
| 18 | } |
| 19 | |
| 20 | return ( |
| 21 | <> |
| 22 | <NewTab /> |
| 23 | <SidePanelEditor onTableCreated={onTableCreated} /> |
| 24 | </> |
| 25 | ) |
| 26 | } |
| 27 | |
| 28 | EditorNewPage.getLayout = (page) => ( |
| 29 | <DefaultLayout> |
| 30 | <EditorBaseLayout |
| 31 | productMenu={<TableEditorMenu />} |
| 32 | product="Table Editor" |
| 33 | productMenuClassName="overflow-y-hidden" |
| 34 | > |
| 35 | <TableEditorLayout>{page}</TableEditorLayout> |
| 36 | </EditorBaseLayout> |
| 37 | </DefaultLayout> |
| 38 | ) |
| 39 | |
| 40 | export default EditorNewPage |