mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Working on project.
This commit is contained in:
@@ -11,7 +11,6 @@ import {prisma} from "@/prisma";
|
||||
export default async function Layout({children}: { children: React.ReactNode }) {
|
||||
|
||||
const user = await currentUser()
|
||||
console.log(user)
|
||||
if (user) {
|
||||
const userInfo = await prisma.user.findUnique({
|
||||
where: {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||
import {requiredCurrentUser} from "@/auth/current-user";
|
||||
import {prisma} from "@/prisma";
|
||||
import {notFound} from "next/navigation";
|
||||
import {ProjectForm} from "@/components/wrappers/project/ProjectForm";
|
||||
import {ProjectForm} from "@/components/wrappers/Project/ProjectForm";
|
||||
|
||||
|
||||
export default async function RoutePage(props: PageParams<{
|
||||
@@ -16,12 +16,31 @@ export default async function RoutePage(props: PageParams<{
|
||||
const project = await prisma.project.findUnique({
|
||||
where: {
|
||||
id: projectId,
|
||||
},
|
||||
include: {
|
||||
databases: {}
|
||||
}
|
||||
});
|
||||
|
||||
if (!project) {
|
||||
notFound();
|
||||
}
|
||||
const organization = await prisma.organization.findFirst({
|
||||
where: {
|
||||
slug: 'default',
|
||||
}
|
||||
})
|
||||
const availableDatabases = await prisma.database.findMany({
|
||||
where: {
|
||||
OR: [
|
||||
{ projectId: null },
|
||||
{ projectId: project.id },
|
||||
],
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
return (
|
||||
@@ -32,7 +51,7 @@ export default async function RoutePage(props: PageParams<{
|
||||
</PageTitle>
|
||||
</PageHeader>
|
||||
<PageContent>
|
||||
<ProjectForm defaultValues={project} projectId={project.id}/>
|
||||
<ProjectForm organization={organization} databases={availableDatabases} defaultValues={project} projectId={project.id}/>
|
||||
</PageContent>
|
||||
</Page>
|
||||
)
|
||||
|
||||
@@ -12,13 +12,15 @@ export default async function RoutePage(props: PageParams<{ projectId: string }>
|
||||
|
||||
const {projectId} = await props.params
|
||||
|
||||
// const project = await prisma.project.findUnique({
|
||||
// where: {
|
||||
// id: projectId,
|
||||
// },
|
||||
// })
|
||||
const project = await prisma.project.findUnique({
|
||||
where: {
|
||||
id: projectId,
|
||||
},
|
||||
include:{
|
||||
databases: {}
|
||||
}
|
||||
})
|
||||
|
||||
const project = projects.find(p => p.id === projectId)
|
||||
|
||||
|
||||
return (
|
||||
@@ -35,7 +37,7 @@ export default async function RoutePage(props: PageParams<{ projectId: string }>
|
||||
|
||||
</PageActions>
|
||||
</div>
|
||||
{/*<PageDescription className="mt-5 sm:mt-0">{project.description}</PageDescription>*/}
|
||||
{/*<PageDescription className="mt-5 sm:mt-0">{Project.description}</PageDescription>*/}
|
||||
<PageContent className="flex flex-col w-full h-full">
|
||||
</PageContent>
|
||||
</Page>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {PageParams} from "@/types/next";
|
||||
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||
import {prisma} from "@/prisma";
|
||||
import {ProjectForm} from "@/components/wrappers/project/ProjectForm";
|
||||
import {ProjectForm} from "@/components/wrappers/Project/ProjectForm";
|
||||
|
||||
|
||||
export default async function RoutePage(props: PageParams<{}>) {
|
||||
@@ -15,6 +15,12 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
},
|
||||
})
|
||||
|
||||
const organization = await prisma.organization.findFirst({
|
||||
where: {
|
||||
slug: 'default',
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<PageHeader>
|
||||
@@ -23,12 +29,7 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
</PageTitle>
|
||||
</PageHeader>
|
||||
<PageContent>
|
||||
Add databases
|
||||
{availableDatabases.map(database =>
|
||||
<div key={database.id}>
|
||||
{database.name}
|
||||
</div>)}
|
||||
<ProjectForm/>
|
||||
<ProjectForm databases={availableDatabases} organization={organization}/>
|
||||
</PageContent>
|
||||
</Page>
|
||||
)
|
||||
|
||||
@@ -5,11 +5,21 @@ import {Button} from "@/components/ui/button";
|
||||
import Link from 'next/link'
|
||||
import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||
import {projects} from "@/utils/mock-data";
|
||||
import {ProjectCard} from "@/components/wrappers/project/ProjectCard";
|
||||
import {ProjectCard} from "@/components/wrappers/Project/ProjectCard";
|
||||
|
||||
export default async function RoutePage(props: PageParams<{}>) {
|
||||
|
||||
// const projects = await prisma.project.findMany({})
|
||||
|
||||
const projects = await prisma.project.findMany({
|
||||
where: {
|
||||
organization: {
|
||||
slug: "default",
|
||||
}
|
||||
},
|
||||
include:{
|
||||
databases: {}
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<Page>
|
||||
@@ -44,8 +54,6 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
</Link>
|
||||
|
||||
}
|
||||
|
||||
|
||||
</PageContent>
|
||||
</Page>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user