From de6365471f59568e7c0a370d0b3cf67c1b175273 Mon Sep 17 00:00:00 2001 From: ln-dev7 Date: Sat, 31 Jan 2026 14:33:04 +0100 Subject: [PATCH 01/75] docs: update README and sidebar to include BaseUI code link to Square UI Pro --- README.md | 2 ++ components/layout/sidebar/app-sidebar.tsx | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 5e73163..d83d1b7 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ Project management interface inspired by Linear. Built with Next.js and shadcn/ui, this application allows tracking of issues, projects and teams with a modern, responsive UI. +> The BaseUI code is available on [Square UI Pro](https://pro.lndev.me/templates). + ## 🛠️ Technologies - **Framework**: [Next.js](https://nextjs.org/) diff --git a/components/layout/sidebar/app-sidebar.tsx b/components/layout/sidebar/app-sidebar.tsx index f035e6d..0860b97 100644 --- a/components/layout/sidebar/app-sidebar.tsx +++ b/components/layout/sidebar/app-sidebar.tsx @@ -42,6 +42,17 @@ export function AppSidebar({ ...props }: React.ComponentProps) {
+

+ BaseUI code on{' '} + + Square UI Pro + +

{open && (
Date: Sat, 18 Apr 2026 21:32:10 +0100 Subject: [PATCH 02/75] chore: update chariow shop domain to lndev.mychariow.shop Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/FUNDING.yml | 2 +- components/layout/sidebar/help-button.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 512be65..416dac1 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -custom: ["https://ecaefmew.mychariow.shop/prd_3cu1s0"] \ No newline at end of file +custom: ["https://lndev.mychariow.shop/prd_3cu1s0"] \ No newline at end of file diff --git a/components/layout/sidebar/help-button.tsx b/components/layout/sidebar/help-button.tsx index 3f27a7b..9c60743 100644 --- a/components/layout/sidebar/help-button.tsx +++ b/components/layout/sidebar/help-button.tsx @@ -63,7 +63,7 @@ export function HelpButton() { - + Support project From 8c2a2a4b7670b8327c909d90fcd56e4e49394b73 Mon Sep 17 00:00:00 2001 From: ln-dev7 Date: Sat, 1 Aug 2026 13:36:45 +0000 Subject: [PATCH 03/75] feat(mock-data): 13-status categorized workflow, cycles with burn-up data, ~90 issues, team documents --- mock-data/cycles.ts | 247 ++++++- mock-data/documents.ts | 228 ++++++ mock-data/issues.ts | 1500 ++++++++++++++++++++++++++++------------ mock-data/status.tsx | 361 +++++----- 4 files changed, 1721 insertions(+), 615 deletions(-) create mode 100644 mock-data/documents.ts diff --git a/mock-data/cycles.ts b/mock-data/cycles.ts index 9617314..475a9fe 100644 --- a/mock-data/cycles.ts +++ b/mock-data/cycles.ts @@ -1,39 +1,238 @@ +import { format, parseISO } from 'date-fns'; + +export type CycleStatus = 'planned' | 'upcoming' | 'current' | 'completed'; + +/** One data point of a cycle burn-up chart. */ +export interface CycleBurnupPoint { + date: string; // ISO date (yyyy-MM-dd) + scope: number; + started: number; + completed: number; + ideal: number; +} + export interface Cycle { id: string; number: number; name: string; teamId: string; - startDate: string; - endDate: string; - progress: number; + status: CycleStatus; + startDate: string; // ISO date + endDate: string; // ISO date + /** Percentage of the team capacity currently allocated to the cycle. */ + capacity: number; + /** Total number of issues in the cycle. */ + scope: number; + /** Scope variation (in %) since the beginning of the cycle. */ + scopeDelta: number; + /** Number of issues started but not completed. */ + started: number; + /** Number of completed issues. */ + completed: number; + /** Completed / scope, for finished cycles ("67% success"). */ + successRate?: number; + /** Burn-up chart points (only meaningful for current / completed cycles). */ + burnup?: CycleBurnupPoint[]; } +/** + * Generates a plausible burn-up curve between startDate and endDate. + * Deterministic (no randomness) so SSR and client render the same chart. + */ +const generateBurnup = ( + startDate: string, + days: number, + startScope: number, + endScope: number, + completedTarget: number, + startedTarget: number +): CycleBurnupPoint[] => { + const points: CycleBurnupPoint[] = []; + const start = parseISO(startDate); + + for (let i = 0; i <= days; i++) { + const t = i / days; + // Ease-in-out curve for completion, slightly stepped scope growth. + const eased = t * t * (3 - 2 * t); + const scope = Math.round(startScope + (endScope - startScope) * Math.min(1, t * 1.35)); + const completed = Math.round(completedTarget * eased); + const started = Math.min( + scope - completed, + Math.round(startedTarget * (0.4 + 0.6 * Math.sin(t * Math.PI))) + ); + const date = new Date(start); + date.setDate(start.getDate() + i); + + points.push({ + date: format(date, 'yyyy-MM-dd'), + scope, + started: completed + Math.max(0, started), + completed, + ideal: Math.round(endScope * t), + }); + } + + return points; +}; + +/** + * Cycles of the CORE team. One `current`, one `upcoming`, one `planned`, + * the rest `completed` — two-week iterations, most recent first. + */ export const cycles: Cycle[] = [ { - id: '42', - number: 42, - name: 'Sprint 42 - Pixel Perfect', - teamId: 'design-system', - startDate: '2025-03-10', - endDate: '2025-03-24', - progress: 80, + id: '23', + number: 23, + name: 'Cycle 23', + teamId: 'CORE', + status: 'planned', + startDate: '2026-08-17', + endDate: '2026-08-30', + capacity: 0, + scope: 0, + scopeDelta: 0, + started: 0, + completed: 0, }, { - id: '43', - number: 43, - name: 'Sprint 43 - Performance Boost', - teamId: 'performance-lab', - startDate: '2025-03-10', - endDate: '2025-03-24', - progress: 50, + id: '22', + number: 22, + name: 'Cycle 22', + teamId: 'CORE', + status: 'upcoming', + startDate: '2026-08-03', + endDate: '2026-08-16', + capacity: 4, + scope: 8, + scopeDelta: 0, + started: 2, + completed: 0, + burnup: generateBurnup('2026-08-03', 13, 8, 8, 0, 2), }, { - id: '44', - number: 44, - name: 'Sprint 44 - Core Enhancements', - teamId: 'lndev-core', - startDate: '2025-03-10', - endDate: '2025-03-24', - progress: 0, + id: '21', + number: 21, + name: 'Cycle 21', + teamId: 'CORE', + status: 'current', + startDate: '2026-07-20', + endDate: '2026-08-02', + capacity: 68, + scope: 37, + scopeDelta: 44, + started: 10, + completed: 12, + burnup: generateBurnup('2026-07-20', 13, 26, 37, 12, 10), + }, + { + id: '20', + number: 20, + name: 'Cycle 20', + teamId: 'CORE', + status: 'completed', + startDate: '2026-07-06', + endDate: '2026-07-19', + capacity: 82, + scope: 24, + scopeDelta: 20, + started: 0, + completed: 17, + successRate: 71, + burnup: generateBurnup('2026-07-06', 13, 20, 24, 17, 4), + }, + { + id: '19', + number: 19, + name: 'Cycle 19', + teamId: 'CORE', + status: 'completed', + startDate: '2026-06-22', + endDate: '2026-07-05', + capacity: 90, + scope: 31, + scopeDelta: 12, + started: 0, + completed: 28, + successRate: 90, + burnup: generateBurnup('2026-06-22', 13, 27, 31, 28, 3), + }, + { + id: '18', + number: 18, + name: 'Cycle 18', + teamId: 'CORE', + status: 'completed', + startDate: '2026-06-08', + endDate: '2026-06-21', + capacity: 76, + scope: 19, + scopeDelta: 35, + started: 0, + completed: 15, + successRate: 79, + burnup: generateBurnup('2026-06-08', 13, 14, 19, 15, 4), + }, + { + id: '17', + number: 17, + name: 'Cycle 17', + teamId: 'CORE', + status: 'completed', + startDate: '2026-05-25', + endDate: '2026-06-07', + capacity: 64, + scope: 27, + scopeDelta: 8, + started: 0, + completed: 18, + successRate: 67, + burnup: generateBurnup('2026-05-25', 13, 25, 27, 18, 5), + }, + { + id: '16', + number: 16, + name: 'Cycle 16', + teamId: 'CORE', + status: 'completed', + startDate: '2026-05-11', + endDate: '2026-05-24', + capacity: 58, + scope: 22, + scopeDelta: 15, + started: 0, + completed: 13, + successRate: 59, + burnup: generateBurnup('2026-05-11', 13, 19, 22, 13, 6), }, ]; + +/* -------------------------------------------------------------------------- */ +/* Helpers */ +/* -------------------------------------------------------------------------- */ + +export function getCurrentCycle(): Cycle { + return cycles.find((c) => c.status === 'current') ?? cycles[0]; +} + +export function getUpcomingCycle(): Cycle { + return cycles.find((c) => c.status === 'upcoming') ?? cycles[0]; +} + +export function getCycleById(id: string): Cycle | undefined { + return cycles.find((c) => c.id === id); +} + +export function getCyclesByTeam(teamId: string): Cycle[] { + return cycles.filter((c) => c.teamId === teamId); +} + +export function formatCycleDateRange(cycle: Cycle): string { + return `${format(parseISO(cycle.startDate), 'MMM d')} → ${format(parseISO(cycle.endDate), 'MMM d')}`; +} + +export const cycleStatusLabel: Record = { + planned: 'Planned', + upcoming: 'Upcoming', + current: 'Current', + completed: 'Completed', +}; diff --git a/mock-data/documents.ts b/mock-data/documents.ts new file mode 100644 index 0000000..cbdf6c7 --- /dev/null +++ b/mock-data/documents.ts @@ -0,0 +1,228 @@ +import { User, users } from './users'; + +export interface TeamDocument { + id: string; + name: string; + icon: string; + creator: User; + createdAt: string; // ISO date + updatedAt: string; // ISO date + pinned?: boolean; +} + +export interface DocumentFolder { + id: string; + name: string; + icon: string; + documents: TeamDocument[]; +} + +/** + * Team documents grouped by folder (project or theme), Linear-style. + * All content is fake data for the LNDev UI component library. + */ +export const documentFolders: DocumentFolder[] = [ + { + id: 'team-documents', + name: 'Team documents', + icon: '📁', + documents: [ + { + id: 'doc-1', + name: 'LNDev UI Team Calendar', + icon: '📆', + creator: users[0], + createdAt: '2026-07-08', + updatedAt: '2026-07-30', + pinned: true, + }, + ], + }, + { + id: 'design-tokens-v2', + name: 'Design Tokens v2', + icon: '🎨', + documents: [ + { + id: 'doc-2', + name: 'PRD - Design Tokens v2 (OKLCH migration)', + icon: '📄', + creator: users[2], + createdAt: '2026-06-15', + updatedAt: '2026-07-22', + }, + { + id: 'doc-3', + name: 'Spec: Token naming conventions', + icon: '📐', + creator: users[4], + createdAt: '2026-06-18', + updatedAt: '2026-06-30', + }, + ], + }, + { + id: 'component-playground', + name: 'Component Playground', + icon: '🧪', + documents: [ + { + id: 'doc-4', + name: 'PRD - Interactive component playground', + icon: '📄', + creator: users[6], + createdAt: '2026-06-02', + updatedAt: '2026-07-12', + }, + { + id: 'doc-5', + name: 'Playground sharing via URL — technical notes', + icon: '🔗', + creator: users[8], + createdAt: '2026-06-10', + updatedAt: '2026-06-25', + }, + ], + }, + { + id: 'data-table-virtualization', + name: 'Data Table Virtualization', + icon: '🗂️', + documents: [ + { + id: 'doc-6', + name: 'PRD - Virtualized Data Table (10k+ rows)', + icon: '📄', + creator: users[4], + createdAt: '2026-07-05', + updatedAt: '2026-07-28', + }, + ], + }, + { + id: 'accessibility-audit', + name: 'Accessibility Audit Q3', + icon: '♿', + documents: [ + { + id: 'doc-7', + name: 'WCAG 2.2 AA audit checklist', + icon: '✅', + creator: users[10], + createdAt: '2026-06-20', + updatedAt: '2026-07-18', + }, + { + id: 'doc-8', + name: 'Focus management guidelines', + icon: '🎯', + creator: users[10], + createdAt: '2026-06-22', + updatedAt: '2026-07-02', + }, + ], + }, + { + id: 'docs-revamp', + name: 'Docs Site Revamp', + icon: '📚', + documents: [ + { + id: 'doc-9', + name: 'PRD - Docs search & prop table indexing', + icon: '📄', + creator: users[14], + createdAt: '2026-05-28', + updatedAt: '2026-07-10', + }, + { + id: 'doc-10', + name: 'Content style guide for component docs', + icon: '✍️', + creator: users[9], + createdAt: '2026-05-30', + updatedAt: '2026-06-14', + }, + ], + }, + { + id: 'theming-engine', + name: 'Theming Engine', + icon: '🌗', + documents: [ + { + id: 'doc-11', + name: 'PRD - AI-assisted theme generator', + icon: '📄', + creator: users[7], + createdAt: '2026-07-09', + updatedAt: '2026-07-25', + }, + { + id: 'doc-12', + name: 'High-contrast preset exploration', + icon: '🔆', + creator: users[12], + createdAt: '2026-07-11', + updatedAt: '2026-07-20', + }, + ], + }, + { + id: 'release-process', + name: 'Release Process', + icon: '🚀', + documents: [ + { + id: 'doc-13', + name: 'v2.4 release checklist', + icon: '📋', + creator: users[5], + createdAt: '2026-07-15', + updatedAt: '2026-07-29', + }, + { + id: 'doc-14', + name: 'Versioning & changelog conventions', + icon: '🏷️', + creator: users[16], + createdAt: '2026-05-12', + updatedAt: '2026-06-08', + }, + ], + }, + { + id: 'cli-tooling', + name: 'CLI & Tooling', + icon: '🛠️', + documents: [ + { + id: 'doc-15', + name: 'PRD - Scaffolding CLI with test files', + icon: '📄', + creator: users[8], + createdAt: '2026-07-01', + updatedAt: '2026-07-24', + }, + ], + }, + { + id: 'quality', + name: 'Quality & Testing', + icon: '🧷', + documents: [ + { + id: 'doc-16', + name: 'Visual regression strategy (Playwright)', + icon: '📷', + creator: users[18], + createdAt: '2026-05-14', + updatedAt: '2026-06-27', + }, + ], + }, +]; + +export function getAllDocuments(): TeamDocument[] { + return documentFolders.flatMap((folder) => folder.documents); +} diff --git a/mock-data/issues.ts b/mock-data/issues.ts index 7834f0a..7c61aa2 100644 --- a/mock-data/issues.ts +++ b/mock-data/issues.ts @@ -2,7 +2,7 @@ import { LexoRank } from '@/lib/utils'; import { LabelInterface, labels } from './labels'; import { Priority, priorities } from './priorities'; import { Project, projects } from './projects'; -import { Status, status } from './status'; +import { Status, status, StatusCategory } from './status'; import { User, users } from './users'; export interface Issue { @@ -15,6 +15,7 @@ export interface Issue { priority: Priority; labels: LabelInterface[]; createdAt: string; + /** Cycle the issue belongs to. Empty string = no cycle (backlog stock). */ cycleId: string; project?: Project; subissues?: string[]; @@ -22,442 +23,1076 @@ export interface Issue { dueDate?: string; } -// generates issues ranks using LexoRank algorithm. +/* -------------------------------------------------------------------------- */ +/* Seed-based generation */ +/* -------------------------------------------------------------------------- */ + +const statusById = (id: string): Status => { + const found = status.find((s) => s.id === id); + if (!found) throw new Error(`Unknown status id: ${id}`); + return found; +}; + +/** + * Compact issue seed: + * [identifier, title, statusId, priorityIdx, assigneeIdx | null, labelIdxs, projectIdx | null, cycleId, createdAt, dueDate?] + * + * - priorityIdx: index in `priorities` (0 no-priority, 1 urgent, 2 high, 3 medium, 4 low) + * - assigneeIdx / labelIdxs / projectIdx: indexes in `users` / `labels` / `projects` + * - cycleId: '' = not planned in any cycle + */ +type IssueSeed = [ + string, + string, + string, + number, + number | null, + number[], + number | null, + string, + string, + string?, +]; + +const seeds: IssueSeed[] = [ + /* ------------------------- Cycle 21 (current) ------------------------- */ + // Product Feedback (2) + [ + 'LNUI-701', + 'Combobox: keyboard selection skips disabled options inconsistently', + 'product-feedback', + 2, + 0, + [0, 8], + 0, + '21', + '2026-07-21', + ], + [ + 'LNUI-702', + 'Date picker: month navigation feels laggy on low-end devices', + 'product-feedback', + 3, + 6, + [5], + 9, + '21', + '2026-07-22', + ], + // In Progress (4) + [ + 'LNUI-703', + 'Rework Dialog focus trap to support nested portals', + 'in-progress', + 1, + 2, + [1, 8], + 2, + '21', + '2026-07-20', + ], + [ + 'LNUI-704', + 'Add virtualization to Data Table for 10k+ rows', + 'in-progress', + 2, + 4, + [5], + 9, + '21', + '2026-07-21', + ], + [ + 'LNUI-705', + 'Ship CLI flag to scaffold components with test files', + 'in-progress', + 3, + 8, + [2, 9], + 5, + '21', + '2026-07-23', + ], + [ + 'LNUI-706', + 'Migrate color tokens to OKLCH with fallbacks', + 'in-progress', + 2, + 12, + [4], + 1, + '21', + '2026-07-24', + ], + // Technical Review (2) + [ + 'LNUI-707', + 'Refactor Tooltip positioning engine to floating middleware', + 'technical-review', + 2, + 1, + [4], + 7, + '21', + '2026-07-20', + ], + [ + 'LNUI-708', + 'Toast queue: collapse duplicate notifications', + 'technical-review', + 3, + 10, + [2], + 11, + '21', + '2026-07-22', + ], + // Paused (1) + [ + 'LNUI-709', + 'Carousel: momentum scrolling on trackpads', + 'paused', + 4, + 14, + [2], + 0, + '21', + '2026-07-21', + ], + // Blocked (1) + [ + 'LNUI-710', + 'Command palette: async sources hang when provider throws', + 'blocked', + 1, + 3, + [1], + 0, + '21', + '2026-07-25', + ], + // Triage (1) + [ + 'LNUI-711', + 'Report: Select dropdown clipped inside scrollable Sheet', + 'triage', + 0, + null, + [1], + null, + '21', + '2026-07-30', + ], + // Todo (13) + [ + 'LNUI-712', + 'Add skeleton variants for Card and Table', + 'to-do', + 3, + 5, + [0], + 6, + '21', + '2026-07-20', + ], + [ + 'LNUI-713', + 'Expose CSS variables for Radix Accordion animations', + 'to-do', + 4, + null, + [0], + 0, + '21', + '2026-07-21', + ], + [ + 'LNUI-714', + 'Breadcrumb: support collapsed middle items with popover', + 'to-do', + 3, + 7, + [2], + 3, + '21', + '2026-07-22', + ], + [ + 'LNUI-715', + 'Form: surface async validation state on submit button', + 'to-do', + 2, + 9, + [10], + 10, + '21', + '2026-07-22', + ], + [ + 'LNUI-716', + 'Avatar group: overflow counter with tooltip listing users', + 'to-do', + 4, + 11, + [2], + 6, + '21', + '2026-07-23', + ], + [ + 'LNUI-717', + 'Number input: locale-aware decimal separators', + 'to-do', + 3, + 13, + [10], + 10, + '21', + '2026-07-24', + ], + [ + 'LNUI-718', + 'Docs: interactive playground for Badge variants', + 'to-do', + 4, + 15, + [3], + 1, + '21', + '2026-07-25', + ], + [ + 'LNUI-719', + 'Resizable panels: persist layout per page in memory', + 'to-do', + 3, + 16, + [2], + 4, + '21', + '2026-07-26', + ], + [ + 'LNUI-720', + 'Tabs: add vertical orientation with proper roving focus', + 'to-do', + 2, + 17, + [8], + 0, + '21', + '2026-07-27', + ], + [ + 'LNUI-721', + 'Progress: indeterminate state with reduced-motion fallback', + 'to-do', + 4, + 18, + [8], + 11, + '21', + '2026-07-28', + ], + [ + 'LNUI-722', + 'Chart palette: colorblind-safe categorical scale', + 'to-do', + 2, + 19, + [8, 6], + 4, + '21', + '2026-07-29', + ], + [ + 'LNUI-723', + 'Sidebar: double-click on rail to collapse to icons', + 'to-do', + 4, + 0, + [2], + 5, + '21', + '2026-07-30', + ], + [ + 'LNUI-724', + 'Dropdown: sub-menu opens off-screen near viewport edge', + 'to-do', + 2, + null, + [1], + 8, + '21', + '2026-07-31', + ], + // Done (10) + [ + 'LNUI-725', + 'Fix Switch thumb misalignment in RTL layouts', + 'done', + 2, + 2, + [1], + 10, + '21', + '2026-07-20', + ], + [ + 'LNUI-726', + 'Memoize Table row renderer to cut re-renders by 60%', + 'done', + 1, + 4, + [5], + 9, + '21', + '2026-07-20', + ], + [ + 'LNUI-727', + 'Add aria-live region to inline form errors', + 'done', + 2, + 6, + [8, 10], + 10, + '21', + '2026-07-21', + ], + [ + 'LNUI-728', + 'Popover: flip to top when bottom space is insufficient', + 'done', + 3, + 8, + [1], + 7, + '21', + '2026-07-21', + ], + [ + 'LNUI-729', + 'Theme switcher: persist preference and honor system change', + 'done', + 3, + 10, + [2], + 1, + '21', + '2026-07-22', + ], + [ + 'LNUI-730', + 'Slider: snap points with haptic-like visual ticks', + 'done', + 4, + 12, + [2], + 10, + '21', + '2026-07-23', + ], + [ + 'LNUI-731', + 'Docs search: index component prop tables', + 'done', + 3, + 14, + [3], + 3, + '21', + '2026-07-24', + ], + [ + 'LNUI-732', + 'Checkbox: indeterminate propagation for nested lists', + 'done', + 2, + 16, + [2], + 10, + '21', + '2026-07-25', + ], + [ + 'LNUI-733', + 'Reduce icon bundle size with per-icon entrypoints', + 'done', + 2, + 18, + [5], + 5, + '21', + '2026-07-26', + ], + [ + 'LNUI-734', + 'Calendar: highlight today with subtle ring in dark mode', + 'done', + 4, + 1, + [6], + 9, + '21', + '2026-07-27', + ], + // Shipped (2) + [ + 'LNUI-735', + 'Release Empty State component with illustration slots', + 'shipped', + 3, + 3, + [2], + 6, + '21', + '2026-07-28', + ], + [ + 'LNUI-736', + 'Publish v2.4 with tree-shakable exports', + 'shipped', + 1, + 5, + [5, 2], + 5, + '21', + '2026-07-29', + ], + // Canceled (1) + [ + 'LNUI-737', + 'Prototype parallax hero for docs landing', + 'canceled', + 4, + 7, + [6], + 3, + '21', + '2026-07-30', + ], + + /* ------------------------ Cycle 22 (upcoming) ------------------------- */ + [ + 'LNUI-738', + 'Timeline component: draft API and anatomy', + 'to-do', + 2, + 9, + [2, 6], + 6, + '22', + '2026-07-26', + ], + [ + 'LNUI-739', + 'File upload: chunked uploads with resumable state', + 'to-do', + 2, + 11, + [2], + 10, + '22', + '2026-07-27', + ], + [ + 'LNUI-740', + 'Kbd component: platform-aware modifier rendering', + 'to-do', + 4, + 13, + [0], + 0, + '22', + '2026-07-28', + ], + [ + 'LNUI-741', + 'Stepper: validate steps lazily on next', + 'to-do', + 3, + 15, + [10], + 10, + '22', + '2026-07-29', + ], + [ + 'LNUI-742', + 'Density mode: compact spacing scale across components', + 'to-do', + 3, + 17, + [0, 6], + 1, + '22', + '2026-07-30', + ], + [ + 'LNUI-743', + 'Docs: migration guide from v1 tokens to v2 tokens', + 'to-do', + 3, + 19, + [3], + 3, + '22', + '2026-07-31', + ], + [ + 'LNUI-744', + 'Audit Dialog scroll locking on iOS Safari', + 'paused', + 2, + 0, + [1, 8], + 2, + '22', + '2026-07-25', + ], + [ + 'LNUI-745', + 'Benchmark charts rendering vs. canvas fallback', + 'paused', + 3, + 2, + [5], + 4, + '22', + '2026-07-26', + ], + + /* ----------------------- Cycle 20 (completed) ------------------------- */ + [ + 'LNUI-681', + 'Add copy-to-clipboard button to code blocks in docs', + 'done', + 3, + 4, + [3], + 3, + '20', + '2026-07-06', + ], + ['LNUI-682', 'Fix Tabs indicator jump on font load', 'done', 2, 6, [1], 0, '20', '2026-07-07'], + [ + 'LNUI-683', + 'Ship Combobox multi-select with tag input', + 'shipped', + 2, + 8, + [2], + 10, + '20', + '2026-07-09', + ], + [ + 'LNUI-684', + 'Contrast pass on muted foreground colors', + 'done', + 2, + 10, + [8], + 1, + '20', + '2026-07-11', + ], + [ + 'LNUI-685', + 'Table sticky header shadow only when scrolled', + 'done', + 4, + 12, + [0], + 9, + '20', + '2026-07-13', + ], + [ + 'LNUI-686', + 'Deprecate legacy Grid in favor of layout primitives', + 'canceled', + 3, + 14, + [4], + 6, + '20', + '2026-07-15', + ], + [ + 'LNUI-687', + 'Snapshot tests for all Badge permutations', + 'done', + 4, + 16, + [9], + 6, + '20', + '2026-07-17', + ], + + /* ----------------------- Cycle 19 (completed) ------------------------- */ + [ + 'LNUI-661', + 'Rewrite Tooltip docs with do/don’t examples', + 'done', + 3, + 1, + [3], + 7, + '19', + '2026-06-22', + ], + [ + 'LNUI-662', + 'Fix focus ring clipped by overflow-hidden cards', + 'done', + 2, + 3, + [1, 8], + 6, + '19', + '2026-06-24', + ], + ['LNUI-663', 'Ship Sonner-based toast presets', 'shipped', 3, 5, [2], 11, '19', '2026-06-26'], + ['LNUI-664', 'Lazy-load heavy demos on docs pages', 'done', 2, 7, [5], 3, '19', '2026-06-28'], + [ + 'LNUI-665', + 'Select: type-ahead across grouped options', + 'done', + 3, + 9, + [2], + 8, + '19', + '2026-06-30', + ], + [ + 'LNUI-666', + 'Duplicate of LNUI-662 reported from support', + 'duplicate', + 0, + null, + [1], + 6, + '19', + '2026-07-01', + ], + ['LNUI-667', 'Storybook a11y addon in CI', 'done', 2, 11, [9, 8], 6, '19', '2026-07-03'], + + /* ----------------------- Cycle 18 (completed) ------------------------- */ + [ + 'LNUI-641', + 'Fix Sheet drag-to-close threshold on touch', + 'done', + 2, + 13, + [1], + 2, + '18', + '2026-06-08', + ], + ['LNUI-642', 'Add Input OTP component', 'shipped', 2, 15, [2], 10, '18', '2026-06-10'], + [ + 'LNUI-643', + 'Prevent layout shift when scrollbar appears with Dialog', + 'done', + 2, + 17, + [1], + 2, + '18', + '2026-06-12', + ], + [ + 'LNUI-644', + 'Document controlled vs uncontrolled patterns', + 'done', + 3, + 19, + [3], + 3, + '18', + '2026-06-14', + ], + [ + 'LNUI-645', + 'Spike: CSS anchor positioning for popovers', + 'canceled', + 4, + 0, + [4], + 7, + '18', + '2026-06-16', + ], + [ + 'LNUI-646', + 'Refactor Avatar to support fallback delays', + 'done', + 4, + 2, + [4], + 6, + '18', + '2026-06-18', + ], + + /* ----------------------- Cycle 17 (completed) ------------------------- */ + [ + 'LNUI-621', + 'Dark mode: fix border contrast on nested cards', + 'done', + 3, + 4, + [1, 6], + 1, + '17', + '2026-05-25', + ], + ['LNUI-622', 'Ship Pagination compound component', 'shipped', 2, 6, [2], 9, '17', '2026-05-27'], + [ + 'LNUI-623', + 'Add usage analytics to docs code copy events', + 'done', + 4, + 8, + [3], + 3, + '17', + '2026-05-29', + ], + ['LNUI-624', 'Textarea: autosize with max rows', 'done', 3, 10, [2], 10, '17', '2026-06-01'], + [ + 'LNUI-625', + 'Fix Menubar closing when moving across triggers', + 'done', + 2, + 12, + [1], + 8, + '17', + '2026-06-03', + ], + [ + 'LNUI-626', + 'Explore Houdini paint worklet for gradients', + 'canceled', + 4, + 14, + [4], + 1, + '17', + '2026-06-05', + ], + + /* ----------------------- Cycle 16 (completed) ------------------------- */ + [ + 'LNUI-601', + 'Set up visual regression tests with Playwright', + 'done', + 2, + 16, + [9], + 6, + '16', + '2026-05-11', + ], + [ + 'LNUI-602', + 'Fix Tooltip flicker when trigger re-renders', + 'done', + 2, + 18, + [1], + 7, + '16', + '2026-05-13', + ], + [ + 'LNUI-603', + 'Ship Scroll Area with custom scrollbar styling', + 'shipped', + 3, + 1, + [2], + 0, + '16', + '2026-05-15', + ], + [ + 'LNUI-604', + 'Normalize z-index scale across overlays', + 'done', + 2, + 3, + [4], + 2, + '16', + '2026-05-17', + ], + [ + 'LNUI-605', + 'Add French and Spanish docs translations', + 'done', + 4, + 5, + [10], + 3, + '16', + '2026-05-19', + ], + + /* --------------------------- Backlog stock ---------------------------- */ + [ + 'LNUI-801', + 'Explore container queries for responsive Card', + 'backlog', + 3, + null, + [0], + 6, + '', + '2026-06-02', + ], + [ + 'LNUI-802', + 'Tree view component with async children', + 'backlog', + 3, + null, + [2], + 6, + '', + '2026-06-05', + ], + [ + 'LNUI-803', + 'Color picker: eyedropper API integration', + 'backlog', + 4, + null, + [2], + 10, + '', + '2026-06-09', + ], + [ + 'LNUI-804', + 'Rich text editor primitives exploration', + 'backlog', + 3, + null, + [2, 4], + null, + '', + '2026-06-12', + ], + [ + 'LNUI-805', + 'Drag handle affordance for sortable lists', + 'backlog', + 4, + null, + [0], + 9, + '', + '2026-06-15', + ], + ['LNUI-806', 'Print stylesheet for docs pages', 'backlog', 4, null, [3], 3, '', '2026-06-18'], + ['LNUI-807', 'High-contrast theme preset', 'backlog', 3, null, [8, 6], 1, '', '2026-06-21'], + [ + 'LNUI-808', + 'Skeleton auto-generation from component slots', + 'backlog', + 4, + null, + [4], + 6, + '', + '2026-06-24', + ], + ['LNUI-809', 'Masonry layout primitive', 'backlog', 4, null, [2], 4, '', '2026-06-27'], + [ + 'LNUI-810', + 'Investigate React Compiler compatibility', + 'backlog', + 2, + null, + [5, 9], + 5, + '', + '2026-06-30', + ], + [ + 'LNUI-811', + 'Currency input with min/max and formatting', + 'backlog', + 3, + null, + [10], + 10, + '', + '2026-07-03', + ], + [ + 'LNUI-812', + 'Docs: add keyboard shortcuts cheat sheet', + 'backlog', + 4, + null, + [3], + 3, + '', + '2026-07-06', + ], + [ + 'LNUI-813', + 'Idea: AI-assisted theme generator from a brand color', + 'idea', + 0, + null, + [6], + 1, + '', + '2026-07-08', + ], + [ + 'LNUI-814', + 'Idea: Figma plugin exporting tokens to CSS variables', + 'idea', + 0, + null, + [6, 2], + 1, + '', + '2026-07-10', + ], + [ + 'LNUI-815', + 'Idea: playground sharing via URL snapshots', + 'idea', + 0, + null, + [3], + 3, + '', + '2026-07-12', + ], + [ + 'LNUI-816', + 'Idea: motion presets pack (spring, snappy, gentle)', + 'idea', + 0, + null, + [2], + 0, + '', + '2026-07-14', + ], + [ + 'LNUI-817', + 'Idea: CLI codemod for breaking changes', + 'idea', + 0, + null, + [5], + 5, + '', + '2026-07-16', + ], + ['LNUI-818', 'Idea: docs dark-mode illustrations', 'idea', 0, null, [6], 3, '', '2026-07-18'], + [ + 'LNUI-819', + 'Report: Combobox crashes with empty option groups', + 'triage', + 1, + null, + [1], + 8, + '', + '2026-07-29', + ], + [ + 'LNUI-820', + 'Report: Table header wraps awkwardly in Safari 17', + 'triage', + 0, + null, + [1], + 9, + '', + '2026-07-30', + ], + [ + 'LNUI-821', + 'Request: expose Tooltip open delay as prop', + 'triage', + 0, + null, + [0], + 7, + '', + '2026-07-31', + ], +]; + +/* -------------------------------------------------------------------------- */ +/* Ranks */ +/* -------------------------------------------------------------------------- */ + +// Generates issue ranks using the LexoRank algorithm. export const ranks: string[] = []; const generateIssuesRanks = () => { const firstRank = new LexoRank('a3c'); ranks.push(firstRank.toString()); - for (let i = 1; i < 30; i++) { + for (let i = 1; i < seeds.length + 20; i++) { const previousRank = LexoRank.from(ranks[i - 1]); - const currentRank = previousRank.increment(); - ranks.push(currentRank.toString()); + ranks.push(previousRank.increment().toString()); } }; generateIssuesRanks(); -export const issues: Issue[] = [ - { - id: '1', - identifier: 'LNUI-101', - title: 'Refactor Button component for full accessibility compliance', +/* -------------------------------------------------------------------------- */ +/* Issues */ +/* -------------------------------------------------------------------------- */ + +export const issues: Issue[] = seeds.map((seed, index) => { + const [ + identifier, + title, + statusId, + priorityIdx, + assigneeIdx, + labelIdxs, + projectIdx, + cycleId, + createdAt, + dueDate, + ] = seed; + + return { + id: String(index + 1), + identifier, + title, description: '', - status: status[5], - priority: priorities[2], - assignee: users[0], - labels: [labels[0]], - createdAt: '2025-03-08', - cycleId: '42', - project: projects[0], - rank: ranks[0], - }, - { - id: '2', - identifier: 'LNUI-204', - title: 'Optimize animations for smoother UI transitions', - description: '', - status: status[2], - priority: priorities[1], - assignee: users[1], - labels: [labels[1]], - createdAt: '2025-03-12', - cycleId: '42', - subissues: ['1', '3'], - rank: ranks[1], - }, - { - id: '3', - identifier: 'LNUI-309', - title: 'Implement dark mode toggle with system preferences support', - description: '', - status: status[3], - priority: priorities[1], - assignee: users[1], - labels: [labels[2]], - createdAt: '2025-03-14', - cycleId: '42', - project: projects[1], - rank: ranks[2], - }, - { - id: '4', - identifier: 'LNUI-415', - title: 'Design new modal system with focus trapping', - description: '', - status: status[1], - priority: priorities[2], - assignee: users[3], - labels: [labels[3]], - createdAt: '2025-03-09', - cycleId: '42', - project: projects[2], - rank: ranks[3], - }, - { - id: '5', - identifier: 'LNUI-501', - title: 'Enhance responsiveness of Navbar', - description: '', - status: status[1], - priority: priorities[3], - assignee: users[0], - labels: [labels[4]], - createdAt: '2025-03-10', - cycleId: '42', - project: projects[4], - subissues: ['8', '9'], - rank: ranks[4], - }, - { - id: '6', - identifier: 'LNUI-502', - title: 'Optimize loading time of Footer', - description: '', - status: status[2], - priority: priorities[0], - assignee: users[0], - labels: [labels[5]], - createdAt: '2025-03-11', - cycleId: '42', - project: projects[5], - rank: ranks[5], - }, - { - id: '7', - identifier: 'LNUI-503', - title: 'Refactor Sidebar for better accessibility', - description: '', - status: status[3], - priority: priorities[1], - assignee: users[2], - labels: [labels[6]], - createdAt: '2025-03-12', - cycleId: '42', - project: projects[5], - rank: ranks[6], - }, - { - id: '8', - identifier: 'LNUI-504', - title: 'Implement new Card component design', - description: '', - status: status[4], - priority: priorities[3], - assignee: users[3], - labels: [labels[7]], - createdAt: '2025-03-13', - cycleId: '42', - project: projects[6], - rank: ranks[7], - }, - { - id: '9', - identifier: 'LNUI-505', - title: 'Improve Tooltip interactivity', - description: '', - status: status[1], - priority: priorities[2], - assignee: users[2], - labels: [labels[8]], - createdAt: '2025-03-14', - cycleId: '42', - project: projects[6], - rank: ranks[8], - }, - { - id: '10', - identifier: 'LNUI-506', - title: 'Redesign Dropdown for mobile devices', - description: '', - status: status[2], - priority: priorities[1], - assignee: users[1], - labels: [labels[9]], - createdAt: '2025-03-15', - cycleId: '42', - project: projects[7], - rank: ranks[9], - }, - { - id: '11', - identifier: 'LNUI-507', - title: 'Fix Form validation issues', - description: '', - status: status[3], - priority: priorities[1], - assignee: null, - labels: [labels[10]], - createdAt: '2025-03-16', - cycleId: '42', - project: projects[7], - rank: ranks[10], - }, - { - id: '12', - identifier: 'LNUI-508', - title: 'Update Modal animations', - description: '', - status: status[0], - priority: priorities[2], - assignee: users[1], - labels: [labels[9]], - createdAt: '2025-03-17', - cycleId: '42', - project: projects[8], - rank: ranks[11], - }, - { - id: '13', - identifier: 'LNUI-509', - title: 'Revamp Button states and interactions', - description: '', - status: status[5], - priority: priorities[1], - assignee: users[1], - labels: [labels[3]], - createdAt: '2025-03-18', - cycleId: '42', - project: projects[8], - rank: ranks[12], - }, - { - id: '14', - identifier: 'LNUI-510', - title: 'Streamline Input component styling', - description: '', - status: status[2], - priority: priorities[2], - assignee: users[2], - labels: [labels[9]], - createdAt: '2025-03-19', - cycleId: '42', - project: projects[9], - rank: ranks[13], - }, - { - id: '15', - identifier: 'LNUI-511', - title: 'Integrate new Select component behavior', - description: '', - status: status[3], - priority: priorities[1], - assignee: users[0], - labels: [labels[4]], - createdAt: '2025-03-20', - cycleId: '42', - project: projects[9], - rank: ranks[14], - }, - { - id: '16', - identifier: 'LNUI-512', - title: 'Enhance Breadcrumb navigation usability', - description: '', - status: status[0], - priority: priorities[3], - assignee: users[0], - labels: [labels[5]], - createdAt: '2025-03-21', - cycleId: '42', - project: projects[9], - rank: ranks[15], - }, - { - id: '17', - identifier: 'LNUI-513', - title: 'Refactor Accordion for smoother transitions', - description: '', - status: status[1], - priority: priorities[2], - assignee: null, - labels: [labels[3]], - createdAt: '2025-03-22', - cycleId: '42', - project: projects[0], - rank: ranks[16], - }, - { - id: '18', - identifier: 'LNUI-514', - title: 'Implement Carousel with lazy loading', - description: '', - status: status[2], - priority: priorities[1], - assignee: users[1], - labels: [labels[6]], - createdAt: '2025-03-23', - cycleId: '42', - project: projects[0], - rank: ranks[17], - }, - { - id: '19', - identifier: 'LNUI-515', - title: 'Optimize Grid layout for responsive design', - description: '', - status: status[3], - priority: priorities[2], - assignee: null, - labels: [labels[7]], - createdAt: '2025-03-24', - cycleId: '42', - project: projects[0], - rank: ranks[18], - }, - { - id: '20', - identifier: 'LNUI-516', - title: 'Update Typography system for clarity', - description: '', - status: status[4], - priority: priorities[3], - assignee: users[3], - labels: [labels[5]], - createdAt: '2025-03-25', - cycleId: '42', - project: projects[0], - rank: ranks[19], - }, - { - id: '21', - identifier: 'LNUI-517', - title: 'Improve Color scheme consistency', - description: '', - status: status[1], - priority: priorities[0], - assignee: users[0], - labels: [labels[5]], - createdAt: '2025-03-26', - cycleId: '42', - project: projects[1], - rank: ranks[20], - }, - { - id: '22', - identifier: 'LNUI-518', - title: 'Design new Icon set for better scalability', - description: '', - status: status[2], - priority: priorities[1], - assignee: users[0], - labels: [labels[5]], - createdAt: '2025-03-27', - cycleId: '42', - project: projects[1], - rank: ranks[21], - }, - { - id: '23', - identifier: 'LNUI-519', - title: 'Fix Notification system timing', - description: '', - status: status[3], - priority: priorities[2], - assignee: users[2], - labels: [labels[8]], - createdAt: '2025-03-28', - cycleId: '42', - project: projects[4], - rank: ranks[22], - }, - { - id: '24', - identifier: 'LNUI-520', - title: 'Enhance Loading indicator performance', - description: '', - status: status[0], - priority: priorities[1], - assignee: users[3], - labels: [labels[9]], - createdAt: '2025-03-29', - cycleId: '42', - project: projects[3], - rank: ranks[23], - }, - { - id: '25', - identifier: 'LNUI-521', - title: 'Refactor Progress bar animations', - description: '', - status: status[5], - priority: priorities[2], - assignee: users[3], - labels: [labels[6]], - createdAt: '2025-03-30', - cycleId: '42', - project: projects[3], - rank: ranks[24], - }, - { - id: '26', - identifier: 'LNUI-522', - title: 'Optimize Table component sorting', - description: '', - status: status[2], - priority: priorities[3], - assignee: users[1], - labels: [labels[7]], - createdAt: '2025-03-31', - cycleId: '42', - project: projects[6], - rank: ranks[25], - }, - { - id: '27', - identifier: 'LNUI-523', - title: 'Improve Pagination logic', - description: '', - status: status[3], - priority: priorities[0], - assignee: users[0], - labels: [labels[8]], - createdAt: '2025-04-01', - cycleId: '42', - project: projects[6], - rank: ranks[26], - }, - { - id: '28', - identifier: 'LNUI-524', - title: 'Implement Search bar with auto-complete', - description: '', - status: status[0], - priority: priorities[1], - assignee: users[3], - labels: [labels[5]], - createdAt: '2025-04-02', - cycleId: '42', - project: projects[5], - rank: ranks[27], - }, - { - id: '29', - identifier: 'LNUI-525', - title: 'Update Alert system for critical notifications', - description: '', - status: status[1], - priority: priorities[2], - assignee: null, - labels: [labels[9]], - createdAt: '2025-04-03', - cycleId: '42', - project: projects[5], - rank: ranks[28], - }, - { - id: '30', - identifier: 'LNUI-526', - title: 'Revise Overlay for better usability', - description: '', - status: status[2], - priority: priorities[3], - assignee: users[3], - labels: [labels[8]], - createdAt: '2025-04-04', - cycleId: '42', - project: projects[1], - rank: ranks[29], - }, -]; + status: statusById(statusId), + priority: priorities[priorityIdx], + assignee: assigneeIdx === null ? null : (users[assigneeIdx] ?? null), + labels: labelIdxs.map((i) => labels[i]).filter(Boolean), + project: projectIdx === null ? undefined : projects[projectIdx], + cycleId, + createdAt, + rank: ranks[index], + ...(dueDate ? { dueDate } : {}), + }; +}); + +/* -------------------------------------------------------------------------- */ +/* Helpers */ +/* -------------------------------------------------------------------------- */ export function groupIssuesByStatus(issues: Issue[]): Record { return issues.reduce>((acc, issue) => { @@ -490,3 +1125,14 @@ export function sortIssuesByPriority(issues: Issue[]): Issue[] { priorityOrder[b.priority.id as keyof typeof priorityOrder] ); } + +export function filterIssuesByCycle(allIssues: Issue[], cycleId: string): Issue[] { + return allIssues.filter((issue) => issue.cycleId === cycleId); +} + +export function filterIssuesByCategories( + allIssues: Issue[], + categories: StatusCategory[] +): Issue[] { + return allIssues.filter((issue) => categories.includes(issue.status.category)); +} diff --git a/mock-data/status.tsx b/mock-data/status.tsx index 5c3ad57..01c6ae6 100644 --- a/mock-data/status.tsx +++ b/mock-data/status.tsx @@ -1,195 +1,228 @@ import React from 'react'; +/** + * Status categories, used to build the "Active" / "Backlog" views, + * to order statuses in a workflow-friendly way and to compute + * progress (completed vs remaining) in cycles. + */ +export type StatusCategory = + | 'triage' + | 'backlog' + | 'unstarted' + | 'started' + | 'completed' + | 'canceled'; + export interface Status { id: string; name: string; color: string; + category: StatusCategory; icon: React.FC; } -export const BacklogIcon: React.FC = () => { +/* -------------------------------------------------------------------------- */ +/* Generic icon builders */ +/* -------------------------------------------------------------------------- */ + +/** + * Dashed gear icon (used by "Idea" and "Backlog" — Linear style). + */ +const GEAR_PATH = + 'M13.9408 7.91426L11.9576 7.65557C11.9855 7.4419 12 7.22314 12 7C12 6.77686 11.9855 6.5581 11.9576 6.34443L13.9408 6.08573C13.9799 6.38496 14 6.69013 14 7C14 7.30987 13.9799 7.61504 13.9408 7.91426ZM13.4688 4.32049C13.2328 3.7514 12.9239 3.22019 12.5538 2.73851L10.968 3.95716C11.2328 4.30185 11.4533 4.68119 11.6214 5.08659L13.4688 4.32049ZM11.2615 1.4462L10.0428 3.03204C9.69815 2.76716 9.31881 2.54673 8.91341 2.37862L9.67951 0.531163C10.2486 0.767153 10.7798 1.07605 11.2615 1.4462ZM7.91426 0.0591659L7.65557 2.04237C7.4419 2.01449 7.22314 2 7 2C6.77686 2 6.5581 2.01449 6.34443 2.04237L6.08574 0.059166C6.38496 0.0201343 6.69013 0 7 0C7.30987 0 7.61504 0.0201343 7.91426 0.0591659ZM4.32049 0.531164L5.08659 2.37862C4.68119 2.54673 4.30185 2.76716 3.95716 3.03204L2.73851 1.4462C3.22019 1.07605 3.7514 0.767153 4.32049 0.531164ZM1.4462 2.73851L3.03204 3.95716C2.76716 4.30185 2.54673 4.68119 2.37862 5.08659L0.531164 4.32049C0.767153 3.7514 1.07605 3.22019 1.4462 2.73851ZM0.0591659 6.08574C0.0201343 6.38496 0 6.69013 0 7C0 7.30987 0.0201343 7.61504 0.059166 7.91426L2.04237 7.65557C2.01449 7.4419 2 7.22314 2 7C2 6.77686 2.01449 6.5581 2.04237 6.34443L0.0591659 6.08574ZM0.531164 9.67951L2.37862 8.91341C2.54673 9.31881 2.76716 9.69815 3.03204 10.0428L1.4462 11.2615C1.07605 10.7798 0.767153 10.2486 0.531164 9.67951ZM2.73851 12.5538L3.95716 10.968C4.30185 11.2328 4.68119 11.4533 5.08659 11.6214L4.32049 13.4688C3.7514 13.2328 3.22019 12.9239 2.73851 12.5538ZM6.08574 13.9408L6.34443 11.9576C6.5581 11.9855 6.77686 12 7 12C7.22314 12 7.4419 11.9855 7.65557 11.9576L7.91427 13.9408C7.61504 13.9799 7.30987 14 7 14C6.69013 14 6.38496 13.9799 6.08574 13.9408ZM9.67951 13.4688L8.91341 11.6214C9.31881 11.4533 9.69815 11.2328 10.0428 10.968L11.2615 12.5538C10.7798 12.9239 10.2486 13.2328 9.67951 13.4688ZM12.5538 11.2615L10.968 10.0428C11.2328 9.69815 11.4533 9.31881 11.6214 8.91341L13.4688 9.67951C13.2328 10.2486 12.924 10.7798 12.5538 11.2615Z'; + +export const StatusGearIcon: React.FC<{ color: string }> = ({ color }) => ( + + + +); + +/** + * Partially-filled circle ("pie") icon used for unstarted / started statuses. + * `fraction` is the filled portion of the inner pie (0 → empty, 1 → full). + */ +export const StatusPieIcon: React.FC<{ color: string; fraction: number }> = ({ + color, + fraction, +}) => { + const clamped = Math.max(0, Math.min(fraction, 0.9999)); + const angle = clamped * 2 * Math.PI; + const x = 3.5 + 3.5 * Math.sin(angle); + const y = 3.5 - 3.5 * Math.cos(angle); + const largeArc = clamped > 0.5 ? 1 : 0; + return ( - - - + + + {clamped > 0 && ( + + )} ); }; -export const PausedIcon: React.FC = () => { - return ( - - - - - ); -}; +/** + * Filled circle with a check mark (used by "Done" and "Shipped"). + */ +export const StatusCheckIcon: React.FC<{ color: string }> = ({ color }) => ( + + + +); -export const ToDoIcon: React.FC = () => { - return ( - - - - - ); -}; +/** + * Filled circle with an X (used by "Canceled"). + */ +export const StatusXIcon: React.FC<{ color: string }> = ({ color }) => ( + + + +); -export const InProgressIcon: React.FC = () => { - return ( - - - - - ); -}; +/** + * Filled circle with a "slash equal" mark (used by "Duplicate"). + */ +export const StatusDuplicateIcon: React.FC<{ color: string }> = ({ color }) => ( + + + +); -export const TechnicalReviewIcon: React.FC = () => { - return ( - - - - - ); -}; +/** + * Triage icon (filled circle with opposite arrows). + */ +export const StatusTriageIcon: React.FC<{ color: string }> = ({ color }) => ( + + + +); -export const CompletedIcon: React.FC = () => { - return ( - - - - - ); -}; +/* -------------------------------------------------------------------------- */ +/* Status definitions */ +/* -------------------------------------------------------------------------- */ +export const InProgressIcon: React.FC = () => ; +export const TechnicalReviewIcon: React.FC = () => ; +export const DoneIcon: React.FC = () => ; +export const PausedIcon: React.FC = () => ; +export const ToDoIcon: React.FC = () => ; +export const BacklogIcon: React.FC = () => ; +export const TriageIcon: React.FC = () => ; +export const IdeaIcon: React.FC = () => ; +export const ProductFeedbackIcon: React.FC = () => ; +export const BlockedIcon: React.FC = () => ; +export const ShippedIcon: React.FC = () => ; +export const CanceledIcon: React.FC = () => ; +export const DuplicateIcon: React.FC = () => ; + +/** + * All workflow statuses. + * + * NOTE: the first six entries keep the same indexes as the historical + * status list (in-progress, technical-review, done, paused, to-do, backlog) + * so mock data referencing `status[0..5]` keeps working. + */ export const status: Status[] = [ - { id: 'in-progress', name: 'In Progress', color: '#facc15', icon: InProgressIcon }, + { + id: 'in-progress', + name: 'In Progress', + color: '#facc15', + category: 'started', + icon: InProgressIcon, + }, { id: 'technical-review', name: 'Technical Review', color: '#22c55e', + category: 'started', icon: TechnicalReviewIcon, }, - { id: 'completed', name: 'Completed', color: '#8b5cf6', icon: CompletedIcon }, - { id: 'paused', name: 'Paused', color: '#0ea5e9', icon: PausedIcon }, - { id: 'to-do', name: 'Todo', color: '#f97316', icon: ToDoIcon }, - { id: 'backlog', name: 'Backlog', color: '#ec4899', icon: BacklogIcon }, + { id: 'done', name: 'Done', color: '#5e6ad2', category: 'completed', icon: DoneIcon }, + { id: 'paused', name: 'Paused', color: '#26b5ce', category: 'started', icon: PausedIcon }, + { id: 'to-do', name: 'Todo', color: '#99a2b2', category: 'unstarted', icon: ToDoIcon }, + { id: 'backlog', name: 'Backlog', color: '#95a2b3', category: 'backlog', icon: BacklogIcon }, + { id: 'triage', name: 'Triage', color: '#f2790f', category: 'triage', icon: TriageIcon }, + { id: 'idea', name: 'Idea', color: '#5e6ad2', category: 'backlog', icon: IdeaIcon }, + { + id: 'product-feedback', + name: 'Product Feedback', + color: '#f2994a', + category: 'started', + icon: ProductFeedbackIcon, + }, + { id: 'blocked', name: 'Blocked', color: '#eb5757', category: 'started', icon: BlockedIcon }, + { id: 'shipped', name: 'Shipped', color: '#4cb782', category: 'completed', icon: ShippedIcon }, + { id: 'canceled', name: 'Canceled', color: '#95a2b3', category: 'canceled', icon: CanceledIcon }, + { + id: 'duplicate', + name: 'Duplicate', + color: '#95a2b3', + category: 'canceled', + icon: DuplicateIcon, + }, ]; +/** + * Workflow ordering (triage → backlog → unstarted → started → completed → canceled), + * used by the insights table. + */ +const CATEGORY_ORDER: Record = { + triage: 0, + backlog: 1, + unstarted: 2, + started: 3, + completed: 4, + canceled: 5, +}; + +/** Display order used by grouped issue views (started statuses first, Linear-like). */ +const DISPLAY_CATEGORY_ORDER: Record = { + started: 0, + unstarted: 1, + triage: 2, + backlog: 3, + completed: 4, + canceled: 5, +}; + +export const workflowOrderedStatus: Status[] = [...status].sort( + (a, b) => + CATEGORY_ORDER[a.category] - CATEGORY_ORDER[b.category] || + status.indexOf(a) - status.indexOf(b) +); + +export const displayOrderedStatus: Status[] = [...status].sort( + (a, b) => + DISPLAY_CATEGORY_ORDER[a.category] - DISPLAY_CATEGORY_ORDER[b.category] || + status.indexOf(a) - status.indexOf(b) +); + +export function getStatusesByCategory(categories: StatusCategory[]): Status[] { + return displayOrderedStatus.filter((s) => categories.includes(s.category)); +} + export const StatusIcon: React.FC<{ statusId: string }> = ({ statusId }) => { const currentStatus = status.find((s) => s.id === statusId); if (!currentStatus) return null; From 7cdf1a39e23c7e5fd2c9738430f488f9128660fb Mon Sep 17 00:00:00 2001 From: ln-dev7 Date: Sat, 1 Aug 2026 13:37:23 +0000 Subject: [PATCH 04/75] feat(cycles): cycles timeline page with burn-up chart and sidebar links --- app/[orgId]/team/[teamId]/cycles/page.tsx | 11 ++ components/common/cycles/capacity-ring.tsx | 50 +++++ .../common/cycles/cycle-burnup-chart.tsx | 175 ++++++++++++++++++ components/common/cycles/cycle-line.tsx | 94 ++++++++++ components/common/cycles/cycles.tsx | 60 ++++++ .../layout/headers/cycles/header-nav.tsx | 32 ++++ components/layout/headers/cycles/header.tsx | 5 + components/layout/sidebar/nav-teams.tsx | 29 ++- 8 files changed, 454 insertions(+), 2 deletions(-) create mode 100644 app/[orgId]/team/[teamId]/cycles/page.tsx create mode 100644 components/common/cycles/capacity-ring.tsx create mode 100644 components/common/cycles/cycle-burnup-chart.tsx create mode 100644 components/common/cycles/cycle-line.tsx create mode 100644 components/common/cycles/cycles.tsx create mode 100644 components/layout/headers/cycles/header-nav.tsx create mode 100644 components/layout/headers/cycles/header.tsx diff --git a/app/[orgId]/team/[teamId]/cycles/page.tsx b/app/[orgId]/team/[teamId]/cycles/page.tsx new file mode 100644 index 0000000..a4cc0a3 --- /dev/null +++ b/app/[orgId]/team/[teamId]/cycles/page.tsx @@ -0,0 +1,11 @@ +import Cycles from '@/components/common/cycles/cycles'; +import Header from '@/components/layout/headers/cycles/header'; +import MainLayout from '@/components/layout/main-layout'; + +export default function CyclesPage() { + return ( + } headersNumber={1}> + + + ); +} diff --git a/components/common/cycles/capacity-ring.tsx b/components/common/cycles/capacity-ring.tsx new file mode 100644 index 0000000..99b9df4 --- /dev/null +++ b/components/common/cycles/capacity-ring.tsx @@ -0,0 +1,50 @@ +'use client'; + +interface CapacityRingProps { + /** 0 → 100 */ + value: number; + size?: number; + color?: string; + trackColor?: string; +} + +/** + * Small circular progress indicator, used for cycle capacity and + * per-assignee completion in the cycle details panel. + */ +export function CapacityRing({ + value, + size = 16, + color = '#5e6ad2', + trackColor = 'var(--border)', +}: CapacityRingProps) { + const clamped = Math.max(0, Math.min(value, 100)); + const radius = 6; + const circumference = 2 * Math.PI * radius; + const offset = circumference * (1 - clamped / 100); + + return ( + + + + + ); +} diff --git a/components/common/cycles/cycle-burnup-chart.tsx b/components/common/cycles/cycle-burnup-chart.tsx new file mode 100644 index 0000000..5354f5f --- /dev/null +++ b/components/common/cycles/cycle-burnup-chart.tsx @@ -0,0 +1,175 @@ +'use client'; + +import { Cycle } from '@/mock-data/cycles'; +import { format, parseISO } from 'date-fns'; +import { + Area, + CartesianGrid, + ComposedChart, + Line, + ResponsiveContainer, + Tooltip, + XAxis, + YAxis, +} from 'recharts'; + +const COLORS = { + scope: '#8f9299', + started: '#facc15', + completed: '#6771c5', + ideal: '#6771c5', +}; + +interface CycleBurnupChartProps { + cycle: Cycle; + height?: number; + /** Compact mode hides axes details (used inside the details panel). */ + compact?: boolean; +} + +/** + * Linear-style burn-up chart: gray scope line, yellow started line, + * indigo completed area and a dashed ideal line. + */ +export function CycleBurnupChart({ cycle, height = 210, compact = false }: CycleBurnupChartProps) { + const data = cycle.burnup ?? []; + + if (data.length === 0) { + return ( +
+ No progress data yet +
+ ); + } + + const first = data[0].date; + const middle = data[Math.floor(data.length / 2)].date; + const last = data[data.length - 1].date; + + return ( + + + + + + + + + + format(parseISO(value), 'MMM d')} + tick={{ fontSize: 11, fill: 'currentColor', opacity: 0.6 }} + axisLine={false} + tickLine={false} + /> + + format(parseISO(String(value)), 'MMM d')} + /> + + + + + + + ); +} + +export function CycleProgressLegend({ cycle }: { cycle: Cycle }) { + const completedPercent = cycle.scope > 0 ? Math.round((cycle.completed / cycle.scope) * 100) : 0; + const startedPercent = cycle.scope > 0 ? Math.round((cycle.started / cycle.scope) * 100) : 0; + + const rows = [ + { + key: 'scope', + label: 'Scope', + swatch: COLORS.scope, + value: cycle.scope, + extra: cycle.scopeDelta !== 0 ? `+${cycle.scopeDelta}%` : undefined, + extraClass: 'text-red-500', + }, + { + key: 'started', + label: 'Started', + swatch: COLORS.started, + value: cycle.started, + extra: `${startedPercent}%`, + extraClass: 'text-muted-foreground', + }, + { + key: 'completed', + label: 'Completed', + swatch: COLORS.completed, + value: cycle.completed, + extra: `${completedPercent}%`, + extraClass: 'text-muted-foreground', + }, + ]; + + return ( +
+ {rows.map((row) => ( +
+
+
+
+ {row.value} + {row.extra && • {row.extra}} +
+
+ ))} +
+ ); +} diff --git a/components/common/cycles/cycle-line.tsx b/components/common/cycles/cycle-line.tsx new file mode 100644 index 0000000..99faabb --- /dev/null +++ b/components/common/cycles/cycle-line.tsx @@ -0,0 +1,94 @@ +'use client'; + +import { Cycle, cycleStatusLabel } from '@/mock-data/cycles'; +import { cn } from '@/lib/utils'; +import Link from 'next/link'; +import { useParams } from 'next/navigation'; +import { CapacityRing } from './capacity-ring'; + +export function CyclePlayIcon({ className }: { className?: string }) { + return ( + + + + + ); +} + +interface CycleLineProps { + cycle: Cycle; +} + +/** + * One row of the cycles timeline. Current / upcoming cycles link to their + * dedicated issue views ("/cycle/active" and "/cycle/upcoming"). + */ +export default function CycleLine({ cycle }: CycleLineProps) { + const { orgId, teamId } = useParams<{ orgId: string; teamId: string }>(); + + const href = + cycle.status === 'current' + ? `/${orgId}/team/${teamId}/cycle/active` + : cycle.status === 'upcoming' + ? `/${orgId}/team/${teamId}/cycle/upcoming` + : undefined; + + const content = ( +
+
+ + {cycle.name} +
+ +
+ + {cycleStatusLabel[cycle.status]} + + + {cycle.status === 'completed' ? ( + <> +
+ + + {cycle.successRate ?? 0}%{' '} + success + +
+ + {cycle.completed} completed + + + ) : ( +
+ + + {cycle.capacity}% of capacity + +
+ )} + + + {cycle.scope} scope + +
+
+ ); + + if (href) { + return ( + + {content} + + ); + } + + return content; +} diff --git a/components/common/cycles/cycles.tsx b/components/common/cycles/cycles.tsx new file mode 100644 index 0000000..a5d751e --- /dev/null +++ b/components/common/cycles/cycles.tsx @@ -0,0 +1,60 @@ +'use client'; + +import { cycles } from '@/mock-data/cycles'; +import { format, parseISO } from 'date-fns'; +import { Fragment } from 'react'; +import CycleLine from './cycle-line'; +import { CycleBurnupChart, CycleProgressLegend } from './cycle-burnup-chart'; + +/** + * Cycles timeline: a date rail on the left and one row per cycle, + * newest first. The current cycle is expanded with its burn-up chart. + */ +export default function Cycles() { + return ( +
+ {cycles.map((cycle) => ( + +
+ {/* Date rail */} +
+ {/* Vertical rail, centered on the dots (pr-4 = 16px + half dot 5px - half line) */} +
+
+ + {format(parseISO(cycle.startDate), 'MMM')} +
+ {format(parseISO(cycle.startDate), 'd')} +
+ +
+
+ + {/* Cycle row + expanded chart for the current cycle */} +
+ + + {cycle.status === 'current' && ( +
+
+ +
+
+ +
+
+ )} +
+
+ + ))} +
+ ); +} diff --git a/components/layout/headers/cycles/header-nav.tsx b/components/layout/headers/cycles/header-nav.tsx new file mode 100644 index 0000000..09292d0 --- /dev/null +++ b/components/layout/headers/cycles/header-nav.tsx @@ -0,0 +1,32 @@ +'use client'; + +import { SidebarTrigger } from '@/components/ui/sidebar'; +import { teams } from '@/mock-data/teams'; +import { ChevronRight, Star } from 'lucide-react'; +import Link from 'next/link'; +import { useParams } from 'next/navigation'; + +export default function HeaderNav() { + const { orgId, teamId } = useParams<{ orgId: string; teamId: string }>(); + const team = teams.find((t) => t.id === teamId) ?? teams[0]; + + return ( +
+
+ + +
+ {team.icon} +
+ {team.name} + + + Cycles + +
+
+ ); +} diff --git a/components/layout/headers/cycles/header.tsx b/components/layout/headers/cycles/header.tsx new file mode 100644 index 0000000..51af44b --- /dev/null +++ b/components/layout/headers/cycles/header.tsx @@ -0,0 +1,5 @@ +import HeaderNav from './header-nav'; + +export default function Header() { + return ; +} diff --git a/components/layout/sidebar/nav-teams.tsx b/components/layout/sidebar/nav-teams.tsx index 9275169..1443511 100644 --- a/components/layout/sidebar/nav-teams.tsx +++ b/components/layout/sidebar/nav-teams.tsx @@ -6,6 +6,7 @@ import { Box, ChevronRight, CopyMinus, + Home, Layers, Link as LinkIcon, MoreHorizontal, @@ -101,7 +102,15 @@ export function NavTeams() { - + + + Home + + + + + + Issues @@ -109,11 +118,27 @@ export function NavTeams() { - + Cycles + + + + + Current + + + + + + + Upcoming + + + + From 3b39a72d7635495ad8fef4664df46edd2b0c406e Mon Sep 17 00:00:00 2001 From: ln-dev7 Date: Sat, 1 Aug 2026 13:37:39 +0000 Subject: [PATCH 05/75] feat(cycles): active and upcoming cycle views with details and insights panels --- .../team/[teamId]/cycle/active/page.tsx | 11 + .../team/[teamId]/cycle/upcoming/page.tsx | 11 + .../common/cycles/cycle-details-panel.tsx | 287 ++++++++++++++++++ components/common/issues/cycle-issues.tsx | 90 ++++++ components/common/issues/insights-panel.tsx | 230 ++++++++++++++ .../layout/headers/cycle/header-nav.tsx | 47 +++ .../layout/headers/cycle/header-options.tsx | 49 +++ components/layout/headers/cycle/header.tsx | 12 + store/right-panel-store.ts | 25 ++ 9 files changed, 762 insertions(+) create mode 100644 app/[orgId]/team/[teamId]/cycle/active/page.tsx create mode 100644 app/[orgId]/team/[teamId]/cycle/upcoming/page.tsx create mode 100644 components/common/cycles/cycle-details-panel.tsx create mode 100644 components/common/issues/cycle-issues.tsx create mode 100644 components/common/issues/insights-panel.tsx create mode 100644 components/layout/headers/cycle/header-nav.tsx create mode 100644 components/layout/headers/cycle/header-options.tsx create mode 100644 components/layout/headers/cycle/header.tsx create mode 100644 store/right-panel-store.ts diff --git a/app/[orgId]/team/[teamId]/cycle/active/page.tsx b/app/[orgId]/team/[teamId]/cycle/active/page.tsx new file mode 100644 index 0000000..570f511 --- /dev/null +++ b/app/[orgId]/team/[teamId]/cycle/active/page.tsx @@ -0,0 +1,11 @@ +import CycleIssues from '@/components/common/issues/cycle-issues'; +import Header from '@/components/layout/headers/cycle/header'; +import MainLayout from '@/components/layout/main-layout'; + +export default function ActiveCyclePage() { + return ( + }> + + + ); +} diff --git a/app/[orgId]/team/[teamId]/cycle/upcoming/page.tsx b/app/[orgId]/team/[teamId]/cycle/upcoming/page.tsx new file mode 100644 index 0000000..161c81e --- /dev/null +++ b/app/[orgId]/team/[teamId]/cycle/upcoming/page.tsx @@ -0,0 +1,11 @@ +import CycleIssues from '@/components/common/issues/cycle-issues'; +import Header from '@/components/layout/headers/cycle/header'; +import MainLayout from '@/components/layout/main-layout'; + +export default function UpcomingCyclePage() { + return ( + }> + + + ); +} diff --git a/components/common/cycles/cycle-details-panel.tsx b/components/common/cycles/cycle-details-panel.tsx new file mode 100644 index 0000000..cb08fd2 --- /dev/null +++ b/components/common/cycles/cycle-details-panel.tsx @@ -0,0 +1,287 @@ +'use client'; + +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { Button } from '@/components/ui/button'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; +import { Cycle, cycleStatusLabel, formatCycleDateRange } from '@/mock-data/cycles'; +import { Issue } from '@/mock-data/issues'; +import { useRightPanelStore } from '@/store/right-panel-store'; +import { Plus, User, X } from 'lucide-react'; +import { useMemo } from 'react'; +import { CapacityRing } from './capacity-ring'; +import { CycleBurnupChart } from './cycle-burnup-chart'; +import { CyclePlayIcon } from './cycle-line'; + +interface BreakdownRow { + key: string; + label: string; + leading: React.ReactNode; + total: number; + completedPercent: number; +} + +interface CycleDetailsPanelProps { + cycle: Cycle; + issues: Issue[]; +} + +const isCompleted = (issue: Issue) => issue.status.category === 'completed'; + +function buildBreakdown( + issues: Issue[], + getKey: (issue: Issue) => T | undefined, + describe: (key: T) => Omit +): BreakdownRow[] { + const buckets = new Map(); + for (const issue of issues) { + const key = getKey(issue); + if (key === undefined) continue; + const bucket = buckets.get(key) ?? []; + bucket.push(issue); + buckets.set(key, bucket); + } + + return [...buckets.entries()] + .map(([key, bucket]) => ({ + ...describe(key), + total: bucket.length, + completedPercent: Math.round((bucket.filter(isCompleted).length / bucket.length) * 100), + })) + .sort((a, b) => b.total - a.total); +} + +function BreakdownList({ rows }: { rows: BreakdownRow[] }) { + if (rows.length === 0) { + return

Nothing to show yet.

; + } + + return ( +
+ {rows.map((row) => ( +
+
+ {row.leading} + {row.label} +
+
+ + + {row.completedPercent}% of {row.total} + +
+
+ ))} +
+ ); +} + +/** + * Right side panel with the cycle summary: dates, progress stats, + * compact burn-up chart and breakdowns by assignee / label / priority / project. + */ +export function CycleDetailsPanel({ cycle, issues }: CycleDetailsPanelProps) { + const { closePanel } = useRightPanelStore(); + + const completedPercent = cycle.scope > 0 ? Math.round((cycle.completed / cycle.scope) * 100) : 0; + const startedPercent = cycle.scope > 0 ? Math.round((cycle.started / cycle.scope) * 100) : 0; + + const assigneeRows = useMemo( + () => + buildBreakdown( + issues, + (issue) => issue.assignee?.id ?? 'no-assignee', + (key) => { + const assignee = issues.find((i) => i.assignee?.id === key)?.assignee; + if (!assignee) { + return { + key: 'no-assignee', + label: 'No assignee', + leading: ( +
+ +
+ ), + }; + } + return { + key: assignee.id, + label: assignee.name, + leading: ( + + + {assignee.name[0]} + + ), + }; + } + ), + [issues] + ); + + const labelRows = useMemo( + () => + buildBreakdown( + issues, + (issue) => issue.labels[0]?.id, + (key) => { + const label = issues + .flatMap((issue) => issue.labels) + .find((candidate) => candidate.id === key); + return { + key: String(key), + label: label?.name ?? 'Unlabeled', + leading: ( + + ), + }; + } + ), + [issues] + ); + + const priorityRows = useMemo( + () => + buildBreakdown( + issues, + (issue) => issue.priority.id, + (key) => { + const priority = issues.find((i) => i.priority.id === key)?.priority; + const Icon = priority?.icon; + return { + key: String(key), + label: priority?.name ?? 'No priority', + leading: Icon ? ( + + ) : null, + }; + } + ), + [issues] + ); + + const projectRows = useMemo( + () => + buildBreakdown( + issues, + (issue) => issue.project?.id, + (key) => { + const project = issues.find((i) => i.project?.id === key)?.project; + const Icon = project?.icon; + return { + key: String(key), + label: project?.name ?? 'No project', + leading: Icon ? ( + + ) : null, + }; + } + ), + [issues] + ); + + return ( +
+ {/* Header */} +
+
+
+ + {cycleStatusLabel[cycle.status]} + + + {formatCycleDateRange(cycle)} + +
+ +
+ +
+ +

{cycle.name}

+
+ + +
+ + {/* Progress */} +
+

Progress

+
+
+
+ + Scope +
+
+ {cycle.scope}{' '} + {cycle.scopeDelta !== 0 && ( + +{cycle.scopeDelta}% + )} +
+
+
+
+ + Started +
+
+ {cycle.started}{' '} + • {startedPercent}% +
+
+
+
+ + Completed +
+
+ {cycle.completed}{' '} + • {completedPercent}% +
+
+
+ +
+ + {/* Breakdowns */} +
+ + + + Assignees + + + Labels + + + Priority + + + Projects + + + + + + + + + + + + + + + +
+
+ ); +} diff --git a/components/common/issues/cycle-issues.tsx b/components/common/issues/cycle-issues.tsx new file mode 100644 index 0000000..466731e --- /dev/null +++ b/components/common/issues/cycle-issues.tsx @@ -0,0 +1,90 @@ +'use client'; + +import { CycleDetailsPanel } from '@/components/common/cycles/cycle-details-panel'; +import { cn } from '@/lib/utils'; +import { getCurrentCycle, getUpcomingCycle } from '@/mock-data/cycles'; +import { Issue } from '@/mock-data/issues'; +import { displayOrderedStatus } from '@/mock-data/status'; +import { useFilterStore } from '@/store/filter-store'; +import { useIssuesStore } from '@/store/issues-store'; +import { useRightPanelStore } from '@/store/right-panel-store'; +import { useSearchStore } from '@/store/search-store'; +import { useViewStore } from '@/store/view-store'; +import { useMemo } from 'react'; +import { GroupedIssuesView } from './grouped-issues-view'; +import { InsightsPanel } from './insights-panel'; +import { SearchIssues } from './search-issues'; + +export type CycleView = 'active' | 'upcoming'; + +interface CycleIssuesProps { + /** 'active' = current cycle, 'upcoming' = next cycle. */ + cycleView: CycleView; +} + +/** + * Issue view scoped to a cycle — same behavior as AllIssues (search, + * filters, list/board) plus the cycle details / insights side panels. + */ +export default function CycleIssues({ cycleView }: CycleIssuesProps) { + const { isSearchOpen, searchQuery } = useSearchStore(); + const { viewType } = useViewStore(); + const { hasActiveFilters, filters } = useFilterStore(); + const { issues, filterIssues } = useIssuesStore(); + const { openPanel } = useRightPanelStore(); + + const cycle = cycleView === 'active' ? getCurrentCycle() : getUpcomingCycle(); + + const isSearching = isSearchOpen && searchQuery.trim() !== ''; + const isViewTypeGrid = viewType === 'grid'; + const isFiltering = hasActiveFilters(); + + const cycleIssues = useMemo( + () => issues.filter((issue) => issue.cycleId === cycle.id), + [issues, cycle.id] + ); + + const displayedIssues = useMemo(() => { + if (!isFiltering) return cycleIssues; + const filtered: Issue[] = filterIssues(filters); + return filtered.filter((issue) => issue.cycleId === cycle.id); + }, [cycleIssues, isFiltering, filterIssues, filters, cycle.id]); + + if (isSearching) { + return ( +
+
+ +
+
+ ); + } + + return ( +
+
+ +
+ + {openPanel === 'insights' && ( + + )} + {openPanel === 'cycle-details' && ( + + )} +
+ ); +} diff --git a/components/common/issues/insights-panel.tsx b/components/common/issues/insights-panel.tsx new file mode 100644 index 0000000..cbd1fc0 --- /dev/null +++ b/components/common/issues/insights-panel.tsx @@ -0,0 +1,230 @@ +'use client'; + +import { Button } from '@/components/ui/button'; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from '@/components/ui/select'; +import { Issue } from '@/mock-data/issues'; +import { priorities } from '@/mock-data/priorities'; +import { Status, workflowOrderedStatus } from '@/mock-data/status'; +import { useRightPanelStore } from '@/store/right-panel-store'; +import { X } from 'lucide-react'; +import { useMemo } from 'react'; +import { Bar, BarChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'; + +const PRIORITY_COLORS: Record = { + 'no-priority': '#64748b', + 'urgent': '#eb5757', + 'high': '#f2994a', + 'medium': '#facc15', + 'low': '#4cb782', +}; + +interface InsightsRow { + status: Status; + total: number; + byPriority: Record; +} + +interface InsightsPanelProps { + issues: Issue[]; +} + +/** Custom X axis tick rendering the status icon under each bar. */ +function StatusTick(props: { x?: number; y?: number; payload?: { value: string } }) { + const { x = 0, y = 0, payload } = props; + const currentStatus = workflowOrderedStatus.find((s) => s.id === payload?.value); + if (!currentStatus) return ; + + const Icon = currentStatus.icon; + return ( + + + + ); +} + +/** + * Analytics side panel ("insights"): issue count sliced by status and + * segmented by priority — stacked bar chart + detail table. + */ +export function InsightsPanel({ issues }: InsightsPanelProps) { + const { closePanel } = useRightPanelStore(); + + const rows = useMemo(() => { + return workflowOrderedStatus + .map((s) => { + const statusIssues = issues.filter((issue) => issue.status.id === s.id); + const byPriority: Record = {}; + for (const priority of priorities) { + byPriority[priority.id] = statusIssues.filter( + (issue) => issue.priority.id === priority.id + ).length; + } + return { status: s, total: statusIssues.length, byPriority }; + }) + .filter((row) => row.total > 0); + }, [issues]); + + const chartData = useMemo( + () => + rows.map((row) => ({ + id: row.status.id, + name: row.status.name, + ...row.byPriority, + })), + [rows] + ); + + return ( +
+ {/* Header */} +
+
+ {issues.length} + issues +
+ +
+ + {/* Measure / Slice / Segment */} +
+
+ Measure + +
+
+ Slice + +
+
+ Segment + +
+
+ + {/* Stacked bar chart */} +
+ + + } + axisLine={false} + tickLine={false} + interval={0} + /> + + + {priorities.map((priority) => ( + + ))} + + +
+ + {/* Detail table */} +
+ + + + + + {priorities.map((priority) => { + const Icon = priority.icon; + return ( + + ); + })} + + + + {rows.map((row) => { + const Icon = row.status.icon; + return ( + + + + {priorities.map((priority) => ( + + ))} + + ); + })} + +
StatusIssue count +
+ + {priority.name} +
+
+
+ + {row.status.name} +
+
{row.total} + {row.byPriority[priority.id]} +
+
+ +
+ +
+
+ ); +} diff --git a/components/layout/headers/cycle/header-nav.tsx b/components/layout/headers/cycle/header-nav.tsx new file mode 100644 index 0000000..be9b48d --- /dev/null +++ b/components/layout/headers/cycle/header-nav.tsx @@ -0,0 +1,47 @@ +'use client'; + +import { CyclePlayIcon } from '@/components/common/cycles/cycle-line'; +import { SidebarTrigger } from '@/components/ui/sidebar'; +import { getCurrentCycle, getUpcomingCycle } from '@/mock-data/cycles'; +import { teams } from '@/mock-data/teams'; +import { ChevronRight, MoreHorizontal, Star } from 'lucide-react'; +import Link from 'next/link'; +import { useParams } from 'next/navigation'; +import { CycleView } from '@/components/common/issues/cycle-issues'; + +export default function HeaderNav({ cycleView }: { cycleView: CycleView }) { + const { orgId, teamId } = useParams<{ orgId: string; teamId: string }>(); + const team = teams.find((t) => t.id === teamId) ?? teams[0]; + const cycle = cycleView === 'active' ? getCurrentCycle() : getUpcomingCycle(); + + return ( +
+
+ + +
+ {team.icon} +
+ {team.name} + + + + Cycles + + +
+ + {cycle.name} +
+ + +
+
+ ); +} diff --git a/components/layout/headers/cycle/header-options.tsx b/components/layout/headers/cycle/header-options.tsx new file mode 100644 index 0000000..0b8fd48 --- /dev/null +++ b/components/layout/headers/cycle/header-options.tsx @@ -0,0 +1,49 @@ +'use client'; + +import { Button } from '@/components/ui/button'; +import { getCurrentCycle, getUpcomingCycle } from '@/mock-data/cycles'; +import { useIssuesStore } from '@/store/issues-store'; +import { useRightPanelStore } from '@/store/right-panel-store'; +import { BarChart3, PanelRight } from 'lucide-react'; +import { DisplayOptions } from '../display-options'; +import { Filter } from '../issues/filter'; +import { CycleView } from '@/components/common/issues/cycle-issues'; + +export default function HeaderOptions({ cycleView }: { cycleView: CycleView }) { + const { openPanel, togglePanel } = useRightPanelStore(); + const { issues } = useIssuesStore(); + + const cycle = cycleView === 'active' ? getCurrentCycle() : getUpcomingCycle(); + const count = issues.filter((issue) => issue.cycleId === cycle.id).length; + + return ( +
+
+ + {count} {count === 1 ? 'issue' : 'issues'} + + +
+ +
+ + + +
+
+ ); +} diff --git a/components/layout/headers/cycle/header.tsx b/components/layout/headers/cycle/header.tsx new file mode 100644 index 0000000..417b0a1 --- /dev/null +++ b/components/layout/headers/cycle/header.tsx @@ -0,0 +1,12 @@ +import { CycleView } from '@/components/common/issues/cycle-issues'; +import HeaderNav from './header-nav'; +import HeaderOptions from './header-options'; + +export default function Header({ cycleView }: { cycleView: CycleView }) { + return ( + <> + + + + ); +} diff --git a/store/right-panel-store.ts b/store/right-panel-store.ts new file mode 100644 index 0000000..eb09ea9 --- /dev/null +++ b/store/right-panel-store.ts @@ -0,0 +1,25 @@ +import { create } from 'zustand'; + +/** + * Right side panel shown on issues / cycle pages. + * - 'insights': analytics panel (issue count by status, segmented by priority) + * - 'cycle-details': current cycle summary (progress chart + breakdowns) + */ +export type RightPanelType = 'insights' | 'cycle-details'; + +interface RightPanelState { + openPanel: RightPanelType | null; + + togglePanel: (panel: RightPanelType) => void; + openPanelOfType: (panel: RightPanelType) => void; + closePanel: () => void; +} + +export const useRightPanelStore = create((set) => ({ + openPanel: null, + + togglePanel: (panel) => + set((state) => ({ openPanel: state.openPanel === panel ? null : panel })), + openPanelOfType: (panel) => set({ openPanel: panel }), + closePanel: () => set({ openPanel: null }), +})); From 92d28f2ef2c5e9e4d756020550c4e467d205f97e Mon Sep 17 00:00:00 2001 From: ln-dev7 Date: Sat, 1 Aug 2026 13:37:40 +0000 Subject: [PATCH 06/75] feat(issues): Active/Backlog/All tabs with category-driven views --- app/[orgId]/team/[teamId]/active/page.tsx | 11 ++ app/[orgId]/team/[teamId]/backlog/page.tsx | 11 ++ components/common/issues/all-issues.tsx | 151 ++++++--------- .../common/issues/grouped-issues-view.tsx | 182 ++++++++++++++++++ .../layout/headers/issues/header-nav.tsx | 42 +++- 5 files changed, 308 insertions(+), 89 deletions(-) create mode 100644 app/[orgId]/team/[teamId]/active/page.tsx create mode 100644 app/[orgId]/team/[teamId]/backlog/page.tsx create mode 100644 components/common/issues/grouped-issues-view.tsx diff --git a/app/[orgId]/team/[teamId]/active/page.tsx b/app/[orgId]/team/[teamId]/active/page.tsx new file mode 100644 index 0000000..1e55f4a --- /dev/null +++ b/app/[orgId]/team/[teamId]/active/page.tsx @@ -0,0 +1,11 @@ +import AllIssues from '@/components/common/issues/all-issues'; +import Header from '@/components/layout/headers/issues/header'; +import MainLayout from '@/components/layout/main-layout'; + +export default function ActiveIssuesPage() { + return ( + }> + + + ); +} diff --git a/app/[orgId]/team/[teamId]/backlog/page.tsx b/app/[orgId]/team/[teamId]/backlog/page.tsx new file mode 100644 index 0000000..79fcab2 --- /dev/null +++ b/app/[orgId]/team/[teamId]/backlog/page.tsx @@ -0,0 +1,11 @@ +import AllIssues from '@/components/common/issues/all-issues'; +import Header from '@/components/layout/headers/issues/header'; +import MainLayout from '@/components/layout/main-layout'; + +export default function BacklogIssuesPage() { + return ( + }> + + + ); +} diff --git a/components/common/issues/all-issues.tsx b/components/common/issues/all-issues.tsx index 0676b3c..99ef2dd 100644 --- a/components/common/issues/all-issues.tsx +++ b/components/common/issues/all-issues.tsx @@ -1,105 +1,80 @@ 'use client'; -import { status } from '@/mock-data/status'; -import { useIssuesStore } from '@/store/issues-store'; -import { useSearchStore } from '@/store/search-store'; -import { useViewStore } from '@/store/view-store'; -import { useFilterStore } from '@/store/filter-store'; -import { FC, useMemo } from 'react'; -import { DndProvider } from 'react-dnd'; -import { HTML5Backend } from 'react-dnd-html5-backend'; -import { GroupIssues } from './group-issues'; -import { SearchIssues } from './search-issues'; -import { CustomDragLayer } from './issue-grid'; import { cn } from '@/lib/utils'; import { Issue } from '@/mock-data/issues'; +import { getStatusesByCategory, StatusCategory, displayOrderedStatus } from '@/mock-data/status'; +import { useFilterStore } from '@/store/filter-store'; +import { useIssuesStore } from '@/store/issues-store'; +import { useRightPanelStore } from '@/store/right-panel-store'; +import { useSearchStore } from '@/store/search-store'; +import { useViewStore } from '@/store/view-store'; +import { useMemo } from 'react'; +import { GroupedIssuesView } from './grouped-issues-view'; +import { InsightsPanel } from './insights-panel'; +import { SearchIssues } from './search-issues'; -export default function AllIssues() { +interface AllIssuesProps { + /** + * Optional status-category filter, used by the "Active" and "Backlog" + * tabs. When omitted, every status is shown ("All issues"). + */ + categories?: StatusCategory[]; +} + +export default function AllIssues({ categories }: AllIssuesProps) { const { isSearchOpen, searchQuery } = useSearchStore(); const { viewType } = useViewStore(); - const { hasActiveFilters } = useFilterStore(); + const { hasActiveFilters, filters } = useFilterStore(); + const { issues, filterIssues } = useIssuesStore(); + const { openPanel } = useRightPanelStore(); const isSearching = isSearchOpen && searchQuery.trim() !== ''; const isViewTypeGrid = viewType === 'grid'; const isFiltering = hasActiveFilters(); + const statuses = useMemo( + () => (categories ? getStatusesByCategory(categories) : displayOrderedStatus), + [categories] + ); + + const displayedIssues = useMemo(() => { + let result: Issue[] = isFiltering ? filterIssues(filters) : issues; + if (categories) { + result = result.filter((issue) => categories.includes(issue.status.category)); + } + return result; + }, [issues, isFiltering, filterIssues, filters, categories]); + + if (isSearching) { + return ( +
+
+ +
+
+ ); + } + return ( -
- {isSearching ? ( - - ) : isFiltering ? ( - - ) : ( - +
+
+ +
+ + {openPanel === 'insights' && ( + )}
); } - -const SearchIssuesView = () => ( -
- -
-); - -const FilteredIssuesView: FC<{ - isViewTypeGrid: boolean; -}> = ({ isViewTypeGrid = false }) => { - const { filters } = useFilterStore(); - const { filterIssues } = useIssuesStore(); - - // Apply filters to get filtered issues - const filteredIssues = useMemo(() => { - return filterIssues(filters); - }, [filterIssues, filters]); - - // Group filtered issues by status - const filteredIssuesByStatus = useMemo(() => { - const result: Record = {}; - - status.forEach((statusItem) => { - result[statusItem.id] = filteredIssues.filter( - (issue) => issue.status.id === statusItem.id - ); - }); - - return result; - }, [filteredIssues]); - - return ( - - -
- {status.map((statusItem) => ( - - ))} -
-
- ); -}; - -const GroupIssuesListView: FC<{ - isViewTypeGrid: boolean; -}> = ({ isViewTypeGrid = false }) => { - const { issuesByStatus } = useIssuesStore(); - return ( - - -
- {status.map((statusItem) => ( - - ))} -
-
- ); -}; diff --git a/components/common/issues/grouped-issues-view.tsx b/components/common/issues/grouped-issues-view.tsx new file mode 100644 index 0000000..dfbc3bb --- /dev/null +++ b/components/common/issues/grouped-issues-view.tsx @@ -0,0 +1,182 @@ +'use client'; + +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { cn } from '@/lib/utils'; +import { Issue, sortIssuesByPriority } from '@/mock-data/issues'; +import { priorities } from '@/mock-data/priorities'; +import { Status } from '@/mock-data/status'; +import { useDisplaySettingsStore } from '@/store/display-settings-store'; +import { Box, User } from 'lucide-react'; +import { FC, useMemo } from 'react'; +import { DndProvider } from 'react-dnd'; +import { HTML5Backend } from 'react-dnd-html5-backend'; +import { GroupIssues, IssueGroupDescriptor } from './group-issues'; +import { CustomDragLayer } from './issue-grid'; + +interface GroupedIssuesViewProps { + issues: Issue[]; + /** Statuses to render when grouping by status (empty groups are skipped unless enabled). */ + statuses: Status[]; + isViewTypeGrid: boolean; +} + +const sortIssues = (issues: Issue[], ordering: string): Issue[] => { + switch (ordering) { + case 'created': + return [...issues].sort( + (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() + ); + case 'title': + return [...issues].sort((a, b) => a.title.localeCompare(b.title)); + case 'priority': + default: + return sortIssuesByPriority(issues); + } +}; + +/** + * Issues grouped according to the Display settings (grouping, ordering, + * completed visibility, empty groups) — list rows or board columns. + * Shared by the All/Active/Backlog views and the cycle views. + */ +export const GroupedIssuesView: FC = ({ + issues, + statuses, + isViewTypeGrid, +}) => { + const { grouping, ordering, completedIssues, showEmptyGroups } = useDisplaySettingsStore(); + + const groups = useMemo(() => { + let visibleIssues = issues; + if (completedIssues === 'none') { + visibleIssues = visibleIssues.filter( + (issue) => issue.status.category !== 'completed' && issue.status.category !== 'canceled' + ); + } + + const buildGroups = (): { group: IssueGroupDescriptor; issues: Issue[] }[] => { + switch (grouping) { + case 'assignee': { + const assignees = new Map(); + for (const issue of visibleIssues) { + const key = issue.assignee?.id ?? 'no-assignee'; + assignees.set(key, [...(assignees.get(key) ?? []), issue]); + } + return [...assignees.entries()] + .sort((a, b) => b[1].length - a[1].length) + .map(([key, groupIssues]) => { + const assignee = groupIssues[0].assignee; + return { + group: { + id: key, + name: assignee?.name ?? 'No assignee', + color: '#8f9299', + icon: assignee ? ( + + + {assignee.name[0]} + + ) : ( + + ), + }, + issues: groupIssues, + }; + }); + } + case 'priority': { + return priorities + .map((priority) => ({ + group: { + id: priority.id, + name: priority.name, + color: '#8f9299', + icon: , + }, + issues: visibleIssues.filter((issue) => issue.priority.id === priority.id), + })) + .filter((entry) => showEmptyGroups || entry.issues.length > 0); + } + case 'project': { + const withProject = new Map(); + for (const issue of visibleIssues) { + const key = issue.project?.id ?? 'no-project'; + withProject.set(key, [...(withProject.get(key) ?? []), issue]); + } + return [...withProject.entries()] + .sort((a, b) => b[1].length - a[1].length) + .map(([key, groupIssues]) => { + const project = groupIssues[0].project; + const Icon = project?.icon ?? Box; + return { + group: { + id: key, + name: project?.name ?? 'No project', + color: '#8f9299', + icon: , + }, + issues: groupIssues, + }; + }); + } + case 'none': { + return [ + { + group: { + id: 'all', + name: 'All issues', + color: '#8f9299', + icon: , + }, + issues: visibleIssues, + }, + ]; + } + case 'status': + default: { + return statuses + .map((statusItem) => ({ + group: { + id: statusItem.id, + name: statusItem.name, + color: statusItem.color, + icon: , + status: statusItem, + }, + issues: visibleIssues.filter((issue) => issue.status.id === statusItem.id), + })) + .filter((entry) => showEmptyGroups || entry.issues.length > 0); + } + } + }; + + return buildGroups().map((entry) => ({ + ...entry, + issues: sortIssues(entry.issues, ordering), + })); + }, [issues, statuses, grouping, ordering, completedIssues, showEmptyGroups]); + + if (groups.length === 0) { + return ( +
+ No issues to show. +
+ ); + } + + return ( + + +
+ {groups.map((entry) => ( + + ))} +
+
+ ); +}; diff --git a/components/layout/headers/issues/header-nav.tsx b/components/layout/headers/issues/header-nav.tsx index 58ce32d..3c4f565 100644 --- a/components/layout/headers/issues/header-nav.tsx +++ b/components/layout/headers/issues/header-nav.tsx @@ -3,11 +3,48 @@ import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { SidebarTrigger } from '@/components/ui/sidebar'; +import { cn } from '@/lib/utils'; import { useSearchStore } from '@/store/search-store'; import { SearchIcon } from 'lucide-react'; +import Link from 'next/link'; +import { useParams, usePathname } from 'next/navigation'; import { useEffect, useRef } from 'react'; import Notifications from './notifications'; +const ISSUE_VIEW_TABS = [ + { label: 'Active', segment: 'active' }, + { label: 'Backlog', segment: 'backlog' }, + { label: 'All issues', segment: 'all' }, +]; + +function IssueViewTabs() { + const { orgId, teamId } = useParams<{ orgId: string; teamId: string }>(); + const pathname = usePathname(); + + return ( +
+ {ISSUE_VIEW_TABS.map((tab) => { + const href = `/${orgId}/team/${teamId}/${tab.segment}`; + const isActive = pathname === href; + return ( + + {tab.label} + + ); + })} +
+ ); +} + export default function HeaderNav() { const { isSearchOpen, toggleSearch, closeSearch, setSearchQuery, searchQuery } = useSearchStore(); @@ -42,7 +79,10 @@ export default function HeaderNav() { return (
- +
+ + +
{isSearchOpen ? ( From 34e8aeeda84f97535133986af27d6eff8af8ed2f Mon Sep 17 00:00:00 2001 From: ln-dev7 Date: Sat, 1 Aug 2026 13:37:40 +0000 Subject: [PATCH 07/75] feat(teams): team home with overview, documents and members tabs --- app/[orgId]/team/[teamId]/documents/page.tsx | 11 ++ app/[orgId]/team/[teamId]/members/page.tsx | 11 ++ app/[orgId]/team/[teamId]/overview/page.tsx | 11 ++ components/common/teams/team-documents.tsx | 82 +++++++++++++ components/common/teams/team-members.tsx | 69 +++++++++++ components/common/teams/team-overview.tsx | 110 ++++++++++++++++++ components/layout/headers/team/header-nav.tsx | 26 +++++ .../layout/headers/team/header-tabs.tsx | 41 +++++++ components/layout/headers/team/header.tsx | 11 ++ 9 files changed, 372 insertions(+) create mode 100644 app/[orgId]/team/[teamId]/documents/page.tsx create mode 100644 app/[orgId]/team/[teamId]/members/page.tsx create mode 100644 app/[orgId]/team/[teamId]/overview/page.tsx create mode 100644 components/common/teams/team-documents.tsx create mode 100644 components/common/teams/team-members.tsx create mode 100644 components/common/teams/team-overview.tsx create mode 100644 components/layout/headers/team/header-nav.tsx create mode 100644 components/layout/headers/team/header-tabs.tsx create mode 100644 components/layout/headers/team/header.tsx diff --git a/app/[orgId]/team/[teamId]/documents/page.tsx b/app/[orgId]/team/[teamId]/documents/page.tsx new file mode 100644 index 0000000..6bce24f --- /dev/null +++ b/app/[orgId]/team/[teamId]/documents/page.tsx @@ -0,0 +1,11 @@ +import TeamDocuments from '@/components/common/teams/team-documents'; +import Header from '@/components/layout/headers/team/header'; +import MainLayout from '@/components/layout/main-layout'; + +export default function TeamDocumentsPage() { + return ( + }> + + + ); +} diff --git a/app/[orgId]/team/[teamId]/members/page.tsx b/app/[orgId]/team/[teamId]/members/page.tsx new file mode 100644 index 0000000..8bfefdc --- /dev/null +++ b/app/[orgId]/team/[teamId]/members/page.tsx @@ -0,0 +1,11 @@ +import TeamMembers from '@/components/common/teams/team-members'; +import Header from '@/components/layout/headers/team/header'; +import MainLayout from '@/components/layout/main-layout'; + +export default function TeamMembersPage() { + return ( + }> + + + ); +} diff --git a/app/[orgId]/team/[teamId]/overview/page.tsx b/app/[orgId]/team/[teamId]/overview/page.tsx new file mode 100644 index 0000000..30a8d3c --- /dev/null +++ b/app/[orgId]/team/[teamId]/overview/page.tsx @@ -0,0 +1,11 @@ +import TeamOverview from '@/components/common/teams/team-overview'; +import Header from '@/components/layout/headers/team/header'; +import MainLayout from '@/components/layout/main-layout'; + +export default function TeamOverviewPage() { + return ( + }> + + + ); +} diff --git a/components/common/teams/team-documents.tsx b/components/common/teams/team-documents.tsx new file mode 100644 index 0000000..fcd813f --- /dev/null +++ b/components/common/teams/team-documents.tsx @@ -0,0 +1,82 @@ +'use client'; + +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { Button } from '@/components/ui/button'; +import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'; +import { documentFolders } from '@/mock-data/documents'; +import { formatDistanceToNowStrict, parseISO } from 'date-fns'; +import { ChevronRight, Pin, Plus, SlidersHorizontal } from 'lucide-react'; + +const timeAgo = (date: string) => + formatDistanceToNowStrict(parseISO(date), { addSuffix: true }) + .replace(' minutes', 'min') + .replace(' hours', 'h') + .replace(' days', 'd') + .replace(' weeks', 'w') + .replace(' months', 'mo') + .replace(' years', 'y'); + +/** + * Team Home — "Documents" tab: documents grouped in collapsible folders + * with created / last edited metadata. + */ +export default function TeamDocuments() { + return ( +
+
+
+ Name ↓ + Created + Last edited + +
+
+ + +
+
+ + {documentFolders.map((folder) => ( + d.pinned)}> + + + + + {folder.documents.map((doc) => ( +
+
+ {doc.icon} + {doc.name} + {doc.pinned && } +
+ + {timeAgo(doc.createdAt)} + + + {timeAgo(doc.updatedAt)} + + + + {doc.creator.name[0]} + +
+ ))} +
+
+ ))} +
+ ); +} diff --git a/components/common/teams/team-members.tsx b/components/common/teams/team-members.tsx new file mode 100644 index 0000000..1e01742 --- /dev/null +++ b/components/common/teams/team-members.tsx @@ -0,0 +1,69 @@ +'use client'; + +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { Button } from '@/components/ui/button'; +import { teams } from '@/mock-data/teams'; +import { Plus, SlidersHorizontal } from 'lucide-react'; +import { useParams } from 'next/navigation'; + +/** + * Team Home — "Members" tab: members of the current team with + * their email and role. + */ +export default function TeamMembers() { + const { teamId } = useParams<{ orgId: string; teamId: string }>(); + const team = teams.find((t) => t.id === teamId) ?? teams[0]; + + const members = [...team.members].sort((a, b) => a.name.localeCompare(b.name)); + + return ( +
+
+ Name ↓ +
+ + +
+
+ +
+
Name
+
Email
+
Role
+
+ + {members.map((member) => ( +
+
+ + + {member.name[0]} + +
+ {member.name} + + {member.name.split('.')[0]} + +
+
+
+ {member.email} +
+
+ + {member.role} + +
+
+ ))} +
+ ); +} diff --git a/components/common/teams/team-overview.tsx b/components/common/teams/team-overview.tsx new file mode 100644 index 0000000..87c6a34 --- /dev/null +++ b/components/common/teams/team-overview.tsx @@ -0,0 +1,110 @@ +'use client'; + +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { Button } from '@/components/ui/button'; +import { documentFolders } from '@/mock-data/documents'; +import { teams } from '@/mock-data/teams'; +import { RiDonutChartFill } from '@remixicon/react'; +import { Box, CopyMinus, Layers, Plus, Settings, SquareStack } from 'lucide-react'; +import Link from 'next/link'; +import { useParams } from 'next/navigation'; + +/** + * Team Home — "Overview" tab: team identity, pinned resources and + * quick links, Linear-style. + */ +export default function TeamOverview() { + const { orgId, teamId } = useParams<{ orgId: string; teamId: string }>(); + const team = teams.find((t) => t.id === teamId) ?? teams[0]; + + const pinnedDocuments = documentFolders + .flatMap((folder) => folder.documents) + .filter((doc) => doc.pinned); + + const goToLinks = [ + { label: 'Team settings', icon: Settings, href: `/${orgId}/settings` }, + { label: 'Issues', icon: CopyMinus, href: `/${orgId}/team/${team.id}/all` }, + { label: 'Cycles', icon: RiDonutChartFill, href: `/${orgId}/team/${team.id}/cycles` }, + { label: 'Projects', icon: Box, href: `/${orgId}/projects` }, + { label: 'Views', icon: Layers, href: '#' }, + ]; + + return ( +
+ {/* Main column */} +
+
+
+ {team.icon} +
+

{team.name}

+
+ +

Add a description...

+ +
+
+

Team resources

+
+ + +
+
+ +
+ {pinnedDocuments.length === 0 && ( +

No resources yet.

+ )} + {pinnedDocuments.map((doc) => ( + + {doc.icon} + {doc.name} + + ))} +
+
+
+ + {/* Side column */} +
+

Members

+ +
+ {team.members.slice(0, 4).map((member) => ( + + + {member.name[0]} + + ))} +
+ {team.members.length} + + +

Go to

+
+ {goToLinks.map((link) => ( + + + {link.label} + + ))} +
+
+
+ ); +} diff --git a/components/layout/headers/team/header-nav.tsx b/components/layout/headers/team/header-nav.tsx new file mode 100644 index 0000000..33fd792 --- /dev/null +++ b/components/layout/headers/team/header-nav.tsx @@ -0,0 +1,26 @@ +'use client'; + +import { SidebarTrigger } from '@/components/ui/sidebar'; +import { teams } from '@/mock-data/teams'; +import { Link2, MoreHorizontal, Star } from 'lucide-react'; +import { useParams } from 'next/navigation'; + +export default function HeaderNav() { + const { teamId } = useParams<{ orgId: string; teamId: string }>(); + const team = teams.find((t) => t.id === teamId) ?? teams[0]; + + return ( +
+
+ +
+ {team.icon} +
+ {team.name} + + +
+ +
+ ); +} diff --git a/components/layout/headers/team/header-tabs.tsx b/components/layout/headers/team/header-tabs.tsx new file mode 100644 index 0000000..ae6884d --- /dev/null +++ b/components/layout/headers/team/header-tabs.tsx @@ -0,0 +1,41 @@ +'use client'; + +import { cn } from '@/lib/utils'; +import Link from 'next/link'; +import { useParams, usePathname } from 'next/navigation'; + +const TEAM_TABS = [ + { label: 'Overview', segment: 'overview' }, + { label: 'Documents', segment: 'documents' }, + { label: 'Members', segment: 'members' }, +]; + +export default function HeaderTabs() { + const { orgId, teamId } = useParams<{ orgId: string; teamId: string }>(); + const pathname = usePathname(); + + return ( +
+
+ {TEAM_TABS.map((tab) => { + const href = `/${orgId}/team/${teamId}/${tab.segment}`; + const isActive = pathname === href; + return ( + + {tab.label} + + ); + })} +
+
+ ); +} diff --git a/components/layout/headers/team/header.tsx b/components/layout/headers/team/header.tsx new file mode 100644 index 0000000..d2d807f --- /dev/null +++ b/components/layout/headers/team/header.tsx @@ -0,0 +1,11 @@ +import HeaderNav from './header-nav'; +import HeaderTabs from './header-tabs'; + +export default function Header() { + return ( + <> + + + + ); +} From c5da644fa7d528fea9dde52b3e7b16fb7edf2ab8 Mon Sep 17 00:00:00 2001 From: ln-dev7 Date: Sat, 1 Aug 2026 13:37:53 +0000 Subject: [PATCH 08/75] feat(filters): URL-synced filters with nuqs, plus cycle and status-type filters --- app/layout.tsx | 11 +- components/layout/headers/issues/filter.tsx | 169 +++++++++++++++++++- package.json | 1 + pnpm-lock.yaml | 36 +++++ store/filter-store.ts | 150 ++++++++--------- store/issues-store.ts | 24 +++ store/members-filter-store.ts | 85 +++++----- store/projects-filter-store.ts | 87 +++++----- store/team-filter-store.ts | 104 +++++------- 9 files changed, 418 insertions(+), 249 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 5572a57..ba847bd 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -54,6 +54,7 @@ export const metadata: Metadata = { }; import { ThemeProvider } from '@/components/layout/theme-provider'; +import { NuqsAdapter } from 'nuqs/adapters/next/app'; export default function RootLayout({ children, @@ -66,10 +67,12 @@ export default function RootLayout({ - - {children} - - + + + {children} + + + ); diff --git a/components/layout/headers/issues/filter.tsx b/components/layout/headers/issues/filter.tsx index 1b67da2..4beea0d 100644 --- a/components/layout/headers/issues/filter.tsx +++ b/components/layout/headers/issues/filter.tsx @@ -13,7 +13,8 @@ import { import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; import { useIssuesStore } from '@/store/issues-store'; import { useFilterStore } from '@/store/filter-store'; -import { status as allStatus } from '@/mock-data/status'; +import { cycles, cycleStatusLabel } from '@/mock-data/cycles'; +import { status as allStatus, StatusCategory } from '@/mock-data/status'; import { priorities } from '@/mock-data/priorities'; import { labels } from '@/mock-data/labels'; import { projects } from '@/mock-data/projects'; @@ -21,7 +22,9 @@ import { users } from '@/mock-data/users'; import { CheckIcon, ChevronRight, + CircleDot, ListFilter, + RefreshCcw, User, CircleCheck, BarChart3, @@ -32,7 +35,23 @@ import { useState } from 'react'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; // Define filter types -type FilterType = 'status' | 'assignee' | 'priority' | 'labels' | 'project'; +type FilterType = + | 'status' + | 'statusType' + | 'assignee' + | 'priority' + | 'labels' + | 'project' + | 'cycle'; + +const STATUS_TYPES: { id: StatusCategory; name: string }[] = [ + { id: 'triage', name: 'Triage' }, + { id: 'backlog', name: 'Backlog' }, + { id: 'unstarted', name: 'Unstarted' }, + { id: 'started', name: 'Started' }, + { id: 'completed', name: 'Completed' }, + { id: 'canceled', name: 'Canceled' }, +]; export function Filter() { const [open, setOpen] = useState(false); @@ -40,8 +59,15 @@ export function Filter() { const { filters, toggleFilter, clearFilters, getActiveFiltersCount } = useFilterStore(); - const { filterByStatus, filterByAssignee, filterByPriority, filterByLabel, filterByProject } = - useIssuesStore(); + const { + filterByStatus, + filterByAssignee, + filterByPriority, + filterByLabel, + filterByProject, + filterByCycle, + getAllIssues, + } = useIssuesStore(); return ( @@ -78,6 +104,23 @@ export function Filter() {
+ setActiveFilter('statusType')} + className="flex items-center justify-between cursor-pointer" + > + + + Status type + +
+ {filters.statusType.length > 0 && ( + + {filters.statusType.length} + + )} + +
+
setActiveFilter('assignee')} className="flex items-center justify-between cursor-pointer" @@ -146,6 +189,23 @@ export function Filter() {
+ setActiveFilter('cycle')} + className="flex items-center justify-between cursor-pointer" + > + + + Cycle + +
+ {filters.cycle.length > 0 && ( + + {filters.cycle.length} + + )} + +
+
{getActiveFiltersCount() > 0 && ( <> @@ -379,6 +439,107 @@ export function Filter() { + ) : activeFilter === 'statusType' ? ( + +
+ + Status type +
+ + + No status type found. + + {STATUS_TYPES.map((item) => ( + toggleFilter('statusType', item.id)} + className="flex items-center justify-between" + > +
+ + {item.name} +
+ {filters.statusType.includes(item.id) && ( + + )} + + { + getAllIssues().filter( + (issue) => issue.status.category === item.id + ).length + } + +
+ ))} +
+
+
+ ) : activeFilter === 'cycle' ? ( + +
+ + Cycle +
+ + + No cycle found. + + toggleFilter('cycle', 'no-cycle')} + className="flex items-center justify-between" + > +
+ + No cycle +
+ {filters.cycle.includes('no-cycle') && ( + + )} + + {filterByCycle('').length} + +
+ {cycles.map((cycle) => ( + toggleFilter('cycle', cycle.id)} + className="flex items-center justify-between" + > +
+ + {cycle.name} + + {cycleStatusLabel[cycle.status]} + +
+ {filters.cycle.includes(cycle.id) && ( + + )} + + {filterByCycle(cycle.id).length} + +
+ ))} +
+
+
) : null} diff --git a/package.json b/package.json index 436c09f..5ae924d 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "motion": "^12.4.10", "next": "15.2.8", "next-themes": "^0.4.4", + "nuqs": "^2.9.4", "react": "^19.0.1", "react-day-picker": "8.10.1", "react-dnd": "^16.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index be1c719..9b1f8fe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -92,6 +92,9 @@ importers: next-themes: specifier: ^0.4.4 version: 0.4.4(react-dom@19.0.1(react@19.0.1))(react@19.0.1) + nuqs: + specifier: ^2.9.4 + version: 2.9.4(next@15.2.8(react-dom@19.0.1(react@19.0.1))(react@19.0.1))(react@19.0.1) react: specifier: ^19.0.1 version: 19.0.1 @@ -1365,6 +1368,9 @@ packages: '@rushstack/eslint-patch@1.10.5': resolution: {integrity: sha512-kkKUDVlII2DQiKy7UstOR1ErJP8kUKAQ4oa+SQtM0K+lPdmmjj0YnnxBgtTVYH7mUKtbsxeFC9y0AmK7Yb78/A==} + '@standard-schema/spec@1.1.0': + resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} + '@standard-schema/utils@0.3.0': resolution: {integrity: sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==} @@ -2612,6 +2618,27 @@ packages: resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + nuqs@2.9.4: + resolution: {integrity: sha512-lsz3NyCOKmuNAyW052i9RWqcTntoYb2Qm6FxSWnkTDwOJnGS6fzpXDAp0VcwTevw3xgnWebYpDr9rm6+o4DHbw==} + peerDependencies: + '@remix-run/react': '>=2' + '@tanstack/react-router': ^1 + next: '>=14.2.0' + react: '>=18.2.0 || ^19.0.0-0' + react-router: ^5 || ^6 || ^7 || ^8 + react-router-dom: ^5 || ^6 || ^7 + peerDependenciesMeta: + '@remix-run/react': + optional: true + '@tanstack/react-router': + optional: true + next: + optional: true + react-router: + optional: true + react-router-dom: + optional: true + object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} @@ -4321,6 +4348,8 @@ snapshots: '@rushstack/eslint-patch@1.10.5': {} + '@standard-schema/spec@1.1.0': {} + '@standard-schema/utils@0.3.0': {} '@swc/counter@0.1.3': {} @@ -5706,6 +5735,13 @@ snapshots: dependencies: path-key: 4.0.0 + nuqs@2.9.4(next@15.2.8(react-dom@19.0.1(react@19.0.1))(react@19.0.1))(react@19.0.1): + dependencies: + '@standard-schema/spec': 1.1.0 + react: 19.0.1 + optionalDependencies: + next: 15.2.8(react-dom@19.0.1(react@19.0.1))(react@19.0.1) + object-assign@4.1.1: {} object-inspect@1.13.4: {} diff --git a/store/filter-store.ts b/store/filter-store.ts index da010af..5a1e997 100644 --- a/store/filter-store.ts +++ b/store/filter-store.ts @@ -1,97 +1,87 @@ -import { create } from 'zustand'; +'use client'; + +import { parseAsArrayOf, parseAsString, useQueryStates } from 'nuqs'; + +/** + * Issue filters, synced to the URL via nuqs (?status=…&assignee=…). + * The hook keeps the exact same API as the previous Zustand store so + * consumers (Filter dropdown, issue views) don't need to change. + */ +export type IssueFilterKey = + | 'status' + | 'assignee' + | 'priority' + | 'labels' + | 'project' + | 'cycle' + | 'statusType'; export interface FilterState { - // Filter options - filters: { - status: string[]; - assignee: string[]; - priority: string[]; - labels: string[]; - project: string[]; - }; + filters: Record; - // Actions - setFilter: ( - type: 'status' | 'assignee' | 'priority' | 'labels' | 'project', - ids: string[] - ) => void; - toggleFilter: ( - type: 'status' | 'assignee' | 'priority' | 'labels' | 'project', - id: string - ) => void; + setFilter: (type: IssueFilterKey, ids: string[]) => void; + toggleFilter: (type: IssueFilterKey, id: string) => void; clearFilters: () => void; - clearFilterType: (type: 'status' | 'assignee' | 'priority' | 'labels' | 'project') => void; + clearFilterType: (type: IssueFilterKey) => void; - // Utility hasActiveFilters: () => boolean; getActiveFiltersCount: () => number; } -export const useFilterStore = create((set, get) => ({ - // Initial state - filters: { - status: [], - assignee: [], - priority: [], - labels: [], - project: [], - }, +const arrayParser = parseAsArrayOf(parseAsString).withDefault([]); - // Actions - setFilter: (type, ids) => { - set((state) => ({ - filters: { - ...state.filters, - [type]: ids, - }, - })); - }, +const filterParsers = { + status: arrayParser, + assignee: arrayParser, + priority: arrayParser, + labels: arrayParser, + project: arrayParser, + cycle: arrayParser, + statusType: arrayParser, +}; - toggleFilter: (type, id) => { - set((state) => { - const currentFilters = state.filters[type]; - const newFilters = currentFilters.includes(id) - ? currentFilters.filter((item) => item !== id) - : [...currentFilters, id]; +export function useFilterStore(): FilterState { + const [filters, setFilters] = useQueryStates(filterParsers, { history: 'replace' }); - return { - filters: { - ...state.filters, - [type]: newFilters, - }, - }; + const setFilter = (type: IssueFilterKey, ids: string[]) => { + setFilters({ [type]: ids.length > 0 ? ids : null }); + }; + + const toggleFilter = (type: IssueFilterKey, id: string) => { + const current = filters[type]; + const next = current.includes(id) ? current.filter((item) => item !== id) : [...current, id]; + setFilters({ [type]: next.length > 0 ? next : null }); + }; + + const clearFilters = () => { + setFilters({ + status: null, + assignee: null, + priority: null, + labels: null, + project: null, + cycle: null, + statusType: null, }); - }, + }; - clearFilters: () => { - set({ - filters: { - status: [], - assignee: [], - priority: [], - labels: [], - project: [], - }, - }); - }, + const clearFilterType = (type: IssueFilterKey) => { + setFilters({ [type]: null }); + }; - clearFilterType: (type) => { - set((state) => ({ - filters: { - ...state.filters, - [type]: [], - }, - })); - }, + const hasActiveFilters = () => + Object.values(filters).some((filterArray) => filterArray.length > 0); - // Utility - hasActiveFilters: () => { - const { filters } = get(); - return Object.values(filters).some((filterArray) => filterArray.length > 0); - }, + const getActiveFiltersCount = () => + Object.values(filters).reduce((acc, curr) => acc + curr.length, 0); - getActiveFiltersCount: () => { - const { filters } = get(); - return Object.values(filters).reduce((acc, curr) => acc + curr.length, 0); - }, -})); + return { + filters, + setFilter, + toggleFilter, + clearFilters, + clearFilterType, + hasActiveFilters, + getActiveFiltersCount, + }; +} diff --git a/store/issues-store.ts b/store/issues-store.ts index c091f40..8be8818 100644 --- a/store/issues-store.ts +++ b/store/issues-store.ts @@ -12,6 +12,8 @@ interface FilterOptions { priority?: string[]; labels?: string[]; project?: string[]; + cycle?: string[]; + statusType?: string[]; } interface IssuesState { @@ -33,6 +35,7 @@ interface IssuesState { filterByAssignee: (userId: string | null) => Issue[]; filterByLabel: (labelId: string) => Issue[]; filterByProject: (projectId: string) => Issue[]; + filterByCycle: (cycleId: string) => Issue[]; searchIssues: (query: string) => Issue[]; filterIssues: (filters: FilterOptions) => Issue[]; @@ -122,6 +125,10 @@ export const useIssuesStore = create((set, get) => ({ return get().issues.filter((issue) => issue.project?.id === projectId); }, + filterByCycle: (cycleId: string) => { + return get().issues.filter((issue) => issue.cycleId === cycleId); + }, + searchIssues: (query: string) => { const lowerCaseQuery = query.toLowerCase(); return get().issues.filter( @@ -176,6 +183,23 @@ export const useIssuesStore = create((set, get) => ({ ); } + // Filter by cycle ('no-cycle' matches issues outside any cycle) + if (filters.cycle && filters.cycle.length > 0) { + filteredIssues = filteredIssues.filter((issue) => { + if (filters.cycle!.includes('no-cycle') && issue.cycleId === '') { + return true; + } + return filters.cycle!.includes(issue.cycleId); + }); + } + + // Filter by status type (status category) + if (filters.statusType && filters.statusType.length > 0) { + filteredIssues = filteredIssues.filter((issue) => + filters.statusType!.includes(issue.status.category) + ); + } + return filteredIssues; }, diff --git a/store/members-filter-store.ts b/store/members-filter-store.ts index dc76d1d..0f0ad35 100644 --- a/store/members-filter-store.ts +++ b/store/members-filter-store.ts @@ -1,4 +1,6 @@ -import { create } from 'zustand'; +'use client'; + +import { parseAsArrayOf, parseAsString, parseAsStringLiteral, useQueryStates } from 'nuqs'; export type MembersSort = | 'name-asc' @@ -8,6 +10,15 @@ export type MembersSort = | 'teams-asc' | 'teams-desc'; +const SORTS: MembersSort[] = [ + 'name-asc', + 'name-desc', + 'joined-asc', + 'joined-desc', + 'teams-asc', + 'teams-desc', +]; + export interface MembersFilterState { filters: { role: ('Guest' | 'Member' | 'Admin')[]; @@ -24,55 +35,33 @@ export interface MembersFilterState { getActiveFiltersCount: () => number; } -export const useMembersFilterStore = create((set, get) => ({ - filters: { - role: [], - }, - sort: 'name-asc', +const parsers = { + role: parseAsArrayOf(parseAsString).withDefault([]), + sort: parseAsStringLiteral(SORTS).withDefault('name-asc'), +}; - setSort: (sort) => set({ sort }), +/** Members page filters + sorting, URL-synced via nuqs (?role=…&sort=…). */ +export function useMembersFilterStore(): MembersFilterState { + const [state, setState] = useQueryStates(parsers, { history: 'replace' }); - setFilter: (type, ids) => - set((state) => ({ - filters: { - ...state.filters, - [type]: ids as ('Guest' | 'Member' | 'Admin')[], - }, - })), + const filters = { role: state.role as ('Guest' | 'Member' | 'Admin')[] }; - toggleFilter: (type, id) => - set((state) => { - const current = state.filters[type]; - const next = current.includes(id) ? current.filter((x) => x !== id) : [...current, id]; - return { - filters: { - ...state.filters, - [type]: next, - }, - }; - }), + return { + filters, + sort: state.sort, - clearFilters: () => - set({ - filters: { - role: [], - }, - }), + setSort: (sort) => setState({ sort: sort === 'name-asc' ? null : sort }), + setFilter: (_type, ids) => setState({ role: ids.length > 0 ? ids : null }), + toggleFilter: (_type, id) => { + const next = filters.role.includes(id) + ? filters.role.filter((x) => x !== id) + : [...filters.role, id]; + setState({ role: next.length > 0 ? next : null }); + }, + clearFilters: () => setState({ role: null }), + clearFilterType: () => setState({ role: null }), - clearFilterType: (type) => - set((state) => ({ - filters: { - ...state.filters, - [type]: [], - }, - })), - - hasActiveFilters: () => { - const { filters } = get(); - return Object.values(filters).some((arr) => arr.length > 0); - }, - getActiveFiltersCount: () => { - const { filters } = get(); - return Object.values(filters).reduce((sum, arr) => sum + arr.length, 0); - }, -})); + hasActiveFilters: () => filters.role.length > 0, + getActiveFiltersCount: () => filters.role.length, + }; +} diff --git a/store/projects-filter-store.ts b/store/projects-filter-store.ts index 444c2c9..48c1680 100644 --- a/store/projects-filter-store.ts +++ b/store/projects-filter-store.ts @@ -1,4 +1,6 @@ -import { create } from 'zustand'; +'use client'; + +import { parseAsArrayOf, parseAsString, parseAsStringLiteral, useQueryStates } from 'nuqs'; export type ProjectsSort = | 'title-asc' @@ -8,6 +10,15 @@ export type ProjectsSort = | 'status-asc' | 'status-desc'; +const SORTS: ProjectsSort[] = [ + 'title-asc', + 'title-desc', + 'date-asc', + 'date-desc', + 'status-asc', + 'status-desc', +]; + export interface ProjectsFilterState { filters: { health: string[]; // health ids @@ -25,57 +36,33 @@ export interface ProjectsFilterState { getActiveFiltersCount: () => number; } -export const useProjectsFilterStore = create((set, get) => ({ - filters: { - health: [], - priority: [], - }, - sort: 'title-asc', +const parsers = { + health: parseAsArrayOf(parseAsString).withDefault([]), + priority: parseAsArrayOf(parseAsString).withDefault([]), + sort: parseAsStringLiteral(SORTS).withDefault('title-asc'), +}; - setSort: (sort) => set({ sort }), +/** Projects page filters + sorting, URL-synced via nuqs (?health=…&priority=…&sort=…). */ +export function useProjectsFilterStore(): ProjectsFilterState { + const [state, setState] = useQueryStates(parsers, { history: 'replace' }); - setFilter: (type, ids) => - set((state) => ({ - filters: { - ...state.filters, - [type]: ids, - }, - })), + const filters = { health: state.health, priority: state.priority }; - toggleFilter: (type, id) => - set((state) => { - const current = state.filters[type]; + return { + filters, + sort: state.sort, + + setSort: (sort) => setState({ sort: sort === 'title-asc' ? null : sort }), + setFilter: (type, ids) => setState({ [type]: ids.length > 0 ? ids : null }), + toggleFilter: (type, id) => { + const current = filters[type]; const next = current.includes(id) ? current.filter((x) => x !== id) : [...current, id]; - return { - filters: { - ...state.filters, - [type]: next, - }, - }; - }), + setState({ [type]: next.length > 0 ? next : null }); + }, + clearFilters: () => setState({ health: null, priority: null }), + clearFilterType: (type) => setState({ [type]: null }), - clearFilters: () => - set({ - filters: { - health: [], - priority: [], - }, - }), - - clearFilterType: (type) => - set((state) => ({ - filters: { - ...state.filters, - [type]: [], - }, - })), - - hasActiveFilters: () => { - const { filters } = get(); - return Object.values(filters).some((arr) => arr.length > 0); - }, - getActiveFiltersCount: () => { - const { filters } = get(); - return Object.values(filters).reduce((sum, arr) => sum + arr.length, 0); - }, -})); + hasActiveFilters: () => Object.values(filters).some((arr) => arr.length > 0), + getActiveFiltersCount: () => Object.values(filters).reduce((sum, arr) => sum + arr.length, 0), + }; +} diff --git a/store/team-filter-store.ts b/store/team-filter-store.ts index 5c7e446..a7d518f 100644 --- a/store/team-filter-store.ts +++ b/store/team-filter-store.ts @@ -1,5 +1,7 @@ +'use client'; + import { Team } from '@/mock-data/teams'; -import { create } from 'zustand'; +import { parseAsArrayOf, parseAsString, parseAsStringLiteral, useQueryStates } from 'nuqs'; export type TeamsSort = | 'name-asc' @@ -9,6 +11,15 @@ export type TeamsSort = | 'projects-asc' //number of projects | 'projects-desc'; +const SORTS: TeamsSort[] = [ + 'name-asc', + 'name-desc', + 'members-asc', + 'members-desc', + 'projects-asc', + 'projects-desc', +]; + export interface TeamsFilterState { filters: { membership: ('Joined' | 'Not-Joined')[]; @@ -31,69 +42,36 @@ export interface TeamsFilterState { getActiveFiltersCount: () => number; } -export const useTeamsFilterStore = create((set, get) => ({ - filters: { - membership: [], - identifier: [], - }, - sort: 'name-asc', +const parsers = { + membership: parseAsArrayOf(parseAsString).withDefault([]), + identifier: parseAsArrayOf(parseAsString).withDefault([]), + sort: parseAsStringLiteral(SORTS).withDefault('name-asc'), +}; - setSort: (sort) => set({ sort }), - setFilter: (type, ids) => - set((state) => ({ - filters: { - ...state.filters, - [type]: ids as 'Joined' | 'Not-Joined' | Team['id'], - }, - })), +/** Teams page filters + sorting, URL-synced via nuqs (?membership=…&identifier=…&sort=…). */ +export function useTeamsFilterStore(): TeamsFilterState { + const [state, setState] = useQueryStates(parsers, { history: 'replace' }); - toggleFilter: (type, id) => { - set((state) => { - if (type === 'membership') { - const current = state.filters.membership; - const typedId = id as 'Joined' | 'Not-Joined'; - const next = current.includes(typedId) - ? current.filter((ele) => ele !== typedId) - : [...current, typedId]; + const filters = { + membership: state.membership as ('Joined' | 'Not-Joined')[], + identifier: state.identifier, + }; - return { - filters: { - ...state.filters, - membership: next, - }, - }; - } else { - const current = state.filters.identifier; - const typedId = id as Team['id']; - const next = current.includes(id) - ? current.filter((currentId) => currentId !== typedId) - : [...current, typedId]; + return { + filters, + sort: state.sort, - return { - filters: { - ...state.filters, - identifier: next, - }, - }; - } - }); - }, - clearFilters: () => set({ filters: { membership: [], identifier: [] } }), - clearFilterType: (type) => - set((state) => { - return { - filters: { - ...state.filters, - [type]: [], - }, - }; - }), - hasActiveFilters: () => { - const { filters } = get(); - return Object.values(filters).some((arr) => arr.length > 0); - }, - getActiveFiltersCount: () => { - const { filters } = get(); - return Object.values(filters).reduce((sum, arr) => sum + arr.length, 0); - }, -})); + setSort: (sort) => setState({ sort: sort === 'name-asc' ? null : sort }), + setFilter: (type, ids) => setState({ [type]: [ids] }), + toggleFilter: (type, id) => { + const current = filters[type] as string[]; + const next = current.includes(id) ? current.filter((x) => x !== id) : [...current, id]; + setState({ [type]: next.length > 0 ? next : null }); + }, + clearFilters: () => setState({ membership: null, identifier: null }), + clearFilterType: (type) => setState({ [type]: null }), + + hasActiveFilters: () => Object.values(filters).some((arr) => arr.length > 0), + getActiveFiltersCount: () => Object.values(filters).reduce((sum, arr) => sum + arr.length, 0), + }; +} From ff4581ec16b84a9fc38d6227af7ddd58fd445580 Mon Sep 17 00:00:00 2001 From: ln-dev7 Date: Sat, 1 Aug 2026 13:37:53 +0000 Subject: [PATCH 09/75] =?UTF-8?q?feat(issues):=20display=20options=20?= =?UTF-8?q?=E2=80=94=20grouping,=20ordering=20and=20display=20properties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/common/issues/group-issues.tsx | 51 ++-- components/common/issues/issue-grid.tsx | 43 ++- components/common/issues/issue-line.tsx | 58 +++- components/layout/headers/display-options.tsx | 267 ++++++++++++++++++ .../layout/headers/issues/header-options.tsx | 62 +--- store/display-settings-store.ts | 102 +++++++ 6 files changed, 490 insertions(+), 93 deletions(-) create mode 100644 components/layout/headers/display-options.tsx create mode 100644 store/display-settings-store.ts diff --git a/components/common/issues/group-issues.tsx b/components/common/issues/group-issues.tsx index 7532179..b8191df 100644 --- a/components/common/issues/group-issues.tsx +++ b/components/common/issues/group-issues.tsx @@ -4,28 +4,40 @@ import { Issue } from '@/mock-data/issues'; import { Status } from '@/mock-data/status'; import { useIssuesStore } from '@/store/issues-store'; import { useViewStore } from '@/store/view-store'; +import { useCreateIssueStore } from '@/store/create-issue-store'; import { cn } from '@/lib/utils'; import { Plus } from 'lucide-react'; -import { FC, useRef } from 'react'; +import { FC, ReactNode, useRef } from 'react'; import { useDrop } from 'react-dnd'; +import { AnimatePresence, motion } from 'motion/react'; import { Button } from '../../ui/button'; import { IssueDragType, IssueGrid } from './issue-grid'; import { IssueLine } from './issue-line'; -import { useCreateIssueStore } from '@/store/create-issue-store'; -import { sortIssuesByPriority } from '@/mock-data/issues'; -import { AnimatePresence, motion } from 'motion/react'; + +/** + * Generic descriptor of an issue group. Groups are usually statuses but the + * "Display" settings also allow grouping by assignee / priority / project. + */ +export interface IssueGroupDescriptor { + id: string; + name: string; + color: string; + icon: ReactNode; + /** Set when grouping by status: enables board drop + "+" default status. */ + status?: Status; +} interface GroupIssuesProps { - status: Status; + group: IssueGroupDescriptor; + /** Issues of the group, already sorted upstream. */ issues: Issue[]; count: number; } -export function GroupIssues({ status, issues, count }: GroupIssuesProps) { +export function GroupIssues({ group, issues, count }: GroupIssuesProps) { const { viewType } = useViewStore(); const isViewTypeGrid = viewType === 'grid'; const { openModal } = useCreateIssueStore(); - const sortedIssues = sortIssuesByPriority(issues); return (
- - {status.name} + {group.icon} + {group.name} {count}
@@ -63,7 +75,7 @@ export function GroupIssues({ status, issues, count }: GroupIssuesProps) { variant="ghost" onClick={(e) => { e.stopPropagation(); - openModal(status); + openModal(group.status); }} > @@ -73,37 +85,36 @@ export function GroupIssues({ status, issues, count }: GroupIssuesProps) { {viewType === 'list' ? (
- {sortedIssues.map((issue) => ( + {issues.map((issue) => ( ))}
) : ( - + )}
); } -const IssueGridList: FC<{ issues: Issue[]; status: Status }> = ({ issues, status }) => { +const IssueGridList: FC<{ issues: Issue[]; status?: Status }> = ({ issues, status }) => { const ref = useRef(null); const { updateIssueStatus } = useIssuesStore(); // Set up drop functionality to accept only issue items. const [{ isOver }, drop] = useDrop(() => ({ accept: IssueDragType, + canDrop: () => status !== undefined, drop(item: Issue, monitor) { - if (monitor.didDrop() && item.status.id !== status.id) { + if (status && monitor.didDrop() && item.status.id !== status.id) { updateIssueStatus(item.id, status); } }, collect: (monitor) => ({ - isOver: !!monitor.isOver(), + isOver: !!monitor.isOver() && !!monitor.canDrop(), }), })); drop(ref); - const sortedIssues = sortIssuesByPriority(issues); - return (
= ({ issues, status }} >
-

Board ordered by priority

+

Drop to update status

)} - {sortedIssues.map((issue) => ( + {issues.map((issue) => ( ))}
diff --git a/components/common/issues/issue-grid.tsx b/components/common/issues/issue-grid.tsx index 92f556a..9ffd960 100644 --- a/components/common/issues/issue-grid.tsx +++ b/components/common/issues/issue-grid.tsx @@ -1,7 +1,10 @@ 'use client'; import { Issue } from '@/mock-data/issues'; +import { useDisplaySettingsStore } from '@/store/display-settings-store'; import { format } from 'date-fns'; +import Link from 'next/link'; +import { useParams } from 'next/navigation'; import { motion } from 'motion/react'; import { useEffect, useRef } from 'react'; import { DragSourceMonitor, useDrag, useDragLayer, useDrop } from 'react-dnd'; @@ -76,6 +79,8 @@ export function CustomDragLayer() { export function IssueGrid({ issue }: IssueGridProps) { const ref = useRef(null); + const { orgId } = useParams<{ orgId: string }>(); + const { displayProperties } = useDisplaySettingsStore(); // Set up drag functionality. const [{ isDragging }, drag, preview] = useDrag(() => ({ @@ -113,23 +118,37 @@ export function IssueGrid({ issue }: IssueGridProps) { >
- - - {issue.identifier} - + {displayProperties.priority && ( + + )} + {displayProperties.id && ( + + {issue.identifier} + + )}
- + {displayProperties.status && ( + + )}
-

{issue.title}

+ +

{issue.title}

+
- - {issue.project && } + {displayProperties.labels && } + {displayProperties.project && issue.project && ( + + )}
- - {format(new Date(issue.createdAt), 'MMM dd')} - - + {displayProperties.created ? ( + + {format(new Date(issue.createdAt), 'MMM dd')} + + ) : ( + + )} + {displayProperties.assignee && }
diff --git a/components/common/issues/issue-line.tsx b/components/common/issues/issue-line.tsx index b3f3ec1..eaa0eb8 100644 --- a/components/common/issues/issue-line.tsx +++ b/components/common/issues/issue-line.tsx @@ -1,7 +1,11 @@ 'use client'; import { Issue } from '@/mock-data/issues'; +import { getCycleById } from '@/mock-data/cycles'; +import { useDisplaySettingsStore } from '@/store/display-settings-store'; import { format } from 'date-fns'; +import Link from 'next/link'; +import { useParams } from 'next/navigation'; import { AssigneeUser } from './assignee-user'; import { LabelBadge } from './label-badge'; import { PrioritySelector } from './priority-selector'; @@ -13,36 +17,62 @@ import { ContextMenu, ContextMenuTrigger } from '@/components/ui/context-menu'; import { IssueContextMenu } from './issue-context-menu'; export function IssueLine({ issue, layoutId = false }: { issue: Issue; layoutId?: boolean }) { + const { orgId } = useParams<{ orgId: string }>(); + const { displayProperties } = useDisplaySettingsStore(); + const cycle = displayProperties.cycle && issue.cycleId ? getCycleById(issue.cycleId) : undefined; + return (
- - - {issue.identifier} - - + {displayProperties.priority && ( + + )} + {displayProperties.id && ( + + {issue.identifier} + + )} + {displayProperties.status && ( + + )}
- + {issue.title} - +
- - {issue.project && } + {displayProperties.labels && } + {displayProperties.project && issue.project && ( + + )}
- - {format(new Date(issue.createdAt), 'MMM dd')} - - + {cycle && ( + + {cycle.name} + + )} + {displayProperties.dueDate && issue.dueDate && ( + + Due {format(new Date(issue.dueDate), 'MMM dd')} + + )} + {displayProperties.created && ( + + {format(new Date(issue.createdAt), 'MMM dd')} + + )} + {displayProperties.assignee && }
diff --git a/components/layout/headers/display-options.tsx b/components/layout/headers/display-options.tsx new file mode 100644 index 0000000..9683b24 --- /dev/null +++ b/components/layout/headers/display-options.tsx @@ -0,0 +1,267 @@ +'use client'; + +import { Button } from '@/components/ui/button'; +import { Label } from '@/components/ui/label'; +import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from '@/components/ui/select'; +import { Switch } from '@/components/ui/switch'; +import { cn } from '@/lib/utils'; +import { + CompletedIssuesFilter, + DISPLAY_PROPERTIES, + GroupingKey, + OrderingKey, + useDisplaySettingsStore, +} from '@/store/display-settings-store'; +import { useViewStore } from '@/store/view-store'; +import { + ArrowUpNarrowWide, + ArrowUpDown, + LayoutGrid, + LayoutList, + SlidersHorizontal, +} from 'lucide-react'; + +const GROUPINGS: { value: GroupingKey; label: string }[] = [ + { value: 'status', label: 'Status' }, + { value: 'assignee', label: 'Assignee' }, + { value: 'priority', label: 'Priority' }, + { value: 'project', label: 'Project' }, + { value: 'none', label: 'No grouping' }, +]; + +const ORDERINGS: { value: OrderingKey; label: string }[] = [ + { value: 'priority', label: 'Priority' }, + { value: 'created', label: 'Created' }, + { value: 'title', label: 'Title' }, +]; + +/** + * Linear-style "Display" popover: list/board switch, grouping, ordering, + * completed-issue visibility, list options and display property chips. + */ +export function DisplayOptions() { + const { viewType, setViewType } = useViewStore(); + const { + grouping, + ordering, + orderCompletedByRecency, + completedIssues, + showSubIssues, + showEmptyGroups, + displayProperties, + setGrouping, + setOrdering, + setOrderCompletedByRecency, + setCompletedIssues, + setShowSubIssues, + setShowEmptyGroups, + toggleDisplayProperty, + resetDisplaySettings, + } = useDisplaySettingsStore(); + + const isDefault = + grouping === 'status' && + ordering === 'priority' && + completedIssues === 'all' && + !showEmptyGroups; + + return ( + + + + + + {/* List / Board switch */} +
+
+ + +
+
+ + {/* Grouping & ordering */} +
+
+ + + Grouping + + +
+ +
+ Sub-grouping + +
+ +
+ + + Ordering + + +
+ +
+ + +
+
+ +
+
+ Completed issues + +
+ +
+ + +
+
+ +
+ List options +
+ + +
+ + Display properties +
+ {DISPLAY_PROPERTIES.map((property) => ( + + ))} +
+
+ +
+ + +
+
+
+ ); +} diff --git a/components/layout/headers/issues/header-options.tsx b/components/layout/headers/issues/header-options.tsx index a155035..573dfc7 100644 --- a/components/layout/headers/issues/header-options.tsx +++ b/components/layout/headers/issues/header-options.tsx @@ -1,60 +1,28 @@ 'use client'; import { Button } from '@/components/ui/button'; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from '@/components/ui/dropdown-menu'; -import { cn } from '@/lib/utils'; -import { useViewStore, ViewType } from '@/store/view-store'; -import { LayoutGrid, LayoutList, SlidersHorizontal } from 'lucide-react'; +import { useRightPanelStore } from '@/store/right-panel-store'; +import { BarChart3 } from 'lucide-react'; +import { DisplayOptions } from '../display-options'; import { Filter } from './filter'; export default function HeaderOptions() { - const { viewType, setViewType } = useViewStore(); - - const handleViewChange = (type: ViewType) => { - setViewType(type); - }; + const { openPanel, togglePanel } = useRightPanelStore(); return (
- - - - - - handleViewChange('list')} - className={cn( - 'w-full text-xs border border-accent flex flex-col gap-1', - viewType === 'list' ? 'bg-accent' : '' - )} - > - - List - - handleViewChange('grid')} - className={cn( - 'w-full text-xs border border-accent flex flex-col gap-1', - viewType === 'grid' ? 'bg-accent' : '' - )} - > - - Board - - - +
+ + +
); } diff --git a/store/display-settings-store.ts b/store/display-settings-store.ts new file mode 100644 index 0000000..fd8524e --- /dev/null +++ b/store/display-settings-store.ts @@ -0,0 +1,102 @@ +import { create } from 'zustand'; +import { createJSONStorage, persist } from 'zustand/middleware'; + +export type GroupingKey = 'status' | 'assignee' | 'priority' | 'project' | 'none'; +export type OrderingKey = 'priority' | 'created' | 'title'; +export type CompletedIssuesFilter = 'all' | 'none'; + +export type DisplayPropertyKey = + | 'id' + | 'status' + | 'priority' + | 'assignee' + | 'labels' + | 'project' + | 'dueDate' + | 'created' + | 'cycle'; + +export const DISPLAY_PROPERTIES: { key: DisplayPropertyKey; label: string }[] = [ + { key: 'id', label: 'ID' }, + { key: 'status', label: 'Status' }, + { key: 'assignee', label: 'Assignee' }, + { key: 'priority', label: 'Priority' }, + { key: 'labels', label: 'Labels' }, + { key: 'project', label: 'Project' }, + { key: 'dueDate', label: 'Due date' }, + { key: 'created', label: 'Created' }, + { key: 'cycle', label: 'Cycle' }, +]; + +const DEFAULT_DISPLAY_PROPERTIES: Record = { + id: true, + status: true, + priority: true, + assignee: true, + labels: true, + project: true, + dueDate: false, + created: true, + cycle: false, +}; + +interface DisplaySettingsState { + grouping: GroupingKey; + ordering: OrderingKey; + orderCompletedByRecency: boolean; + completedIssues: CompletedIssuesFilter; + showSubIssues: boolean; + showEmptyGroups: boolean; + displayProperties: Record; + + setGrouping: (grouping: GroupingKey) => void; + setOrdering: (ordering: OrderingKey) => void; + setOrderCompletedByRecency: (value: boolean) => void; + setCompletedIssues: (value: CompletedIssuesFilter) => void; + setShowSubIssues: (value: boolean) => void; + setShowEmptyGroups: (value: boolean) => void; + toggleDisplayProperty: (key: DisplayPropertyKey) => void; + resetDisplaySettings: () => void; +} + +const DEFAULTS = { + grouping: 'status' as GroupingKey, + ordering: 'priority' as OrderingKey, + orderCompletedByRecency: false, + completedIssues: 'all' as CompletedIssuesFilter, + showSubIssues: true, + showEmptyGroups: false, + displayProperties: DEFAULT_DISPLAY_PROPERTIES, +}; + +/** + * View display settings (Linear's "Display" popover): grouping, ordering, + * completed-issue visibility and per-row display properties. + * Persisted to localStorage. + */ +export const useDisplaySettingsStore = create()( + persist( + (set) => ({ + ...DEFAULTS, + + setGrouping: (grouping) => set({ grouping }), + setOrdering: (ordering) => set({ ordering }), + setOrderCompletedByRecency: (orderCompletedByRecency) => set({ orderCompletedByRecency }), + setCompletedIssues: (completedIssues) => set({ completedIssues }), + setShowSubIssues: (showSubIssues) => set({ showSubIssues }), + setShowEmptyGroups: (showEmptyGroups) => set({ showEmptyGroups }), + toggleDisplayProperty: (key) => + set((state) => ({ + displayProperties: { + ...state.displayProperties, + [key]: !state.displayProperties[key], + }, + })), + resetDisplaySettings: () => set({ ...DEFAULTS }), + }), + { + name: 'display-settings', + storage: createJSONStorage(() => localStorage), + } + ) +); From 537ab818f03598b5860c6db9b17bdc8f94e5e3a2 Mon Sep 17 00:00:00 2001 From: ln-dev7 Date: Sat, 1 Aug 2026 13:37:54 +0000 Subject: [PATCH 10/75] feat(issues): issue detail page with rich content, activity feed and properties --- app/[orgId]/issue/[issueId]/page.tsx | 11 + .../common/issues/details/activity-feed.tsx | 146 +++ .../common/issues/details/content-blocks.tsx | 243 +++++ .../common/issues/details/issue-details.tsx | 119 +++ .../issues/details/issue-properties-panel.tsx | 131 +++ .../layout/headers/issue/header-nav.tsx | 109 ++ components/layout/headers/issue/header.tsx | 5 + mock-data/issue-details.ts | 943 ++++++++++++++++++ 8 files changed, 1707 insertions(+) create mode 100644 app/[orgId]/issue/[issueId]/page.tsx create mode 100644 components/common/issues/details/activity-feed.tsx create mode 100644 components/common/issues/details/content-blocks.tsx create mode 100644 components/common/issues/details/issue-details.tsx create mode 100644 components/common/issues/details/issue-properties-panel.tsx create mode 100644 components/layout/headers/issue/header-nav.tsx create mode 100644 components/layout/headers/issue/header.tsx create mode 100644 mock-data/issue-details.ts diff --git a/app/[orgId]/issue/[issueId]/page.tsx b/app/[orgId]/issue/[issueId]/page.tsx new file mode 100644 index 0000000..78169ad --- /dev/null +++ b/app/[orgId]/issue/[issueId]/page.tsx @@ -0,0 +1,11 @@ +import IssueDetails from '@/components/common/issues/details/issue-details'; +import Header from '@/components/layout/headers/issue/header'; +import MainLayout from '@/components/layout/main-layout'; + +export default function IssueDetailPage() { + return ( + } headersNumber={1}> + + + ); +} diff --git a/components/common/issues/details/activity-feed.tsx b/components/common/issues/details/activity-feed.tsx new file mode 100644 index 0000000..3fbf8cc --- /dev/null +++ b/components/common/issues/details/activity-feed.tsx @@ -0,0 +1,146 @@ +'use client'; + +import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; +import { Button } from '@/components/ui/button'; +import { ActivityItem } from '@/mock-data/issue-details'; +import { users } from '@/mock-data/users'; +import { + Ban, + CircleDot, + GitPullRequestArrow, + Link2, + PenLine, + Plus, + RefreshCcw, + SmilePlus, + Tag, + Unlock, +} from 'lucide-react'; +import { ReactNode, useState } from 'react'; +import { ContentBlocks } from './content-blocks'; + +const EVENT_ICONS: Record = { + created: , + status: , + label: , + priority: , + cycle: , + blocked: , + unblocked: , + related: , + pr: , +}; + +function EventRow({ item }: { item: Extract }) { + return ( +
+ + {EVENT_ICONS[item.event] ?? } + + + {item.actor.name} {item.text} + + · {item.timeAgo} +
+ ); +} + +function CommentCard({ item }: { item: Extract }) { + return ( +
+
+ + + {item.actor.name[0]} + + {item.actor.name} + {item.timeAgo} +
+
+ +
+
+ {item.reactions?.map((reaction) => ( + + {reaction.emoji} {reaction.count} + + ))} + +
+
+ ); +} + +/** + * Issue activity: interleaved events and comments, plus a local + * comment composer (comments are kept in memory only). + */ +export function ActivityFeed({ activity }: { activity: ActivityItem[] }) { + const [items, setItems] = useState(activity); + const [draft, setDraft] = useState(''); + const currentUser = users[0]; + + const submitComment = () => { + const text = draft.trim(); + if (!text) return; + setItems((previous) => [ + ...previous, + { + kind: 'comment', + id: `local-${previous.length}`, + actor: currentUser, + timeAgo: 'just now', + body: [{ type: 'paragraph', text }], + }, + ]); + setDraft(''); + }; + + return ( +
+
+

Activity

+ +
+ +
+ {items.map((item) => + item.kind === 'event' ? ( + + ) : ( + + ) + )} +
+ + {/* Composer */} +
+