mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-05-01 03:09:34 +00:00
Initial Commit
This commit is contained in:
commit
f3e2f01bd7
150 changed files with 13612 additions and 0 deletions
60
app/(platform)/(dashboard)/board/[boardId]/layout.tsx
Normal file
60
app/(platform)/(dashboard)/board/[boardId]/layout.tsx
Normal file
|
@ -0,0 +1,60 @@
|
|||
import { auth } from "@clerk/nextjs";
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
|
||||
import { db } from "@/lib/db";
|
||||
import { BoardNavbar } from "./_components/board-navbar";
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: { boardId: string };
|
||||
}) {
|
||||
const { orgId } = auth();
|
||||
|
||||
if (!orgId) return { title: "Board" };
|
||||
|
||||
const board = await db.board.findUnique({
|
||||
where: {
|
||||
id: params.boardId,
|
||||
orgId,
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
title: board?.title ?? "Board",
|
||||
};
|
||||
}
|
||||
|
||||
const BoardIdLayout = async ({
|
||||
children,
|
||||
params,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
params: { boardId: string };
|
||||
}) => {
|
||||
const { orgId } = auth();
|
||||
|
||||
if (!orgId) redirect("/select-org");
|
||||
|
||||
const board = await db.board.findUnique({
|
||||
where: {
|
||||
id: params.boardId,
|
||||
orgId,
|
||||
},
|
||||
});
|
||||
|
||||
if (!board) notFound();
|
||||
|
||||
return (
|
||||
<div
|
||||
className="relative h-full bg-no-repeat bg-cover bg-center"
|
||||
style={{ backgroundImage: `url(${board.imageFullUrl})` }}
|
||||
>
|
||||
<BoardNavbar data={board} />
|
||||
<div className="absolute inset-0 bg-black/10" />
|
||||
<main className="relative pt-28 h-full">{children}</main>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default BoardIdLayout;
|
Loading…
Add table
Add a link
Reference in a new issue