mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Working on settings Page. Adding init function on next.js startup.
This commit is contained in:
+10
-7
@@ -6,16 +6,19 @@ import {prisma} from "@/prisma";
|
||||
export default async function Layout({children}: { children: React.ReactNode }) {
|
||||
|
||||
const user = await currentUser()
|
||||
// const userInfo = await prisma.user.findUnique({
|
||||
// where: {
|
||||
// email: user?.email
|
||||
// }
|
||||
// })
|
||||
//
|
||||
if(user){
|
||||
redirect('/dashboard')
|
||||
const userInfo = await prisma.user.findUnique({
|
||||
where: {
|
||||
email: user?.email
|
||||
}
|
||||
})
|
||||
|
||||
if(userInfo){
|
||||
redirect('/dashboard')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<LayoutAdmin>
|
||||
<div
|
||||
|
||||
@@ -16,20 +16,35 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
<PageTitle>
|
||||
Agents
|
||||
</PageTitle>
|
||||
<PageActions>
|
||||
<Link href={"/dashboard/agents/new"}>
|
||||
<Button>+ Create Agent</Button>
|
||||
</Link>
|
||||
</PageActions>
|
||||
{agents.length > 0 && (
|
||||
<PageActions>
|
||||
<Link href={"/dashboard/agents/new"}>
|
||||
<Button>+ Create Agent</Button>
|
||||
</Link>
|
||||
</PageActions>
|
||||
)}
|
||||
|
||||
</PageHeader>
|
||||
|
||||
<PageContent className="mt-10">
|
||||
<CardsWithPagination
|
||||
data={agents}
|
||||
cardItem={AgentCard}
|
||||
cardsPerPage={4}
|
||||
numberOfColumns={1}
|
||||
/>
|
||||
|
||||
{agents.length > 0 ?
|
||||
<CardsWithPagination
|
||||
data={agents}
|
||||
cardItem={AgentCard}
|
||||
cardsPerPage={4}
|
||||
numberOfColumns={1}
|
||||
/>
|
||||
:
|
||||
<Link
|
||||
href="/dashboard/agents/new"
|
||||
className=" flex item-center justify-center border-2 border-dashed transition-colors border-primary p-8 lg:p-12 w-full rounded-md">
|
||||
Create new Agent
|
||||
</Link>
|
||||
|
||||
}
|
||||
|
||||
|
||||
</PageContent>
|
||||
</Page>
|
||||
)
|
||||
|
||||
@@ -19,6 +19,11 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
}
|
||||
})
|
||||
|
||||
const settings = await prisma.settings.findUnique({
|
||||
where:{
|
||||
name: "system"
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<Page>
|
||||
@@ -31,7 +36,7 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
Manage your Portabase settings
|
||||
</PageDescription>
|
||||
<PageContent>
|
||||
<SettingsTabs users={users}/>
|
||||
<SettingsTabs settings={settings} users={users}/>
|
||||
</PageContent>
|
||||
</Page>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user