-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### What problem does this PR solve? feat: Move the system page to the home page #1841 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
- Loading branch information
Showing
8 changed files
with
508 additions
and
51 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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { Card, CardHeader, CardTitle } from '@/components/ui/card'; | ||
import AddIcon from '/public/add.svg'; | ||
|
||
import { | ||
Select, | ||
SelectContent, | ||
SelectItem, | ||
SelectTrigger, | ||
SelectValue | ||
} from '@radix-ui/react-select'; | ||
import { listDatabase } from '../actions'; | ||
import { DatabaseCard } from '../database-card'; | ||
import { DatabaseCreatingDialog } from '../database-creating-dialog'; | ||
|
||
interface IDatabaseSelectProps { | ||
placeholder?: string; | ||
options: Array<{ label: string; value: string }>; | ||
} | ||
|
||
export function DatabaseSelect({ placeholder, options }: IDatabaseSelectProps) { | ||
return ( | ||
<Select> | ||
<SelectTrigger className="w-[180px]"> | ||
<SelectValue placeholder={placeholder} /> | ||
</SelectTrigger> | ||
<SelectContent> | ||
{options.map(({ value, label }) => ( | ||
<SelectItem value={value} key={value}> | ||
{label} | ||
</SelectItem> | ||
))} | ||
</SelectContent> | ||
</Select> | ||
); | ||
} | ||
|
||
export default async function HomePage({ | ||
searchParams | ||
}: { | ||
searchParams: { q: string; offset: string }; | ||
}) { | ||
const ret = await listDatabase(); | ||
const search = searchParams.q ?? ''; | ||
const offset = searchParams.offset ?? 0; | ||
|
||
return ( | ||
<div className="grid grid-cols-4 gap-4"> | ||
{ret.databases.map((x: string, idx: number) => ( | ||
<DatabaseCard key={idx} data={x}></DatabaseCard> | ||
))} | ||
<Card className="w-full max-w-sm"> | ||
<DatabaseCreatingDialog> | ||
<CardHeader> | ||
<AddIcon className="w-10 h-10"></AddIcon> | ||
<CardTitle className="text-1xl">Create Database</CardTitle> | ||
</CardHeader> | ||
</DatabaseCreatingDialog> | ||
</Card> | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use client'; | ||
|
||
import { | ||
ContextMenuContent, | ||
ContextMenuItem | ||
} from '@/components/ui/context-menu'; | ||
import { useSeDialogState } from '@/lib/hooks'; | ||
import { TableCreatingDialog } from './table-creating-dialog'; | ||
import AddIcon from '/public/add.svg'; | ||
|
||
export function InfinityContextMenuContent({ | ||
databaseName | ||
}: { | ||
databaseName: string; | ||
}) { | ||
const { showDialog, visible, hideDialog, switchVisible } = useSeDialogState(); | ||
return ( | ||
<> | ||
<ContextMenuContent> | ||
<ContextMenuItem> | ||
<div className="flex justify-between w-full" onClick={showDialog}> | ||
Add <AddIcon className="w-5 h-5"></AddIcon> | ||
</div> | ||
</ContextMenuItem> | ||
</ContextMenuContent> | ||
<TableCreatingDialog | ||
visible={visible} | ||
hideDialog={hideDialog} | ||
switchVisible={switchVisible} | ||
></TableCreatingDialog> | ||
</> | ||
); | ||
} |
Oops, something went wrong.