ubiquitous-invention/apps/web/components/views/board/board-column.tsx
Randall Stillwell a508ece6e7 feat: Full project management application scaffold
Complete architecture for a ClickUp/Notion/Miro-class project management app:

- Turborepo monorepo with Next.js 15, TypeScript, PostgreSQL (Drizzle ORM)
- Object-centered database schema (everything is an Object: tasks, projects, docs, whiteboards)
- NextAuth v5 authentication with credentials + OAuth providers
- tRPC v11 API layer with full CRUD for objects, properties, relations, templates, search
- Three-panel UI: collapsible sidebar, center content area, push-in right panel
- Purple/teal theme with light/dark mode via Shadcn/ui + Tailwind CSS
- Multiple views: List, Kanban board (dnd-kit), Table (spreadsheet), Embedded iframe
- TipTap rich text editor with slash commands, custom blocks (callout, toggle, mention, embed, divider), AI block
- Real-time collaboration via Yjs + Hocuspocus with presence/cursors
- tldraw whiteboard with custom shape cards (task, document, project)
- MCP server exposing all app data/tools for AI agents
- AI chat panel, editor AI slash commands, Cmd+K command palette
- Template system with built-in templates (Bug Report, Meeting Notes, Sprint)
- Full-text search with result highlighting
- Docker Compose for full-stack deployment (web + collab + postgres + redis)

Made-with: Cursor
2026-03-26 22:39:16 -05:00

101 lines
3 KiB
TypeScript

"use client";
import * as React from "react";
import { useDroppable } from "@dnd-kit/core";
import { SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
import { Plus } from "lucide-react";
import { Button } from "@/components/ui/button";
import { ScrollArea } from "@/components/ui/scroll-area";
import type { ViewObject } from "@/lib/hooks/use-view-data";
import { cn } from "@/lib/utils";
import { BoardCard } from "./board-card";
export interface BoardColumnProps {
columnId: string;
label: string;
items: ViewObject[];
dotClass: string;
borderTopClass: string;
onAddTask?: () => void;
}
function formatColumnLabel(id: string): string {
return id.replace(/_/g, " ");
}
export function BoardColumn({
columnId,
label,
items,
dotClass,
borderTopClass,
onAddTask,
}: BoardColumnProps) {
const { setNodeRef, isOver } = useDroppable({
id: columnId,
data: { type: "column", columnId },
});
const ids = items.map((i) => i.id);
const displayLabel = label || formatColumnLabel(columnId);
const showEmptyDropLine = items.length === 0 && isOver;
return (
<div
className={cn(
"flex h-full min-h-[min(420px,70vh)] w-[min(100%,290px)] min-w-[280px] max-w-[300px] shrink-0 flex-col overflow-hidden rounded-lg border border-border/60 bg-muted/40 shadow-sm dark:bg-muted/25",
borderTopClass,
)}
>
<header className="shrink-0 border-b border-border/50 px-3 py-2.5">
<div className="flex items-center gap-2">
<span
className={cn("h-2 w-2 shrink-0 rounded-full", dotClass)}
aria-hidden
/>
<h3 className="min-w-0 flex-1 truncate text-sm font-semibold capitalize text-foreground">
{displayLabel}
</h3>
<span className="tabular-nums text-xs font-medium text-muted-foreground">
{items.length}
</span>
</div>
</header>
<div ref={setNodeRef} className="relative flex min-h-0 flex-1 flex-col">
{showEmptyDropLine && (
<div
className="pointer-events-none absolute inset-x-2 top-2 z-0 h-0.5 rounded-full bg-primary/80 shadow-[0_0_10px_hsl(var(--primary)/0.5)]"
aria-hidden
/>
)}
<ScrollArea className="min-h-0 flex-1 px-2 pt-2">
<SortableContext items={ids} strategy={verticalListSortingStrategy}>
<ul className="flex flex-col gap-2 pb-2">
{items.map((object) => (
<li key={object.id}>
<BoardCard object={object} />
</li>
))}
</ul>
</SortableContext>
</ScrollArea>
<div className="shrink-0 border-t border-border/40 p-2">
<Button
type="button"
variant="ghost"
size="sm"
className="w-full justify-start gap-2 text-muted-foreground hover:text-foreground"
onClick={onAddTask}
>
<Plus className="h-4 w-4" />
Add task
</Button>
</div>
</div>
</div>
);
}