Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(site): bring product preview up to date with current app

Tindd855f775b28
diff --git a/apps/site/components/landing/app-preview/board-view.tsx b/apps/site/components/landing/app-preview/board-view.tsx
new file mode 100644
index 000000000..9796b5af7
--- /dev/null
+++ b/apps/site/components/landing/app-preview/board-view.tsx
@@ -0,0 +1,90 @@
+"use client";
+
+import { Plus } from "lucide-react";
+import { DEFAULT_COLUMNS } from "@/constants/columns";
+import { getColumnIcon } from "@/lib/column";
+import type { ProjectWithTasks } from "@/types/project";
+import type Task from "@/types/task";
+import type { PreviewTaskDetails } from "./mock-data";
+import { PreviewTaskCard } from "./task-card";
+
+type PreviewBoardProps = {
+ project: ProjectWithTasks;
+ onTaskClick: (task: Task) => void;
+ details: Record<string, PreviewTaskDetails>;
+};
+
+export function PreviewBoard({
+ project,
+ onTaskClick,
+ details,
+}: PreviewBoardProps) {
+ const columns = DEFAULT_COLUMNS.map((col) => ({
+ ...col,
+ tasks:
+ project.columns?.find((c: { id: string }) => c.id === col.id)?.tasks ??
+ [],
+ isFinal:
+ project.columns?.find((c: { id: string }) => c.id === col.id)?.isFinal ??
+ false,
+ }));
+
+ return (
+ <div className="flex-1 min-h-0 overflow-x-hidden md:overflow-x-auto overflow-y-hidden [-webkit-overflow-scrolling:touch]">
+ <div className="flex gap-3 p-3 h-full min-w-max bg-card/80 backdrop-blur supports-[backdrop-filter]:bg-card/70">
+ {columns.map((column) => (
+ <div
+ key={column.id}
+ data-column-id={column.id}
+ className="h-full max-w-96 min-w-80 shrink-0 flex-1"
+ >
+ {/* Column wrapper (private style) */}
+ <div className="group relative flex h-full min-h-0 w-full flex-col rounded-xl border transition-all duration-300 ease-out border-border/70 bg-muted/40 shadow-xs/5 hover:border-border/90 dark:bg-card/90">
+ {/* Column header */}
+ <div className="shrink-0 border-b border-border/60 px-3 py-2">
+ <div className="flex items-center justify-between gap-2">
+ <div className="flex min-w-0 items-center gap-2">
+ <span className="text-muted-foreground">
+ {getColumnIcon(column.id, column.isFinal)}
+ </span>
+ <span className="truncate text-sm font-medium text-foreground/95">
+ {column.name}
+ </span>
+ <span className="rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground">
+ {column.tasks.length}
+ </span>
+ </div>
+ </div>
+ </div>
+
+ {/* Task list */}
+ <div className="min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-2 py-2 flex flex-col gap-1.5">
+ {column.tasks.map((task: Task) => (
+ <PreviewTaskCard
+ key={task.id}
+ task={task}
+ details={details[task.id]}
+ projectSlug={project.slug}
+ isCompleted={column.isFinal}
+ onTaskClick={onTaskClick}
+ />
+ ))}
+ </div>
+
+ {/* Add task footer, revealed on column hover */}
+ <div className="shrink-0 border-t border-border/60 p-1.5 md:opacity-0 md:group-hover:opacity-100 transition-opacity duration-150">
+ <button
+ type="button"
+ className="flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground"
+ >
+ <Plus className="h-3.5 w-3.5" />
+ Add task
+ </button>
+ </div>
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/site/components/landing/app-preview/calendar-model.ts b/apps/site/components/landing/app-preview/calendar-model.ts
new file mode 100644
index 000000000..b2368c743
--- /dev/null
+++ b/apps/site/components/landing/app-preview/calendar-model.ts
@@ -0,0 +1,169 @@
+// Keep the preview layout aligned with apps/web/src/components/calendar/month-grid-model.ts.
+import {
+ differenceInCalendarDays,
+ eachDayOfInterval,
+ endOfMonth,
+ endOfWeek,
+ startOfMonth,
+ startOfWeek,
+} from "date-fns";
+
+export const DAYS_PER_WEEK = 7;
+
+export type WeekStartsOn = 0 | 1 | 2 | 3 | 4 | 5 | 6;
+
+/**
+ * Any task already normalized by `toScheduledTasks`. Kept minimal so the layout
+ * math stays independent of the task payload.
+ */
+export type PackableTask = {
+ id: string;
+ scheduleStart: Date;
+ scheduleEnd: Date;
+};
+
+export type WeekSegment<TTask extends PackableTask> = {
+ task: TTask;
+ lane: number;
+ /** 1-based CSS grid line where the bar starts. */
+ columnStart: number;
+ /** Exclusive CSS grid line where the bar ends. */
+ columnEnd: number;
+ continuesBefore: boolean;
+ continuesAfter: boolean;
+};
+
+export type WeekLayout<TTask extends PackableTask> = {
+ segments: Array<WeekSegment<TTask>>;
+ /** Per weekday index, how many tasks did not fit within `maxLanes`. */
+ hiddenCountByDay: number[];
+ /**
+ * Per weekday index, every task overlapping that day — visible or not — in
+ * the same order the lanes were packed. Backs the overflow popover.
+ */
+ tasksByDay: TTask[][];
+};
+
+/**
+ * Week-aligned month grid: always whole weeks, so the first and last row can
+ * carry days from the neighbouring months.
+ */
+export function buildMonthWeeks(
+ visibleMonth: Date,
+ weekStartsOn: WeekStartsOn,
+): Date[][] {
+ const gridStart = startOfWeek(startOfMonth(visibleMonth), { weekStartsOn });
+ const gridEnd = endOfWeek(endOfMonth(visibleMonth), { weekStartsOn });
+ const days = eachDayOfInterval({ start: gridStart, end: gridEnd });
+
+ const weeks: Date[][] = [];
+ for (let index = 0; index < days.length; index += DAYS_PER_WEEK) {
+ weeks.push(days.slice(index, index + DAYS_PER_WEEK));
+ }
+
+ return weeks;
+}
+
+/**
+ * Clips every task overlapping the week to that week's seven columns, then
+ * greedily packs the clipped segments into lanes so overlapping tasks stack
+ * instead of colliding. Segments past `maxLanes` are reported per day so the
+ * cell can render an overflow hint.
+ */
+export function packWeekLanes<TTask extends PackableTask>(
+ week: Date[],
+ tasks: TTask[],
+ maxLanes: number,
+): WeekLayout<TTask> {
+ const hiddenCountByDay = new Array<number>(DAYS_PER_WEEK).fill(0);
+ const tasksByDay: TTask[][] = Array.from({ length: DAYS_PER_WEEK }, () => []);
+ const weekStart = week[0];
+
+ if (!weekStart) {
+ return { segments: [], hiddenCountByDay, tasksByDay };
+ }
+
+ const lastDayIndex = DAYS_PER_WEEK - 1;
+
+ const candidates = tasks
+ .map((task) => {
+ const startOffset = differenceInCalendarDays(
+ task.scheduleStart,
+ weekStart,
+ );
+ const endOffset = differenceInCalendarDays(task.scheduleEnd, weekStart);
+
+ if (endOffset < 0 || startOffset > lastDayIndex) return null;
+
+ const clippedStart = Math.max(0, startOffset);
+ const clippedEnd = Math.min(lastDayIndex, endOffset);
+
+ return {
+ task,
+ clippedStart,
+ clippedEnd,
+ columnStart: clippedStart + 1,
+ columnEnd: clippedEnd + 2,
+ continuesBefore: startOffset < 0,
+ continuesAfter: endOffset > lastDayIndex,
+ };
+ })
+ .filter((entry): entry is NonNullable<typeof entry> => entry !== null)
+ // Longest bar first within a start column, then by id so the layout does
+ // not shuffle between renders of the same data.
+ .sort((left, right) => {
+ if (left.columnStart !== right.columnStart) {
+ return left.columnStart - right.columnStart;
+ }
+ const leftSpan = left.columnEnd - left.columnStart;
+ const rightSpan = right.columnEnd - right.columnStart;
+ if (leftSpan !== rightSpan) return rightSpan - leftSpan;
+ return left.task.id.localeCompare(right.task.id);
+ });
+
+ const segments: Array<WeekSegment<TTask>> = [];
+ const laneNextFreeColumn: number[] = [];
+
+ for (const candidate of candidates) {
+ for (
+ let dayIndex = candidate.clippedStart;
+ dayIndex <= candidate.clippedEnd;
+ dayIndex += 1
+ ) {
+ tasksByDay[dayIndex].push(candidate.task);
+ }
+
+ let lane = laneNextFreeColumn.findIndex(
+ (nextFree) => nextFree <= candidate.columnStart,
+ );
+
+ if (lane === -1) {
+ lane = laneNextFreeColumn.length;
+ laneNextFreeColumn.push(candidate.columnEnd);
+ } else {
+ laneNextFreeColumn[lane] = candidate.columnEnd;
+ }
+
+ if (lane < maxLanes) {
+ segments.push({
+ task: candidate.task,
+ lane,
+ columnStart: candidate.columnStart,
+ columnEnd: candidate.columnEnd,
+ continuesBefore: candidate.continuesBefore,
+ continuesAfter: candidate.continuesAfter,
+ });
+ continue;
+ }
+
+ for (
+ let dayIndex = candidate.clippedStart;
+ dayIndex <= candidate.clippedEnd;
+ dayIndex += 1
+ ) {
+ hiddenCountByDay[dayIndex] += 1;
+ }
+ }
+
+ return { segments, hiddenCountByDay, tasksByDay };
+}
diff --git a/apps/site/components/landing/app-preview/calendar-view.tsx b/apps/site/components/landing/app-preview/calendar-view.tsx
new file mode 100644
index 000000000..fc1e52f25
--- /dev/null
+++ b/apps/site/components/landing/app-preview/calendar-view.tsx
@@ -0,0 +1,183 @@
+import {
+ addMonths,
+ format,
+ isSameMonth,
+ isToday,
+ isWeekend,
+ parseISO,
+} from "date-fns";
+import { ChevronLeft, ChevronRight } from "lucide-react";
+import { useMemo, useState } from "react";
+import { Button } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
+import type { ProjectWithTasks } from "@/types/project";
+import type Task from "@/types/task";
+import messages from "../../../../../i18n/en-US.json";
+import { buildMonthWeeks, packWeekLanes } from "./calendar-model";
+
+const copy = messages.tasks.calendar;
+// Matches the status colors used by the app's CalendarTaskBar.
+const statusClasses: Record<string, string> = {
+ "to-do": "border-slate-500/35 bg-slate-500/15 hover:bg-slate-500/20",
+ "in-progress": "border-blue-500/35 bg-blue-500/15 hover:bg-blue-500/20",
+ "in-review": "border-amber-500/40 bg-amber-500/15 hover:bg-amber-500/20",
+ done: "border-emerald-500/35 bg-emerald-500/15 hover:bg-emerald-500/20",
+};
+
+export function PreviewCalendar({
+ project,
+ onTaskClick,
+}: {
+ project: ProjectWithTasks;
+ onTaskClick: (task: Task) => void;
+}) {
+ const [month, setMonth] = useState(() => new Date());
+ const weeks = useMemo(() => buildMonthWeeks(month, 1), [month]);
+ const tasks = useMemo(
+ () =>
+ project.columns
+ .flatMap((column) => column.tasks)
+ .flatMap((task) => {
+ const start = task.startDate ?? task.dueDate;
+ const end = task.dueDate ?? task.startDate;
+ if (!start || !end) return [];
+ const first = parseISO(start);
+ const last = parseISO(end);
+ return [
+ {
+ ...task,
+ scheduleStart: first < last ? first : last,
+ scheduleEnd: first < last ? last : first,
+ },
+ ];
+ }),
+ [project],
+ );
+ return (
+ <div className="flex h-full min-h-0 flex-col bg-background">
+ <div className="flex items-center justify-between gap-3 border-b border-border/80 px-4 py-3">
+ <div className="flex items-center gap-2">
+ <h2 className="text-sm font-semibold">{copy.title}</h2>
+ <span className="text-sm text-muted-foreground">
+ {format(month, "MMMM yyyy")}
+ </span>
+ </div>
+ <div className="flex items-center gap-1">
+ <Button
+ variant="outline"
+ size="icon-xs"
+ aria-label={copy.previousMonth}
+ onClick={() => setMonth((value) => addMonths(value, -1))}
+ >
+ <ChevronLeft />
+ </Button>
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={() => setMonth(new Date())}
+ >
+ {copy.today}
+ </Button>
+ <Button
+ variant="outline"
+ size="icon-xs"
+ aria-label={copy.nextMonth}
+ onClick={() => setMonth((value) => addMonths(value, 1))}
+ >
+ <ChevronRight />
+ </Button>
+ </div>
+ </div>
+ <div className="flex min-h-0 flex-1 flex-col overflow-auto">
+ <div className="sticky top-0 z-20 grid grid-cols-7 border-b border-border bg-background/95">
+ {weeks[0].map((day) => (
+ <div
+ key={day.toISOString()}
+ className="border-r border-border/60 px-1 py-2 text-center text-[11px] font-medium uppercase tracking-wide text-muted-foreground"
+ >
+ {format(day, "EEE")}
+ </div>
+ ))}
+ </div>
+ {weeks.map((week) => {
+ // Sample projects are small; give every overlapping task a visible lane.
+ const { segments } = packWeekLanes(week, tasks, tasks.length);
+ const lanes = Math.max(
+ 3,
+ ...segments.map((segment) => segment.lane + 1),
+ );
+ return (
+ <div
+ key={week[0].toISOString()}
+ className="relative grid min-h-28 flex-1 grid-cols-7 border-b border-border/70"
+ style={{
+ gridTemplateRows: `28px repeat(${lanes}, min-content) 1fr`,
+ }}
+ >
+ {week.map((day, index) => (
+ <div
+ key={day.toISOString()}
+ className={cn(
+ "min-w-0 border-r border-border/60",
+ isWeekend(day) && "bg-muted/25",
+ )}
+ style={{ gridColumn: index + 1, gridRow: "1 / -1" }}
+ />
+ ))}
+ {week.map((day, index) => (
+ <div
+ key={`date-${day.toISOString()}`}
+ style={{ gridColumn: index + 1, gridRow: 1 }}
+ className="z-10 flex justify-end px-1 py-1"
+ >
+ <span
+ className={cn(
+ "flex size-5 items-center justify-center rounded-full text-[11px] font-medium",
+ !isSameMonth(day, month) && "text-muted-foreground/60",
+ isToday(day) && "bg-primary text-primary-foreground",
+ )}
+ >
+ {format(day, "d")}
+ </span>
+ </div>
+ ))}
+ {segments.map(
+ ({
+ task,
+ lane,
+ columnStart,
+ columnEnd,
+ continuesBefore,
+ continuesAfter,
+ }) => (
+ <button
+ type="button"
+ key={task.id}
+ onClick={() => onTaskClick(task)}
+ title={`${project.slug}-${task.number} · ${task.title}`}
+ style={{
+ gridColumn: `${columnStart} / ${columnEnd}`,
+ gridRow: lane + 2,
+ }}
+ className={cn(
+ "z-10 mb-0.5 flex h-5 min-w-0 items-center overflow-hidden border px-1.5 text-left text-[11px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ statusClasses[task.status],
+ continuesBefore
+ ? "rounded-l-none border-l-0"
+ : "ml-1 rounded-l-md",
+ continuesAfter
+ ? "rounded-r-none border-r-0"
+ : "mr-1 rounded-r-md",
+ )}
+ >
+ <span className="truncate">{task.title}</span>
+ </button>
+ ),
+ )}
+ </div>
+ );
+ })}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/site/components/landing/app-preview/index.tsx b/apps/site/components/landing/app-preview/index.tsx
index a01a0bd9f..b00ffe446 100644
--- a/apps/site/components/landing/app-preview/index.tsx
+++ b/apps/site/components/landing/app-preview/index.tsx
@@ -4,7 +4,6 @@ import {
addDays,
differenceInCalendarDays,
eachDayOfInterval,
- endOfWeek,
format,
isSameMonth,
isToday,
@@ -14,7 +13,9 @@ import {
} from "date-fns";
import {
CalendarDays,
+ CalendarRange,
ChevronDown,
+ ChevronLeft,
ChevronRight,
MoreHorizontal,
SearchIcon,
@@ -31,7 +32,6 @@ import {
useState,
} from "react";
import BoardToolbar from "@/components/project-board-toolbar";
-import { PrivateKanbanView } from "@/components/project-private-kanban-view";
import { PrivateListView } from "@/components/project-private-list-view";
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
@@ -40,6 +40,7 @@ import {
CollapsiblePanel,
CollapsibleTrigger,
} from "@/components/ui/collapsible";
+import { Input } from "@/components/ui/input";
import {
DropdownMenu,
DropdownMenuContent,
@@ -66,17 +67,23 @@ import {
import { useTaskFilters } from "@/hooks/use-task-filters";
import { cn } from "@/lib/utils";
import type Task from "@/types/task";
+import messages from "../../../../../i18n/en-US.json";
+import { version } from "../../../../../package.json";
+import { PreviewBoard } from "./board-view";
+import { PreviewCalendar } from "./calendar-view";
import {
MOCK_PROJECTS,
+ MOCK_TASK_DETAILS,
MOCK_USERS,
MOCK_WORKSPACE,
MOCK_WORKSPACE_LABELS,
} from "./mock-data";
+import { PreviewTaskDetailsPanel } from "./task-details";
const PREVIEW_W = 1400;
const PREVIEW_H = 860;
-export type PreviewMode = "board" | "list" | "gantt";
+export type PreviewMode = "board" | "list" | "calendar" | "gantt";
type ScheduledTask = Task & {
scheduleStart: Date;
@@ -112,8 +119,10 @@ function getBarGridColumns(
function MockGanttTaskBar({
task,
timeline,
+ onTaskClick,
}: {
task: ScheduledTask;
+ onTaskClick: (task: Task) => void;
timeline: {
days: Date[];
rangeStart: Date;
@@ -141,7 +150,8 @@ function MockGanttTaskBar({
<div className="relative z-20 w-2 shrink-0 border-r border-primary/15 bg-primary/8" />
<button
type="button"
- className="relative z-10 min-w-0 flex-1 cursor-grab overflow-hidden px-2.5 text-left active:cursor-grabbing"
+ onClick={() => onTaskClick(task)}
+ className="relative z-10 min-w-0 flex-1 cursor-pointer overflow-hidden px-2.5 text-left active:cursor-grabbing"
>
<div className="absolute inset-0 z-0 bg-primary/12 transition-colors group-hover:bg-primary/18" />
<span className="relative z-10 block truncate">{task.title}</span>
@@ -154,9 +164,20 @@ function MockGanttTaskBar({
function MockGanttView({
project,
+ onTaskClick,
}: {
project: (typeof MOCK_PROJECTS)[number];
+ onTaskClick: (task: Task) => void;
}) {
+ const [search, setSearch] = useState("");
+ const [rangeStart, setRangeStart] = useState(() => subDays(new Date(), 4));
+ const scrollArea = useRef<HTMLDivElement>(null);
+ const visibleTasks = (tasks: ScheduledTask[]) =>
+ tasks.filter((task) =>
+ `${project.slug}-${task.number} ${task.title}`
+ .toLowerCase()
+ .includes(search.toLowerCase()),
+ );
const dayColumnWidthRem = 2.75;
const taskColumnWidthRem = 20;
@@ -193,18 +214,7 @@ function MockGanttView({
}, [project.columns]);
const timeline = useMemo(() => {
- if (parsedTasks.length === 0) return null;
-
- const latest = parsedTasks.reduce(
- (current, task) =>
- task.scheduleEnd > current ? task.scheduleEnd : current,
- parsedTasks[0].scheduleEnd,
- );
-
- const weekEnd = endOfWeek(latest, { weekStartsOn: 1 });
- const today = new Date();
- const rangeStart = subDays(today, 4);
- const rangeEnd = addDays(weekEnd, 21);
+ const rangeEnd = addDays(rangeStart, 41);
const days = eachDayOfInterval({ start: rangeStart, end: rangeEnd });
return {
@@ -213,28 +223,75 @@ function MockGanttView({
gridTemplateColumns: `repeat(${days.length}, minmax(${dayColumnWidthRem}rem, ${dayColumnWidthRem}rem))`,
timelineMinWidthRem: days.length * dayColumnWidthRem,
};
- }, [parsedTasks]);
-
- if (!timeline) return null;
+ }, [rangeStart]);
return (
<div className="flex h-full min-h-0 flex-col bg-background">
<div className="border-b border-border/80 px-4 py-3">
<div className="flex items-center justify-between gap-3">
<div className="space-y-1">
- <h2 className="text-sm font-semibold text-foreground">Gantt</h2>
+ <h2 className="text-sm font-semibold text-foreground">
+ {messages.tasks.gantt.title}
+ </h2>
</div>
- <div className="relative w-full max-w-sm">
+ <div className="relative w-full max-w-52">
<SearchIcon className="pointer-events-none absolute top-1/2 left-2.5 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
- <div className="flex h-8 items-center rounded-md border border-input bg-background pl-8 pr-3 text-xs text-muted-foreground shadow-xs">
- Search tasks...
- </div>
+ <Input
+ type="search"
+ aria-label={messages.tasks.gantt.searchPlaceholder}
+ placeholder={messages.tasks.gantt.searchPlaceholder}
+ value={search}
+ onChange={(event) => setSearch(event.target.value)}
+ className="h-8 [&_[data-slot=input]]:pl-8 [&_[data-slot=input]]:text-xs"
+ />
+ </div>
+ <div className="flex shrink-0 items-center gap-2">
+ <Button
+ variant="outline"
+ size="icon-xs"
+ aria-label={messages.tasks.gantt.previousPeriod}
+ onClick={() => setRangeStart((date) => subDays(date, 28))}
+ >
+ <ChevronLeft />
+ </Button>
+ <input
+ type="date"
+ aria-label={messages.tasks.gantt.periodStart}
+ value={format(rangeStart, "yyyy-MM-dd")}
+ onChange={(event) => {
+ const date = parseTaskDate(event.target.value);
+ if (date) setRangeStart(date);
+ }}
+ className="h-8 rounded-md border border-border bg-background px-2 text-xs"
+ />
+ <Button
+ variant="outline"
+ size="icon-xs"
+ aria-label={messages.tasks.gantt.nextPeriod}
+ onClick={() => setRangeStart((date) => addDays(date, 28))}
+ >
+ <ChevronRight />
+ </Button>
+ <Button
+ variant="outline"
+ size="xs"
+ onClick={() => {
+ setRangeStart(subDays(new Date(), 4));
+ if (scrollArea.current) scrollArea.current.scrollLeft = 0;
+ }}
+ >
+ <CalendarDays className="size-3.5" />
+ {messages.tasks.gantt.jumpToToday}
+ </Button>
</div>
</div>
</div>
- <div className="min-h-0 flex-1 overflow-auto overscroll-x-contain">
+ <div
+ ref={scrollArea}
+ className="min-h-0 flex-1 overflow-auto overscroll-x-contain"
+ >
<div className="relative min-w-max">
<div className="sticky top-0 z-20 flex border-b border-border bg-background/95 backdrop-blur">
<div
@@ -303,7 +360,12 @@ function MockGanttView({
</div>
<div className="relative z-10 flex flex-col">
- {parsedTasks.map((task) => (
+ {visibleTasks(parsedTasks).length === 0 && (
+ <p className="sticky left-0 w-80 p-4 text-sm text-muted-foreground">
+ {messages.tasks.gantt.noTasksFound}
+ </p>
+ )}
+ {visibleTasks(parsedTasks).map((task) => (
<div
key={task.id}
className="grid items-stretch border-b border-border/70"
@@ -314,6 +376,7 @@ function MockGanttView({
<div className="sticky left-0 z-[11] h-full border-r border-border bg-background">
<button
type="button"
+ onClick={() => onTaskClick(task)}
className="flex w-full min-w-0 flex-col items-start justify-center gap-0.5 px-3 py-1.5 text-left transition-colors hover:bg-muted"
>
<div className="flex w-full items-center gap-1.5">
@@ -339,7 +402,11 @@ function MockGanttView({
className="relative h-[50px] shrink-0 select-none"
style={{ minWidth: `${timeline.timelineMinWidthRem}rem` }}
>
- <MockGanttTaskBar task={task} timeline={timeline} />
+ <MockGanttTaskBar
+ task={task}
+ timeline={timeline}
+ onTaskClick={onTaskClick}
+ />
</div>
</div>
))}
@@ -522,7 +589,7 @@ function MockSidebar({
{/* Footer: version only */}
<SidebarFooter>
<div className="flex items-center justify-center px-2 py-1.5">
- <span className="text-xs text-muted-foreground">v1.0.0</span>
+ <span className="text-xs text-muted-foreground">v{version}</span>
</div>
</SidebarFooter>
</Sidebar>
@@ -547,18 +614,47 @@ export function AppPreview({
}) {
const wrapperRef = useRef<HTMLDivElement>(null);
const [scale, setScale] = useState(1);
+ const [taskDetails, setTaskDetails] = useState(MOCK_TASK_DETAILS);
+ const [selectedTaskId, setSelectedTaskId] = useState<string | null>(null);
+ const taskTrigger = useRef<HTMLElement | null>(null);
+ const previousScrollLeft = useRef(0);
+ const openTask = (task: Task) => {
+ taskTrigger.current =
+ document.activeElement instanceof HTMLElement
+ ? document.activeElement
+ : null;
+ previousScrollLeft.current = wrapperRef.current?.scrollLeft ?? 0;
+ setSelectedTaskId(task.id);
+ if (wrapperRef.current && wrapperRef.current.clientWidth < 768) {
+ wrapperRef.current.scrollLeft = wrapperRef.current.scrollWidth;
+ }
+ };
+ const closeTask = () => {
+ setSelectedTaskId(null);
+ if (wrapperRef.current)
+ wrapperRef.current.scrollLeft = previousScrollLeft.current;
+ taskTrigger.current?.focus({ preventScroll: true });
+ };
const [activeProjectId, setActiveProjectId] = useState(MOCK_PROJECTS[0].id);
const [selectedViewMode, setSelectedViewMode] =
useState<PreviewMode>("board");
const setViewMode = useCallback(
(next: PreviewMode) => {
+ setSelectedTaskId(null);
setSelectedViewMode(next);
onModeChange?.(next);
},
[onModeChange],
);
const viewMode = mode ?? selectedViewMode;
+ const previousView = useRef(viewMode);
+ useEffect(() => {
+ if (previousView.current !== viewMode) {
+ setSelectedTaskId(null);
+ previousView.current = viewMode;
+ }
+ }, [viewMode]);
const [taskStatuses, setTaskStatuses] = useState<Record<string, string>>({});
useImperativeHandle(
@@ -587,6 +683,10 @@ export function AppPreview({
};
}, [activeProjectId, taskStatuses]);
+ const selectedTask = activeProject.columns
+ .flatMap((column) => column.tasks)
+ .find((task) => task.id === selectedTaskId);
+
const {
filters,
filteredProject,
@@ -597,6 +697,7 @@ export function AppPreview({
} = useTaskFilters(activeProject, activeProjectId);
const handleProjectSelect = useCallback((id: string) => {
+ setSelectedTaskId(null);
setActiveProjectId(id);
}, []);
@@ -656,7 +757,7 @@ export function AppPreview({
<SidebarInset className="m-2 flex flex-1 flex-col overflow-hidden rounded-xl border border-border/80 bg-background shadow-sm/5">
{/* ── Project header (matches project-layout.tsx) ───────────── */}
- <header className="h-10 flex shrink-0 items-center gap-2 border-b border-border bg-card px-2">
+ <header className="h-11 flex shrink-0 items-center gap-2 border-b border-border/80 bg-card px-2">
<div className="flex w-full items-center justify-between gap-2">
<div className="flex min-w-0 items-center gap-2">
{/* Breadcrumb */}
@@ -698,6 +799,19 @@ export function AppPreview({
<SquareKanban className="size-3.5" />
Board
</Button>
+ <Button
+ variant={viewMode === "calendar" ? "secondary" : "ghost"}
+ size="xs"
+ data-tour-target="calendar"
+ onClick={() => setViewMode("calendar")}
+ className={cn(
+ "h-6 gap-1.5 rounded-md px-2 text-xs",
+ viewMode !== "calendar" && "text-muted-foreground",
+ )}
+ >
+ <CalendarRange className="size-3.5" />
+ {messages.tasks.calendar.title}
+ </Button>
<Button
variant={viewMode === "gantt" ? "secondary" : "ghost"}
size="xs"
@@ -717,7 +831,7 @@ export function AppPreview({
</header>
{/* ── Board Toolbar ─────────────────────────────────────────── */}
- {viewMode !== "gantt" ? (
+ {viewMode === "board" || viewMode === "list" ? (
<BoardToolbar
project={activeProject}
filters={filters}
@@ -734,22 +848,52 @@ export function AppPreview({
{/* ── View content ─────────────────────────────────────────── */}
<div className="relative flex-1 overflow-hidden flex flex-col min-h-0 bg-linear-to-b from-muted/20 to-background">
- {viewMode === "gantt" ? (
- <MockGanttView project={filteredProject ?? activeProject} />
+ {viewMode === "calendar" ? (
+ <PreviewCalendar
+ project={activeProject}
+ onTaskClick={openTask}
+ />
+ ) : viewMode === "gantt" ? (
+ <MockGanttView
+ key={activeProject.id}
+ project={activeProject}
+ onTaskClick={openTask}
+ />
) : viewMode === "board" ? (
- <PrivateKanbanView
+ <PreviewBoard
+ details={taskDetails}
project={filteredProject ?? activeProject}
- onTaskClick={() => {}}
+ onTaskClick={openTask}
/>
) : (
<PrivateListView
project={filteredProject ?? activeProject}
- onTaskClick={() => {}}
+ onTaskClick={openTask}
/>
)}
</div>
</SidebarInset>
</SidebarProvider>
+ {selectedTask && (
+ <PreviewTaskDetailsPanel
+ key={selectedTask.id}
+ task={selectedTask}
+ projectSlug={activeProject.slug}
+ statusName={
+ activeProject.columns.find(
+ (column) => column.id === selectedTask.status,
+ )?.name ?? selectedTask.status
+ }
+ details={taskDetails[selectedTask.id]}
+ onChange={(details) =>
+ setTaskDetails((current) => ({
+ ...current,
+ [selectedTask.id]: details,
+ }))
+ }
+ onClose={closeTask}
+ />
+ )}
</div>
</div>
);
diff --git a/apps/site/components/landing/app-preview/mock-data.ts b/apps/site/components/landing/app-preview/mock-data.ts
index 623f4b35e..edbf62469 100644
--- a/apps/site/components/landing/app-preview/mock-data.ts
+++ b/apps/site/components/landing/app-preview/mock-data.ts
@@ -404,3 +404,60 @@ export const MOB_PROJECT: ProjectWithTasks = {
};
export const MOCK_PROJECTS: ProjectWithTasks[] = [WEB_PROJECT, MOB_PROJECT];
+
+export type PreviewTaskDetails = {
+ checklist: { id: string; title: string; completed: boolean }[];
+ fields: {
+ id: string;
+ name: string;
+ value: string;
+ type: "text" | "number";
+ }[];
+};
+
+// Local sample values for the app's checklist and project custom-field features.
+export const MOCK_TASK_DETAILS: Record<string, PreviewTaskDetails> = {
+ "t-101": {
+ checklist: [
+ { id: "venue", title: "Book Chili’s for the ceremony", completed: true },
+ { id: "trophies", title: "Order the Dundie trophies", completed: true },
+ { id: "slides", title: "Finish the awards slideshow", completed: false },
+ { id: "speech", title: "Rehearse the opening speech", completed: false },
+ ],
+ fields: [
+ { id: "budget", name: "Budget ($)", value: "500", type: "number" },
+ { id: "venue", name: "Venue", value: "Chili’s, Scranton", type: "text" },
+ ],
+ },
+ "t-103": {
+ checklist: [
+ { id: "vendor", title: "Confirm the pretzel vendor", completed: true },
+ { id: "queue", title: "Set up the queue at reception", completed: false },
+ {
+ id: "toppings",
+ title: "Collect everyone’s topping requests",
+ completed: false,
+ },
+ ],
+ fields: [
+ { id: "budget", name: "Budget ($)", value: "180", type: "number" },
+ {
+ id: "vendor",
+ name: "Vendor",
+ value: "Scranton Pretzel Co.",
+ type: "text",
+ },
+ ],
+ },
+ "t-201": {
+ checklist: [
+ { id: "cut", title: "Assemble the rough cut", completed: true },
+ { id: "sound", title: "Mix the casino soundtrack", completed: false },
+ { id: "review", title: "Review with Michael", completed: false },
+ ],
+ fields: [
+ { id: "scene", name: "Scene", value: "Casino heist", type: "text" },
+ { id: "runtime", name: "Runtime (minutes)", value: "8", type: "number" },
+ ],
+ },
+};
diff --git a/apps/site/components/landing/app-preview/task-card.tsx b/apps/site/components/landing/app-preview/task-card.tsx
new file mode 100644
index 000000000..425fd34fd
--- /dev/null
+++ b/apps/site/components/landing/app-preview/task-card.tsx
@@ -0,0 +1,103 @@
+import { format } from "date-fns";
+import { Calendar, SlidersHorizontal, SquareCheck } from "lucide-react";
+import { PublicTaskLabels } from "@/components/project-task-labels";
+import { Avatar, AvatarFallback } from "@/components/ui/avatar";
+import { dueDateStatusColors, getDueDateStatus } from "@/lib/due-date-status";
+import { getPriorityIcon } from "@/lib/priority";
+import { cn } from "@/lib/utils";
+import messages from "../../../../../i18n/en-US.json";
+import type { PreviewTaskDetails, TaskWithExtras } from "./mock-data";
+
+// Same card hierarchy and metadata as apps/web's kanban-board/task-card.
+export function PreviewTaskCard({
+ task,
+ details,
+ projectSlug,
+ isCompleted,
+ onTaskClick,
+}: {
+ task: TaskWithExtras;
+ details?: PreviewTaskDetails;
+ projectSlug: string;
+ isCompleted: boolean;
+ onTaskClick: (task: TaskWithExtras) => void;
+}) {
+ const completed =
+ details?.checklist.filter((item) => item.completed).length ?? 0;
+ const fields = details?.fields.filter((field) => field.value !== "") ?? [];
+ return (
+ <button
+ type="button"
+ data-task-id={task.id}
+ onClick={() => onTaskClick(task)}
+ className="group relative w-full rounded-lg border border-border bg-background p-3 text-left shadow-xs/5 transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <div className="mb-2 flex items-center justify-between gap-2">
+ <span className="text-xs font-medium text-muted-foreground">
+ {projectSlug}-{task.number}
+ </span>
+ <Avatar
+ className="h-5 w-5"
+ title={
+ task.assigneeName ??
+ messages.common.modals.createTask.assignUnassigned
+ }
+ >
+ <AvatarFallback className="border border-border/30 text-[10px] font-medium">
+ {task.assigneeName
+ ?.split(" ")
+ .map((name) => name[0])
+ .join("") ?? "?"}
+ </AvatarFallback>
+ </Avatar>
+ </div>
+ <div className="mb-2.5 line-clamp-3 break-words pr-6 text-[15px] font-medium leading-5 text-foreground/95">
+ {task.title}
+ </div>
+ {!!task.labels?.length && (
+ <div className="mb-2.5">
+ <PublicTaskLabels labels={task.labels} />
+ </div>
+ )}
+ <div className="flex flex-wrap items-center gap-1.5">
+ <span className="inline-flex h-5.5 items-center rounded border border-border/70 bg-muted/55 px-2 py-1 text-[10px] text-muted-foreground">
+ {getPriorityIcon(task.priority ?? "")}
+ </span>
+ {fields.length > 0 && (
+ <span
+ title={fields
+ .map((field) => `${field.name}: ${field.value}`)
+ .join(" · ")}
+ className="inline-flex items-center gap-1 rounded border border-border/70 bg-muted/55 px-2 py-1 text-[10px] text-muted-foreground"
+ >
+ <SlidersHorizontal className="size-3" />
+ {fields.length}
+ </span>
+ )}
+ {!!details?.checklist.length && (
+ <span
+ className={cn(
+ "flex h-5.5 items-center gap-1 rounded bg-muted/50 px-2 py-1 text-[10px] text-muted-foreground",
+ completed === details.checklist.length &&
+ "bg-success/10 text-success-foreground",
+ )}
+ >
+ <SquareCheck className="size-3" />
+ {completed}/{details.checklist.length}
+ </span>
+ )}
+ {task.dueDate && (
+ <span
+ className={cn(
+ "flex h-5.5 items-center gap-1 rounded px-2 py-1 text-[10px]",
+ dueDateStatusColors[getDueDateStatus(task.dueDate, isCompleted)],
+ )}
+ >
+ <Calendar className="size-3" />
+ {format(new Date(task.dueDate), "MMM d")}
+ </span>
+ )}
+ </div>
+ </button>
+ );
+}
diff --git a/apps/site/components/landing/app-preview/task-details.tsx b/apps/site/components/landing/app-preview/task-details.tsx
new file mode 100644
index 000000000..91814c069
--- /dev/null
+++ b/apps/site/components/landing/app-preview/task-details.tsx
@@ -0,0 +1,176 @@
+import { format } from "date-fns";
+import { Calendar, ChevronDown, X } from "lucide-react";
+import { useEffect, useId, useRef } from "react";
+import { PublicTaskLabels } from "@/components/project-task-labels";
+import { Avatar, AvatarFallback } from "@/components/ui/avatar";
+import { Button } from "@/components/ui/button";
+import { Checkbox } from "@/components/ui/checkbox";
+import { Input } from "@/components/ui/input";
+import { getColumnIcon } from "@/lib/column";
+import { getPriorityIcon } from "@/lib/priority";
+import messages from "../../../../../i18n/en-US.json";
+import type { PreviewTaskDetails, TaskWithExtras } from "./mock-data";
+
+// An embedded, non-modal version of the app's task sheet, confined to the preview.
+export function PreviewTaskDetailsPanel({
+ task,
+ projectSlug,
+ statusName,
+ details,
+ onChange,
+ onClose,
+}: {
+ task: TaskWithExtras;
+ projectSlug: string;
+ statusName: string;
+ details?: PreviewTaskDetails;
+ onChange: (details: PreviewTaskDetails) => void;
+ onClose: () => void;
+}) {
+ const heading = useRef<HTMLHeadingElement>(null);
+ const id = useId();
+ useEffect(() => {
+ heading.current?.focus({ preventScroll: true });
+ }, []);
+ return (
+ <aside
+ aria-labelledby={id}
+ data-preview-task-panel
+ className="absolute inset-y-0 right-0 z-30 flex w-[540px] flex-col border-l border-border bg-background shadow-2xl md:w-[720px]"
+ onKeyDown={(event) => {
+ if (event.key === "Escape") {
+ event.stopPropagation();
+ onClose();
+ }
+ }}
+ >
+ <div className="flex shrink-0 items-center justify-between border-b border-border px-4 py-2.5">
+ <span className="text-sm font-medium text-muted-foreground">
+ {projectSlug}-{task.number}
+ </span>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={messages.common.actions.close}
+ onClick={onClose}
+ >
+ <X className="size-4" />
+ </Button>
+ </div>
+ <div className="flex shrink-0 flex-wrap items-center gap-3 border-b border-border bg-sidebar p-3 text-xs font-semibold">
+ <span className="inline-flex items-center gap-1.5">
+ {getColumnIcon(task.status)}
+ {statusName}
+ </span>
+ <span className="inline-flex items-center gap-1.5">
+ {getPriorityIcon(task.priority ?? "")}
+ {
+ messages.tasks.priority[
+ task.priority as keyof typeof messages.tasks.priority
+ ]
+ }
+ </span>
+ {task.assigneeName && (
+ <span className="inline-flex items-center gap-1.5">
+ <Avatar className="size-4">
+ <AvatarFallback className="text-[9px]">
+ {task.assigneeName[0]}
+ </AvatarFallback>
+ </Avatar>
+ {task.assigneeName}
+ </span>
+ )}
+ {task.dueDate && (
+ <span className="inline-flex items-center gap-1.5">
+ <Calendar className="size-3.5" />
+ {format(new Date(task.dueDate), "MMM d")}
+ </span>
+ )}
+ </div>
+ <div className="min-h-0 flex-1 space-y-6 overflow-auto p-4">
+ <div className="space-y-3">
+ <h2
+ id={id}
+ ref={heading}
+ tabIndex={-1}
+ className="text-xl font-semibold tracking-tight outline-none"
+ >
+ {task.title}
+ </h2>
+ <p className="text-sm leading-6 text-foreground/85">
+ {task.description}
+ </p>
+ {details?.checklist.map((item) => (
+ <div
+ key={item.id}
+ className="flex cursor-pointer items-center gap-2 text-sm leading-6"
+ >
+ <Checkbox
+ id={`${id}-check-${item.id}`}
+ checked={item.completed}
+ onCheckedChange={(checked) =>
+ onChange({
+ ...details,
+ checklist: details.checklist.map((entry) =>
+ entry.id === item.id
+ ? { ...entry, completed: checked === true }
+ : entry,
+ ),
+ })
+ }
+ />
+ <label
+ htmlFor={`${id}-check-${item.id}`}
+ className={
+ item.completed ? "text-muted-foreground line-through" : ""
+ }
+ >
+ {item.title}
+ </label>
+ </div>
+ ))}
+ <PublicTaskLabels labels={task.labels ?? []} />
+ </div>
+ {!!details?.fields.length && (
+ <details
+ open
+ className="rounded-lg border border-border bg-sidebar/30 px-4"
+ >
+ <summary className="flex cursor-pointer list-none items-center justify-between py-4 text-sm font-semibold">
+ {messages.tasks.common.customFields}
+ <ChevronDown className="size-4 text-muted-foreground" />
+ </summary>
+ <div className="grid grid-cols-2 gap-4 pb-4">
+ {details.fields.map((field) => (
+ <div key={field.id} className="space-y-1.5">
+ <label
+ htmlFor={`${id}-${field.id}`}
+ className="text-xs font-medium text-muted-foreground"
+ >
+ {field.name}
+ </label>
+ <Input
+ id={`${id}-${field.id}`}
+ type={field.type}
+ value={field.value}
+ className="h-9 bg-background text-sm"
+ onChange={(event) =>
+ onChange({
+ ...details,
+ fields: details.fields.map((entry) =>
+ entry.id === field.id
+ ? { ...entry, value: event.target.value }
+ : entry,
+ ),
+ })
+ }
+ />
+ </div>
+ ))}
+ </div>
+ </details>
+ )}
+ </div>
+ </aside>
+ );
+}
diff --git a/apps/site/components/landing/product-showcase.module.css b/apps/site/components/landing/product-showcase.module.css
index 0f49bf0ae..fda2bfe8e 100644
--- a/apps/site/components/landing/product-showcase.module.css
+++ b/apps/site/components/landing/product-showcase.module.css
@@ -136,8 +136,9 @@
.playButton:hover { background: var(--muted); color: var(--foreground); }
}
@media (max-width: 600px) {
- .controls { gap: 2px; }
- .sceneButton, .playButton { min-height: 44px; }
+ .controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 2px; }
+ .sceneButton, .playButton { min-height: 44px; padding-inline: 4px; gap: 4px; font-size: 11px; }
+ .playButton { width: 36px; }
}
@media (prefers-reduced-motion: reduce) {
.cursor { display: none; transition: none; }
diff --git a/apps/site/components/landing/product-showcase.tsx b/apps/site/components/landing/product-showcase.tsx
index 6ae76974d..87d5c5b86 100644
--- a/apps/site/components/landing/product-showcase.tsx
+++ b/apps/site/components/landing/product-showcase.tsx
@@ -2,6 +2,7 @@
import {
CalendarDays,
+ CalendarRange,
ListTodo,
Pause,
Play,
@@ -21,17 +22,24 @@ import {
type PreviewMode,
} from "@/components/landing/app-preview";
import { landing } from "@/lib/landing";
+import messages from "../../../../i18n/en-US.json";
import styles from "./product-showcase.module.css";
const scenes = [
{ mode: "board", icon: SquareKanban, label: landing.showcase.board },
{ mode: "list", icon: ListTodo, label: landing.showcase.list },
+ {
+ mode: "calendar",
+ icon: CalendarRange,
+ label: messages.tasks.calendar.title,
+ },
{ mode: "gantt", icon: CalendarDays, label: landing.showcase.gantt },
] satisfies { mode: PreviewMode; icon: typeof SquareKanban; label: string }[];
const tourTargets = [
"drag-forward",
"list",
+ "calendar",
"gantt",
"board",
"drag-back",