Complete rewrite: Project Hub with Kanban board and threaded notes

- Replaced broken Gantt chart with working Kanban board
- Added task types: idea, task, bug, research, plan
- Added status columns: backlog, in-progress, review, done
- Added priority levels: low, medium, high, urgent
- Implemented 1-to-many threaded comments/notes system
- Added working CRUD for projects and tasks
- Added shadcn/ui components: badge, button, card, dialog, label, select, table, textarea
- Data persistence with Zustand + localStorage
- Fixed all UI overlap issues
This commit is contained in:
Matt Bruce 2026-02-18 09:32:47 -06:00
parent ae11914a39
commit 7badcb8bba
16 changed files with 3120 additions and 953 deletions

1747
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,30 +9,43 @@
"lint": "eslint"
},
"dependencies": {
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-dropdown-menu": "^2.1.16",
"@radix-ui/react-label": "^2.1.8",
"@radix-ui/react-select": "^2.2.6",
"firebase": "^12.9.0"
},
"devDependencies": {
"@radix-ui/react-slot": "^1.2.4",
"@tailwindcss/postcss": "^4",
"@types/frappe-gantt": "^0.9.0",
"@types/node": "^20.19.33",
"@types/react": "^19.2.14",
"@types/react-dom": "^19",
"autoprefixer": "^10.4.24",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
"firebase": "^12.9.0",
"eslint": "^9",
"eslint-config-next": "^16.1.6",
"framer-motion": "^12.34.1",
"frappe-gantt": "^1.2.1",
"lucide-react": "^0.574.0",
"next": "16.1.6",
"react": "19.2.3",
"react-dom": "19.2.3",
"next": "^15.5.12",
"postcss": "^8.5.6",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"recharts": "^3.7.0",
"tailwind-merge": "^3.4.1",
"tailwindcss": "^4.1.18",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"zustand": "^5.0.11"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "16.1.6",
"tailwindcss": "^4",
"typescript": "^5"
}
"description": "This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).",
"main": "index.js",
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs"
}

File diff suppressed because it is too large Load Diff

View File

@ -1,85 +0,0 @@
'use client'
import { useEffect, useRef } from 'react'
import { type TaskStatus, useGanttStore } from '@/stores/useGanttStore'
interface GanttChartProps {
project: string
viewMode?: 'Day' | 'Week' | 'Month' | 'Year'
}
function toDateString(value: string | Date): string {
if (typeof value === 'string') return value
return value.toISOString().slice(0, 10)
}
function getTaskStatus(progress: number, status?: string): TaskStatus {
if (status === 'backlog' || status === 'in-progress' || status === 'blocked' || status === 'done') {
return status
}
if (progress >= 100) return 'done'
if (progress > 0) return 'in-progress'
return 'backlog'
}
export function GanttChart({ project, viewMode = 'Week' }: GanttChartProps) {
const chartRef = useRef<HTMLDivElement>(null)
const { tasks, updateTask } = useGanttStore()
const projectTasks = tasks.filter(task => task.project === project)
useEffect(() => {
if (!chartRef.current || projectTasks.length === 0) {
if (chartRef.current) chartRef.current.innerHTML = ''
return
}
let disposed = false
const container = chartRef.current
;(async () => {
const { default: FrappeGantt } = await import('frappe-gantt')
if (disposed) return
container.innerHTML = ''
new FrappeGantt(
container,
projectTasks.map(task => ({
id: task.id,
name: task.name,
start: task.start,
end: task.end,
progress: task.progress,
dependencies: task.dependencies,
custom_class: `task-${getTaskStatus(task.progress, task.status)}`
})),
{
on_date_change: (task, start, end) => {
if (!task.id) return
updateTask(task.id, { start: toDateString(start), end: toDateString(end) })
},
on_progress_change: (task, progress) => {
if (!task.id) return
updateTask(task.id, { progress })
},
view_mode: viewMode,
bar_height: 30,
bar_corner_radius: 3,
container_height: 560,
padding: 18,
date_format: 'YYYY-MM-DD'
}
)
})()
return () => {
disposed = true
container.innerHTML = ''
}
}, [projectTasks, project, updateTask, viewMode])
return (
<div ref={chartRef} className="gantt-shell w-full h-[600px] border rounded-lg overflow-auto" />
)
}

View File

@ -0,0 +1,35 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const badgeVariants = cva(
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
{
variants: {
variant: {
default:
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
secondary:
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive:
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
outline: "text-foreground",
},
},
defaultVariants: {
variant: "default",
},
}
)
export interface BadgeProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}
function Badge({ className, variant, ...props }: BadgeProps) {
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
)
}
export { Badge, badgeVariants }

View File

@ -0,0 +1,52 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
)
}
)
Button.displayName = "Button"
export { Button, buttonVariants }

View File

@ -0,0 +1,78 @@
import * as React from "react"
import { cn } from "@/lib/utils"
const Card = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"rounded-lg border bg-card text-card-foreground shadow-sm",
className
)}
{...props}
/>
))
Card.displayName = "Card"
const CardHeader = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex flex-col space-y-1.5 p-6", className)}
{...props}
/>
))
CardHeader.displayName = "CardHeader"
const CardTitle = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
<h3
ref={ref}
className={cn(
"text-2xl font-semibold leading-none tracking-tight",
className
)}
{...props}
/>
))
CardTitle.displayName = "CardTitle"
const CardDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
<p
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
CardDescription.displayName = "CardDescription"
const CardContent = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
))
CardContent.displayName = "CardContent"
const CardFooter = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex items-center p-6 pt-0", className)}
{...props}
/>
))
CardFooter.displayName = "CardFooter"
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }

View File

@ -0,0 +1,119 @@
import * as React from "react"
import * as DialogPrimitive from "@radix-ui/react-dialog"
import { X } from "lucide-react"
import { cn } from "@/lib/utils"
const Dialog = DialogPrimitive.Root
const DialogTrigger = DialogPrimitive.Trigger
const DialogPortal = DialogPrimitive.Portal
const DialogClose = DialogPrimitive.Close
const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay
ref={ref}
className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
)}
{...props}
/>
))
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
className
)}
{...props}
>
{children}
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
))
DialogContent.displayName = DialogPrimitive.Content.displayName
const DialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-1.5 text-center sm:text-left",
className
)}
{...props}
/>
)
DialogHeader.displayName = "DialogHeader"
const DialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className
)}
{...props}
/>
)
DialogFooter.displayName = "DialogFooter"
const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className
)}
{...props}
/>
))
DialogTitle.displayName = DialogPrimitive.Title.displayName
const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
DialogDescription.displayName = DialogPrimitive.Description.displayName
export {
Dialog,
DialogPortal,
DialogOverlay,
DialogClose,
DialogTrigger,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
}

View File

@ -0,0 +1,23 @@
import * as React from "react"
import * as LabelPrimitive from "@radix-ui/react-label"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const labelVariants = cva(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
)
const Label = React.forwardRef<
React.ElementRef<typeof LabelPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
VariantProps<typeof labelVariants>
>(({ className, ...props }, ref) => (
<LabelPrimitive.Root
ref={ref}
className={cn(labelVariants(), className)}
{...props}
/>
))
Label.displayName = LabelPrimitive.Root.displayName
export { Label }

View File

@ -0,0 +1,159 @@
"use client"
import * as React from "react"
import * as SelectPrimitive from "@radix-ui/react-select"
import { Check, ChevronDown, ChevronUp } from "lucide-react"
import { cn } from "@/lib/utils"
const Select = SelectPrimitive.Root
const SelectGroup = SelectPrimitive.Group
const SelectValue = SelectPrimitive.Value
const SelectTrigger = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Trigger>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Trigger
ref={ref}
className={cn(
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
className
)}
{...props}
>
{children}
<SelectPrimitive.Icon asChild>
<ChevronDown className="h-4 w-4 opacity-50" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
))
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
const SelectScrollUpButton = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollUpButton
ref={ref}
className={cn(
"flex cursor-default items-center justify-center py-1",
className
)}
{...props}
>
<ChevronUp className="h-4 w-4" />
</SelectPrimitive.ScrollUpButton>
))
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
const SelectScrollDownButton = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
>(({ className, ...props }, ref) => (
<SelectPrimitive.ScrollDownButton
ref={ref}
className={cn(
"flex cursor-default items-center justify-center py-1",
className
)}
{...props}
>
<ChevronDown className="h-4 w-4" />
</SelectPrimitive.ScrollDownButton>
))
SelectScrollDownButton.displayName =
SelectPrimitive.ScrollDownButton.displayName
const SelectContent = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
>(({ className, children, position = "popper", ...props }, ref) => (
<SelectPrimitive.Portal>
<SelectPrimitive.Content
ref={ref}
className={cn(
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
position === "popper" &&
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className
)}
position={position}
{...props}
>
<SelectScrollUpButton />
<SelectPrimitive.Viewport
className={cn(
"p-1",
position === "popper" &&
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
)}
>
{children}
</SelectPrimitive.Viewport>
<SelectScrollDownButton />
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
))
SelectContent.displayName = SelectPrimitive.Content.displayName
const SelectLabel = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Label>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Label
ref={ref}
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
{...props}
/>
))
SelectLabel.displayName = SelectPrimitive.Label.displayName
const SelectItem = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
>(({ className, children, ...props }, ref) => (
<SelectPrimitive.Item
ref={ref}
className={cn(
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
<Check className="h-4 w-4" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
))
SelectItem.displayName = SelectPrimitive.Item.displayName
const SelectSeparator = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Separator>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
>(({ className, ...props }, ref) => (
<SelectPrimitive.Separator
ref={ref}
className={cn("-mx-1 my-1 h-px bg-muted", className)}
{...props}
/>
))
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
export {
Select,
SelectGroup,
SelectValue,
SelectTrigger,
SelectContent,
SelectLabel,
SelectItem,
SelectSeparator,
SelectScrollUpButton,
SelectScrollDownButton,
}

116
src/components/ui/table.tsx Normal file
View File

@ -0,0 +1,116 @@
import * as React from "react"
import { cn } from "@/lib/utils"
const Table = React.forwardRef<
HTMLTableElement,
React.HTMLAttributes<HTMLTableElement>
>(({ className, ...props }, ref) => (
<div className="relative w-full overflow-auto">
<table
ref={ref}
className={cn("w-full caption-bottom text-sm", className)}
{...props}
/>
</div>
))
Table.displayName = "Table"
const TableHeader = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
<thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
))
TableHeader.displayName = "TableHeader"
const TableBody = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
<tbody
ref={ref}
className={cn("[&_tr:last-child]:border-0", className)}
{...props}
/>
))
TableBody.displayName = "TableBody"
const TableFooter = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
<tfoot
ref={ref}
className={cn(
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
className
)}
{...props}
/>
))
TableFooter.displayName = "TableFooter"
const TableRow = React.forwardRef<
HTMLTableRowElement,
React.HTMLAttributes<HTMLTableRowElement>
>(({ className, ...props }, ref) => (
<tr
ref={ref}
className={cn(
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
className
)}
{...props}
/>
))
TableRow.displayName = "TableRow"
const TableHead = React.forwardRef<
HTMLTableCellElement,
React.ThHTMLAttributes<HTMLTableCellElement>
>(({ className, ...props }, ref) => (
<th
ref={ref}
className={cn(
"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
className
)}
{...props}
/>
))
TableHead.displayName = "TableHead"
const TableCell = React.forwardRef<
HTMLTableCellElement,
React.TdHTMLAttributes<HTMLTableCellElement>
>(({ className, ...props }, ref) => (
<td
ref={ref}
className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
{...props}
/>
))
TableCell.displayName = "TableCell"
const TableCaption = React.forwardRef<
HTMLTableCaptionElement,
React.HTMLAttributes<HTMLTableCaptionElement>
>(({ className, ...props }, ref) => (
<caption
ref={ref}
className={cn("mt-4 text-sm text-muted-foreground", className)}
{...props}
/>
))
TableCaption.displayName = "TableCaption"
export {
Table,
TableHeader,
TableBody,
TableFooter,
TableHead,
TableRow,
TableCell,
TableCaption,
}

View File

@ -0,0 +1,23 @@
import * as React from "react"
import { cn } from "@/lib/utils"
export interface TextareaProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, ...props }, ref) => {
return (
<textarea
className={cn(
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className
)}
ref={ref}
{...props}
/>
)
}
)
Textarea.displayName = "Textarea"
export { Textarea }

6
src/lib/utils.ts Normal file
View File

@ -0,0 +1,6 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}

View File

@ -1,35 +1,21 @@
import { create } from 'zustand'
import { persist } from 'zustand/middleware'
export type TaskStatus = 'backlog' | 'in-progress' | 'blocked' | 'done'
export type TaskPriority = 'low' | 'medium' | 'high' | 'critical'
export interface Task {
interface Task {
id: string
name: string
start: string
end: string
progress: number
dependencies: string[]
project: string
assignee: string
status: TaskStatus
priority: TaskPriority
}
interface GanttStore {
projects: string[]
tasks: Task[]
addTask: (task: Omit<Task, 'id'>) => void
updateTask: (id: string, updates: Partial<Task>) => void
deleteTask: (id: string) => void
addProject: (name: string) => void
}
export const useGanttStore = create<GanttStore>()(
persist(
(set) => ({
projects: ['OpenClaw iOS', 'BedrockTestApp', 'Web Gantt', 'Skills Update'],
export const useGanttStore = create<GanttStore>((set) => ({
projects: ['OpenClaw iOS', 'BedrockTestApp', 'Web Gantt Board', 'Viral iOS Research', 'Self-Improvement'],
tasks: [
{
id: '1',
@ -37,23 +23,15 @@ export const useGanttStore = create<GanttStore>()(
start: '2026-02-17',
end: '2026-02-18',
progress: 50,
dependencies: [],
project: 'BedrockTestApp',
assignee: 'Matt',
status: 'in-progress',
priority: 'high'
project: 'BedrockTestApp'
},
{
id: '2',
name: 'Assets Complete',
name: 'Bedrock Assets Complete',
start: '2026-02-18',
end: '2026-02-20',
progress: 20,
dependencies: ['1'],
project: 'BedrockTestApp',
assignee: 'Ari',
status: 'backlog',
priority: 'medium'
project: 'BedrockTestApp'
},
{
id: '3',
@ -61,58 +39,23 @@ export const useGanttStore = create<GanttStore>()(
start: '2026-02-18',
end: '2026-02-25',
progress: 0,
dependencies: [],
project: 'OpenClaw iOS',
assignee: 'Sam',
status: 'blocked',
priority: 'critical'
project: 'OpenClaw iOS'
},
{
id: '4',
name: 'Firebase Auth',
name: 'Gantt Firebase Auth',
start: '2026-02-18',
end: '2026-02-21',
progress: 0,
dependencies: [],
project: 'Web Gantt',
assignee: 'Priya',
status: 'backlog',
priority: 'medium'
}
],
addTask: (task) =>
set((state) => ({
tasks: [
...state.tasks,
project: 'Web Gantt Board'
},
{
id: crypto.randomUUID(),
...task,
assignee: task.assignee.trim() || 'Unassigned',
id: '5',
name: 'Viral iOS Research',
start: '2026-02-17',
end: '2026-02-24',
progress: 10,
project: 'Viral iOS Research'
}
]
})),
updateTask: (id, updates) =>
set((state) => ({
tasks: state.tasks.map(t => t.id === id ? { ...t, ...updates } : t)
})),
deleteTask: (id) =>
set((state) => ({
tasks: state.tasks.filter(t => t.id !== id)
})),
addProject: (name) =>
set((state) => {
const trimmed = name.trim()
if (!trimmed || state.projects.includes(trimmed)) {
return state
}
return {
projects: [...state.projects, trimmed]
}
})
}),
{
name: 'gantt-storage'
}
)
)
}))

210
src/stores/useTaskStore.ts Normal file
View File

@ -0,0 +1,210 @@
import { create } from 'zustand'
import { persist } from 'zustand/middleware'
export type TaskType = 'idea' | 'task' | 'bug' | 'research' | 'plan'
export type TaskStatus = 'backlog' | 'in-progress' | 'review' | 'done' | 'archived'
export type Priority = 'low' | 'medium' | 'high' | 'urgent'
export interface Comment {
id: string
text: string
createdAt: string
author: 'user' | 'assistant'
}
export interface Task {
id: string
title: string
description?: string
type: TaskType
status: TaskStatus
priority: Priority
projectId: string
createdAt: string
updatedAt: string
dueDate?: string
comments: Comment[]
tags: string[]
}
export interface Project {
id: string
name: string
description?: string
color: string
createdAt: string
}
interface TaskStore {
projects: Project[]
tasks: Task[]
selectedProjectId: string | null
selectedTaskId: string | null
// Project actions
addProject: (name: string, description?: string) => void
updateProject: (id: string, updates: Partial<Project>) => void
deleteProject: (id: string) => void
selectProject: (id: string | null) => void
// Task actions
addTask: (task: Omit<Task, 'id' | 'createdAt' | 'updatedAt' | 'comments'>) => void
updateTask: (id: string, updates: Partial<Task>) => void
deleteTask: (id: string) => void
selectTask: (id: string | null) => void
// Comment actions
addComment: (taskId: string, text: string, author: 'user' | 'assistant') => void
deleteComment: (taskId: string, commentId: string) => void
// Filters
getTasksByProject: (projectId: string) => Task[]
getTasksByStatus: (status: TaskStatus) => Task[]
getTaskById: (id: string) => Task | undefined
}
const defaultProjects: Project[] = [
{ id: '1', name: 'OpenClaw iOS', description: 'Main iOS app development', color: '#8b5cf6', createdAt: new Date().toISOString() },
{ id: '2', name: 'Web Projects', description: 'Web tools and dashboards', color: '#3b82f6', createdAt: new Date().toISOString() },
{ id: '3', name: 'Research', description: 'Experiments and learning', color: '#10b981', createdAt: new Date().toISOString() },
]
const defaultTasks: Task[] = [
{
id: '1',
title: 'Redesign Gantt Board',
description: 'Make it actually work with proper notes system',
type: 'task',
status: 'in-progress',
priority: 'high',
projectId: '2',
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
comments: [
{ id: 'c1', text: 'Need 1-to-many notes, not one big text field', createdAt: new Date().toISOString(), author: 'user' },
{ id: 'c2', text: 'Agreed - will rebuild with proper comment threads', createdAt: new Date().toISOString(), author: 'assistant' },
],
tags: ['ui', 'rewrite']
},
{
id: '2',
title: 'MoodWeave App Idea',
description: 'Social mood tracking with woven visualizations',
type: 'idea',
status: 'backlog',
priority: 'medium',
projectId: '1',
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
comments: [],
tags: ['ios', 'social']
}
]
export const useTaskStore = create<TaskStore>()(
persist(
(set, get) => ({
projects: defaultProjects,
tasks: defaultTasks,
selectedProjectId: '1',
selectedTaskId: null,
addProject: (name, description) => {
const colors = ['#8b5cf6', '#3b82f6', '#10b981', '#f59e0b', '#ef4444', '#ec4899', '#06b6d4']
const newProject: Project = {
id: Date.now().toString(),
name,
description,
color: colors[Math.floor(Math.random() * colors.length)],
createdAt: new Date().toISOString(),
}
set((state) => ({ projects: [...state.projects, newProject] }))
},
updateProject: (id, updates) => {
set((state) => ({
projects: state.projects.map((p) => (p.id === id ? { ...p, ...updates } : p)),
}))
},
deleteProject: (id) => {
set((state) => ({
projects: state.projects.filter((p) => p.id !== id),
tasks: state.tasks.filter((t) => t.projectId !== id),
selectedProjectId: state.selectedProjectId === id ? null : state.selectedProjectId,
}))
},
selectProject: (id) => set({ selectedProjectId: id, selectedTaskId: null }),
addTask: (task) => {
const newTask: Task = {
...task,
id: Date.now().toString(),
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
comments: [],
}
set((state) => ({ tasks: [...state.tasks, newTask] }))
},
updateTask: (id, updates) => {
set((state) => ({
tasks: state.tasks.map((t) =>
t.id === id ? { ...t, ...updates, updatedAt: new Date().toISOString() } : t
),
}))
},
deleteTask: (id) => {
set((state) => ({
tasks: state.tasks.filter((t) => t.id !== id),
selectedTaskId: state.selectedTaskId === id ? null : state.selectedTaskId,
}))
},
selectTask: (id) => set({ selectedTaskId: id }),
addComment: (taskId, text, author) => {
const newComment: Comment = {
id: Date.now().toString(),
text,
createdAt: new Date().toISOString(),
author,
}
set((state) => ({
tasks: state.tasks.map((t) =>
t.id === taskId
? { ...t, comments: [...t.comments, newComment], updatedAt: new Date().toISOString() }
: t
),
}))
},
deleteComment: (taskId, commentId) => {
set((state) => ({
tasks: state.tasks.map((t) =>
t.id === taskId
? { ...t, comments: t.comments.filter((c) => c.id !== commentId) }
: t
),
}))
},
getTasksByProject: (projectId) => {
return get().tasks.filter((t) => t.projectId === projectId)
},
getTasksByStatus: (status) => {
return get().tasks.filter((t) => t.status === status)
},
getTaskById: (id) => {
return get().tasks.find((t) => t.id === id)
},
}),
{
name: 'task-store',
}
)
)

View File

@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
@ -11,7 +15,7 @@
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"jsx": "preserve",
"incremental": true,
"plugins": [
{
@ -19,7 +23,9 @@
}
],
"paths": {
"@/*": ["./src/*"]
"@/*": [
"./src/*"
]
}
},
"include": [
@ -30,5 +36,7 @@
".next/dev/types/**/*.ts",
"**/*.mts"
],
"exclude": ["node_modules"]
"exclude": [
"node_modules"
]
}