Initial commit

This commit is contained in:
Yaojia Wang
2025-11-03 00:04:07 +01:00
parent 34b701de48
commit 097300e8ec
37 changed files with 3473 additions and 109 deletions

View File

@@ -0,0 +1,108 @@
'use client';
import Link from 'next/link';
import { FolderKanban, Plus } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { useProjects } from '@/lib/hooks/use-projects';
export default function DashboardPage() {
const { data: projects } = useProjects();
return (
<div className="space-y-6">
<div>
<h1 className="text-3xl font-bold tracking-tight">Dashboard</h1>
<p className="text-muted-foreground">
Welcome to ColaFlow - Your AI-powered project management system
</p>
</div>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Total Projects</CardTitle>
<FolderKanban className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">{projects?.length || 0}</div>
<p className="text-xs text-muted-foreground">
Active projects in your workspace
</p>
</CardContent>
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Active Projects</CardTitle>
<FolderKanban className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">
{projects?.filter((p) => p.status === 'Active').length || 0}
</div>
<p className="text-xs text-muted-foreground">
Currently in progress
</p>
</CardContent>
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium">Quick Actions</CardTitle>
<Plus className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<Link href="/projects">
<Button className="w-full" variant="outline">
View All Projects
</Button>
</Link>
</CardContent>
</Card>
</div>
<Card>
<CardHeader>
<CardTitle>Recent Projects</CardTitle>
<CardDescription>
Your most recently updated projects
</CardDescription>
</CardHeader>
<CardContent>
{projects && projects.length > 0 ? (
<div className="space-y-2">
{projects.slice(0, 5).map((project) => (
<Link
key={project.id}
href={`/projects/${project.id}`}
className="block rounded-lg border p-3 transition-colors hover:bg-accent"
>
<div className="flex items-center justify-between">
<div>
<h3 className="font-medium">{project.name}</h3>
<p className="text-sm text-muted-foreground">{project.key}</p>
</div>
<span
className={`rounded-full px-2 py-1 text-xs font-medium ${
project.status === 'Active'
? 'bg-green-100 text-green-700'
: 'bg-gray-100 text-gray-700'
}`}
>
{project.status}
</span>
</div>
</Link>
))}
</div>
) : (
<p className="text-sm text-muted-foreground">
No projects yet. Create your first project to get started.
</p>
)}
</CardContent>
</Card>
</div>
);
}

View File

@@ -0,0 +1,57 @@
'use client';
import { use } from 'react';
import Link from 'next/link';
import { ArrowLeft, Loader2 } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { KanbanBoard } from '@/components/features/kanban/KanbanBoard';
import { useKanbanBoard } from '@/lib/hooks/use-kanban';
interface KanbanPageProps {
params: Promise<{ projectId: string }>;
}
export default function KanbanPage({ params }: KanbanPageProps) {
const { projectId } = use(params);
const { data: board, isLoading, error } = useKanbanBoard(projectId);
if (isLoading) {
return (
<div className="flex h-[50vh] items-center justify-center">
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
</div>
);
}
if (error || !board) {
return (
<div className="space-y-4">
<Link href="/projects">
<Button variant="ghost" size="icon">
<ArrowLeft className="h-4 w-4" />
</Button>
</Link>
<div className="flex h-[50vh] items-center justify-center">
<p className="text-sm text-muted-foreground">
Failed to load kanban board. Please try again later.
</p>
</div>
</div>
);
}
return (
<div className="space-y-6">
<div className="flex items-center gap-4">
<Link href={`/projects/${projectId}`}>
<Button variant="ghost" size="icon">
<ArrowLeft className="h-4 w-4" />
</Button>
</Link>
<h1 className="text-3xl font-bold tracking-tight">Kanban Board</h1>
</div>
<KanbanBoard board={board} />
</div>
);
}

View File

@@ -0,0 +1,29 @@
'use client';
import { Header } from '@/components/layout/Header';
import { Sidebar } from '@/components/layout/Sidebar';
import { useUIStore } from '@/stores/ui-store';
export default function DashboardLayout({
children,
}: {
children: React.ReactNode;
}) {
const sidebarOpen = useUIStore((state) => state.sidebarOpen);
return (
<div className="min-h-screen">
<Header />
<div className="flex">
<Sidebar />
<main
className={`flex-1 transition-all duration-200 ${
sidebarOpen ? 'ml-64' : 'ml-0'
}`}
>
<div className="p-6">{children}</div>
</main>
</div>
</div>
);
}

View File

@@ -0,0 +1,91 @@
'use client';
import { use } from 'react';
import Link from 'next/link';
import { ArrowLeft, Loader2, KanbanSquare } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { useProject } from '@/lib/hooks/use-projects';
interface ProjectDetailPageProps {
params: Promise<{ id: string }>;
}
export default function ProjectDetailPage({ params }: ProjectDetailPageProps) {
const { id } = use(params);
const { data: project, isLoading, error } = useProject(id);
if (isLoading) {
return (
<div className="flex h-[50vh] items-center justify-center">
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
</div>
);
}
if (error || !project) {
return (
<div className="flex h-[50vh] items-center justify-center">
<p className="text-sm text-muted-foreground">
Project not found or failed to load.
</p>
</div>
);
}
return (
<div className="space-y-6">
<div className="flex items-center gap-4">
<Link href="/projects">
<Button variant="ghost" size="icon">
<ArrowLeft className="h-4 w-4" />
</Button>
</Link>
<div className="flex-1">
<div className="flex items-center gap-3">
<h1 className="text-3xl font-bold tracking-tight">{project.name}</h1>
<span
className={`rounded-full px-2 py-1 text-xs font-medium ${
project.status === 'Active'
? 'bg-green-100 text-green-700'
: 'bg-gray-100 text-gray-700'
}`}
>
{project.status}
</span>
</div>
<p className="text-muted-foreground">Key: {project.key}</p>
</div>
<Link href={`/kanban/${project.id}`}>
<Button>
<KanbanSquare className="mr-2 h-4 w-4" />
View Board
</Button>
</Link>
</div>
<Card>
<CardHeader>
<CardTitle>Project Details</CardTitle>
<CardDescription>Information about this project</CardDescription>
</CardHeader>
<CardContent className="space-y-4">
<div>
<h3 className="text-sm font-medium text-muted-foreground">Description</h3>
<p className="mt-1">{project.description || 'No description provided'}</p>
</div>
<div>
<h3 className="text-sm font-medium text-muted-foreground">Created</h3>
<p className="mt-1">{new Date(project.createdAt).toLocaleDateString()}</p>
</div>
{project.updatedAt && (
<div>
<h3 className="text-sm font-medium text-muted-foreground">Last Updated</h3>
<p className="mt-1">{new Date(project.updatedAt).toLocaleDateString()}</p>
</div>
)}
</CardContent>
</Card>
</div>
);
}

View File

@@ -0,0 +1,95 @@
'use client';
import { useState } from 'react';
import Link from 'next/link';
import { Plus, Loader2 } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import { useProjects } from '@/lib/hooks/use-projects';
import { CreateProjectDialog } from '@/components/features/projects/CreateProjectDialog';
export default function ProjectsPage() {
const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false);
const { data: projects, isLoading, error } = useProjects();
if (isLoading) {
return (
<div className="flex h-[50vh] items-center justify-center">
<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
</div>
);
}
if (error) {
return (
<div className="flex h-[50vh] items-center justify-center">
<p className="text-sm text-muted-foreground">
Failed to load projects. Please try again later.
</p>
</div>
);
}
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<div>
<h1 className="text-3xl font-bold tracking-tight">Projects</h1>
<p className="text-muted-foreground">
Manage your projects and track progress
</p>
</div>
<Button onClick={() => setIsCreateDialogOpen(true)}>
<Plus className="mr-2 h-4 w-4" />
New Project
</Button>
</div>
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
{projects?.map((project) => (
<Link key={project.id} href={`/projects/${project.id}`}>
<Card className="transition-colors hover:bg-accent">
<CardHeader>
<div className="flex items-start justify-between">
<div className="space-y-1">
<CardTitle>{project.name}</CardTitle>
<CardDescription>{project.key}</CardDescription>
</div>
<span
className={`rounded-full px-2 py-1 text-xs font-medium ${
project.status === 'Active'
? 'bg-green-100 text-green-700'
: 'bg-gray-100 text-gray-700'
}`}
>
{project.status}
</span>
</div>
</CardHeader>
<CardContent>
<p className="line-clamp-2 text-sm text-muted-foreground">
{project.description}
</p>
</CardContent>
</Card>
</Link>
))}
{!projects || projects.length === 0 ? (
<Card className="col-span-full">
<CardContent className="flex h-40 items-center justify-center">
<p className="text-sm text-muted-foreground">
No projects yet. Create your first project to get started.
</p>
</CardContent>
</Card>
) : null}
</div>
<CreateProjectDialog
open={isCreateDialogOpen}
onOpenChange={setIsCreateDialogOpen}
/>
</div>
);
}

View File

@@ -1,26 +1,122 @@
@import "tailwindcss";
@import "tw-animate-css";
:root {
--background: #ffffff;
--foreground: #171717;
}
@custom-variant dark (&:is(.dark *));
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
--color-sidebar-ring: var(--sidebar-ring);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar: var(--sidebar);
--color-chart-5: var(--chart-5);
--color-chart-4: var(--chart-4);
--color-chart-3: var(--chart-3);
--color-chart-2: var(--chart-2);
--color-chart-1: var(--chart-1);
--color-ring: var(--ring);
--color-input: var(--input);
--color-border: var(--border);
--color-destructive: var(--destructive);
--color-accent-foreground: var(--accent-foreground);
--color-accent: var(--accent);
--color-muted-foreground: var(--muted-foreground);
--color-muted: var(--muted);
--color-secondary-foreground: var(--secondary-foreground);
--color-secondary: var(--secondary);
--color-primary-foreground: var(--primary-foreground);
--color-primary: var(--primary);
--color-popover-foreground: var(--popover-foreground);
--color-popover: var(--popover);
--color-card-foreground: var(--card-foreground);
--color-card: var(--card);
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
}
@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
:root {
--radius: 0.625rem;
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--chart-1: oklch(0.646 0.222 41.116);
--chart-2: oklch(0.6 0.118 184.704);
--chart-3: oklch(0.398 0.07 227.392);
--chart-4: oklch(0.828 0.189 84.429);
--chart-5: oklch(0.769 0.188 70.08);
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.205 0 0);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
}
.dark {
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
--card: oklch(0.205 0 0);
--card-foreground: oklch(0.985 0 0);
--popover: oklch(0.205 0 0);
--popover-foreground: oklch(0.985 0 0);
--primary: oklch(0.922 0 0);
--primary-foreground: oklch(0.205 0 0);
--secondary: oklch(0.269 0 0);
--secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.269 0 0);
--muted-foreground: oklch(0.708 0 0);
--accent: oklch(0.269 0 0);
--accent-foreground: oklch(0.985 0 0);
--destructive: oklch(0.704 0.191 22.216);
--border: oklch(1 0 0 / 10%);
--input: oklch(1 0 0 / 15%);
--ring: oklch(0.556 0 0);
--chart-1: oklch(0.488 0.243 264.376);
--chart-2: oklch(0.696 0.17 162.48);
--chart-3: oklch(0.769 0.188 70.08);
--chart-4: oklch(0.627 0.265 303.9);
--chart-5: oklch(0.645 0.246 16.439);
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.556 0 0);
}
@layer base {
* {
@apply border-border outline-ring/50;
}
body {
@apply bg-background text-foreground;
}
}
body {
background: var(--background);
color: var(--foreground);
font-family: Arial, Helvetica, sans-serif;
}

View File

@@ -1,6 +1,7 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import { QueryProvider } from "@/lib/providers/query-provider";
const geistSans = Geist({
variable: "--font-geist-sans",
@@ -13,8 +14,8 @@ const geistMono = Geist_Mono({
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: "ColaFlow - AI-Powered Project Management",
description: "Modern project management system with AI and MCP protocol",
};
export default function RootLayout({
@@ -27,7 +28,7 @@ export default function RootLayout({
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
<QueryProvider>{children}</QueryProvider>
</body>
</html>
);

View File

@@ -1,65 +1,5 @@
import Image from "next/image";
import { redirect } from 'next/navigation';
export default function Home() {
return (
<div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
<main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
<Image
className="dark:invert"
src="/next.svg"
alt="Next.js logo"
width={100}
height={20}
priority
/>
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
To get started, edit the page.tsx file.
</h1>
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
Looking for a starting point or more instructions? Head over to{" "}
<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
className="font-medium text-zinc-950 dark:text-zinc-50"
>
Templates
</a>{" "}
or the{" "}
<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
className="font-medium text-zinc-950 dark:text-zinc-50"
>
Learning
</a>{" "}
center.
</p>
</div>
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
<a
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className="dark:invert"
src="/vercel.svg"
alt="Vercel logomark"
width={16}
height={16}
/>
Deploy Now
</a>
<a
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Documentation
</a>
</div>
</main>
</div>
);
redirect('/dashboard');
}