Bundles in-flight ECHODO work with the Coolify deployment configuration: App - New routes: ai, forms, planner, settings (templates/types), teams, doc detail, whiteboard detail - New components: app shell rework (icon-rail, top-header), forms builder/renderer/responses, types manager, objects creation dialog, card primitive, form + overview views - New tRPC routers: favorites, forms, types, workspaces; updates to health and objects routers - Markdown backlog sync (packages/database) + cursor-sync schema/migrations - Schema additions: forms, types, favorites, markdown_backlog, cursor_sync - Initial Drizzle migrations checked in Deployment - docker/docker-compose.coolify.yml: drops bundled Postgres/Redis (uses CT 102 shared services), removes host port mappings, adds Coolify SERVICE_FQDN_* magic vars for web + collab - .env.example rewritten as the full ECHODO/Coolify variable manifest - NextAuth gains an Authentik OIDC provider (gated on env presence) - Root layout injects Umami tracking script when configured; metadata title flipped to ECHODO Security - .gitignore expanded to exclude AGENT-DEPLOY.md, .env.*, secrets/, credentials.*, *.key, *.crt, *.pem, ssh keys Made-with: Cursor
105 lines
3.2 KiB
TypeScript
105 lines
3.2 KiB
TypeScript
"use client";
|
|
|
|
import { Building2, Check, Plus } from "lucide-react";
|
|
import { useRouter } from "next/navigation";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuLabel,
|
|
DropdownMenuSeparator,
|
|
DropdownMenuTrigger,
|
|
} from "@/components/ui/dropdown-menu";
|
|
import {
|
|
Tooltip,
|
|
TooltipContent,
|
|
TooltipTrigger,
|
|
} from "@/components/ui/tooltip";
|
|
import { useWorkspaceStore } from "@/lib/stores/workspace-store";
|
|
import { api } from "@/lib/trpc";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
export function WorkspaceSwitcher({
|
|
collapsed,
|
|
className,
|
|
}: {
|
|
collapsed?: boolean;
|
|
className?: string;
|
|
}) {
|
|
const router = useRouter();
|
|
const current = useWorkspaceStore((s) => s.currentWorkspace);
|
|
const { data: workspaces } = api.workspaces.listForUser.useQuery();
|
|
|
|
const displayName = current?.name ?? "Select workspace...";
|
|
|
|
const trigger = (
|
|
<Button
|
|
type="button"
|
|
variant="ghost"
|
|
className={cn(
|
|
"h-auto min-h-9 w-full justify-start gap-2 rounded-md px-2 py-1.5 text-left font-semibold text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
collapsed && "justify-center px-0",
|
|
className,
|
|
)}
|
|
>
|
|
<Building2 className="size-4 shrink-0 text-primary" />
|
|
{!collapsed ? (
|
|
<span className="min-w-0 flex-1 truncate text-sm">{displayName}</span>
|
|
) : null}
|
|
</Button>
|
|
);
|
|
|
|
return (
|
|
<div className={cn("min-w-0", collapsed && "flex justify-center")}>
|
|
<DropdownMenu>
|
|
{collapsed ? (
|
|
<Tooltip delayDuration={0}>
|
|
<TooltipTrigger asChild>
|
|
<DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>
|
|
</TooltipTrigger>
|
|
<TooltipContent side="right">{displayName}</TooltipContent>
|
|
</Tooltip>
|
|
) : (
|
|
<DropdownMenuTrigger asChild className="min-w-0 flex-1">
|
|
{trigger}
|
|
</DropdownMenuTrigger>
|
|
)}
|
|
<DropdownMenuContent className="w-56" align="start" side="bottom">
|
|
<DropdownMenuLabel className="text-xs font-normal text-muted-foreground">
|
|
Workspaces
|
|
</DropdownMenuLabel>
|
|
{(workspaces ?? []).map((ws) => {
|
|
const selected = current?.id === ws.id;
|
|
return (
|
|
<DropdownMenuItem
|
|
key={ws.id}
|
|
className="gap-2"
|
|
onClick={() => {
|
|
router.push(`/${ws.id}`);
|
|
}}
|
|
>
|
|
<Building2 className="size-4 shrink-0 opacity-70" />
|
|
<span className="flex-1 truncate">{ws.title}</span>
|
|
{selected ? (
|
|
<Check className="size-4 shrink-0 text-primary" />
|
|
) : null}
|
|
</DropdownMenuItem>
|
|
);
|
|
})}
|
|
<DropdownMenuSeparator />
|
|
<DropdownMenuItem
|
|
className="gap-2 text-muted-foreground focus:text-foreground"
|
|
onClick={() => {
|
|
// Conductor: wire create workspace flow
|
|
}}
|
|
>
|
|
<Plus className="size-4" />
|
|
Create Workspace
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
</div>
|
|
);
|
|
}
|