-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create table and redirect to table page
- Loading branch information
Showing
23 changed files
with
137 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,3 @@ | ||
'use client' | ||
|
||
import { AppShell, Header } from '@egodb/ui' | ||
import { EGOTable } from '@egodb/table-ui' | ||
import { CreateTableFormDrawer } from '../components/create-table-form' | ||
import { TableNavList } from '../components/tables-list-nav/table-list-nav' | ||
|
||
export default function App() { | ||
return ( | ||
<> | ||
<AppShell | ||
padding="md" | ||
navbar={<TableNavList />} | ||
header={ | ||
<Header height={60} p="xs"> | ||
{/* Header content */} | ||
</Header> | ||
} | ||
> | ||
<EGOTable /> | ||
</AppShell> | ||
<CreateTableFormDrawer /> | ||
</> | ||
) | ||
return <>{null}</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use client' | ||
|
||
import { Alert, Container, IconAlertCircle } from '@egodb/ui' | ||
import { trpc } from '../../../trpc' | ||
import Table from './table' | ||
|
||
export default function Page({ params: { id } }: { params: { id: string } }) { | ||
const getTable = trpc.table.get.useQuery({ id }) | ||
|
||
if (getTable.isLoading) { | ||
return 'loading' | ||
} | ||
|
||
if (getTable.isError) { | ||
return ( | ||
<Container> | ||
<Alert icon={<IconAlertCircle size={16} />} title="Oops! Get Table Error!" mt="lg" color="red"> | ||
{getTable.error.message} | ||
</Alert> | ||
</Container> | ||
) | ||
} | ||
|
||
if (!getTable.data) { | ||
return 'none' | ||
} | ||
|
||
return <Table table={getTable.data} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use client' | ||
|
||
import type { IGetTableOutput } from '@egodb/core' | ||
import { EGOTable } from '@egodb/table-ui' | ||
import { Box, Title } from '@egodb/ui' | ||
|
||
interface IProps { | ||
table: NonNullable<IGetTableOutput> | ||
} | ||
|
||
export default function Table({ table }: IProps) { | ||
return ( | ||
<Box> | ||
<Title>{table.name}</Title> | ||
<EGOTable table={table} /> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
packages/core/commands/create-table/create-table.command.output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import * as z from 'zod' | ||
import { tableIdSchema } from '../../value-objects' | ||
|
||
export const createTableCommandOutput = z.void() | ||
export const createTableCommandOutput = z.object({ | ||
id: tableIdSchema, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import * as z from 'zod' | ||
import { queryColumnsSchema } from '../../column' | ||
|
||
export const getTableQueryOutput = z.object({ | ||
id: z.string(), | ||
name: z.string(), | ||
columns: queryColumnsSchema, | ||
}) | ||
export const getTableQueryOutput = z | ||
.object({ | ||
id: z.string(), | ||
name: z.string(), | ||
columns: queryColumnsSchema, | ||
}) | ||
.optional() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import * as z from 'zod' | ||
import { getTableQueryOutput } from '../get-table/get-table.query.output' | ||
|
||
export const getTablesQueryOutput = z.array(getTableQueryOutput) | ||
export const getTablesQueryOutput = z.array(getTableQueryOutput.unwrap()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { AppShell, Navbar, Header, Aside, Footer } from '@mantine/core' | ||
export { AppShell, Navbar, Header, Aside, Footer, ScrollArea } from '@mantine/core' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { Center, Group, Flex, Box, Space } from '@mantine/core' | ||
export { Center, Group, Flex, Box, Space, Container } from '@mantine/core' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { Text } from '@mantine/core' | ||
export { Text, Title } from '@mantine/core' |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.