Mega push vol1
This commit is contained in:
@@ -2,17 +2,32 @@
|
||||
import { page } from "$app/stores";
|
||||
import type { Snippet } from "svelte";
|
||||
|
||||
interface Member {
|
||||
id: string;
|
||||
user_id: string;
|
||||
role: string;
|
||||
profiles: {
|
||||
id: string;
|
||||
email: string;
|
||||
full_name: string | null;
|
||||
avatar_url: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface Props {
|
||||
data: {
|
||||
org: { id: string; name: string; slug: string };
|
||||
role: string;
|
||||
userRole: string;
|
||||
members: Member[];
|
||||
};
|
||||
children: Snippet;
|
||||
}
|
||||
|
||||
let { data, children }: Props = $props();
|
||||
|
||||
let sidebarCollapsed = $state(false);
|
||||
|
||||
const isAdmin = $derived(
|
||||
data.userRole === "owner" || data.userRole === "admin",
|
||||
);
|
||||
@@ -47,115 +62,210 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex h-screen bg-dark">
|
||||
<aside class="w-64 bg-surface border-r border-light/10 flex flex-col">
|
||||
<div class="p-4 border-b border-light/10">
|
||||
<h1 class="text-lg font-semibold text-light truncate">
|
||||
{data.org.name}
|
||||
</h1>
|
||||
<p class="text-xs text-light/50 capitalize">{data.role}</p>
|
||||
<!-- Figma-matched layout: bg-background with gap-4 padding -->
|
||||
<div class="flex h-screen bg-background p-4 gap-4">
|
||||
<!-- Organization Module -->
|
||||
<aside
|
||||
class="{sidebarCollapsed
|
||||
? 'w-20'
|
||||
: 'w-56'} bg-night rounded-[32px] flex flex-col px-3 py-5 transition-all duration-200 overflow-hidden"
|
||||
>
|
||||
<!-- Org Header -->
|
||||
<div class="flex items-start gap-2 px-1 mb-2">
|
||||
<div
|
||||
class="w-12 h-12 rounded-full bg-primary/20 flex items-center justify-center text-primary text-xl font-heading shrink-0"
|
||||
>
|
||||
{data.org.name[0].toUpperCase()}
|
||||
</div>
|
||||
{#if !sidebarCollapsed}
|
||||
<div class="min-w-0 flex-1">
|
||||
<h1 class="font-heading text-xl text-light truncate">
|
||||
{data.org.name}
|
||||
</h1>
|
||||
<p class="text-xs text-white capitalize">{data.role}</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<nav class="flex-1 p-2 space-y-1">
|
||||
<!-- Nav Items -->
|
||||
<nav class="flex-1 space-y-0.5">
|
||||
{#each navItems as item}
|
||||
<a
|
||||
href={item.href}
|
||||
class="flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors {isActive(
|
||||
class="flex items-center gap-2 pl-1 pr-2 py-1 rounded-[50px] transition-colors {isActive(
|
||||
item.href,
|
||||
)
|
||||
? 'bg-primary text-white'
|
||||
: 'text-light/70 hover:bg-light/5 hover:text-light'}"
|
||||
? 'bg-primary/20'
|
||||
: 'hover:bg-light/5'}"
|
||||
title={sidebarCollapsed ? item.label : undefined}
|
||||
>
|
||||
{#if item.icon === "home"}
|
||||
<svg
|
||||
class="w-5 h-5"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
<!-- Icon circle -->
|
||||
<div
|
||||
class="w-8 h-8 rounded-full {isActive(item.href)
|
||||
? 'bg-primary'
|
||||
: 'bg-light'} flex items-center justify-center shrink-0"
|
||||
>
|
||||
{#if item.icon === "home"}
|
||||
<svg
|
||||
class="w-4 h-4 {isActive(item.href)
|
||||
? 'text-white'
|
||||
: 'text-night'}"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
>
|
||||
<path
|
||||
d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"
|
||||
/>
|
||||
<polyline points="9,22 9,12 15,12 15,22" />
|
||||
</svg>
|
||||
{:else if item.icon === "file"}
|
||||
<svg
|
||||
class="w-4 h-4 {isActive(item.href)
|
||||
? 'text-white'
|
||||
: 'text-night'}"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
>
|
||||
<path
|
||||
d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"
|
||||
/>
|
||||
<polyline points="14,2 14,8 20,8" />
|
||||
</svg>
|
||||
{:else if item.icon === "kanban"}
|
||||
<svg
|
||||
class="w-4 h-4 {isActive(item.href)
|
||||
? 'text-white'
|
||||
: 'text-night'}"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
>
|
||||
<rect
|
||||
x="3"
|
||||
y="3"
|
||||
width="18"
|
||||
height="18"
|
||||
rx="2"
|
||||
/>
|
||||
<line x1="9" y1="3" x2="9" y2="21" />
|
||||
<line x1="15" y1="3" x2="15" y2="21" />
|
||||
</svg>
|
||||
{:else if item.icon === "calendar"}
|
||||
<svg
|
||||
class="w-4 h-4 {isActive(item.href)
|
||||
? 'text-white'
|
||||
: 'text-night'}"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
>
|
||||
<rect
|
||||
x="3"
|
||||
y="4"
|
||||
width="18"
|
||||
height="18"
|
||||
rx="2"
|
||||
/>
|
||||
<line x1="16" y1="2" x2="16" y2="6" />
|
||||
<line x1="8" y1="2" x2="8" y2="6" />
|
||||
<line x1="3" y1="10" x2="21" y2="10" />
|
||||
</svg>
|
||||
{:else if item.icon === "settings"}
|
||||
<svg
|
||||
class="w-4 h-4 {isActive(item.href)
|
||||
? 'text-white'
|
||||
: 'text-night'}"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
>
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
<path
|
||||
d="M12 1v2m0 18v2M4.2 4.2l1.4 1.4m12.8 12.8l1.4 1.4M1 12h2m18 0h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4"
|
||||
/>
|
||||
</svg>
|
||||
{/if}
|
||||
</div>
|
||||
{#if !sidebarCollapsed}
|
||||
<span class="font-bold text-light truncate"
|
||||
>{item.label}</span
|
||||
>
|
||||
<path
|
||||
d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"
|
||||
/>
|
||||
<polyline points="9,22 9,12 15,12 15,22" />
|
||||
</svg>
|
||||
{:else if item.icon === "file"}
|
||||
<svg
|
||||
class="w-5 h-5"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
>
|
||||
<path
|
||||
d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"
|
||||
/>
|
||||
<polyline points="14,2 14,8 20,8" />
|
||||
</svg>
|
||||
{:else if item.icon === "kanban"}
|
||||
<svg
|
||||
class="w-5 h-5"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
>
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" />
|
||||
<line x1="9" y1="3" x2="9" y2="21" />
|
||||
<line x1="15" y1="3" x2="15" y2="21" />
|
||||
</svg>
|
||||
{:else if item.icon === "calendar"}
|
||||
<svg
|
||||
class="w-5 h-5"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
>
|
||||
<rect x="3" y="4" width="18" height="18" rx="2" />
|
||||
<line x1="16" y1="2" x2="16" y2="6" />
|
||||
<line x1="8" y1="2" x2="8" y2="6" />
|
||||
<line x1="3" y1="10" x2="21" y2="10" />
|
||||
</svg>
|
||||
{:else if item.icon === "settings"}
|
||||
<svg
|
||||
class="w-5 h-5"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
>
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
<path
|
||||
d="M12 1v2m0 18v2M4.2 4.2l1.4 1.4m12.8 12.8l1.4 1.4M1 12h2m18 0h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4"
|
||||
/>
|
||||
</svg>
|
||||
{/if}
|
||||
{item.label}
|
||||
</a>
|
||||
{/each}
|
||||
</nav>
|
||||
|
||||
<div class="p-4 border-t border-light/10">
|
||||
<!-- Team Members -->
|
||||
{#if !sidebarCollapsed}
|
||||
<div class="mt-4 pt-4 border-t border-light/10">
|
||||
<p class="font-heading text-base text-light mb-2 px-1">Team</p>
|
||||
{#if data.members && data.members.length > 0}
|
||||
<div class="space-y-0.5">
|
||||
{#each data.members.slice(0, 5) as member}
|
||||
<div
|
||||
class="flex items-center gap-2 pl-1 pr-2 py-1 rounded-[50px] hover:bg-light/5 transition-colors"
|
||||
>
|
||||
<div
|
||||
class="w-5 h-5 rounded-full bg-gradient-to-br from-primary to-primary/50 flex items-center justify-center text-white text-xs font-medium"
|
||||
>
|
||||
{(member.profiles?.full_name ||
|
||||
member.profiles?.email ||
|
||||
"?")[0].toUpperCase()}
|
||||
</div>
|
||||
<span
|
||||
class="text-sm font-bold text-light truncate flex-1"
|
||||
>
|
||||
{member.profiles?.full_name ||
|
||||
member.profiles?.email?.split("@")[0] ||
|
||||
"User"}
|
||||
</span>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{:else}
|
||||
<p class="text-xs text-light/40 px-1">
|
||||
No team members found
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Back link -->
|
||||
<div class="mt-auto pt-4">
|
||||
<a
|
||||
href="/"
|
||||
class="flex items-center gap-2 text-sm text-light/50 hover:text-light transition-colors"
|
||||
class="flex items-center gap-2 pl-1 pr-2 py-1 rounded-[50px] text-light/50 hover:text-light hover:bg-light/5 transition-colors"
|
||||
title={sidebarCollapsed ? "All Organizations" : undefined}
|
||||
>
|
||||
<svg
|
||||
class="w-4 h-4"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
<div
|
||||
class="w-5 h-5 rounded-full bg-light/20 flex items-center justify-center"
|
||||
>
|
||||
<path d="m15 18-6-6 6-6" />
|
||||
</svg>
|
||||
All Organizations
|
||||
<svg
|
||||
class="w-3 h-3"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
>
|
||||
<path d="m15 18-6-6 6-6" />
|
||||
</svg>
|
||||
</div>
|
||||
{#if !sidebarCollapsed}
|
||||
<span class="text-sm">All Organizations</span>
|
||||
{/if}
|
||||
</a>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main class="flex-1 overflow-auto">
|
||||
<!-- Main Content Area -->
|
||||
<main class="flex-1 bg-night rounded-[32px] overflow-auto">
|
||||
{@render children()}
|
||||
</main>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user