"use client"; import { useState } from "react"; import Link from "next/link"; import { Card, CardHeader, CardTitle, CardContent, CardFooter } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Users, Settings, Waypoints, Combine } from "lucide-react"; import { RoleItem } from "@server/routers/user"; interface OrgStat { label: string; value: number; icon: React.ReactNode; } type OrganizationLandingCardProps = { overview: { orgName: string; stats: { sites: number; resources: number; users: number; }; roles: RoleItem[]; isAdmin: boolean; isOwner: boolean; orgId: string; }; }; export default function OrganizationLandingCard( props: OrganizationLandingCardProps ) { const [orgData] = useState(props); const orgStats: OrgStat[] = [ { label: "Sites", value: orgData.overview.stats.sites, icon: }, { label: "Resources", value: orgData.overview.stats.resources, icon: }, { label: "Users", value: orgData.overview.stats.users, icon: } ]; return ( {orgData.overview.orgName}
{orgStats.map((stat, index) => (
{stat.icon} {stat.value} {stat.label}
))}
Your role {orgData.overview.isOwner || orgData.overview.isAdmin || orgData.overview.roles.length === 1 ? "" : "s"} :{" "} {orgData.overview.isOwner ? "Owner" : orgData.overview.isAdmin ? "Admin" : orgData.overview.roles .map((r) => r.name) .join(", ")}
{orgData.overview.isAdmin && ( )}
); }