mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Working on add/delete users to workspace. Edit workspaces and some permissions.
This commit is contained in:
@@ -8,11 +8,21 @@ import {ButtonDeleteProject} from "@/components/wrappers/dashboard/projects/Butt
|
||||
import {CardsWithPagination} from "@/components/wrappers/common/cards-with-pagination";
|
||||
import {ProjectDatabaseCard} from "@/components/wrappers/dashboard/projects/ProjectCard/ProjectDatabaseCard";
|
||||
import {notFound} from "next/navigation";
|
||||
import {getCurrentOrganizationSlug} from "@/features/dashboard/organization-cookie";
|
||||
|
||||
|
||||
export default async function RoutePage(props: PageParams<{ projectId: string }>) {
|
||||
export default async function RoutePage(props: PageParams<{ slug:string, projectId: string }>) {
|
||||
|
||||
const {slug: organizationSlug, projectId} = await props.params
|
||||
|
||||
|
||||
const currentOrganizationSlug = await getCurrentOrganizationSlug()
|
||||
|
||||
if(currentOrganizationSlug != organizationSlug) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
|
||||
const {projectId} = await props.params
|
||||
|
||||
const project = await prisma.project.findUnique({
|
||||
where: {
|
||||
@@ -33,7 +43,7 @@ export default async function RoutePage(props: PageParams<{ projectId: string }>
|
||||
<PageTitle className="flex items-center">
|
||||
{project.name}
|
||||
<Link className={buttonVariants({variant: "outline"})}
|
||||
href={`/dashboard/projects/${project.id}/edit`}>
|
||||
href={`/dashboard/${currentOrganizationSlug}/projects/${project.id}/edit`}>
|
||||
<GearIcon className="w-7 h-7"/>
|
||||
</Link>
|
||||
</PageTitle>
|
||||
@@ -51,6 +61,7 @@ export default async function RoutePage(props: PageParams<{ projectId: string }>
|
||||
{project.databases.length > 0 ?
|
||||
<CardsWithPagination
|
||||
data={project.databases}
|
||||
organizationSlug={organizationSlug}
|
||||
cardItem={ProjectDatabaseCard}
|
||||
cardsPerPage={4}
|
||||
numberOfColumns={1}
|
||||
|
||||
@@ -2,9 +2,17 @@ import {PageParams} from "@/types/next";
|
||||
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||
import {prisma} from "@/prisma";
|
||||
import {ProjectForm} from "@/components/wrappers/dashboard/projects/ProjectsForm/ProjectForm";
|
||||
import {notFound} from "next/navigation";
|
||||
import {getCurrentOrganizationSlug} from "@/features/dashboard/organization-cookie";
|
||||
|
||||
|
||||
export default async function RoutePage(props: PageParams<{}>) {
|
||||
export default async function RoutePage(props: PageParams<{slug: string}>) {
|
||||
const {slug: organizationSlug} = await props.params
|
||||
const currentOrganizationSlug = await getCurrentOrganizationSlug()
|
||||
if(currentOrganizationSlug != organizationSlug) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
|
||||
const availableDatabases = await prisma.database.findMany({
|
||||
where: {
|
||||
@@ -20,7 +28,7 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
|
||||
const organization = await prisma.organization.findFirst({
|
||||
where: {
|
||||
slug: 'default',
|
||||
slug: currentOrganizationSlug,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ export default async function RoutePage(props: PageParams<{slug: string}>) {
|
||||
</PageTitle>
|
||||
{projects.length > 0 && (
|
||||
<PageActions>
|
||||
<Link href={"/dashboard/projects/new"}>
|
||||
<Link href={`/dashboard/${currentOrganizationSlug}/projects/new`}>
|
||||
<Button>+ Create Project</Button>
|
||||
</Link>
|
||||
</PageActions>
|
||||
@@ -59,6 +59,7 @@ export default async function RoutePage(props: PageParams<{slug: string}>) {
|
||||
|
||||
{projects.length > 0 ?
|
||||
<CardsWithPagination
|
||||
organizationSlug={currentOrganizationSlug}
|
||||
data={projects}
|
||||
cardItem={ProjectCard}
|
||||
cardsPerPage={4}
|
||||
@@ -66,7 +67,7 @@ export default async function RoutePage(props: PageParams<{slug: string}>) {
|
||||
/>
|
||||
:
|
||||
<Link
|
||||
href="/dashboard/projects/new"
|
||||
href={`/dashboard/${currentOrganizationSlug}/projects/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 Project
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user