feat: implement portal shell layout with user authentication, sidebar navigation, and progress tracking

This commit is contained in:
Poyraz Avsever
2026-06-08 13:56:06 +03:00
parent 47b9f728e6
commit d41267c29b
17 changed files with 582 additions and 130 deletions
+19
View File
@@ -39,6 +39,24 @@ export default async function PortalLayout({
.join("")
.slice(0, 2) || "MS";
const { data: clientData } = await supabase
.from("clients")
.select("id")
.eq("client_auth_id", user.id)
.maybeSingle();
let avgProgress = 0;
if (clientData) {
const { data: projectsData } = await supabase
.from("projects")
.select("progress")
.eq("client_id", clientData.id)
.eq("status", "active");
if (projectsData && projectsData.length > 0) {
avgProgress = Math.round(projectsData.reduce((sum, p) => sum + p.progress, 0) / projectsData.length);
}
}
return (
<PortalShell
user={{
@@ -47,6 +65,7 @@ export default async function PortalLayout({
shortName,
avatarUrl: profile?.avatar_url || null,
}}
progress={avgProgress}
>
{children}
</PortalShell>