@knotpad/app 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/brief.js +165 -78
- package/package.json +6 -86
- package/app/(app)/calendar/page.tsx +0 -57
- package/app/(app)/error.tsx +0 -35
- package/app/(app)/graph/page.tsx +0 -32
- package/app/(app)/guide/page.tsx +0 -21
- package/app/(app)/kanban/loading.tsx +0 -24
- package/app/(app)/kanban/page.tsx +0 -59
- package/app/(app)/layout.tsx +0 -122
- package/app/(app)/list/loading.tsx +0 -21
- package/app/(app)/list/page.tsx +0 -137
- package/app/(app)/loading.tsx +0 -18
- package/app/(app)/notes/[noteId]/page.tsx +0 -84
- package/app/(app)/notes/layout.tsx +0 -30
- package/app/(app)/notes/page.tsx +0 -39
- package/app/(app)/page.tsx +0 -5
- package/app/(app)/settings/agent-token/page.tsx +0 -59
- package/app/(app)/settings/backup/page.tsx +0 -49
- package/app/(app)/settings/billing/page.tsx +0 -53
- package/app/(app)/settings/calendar/page.tsx +0 -41
- package/app/(app)/settings/layout.test.tsx +0 -39
- package/app/(app)/settings/layout.tsx +0 -71
- package/app/(app)/settings/page.tsx +0 -4
- package/app/(app)/settings/security/page.tsx +0 -43
- package/app/(app)/settings/team/page.tsx +0 -74
- package/app/(app)/settings/workspace/page.tsx +0 -27
- package/app/(app)/tasks/[taskId]/page.tsx +0 -79
- package/app/(auth)/forgot-password/page.tsx +0 -106
- package/app/(auth)/guest/page.tsx +0 -56
- package/app/(auth)/layout.tsx +0 -13
- package/app/(auth)/login/page.tsx +0 -14
- package/app/(auth)/register/page.tsx +0 -193
- package/app/(auth)/reset-password/page.tsx +0 -138
- package/app/api/account/claim/route.tsx +0 -135
- package/app/api/admin/backfill-encryption/route.tsx +0 -43
- package/app/api/admin/license/route.tsx +0 -42
- package/app/api/auth/2fa/route.tsx +0 -148
- package/app/api/auth/[...nextauth]/route.tsx +0 -3
- package/app/api/auth/change-password/route.tsx +0 -61
- package/app/api/auth/check-2fa/route.tsx +0 -19
- package/app/api/auth/forgot-password/route.tsx +0 -65
- package/app/api/auth/reset-password/route.tsx +0 -52
- package/app/api/auth/verify-2fa/route.tsx +0 -88
- package/app/api/backup/download/db/route.ts +0 -29
- package/app/api/backup/download/notes/route.ts +0 -25
- package/app/api/backup/settings/route.ts +0 -92
- package/app/api/billing/checkout/route.tsx +0 -81
- package/app/api/billing/migrate/route.tsx +0 -163
- package/app/api/billing/portal/route.tsx +0 -24
- package/app/api/billing/setup-intent/route.tsx +0 -55
- package/app/api/billing/status/route.tsx +0 -36
- package/app/api/billing/subscribe/route.tsx +0 -85
- package/app/api/billing/webhook/route.tsx +0 -199
- package/app/api/calendar-feeds/[feedId]/route.tsx +0 -67
- package/app/api/calendar-feeds/[feedId]/sync/route.tsx +0 -37
- package/app/api/calendar-feeds/events/route.tsx +0 -82
- package/app/api/calendar-feeds/route.tsx +0 -52
- package/app/api/calendar-feeds/sync-all/route.tsx +0 -34
- package/app/api/cron/calendar-feeds/route.tsx +0 -31
- package/app/api/cron/stale-tasks/route.tsx +0 -51
- package/app/api/cron/sync/route.tsx +0 -34
- package/app/api/devices/[deviceId]/route.tsx +0 -25
- package/app/api/devices/route.tsx +0 -41
- package/app/api/export/route.tsx +0 -40
- package/app/api/feedback/route.tsx +0 -54
- package/app/api/folders/[folderId]/route.tsx +0 -51
- package/app/api/folders/route.tsx +0 -37
- package/app/api/graph/route.tsx +0 -242
- package/app/api/guest/route.tsx +0 -58
- package/app/api/health/route.tsx +0 -10
- package/app/api/holidays/countries/route.tsx +0 -14
- package/app/api/holidays/route.tsx +0 -49
- package/app/api/holidays/states/route.tsx +0 -21
- package/app/api/invites/[token]/route.tsx +0 -131
- package/app/api/invites/route.tsx +0 -74
- package/app/api/mcp/generate-token/route.tsx +0 -55
- package/app/api/mcp/revoke-token/[tokenId]/route.tsx +0 -30
- package/app/api/mcp/update-alias/[tokenId]/route.tsx +0 -22
- package/app/api/notes/[noteId]/export/route.tsx +0 -45
- package/app/api/notes/[noteId]/route.tsx +0 -360
- package/app/api/notes/route.tsx +0 -112
- package/app/api/notifications/route.tsx +0 -44
- package/app/api/register/route.tsx +0 -67
- package/app/api/restore/route.tsx +0 -148
- package/app/api/sync/conflicts/[conflictId]/route.tsx +0 -134
- package/app/api/sync/conflicts/route.tsx +0 -48
- package/app/api/sync/status/route.tsx +0 -49
- package/app/api/sync/trigger/route.tsx +0 -15
- package/app/api/tasks/[taskId]/detail/route.tsx +0 -68
- package/app/api/tasks/[taskId]/route.tsx +0 -259
- package/app/api/tasks/bulk/route.tsx +0 -133
- package/app/api/tasks/route.tsx +0 -36
- package/app/api/workspace/active/route.tsx +0 -39
- package/app/api/workspace/create-team/route.tsx +0 -42
- package/app/api/workspace/kanban-statuses/route.tsx +0 -71
- package/app/api/workspace/members/[memberId]/route.tsx +0 -69
- package/app/api/workspace/route.tsx +0 -24
- package/app/download/page.tsx +0 -170
- package/app/favicon.ico +0 -0
- package/app/generated/prisma/client.d.ts +0 -1
- package/app/generated/prisma/client.js +0 -5
- package/app/generated/prisma/default.d.ts +0 -1
- package/app/generated/prisma/default.js +0 -5
- package/app/generated/prisma/edge.d.ts +0 -1
- package/app/generated/prisma/edge.js +0 -497
- package/app/generated/prisma/index-browser.js +0 -523
- package/app/generated/prisma/index.d.ts +0 -46376
- package/app/generated/prisma/index.js +0 -497
- package/app/generated/prisma/package.json +0 -144
- package/app/generated/prisma/query_compiler_fast_bg.js +0 -2
- package/app/generated/prisma/query_compiler_fast_bg.wasm +0 -0
- package/app/generated/prisma/query_compiler_fast_bg.wasm-base64.js +0 -2
- package/app/generated/prisma/runtime/client.d.ts +0 -3386
- package/app/generated/prisma/runtime/client.js +0 -86
- package/app/generated/prisma/runtime/index-browser.d.ts +0 -90
- package/app/generated/prisma/runtime/index-browser.js +0 -6
- package/app/generated/prisma/runtime/wasm-compiler-edge.js +0 -76
- package/app/generated/prisma/schema.prisma +0 -456
- package/app/generated/prisma/wasm-edge-light-loader.mjs +0 -5
- package/app/generated/prisma/wasm-worker-loader.mjs +0 -5
- package/app/globals.css +0 -54
- package/app/invite/[token]/page.tsx +0 -52
- package/app/layout.tsx +0 -90
- package/app/mcp/route.tsx +0 -430
- package/app/opengraph-image.tsx +0 -120
- package/app/page.tsx +0 -398
- package/app/privacy/page.tsx +0 -69
- package/app/robots.tsx +0 -25
- package/app/sitemap.tsx +0 -36
- package/app/terms/page.tsx +0 -69
- package/app/upgrade/page.tsx +0 -75
- package/auth.config.ts +0 -33
- package/auth.ts +0 -79
- package/components/auth/login-form.tsx +0 -302
- package/components/auth/password-checklist.tsx +0 -31
- package/components/auth/password-input.tsx +0 -36
- package/components/auth/switch-account-button.test.tsx +0 -22
- package/components/auth/switch-account-button.tsx +0 -19
- package/components/auth/two-factor-input.tsx +0 -116
- package/components/billing/billing-dashboard.tsx +0 -265
- package/components/billing/card-form.tsx +0 -210
- package/components/billing/claim-account-form.tsx +0 -99
- package/components/branding/app-logo.test.tsx +0 -20
- package/components/branding/app-logo.tsx +0 -25
- package/components/calendar/calendar-agenda.tsx +0 -150
- package/components/calendar/calendar-drag.test.tsx +0 -177
- package/components/calendar/calendar-grid.tsx +0 -357
- package/components/calendar/calendar-hooks.test.tsx +0 -27
- package/components/calendar/calendar-hooks.ts +0 -351
- package/components/calendar/calendar-toolbar.test.tsx +0 -68
- package/components/calendar/calendar-toolbar.tsx +0 -291
- package/components/calendar/calendar-types.ts +0 -148
- package/components/calendar/calendar-view.test.tsx +0 -295
- package/components/calendar/calendar-view.tsx +0 -307
- package/components/calendar/day-detail-popover.tsx +0 -174
- package/components/calendar/task-chip.tsx +0 -86
- package/components/command/command-palette.test.tsx +0 -33
- package/components/command/command-palette.tsx +0 -310
- package/components/download-cta.tsx +0 -87
- package/components/feedback/feedback-popup.tsx +0 -207
- package/components/graph/graph-draw.ts +0 -337
- package/components/graph/graph-overlays.tsx +0 -160
- package/components/graph/graph-page.test.tsx +0 -131
- package/components/graph/graph-page.tsx +0 -263
- package/components/graph/graph-types.ts +0 -47
- package/components/graph/graph-view.tsx +0 -322
- package/components/guide/guide-view.tsx +0 -522
- package/components/kanban/kanban-board.test.tsx +0 -128
- package/components/kanban/kanban-board.tsx +0 -361
- package/components/kanban/kanban-card-menu.tsx +0 -102
- package/components/kanban/kanban-card.tsx +0 -227
- package/components/kanban/kanban-column.tsx +0 -49
- package/components/kanban/kanban-status-context.tsx +0 -28
- package/components/landing/calendar-sandbox.test.tsx +0 -15
- package/components/landing/calendar-sandbox.tsx +0 -107
- package/components/landing/graph-sandbox.test.tsx +0 -27
- package/components/landing/graph-sandbox.tsx +0 -80
- package/components/landing/kanban-sandbox.test.tsx +0 -24
- package/components/landing/kanban-sandbox.tsx +0 -101
- package/components/landing/landing-showcase.test.tsx +0 -21
- package/components/landing/landing-showcase.tsx +0 -54
- package/components/landing/list-sandbox.tsx +0 -86
- package/components/landing/mock-workspace.ts +0 -168
- package/components/landing/notes-sandbox.test.tsx +0 -14
- package/components/landing/notes-sandbox.tsx +0 -88
- package/components/layout/app-shell.tsx +0 -83
- package/components/layout/backup-scheduler.tsx +0 -122
- package/components/layout/bottom-nav.tsx +0 -43
- package/components/layout/icon-bar.test.tsx +0 -29
- package/components/layout/icon-bar.tsx +0 -118
- package/components/layout/mobile-top-bar.tsx +0 -68
- package/components/layout/notes-panel-folder.tsx +0 -127
- package/components/layout/notes-panel-note-item.tsx +0 -140
- package/components/layout/notes-panel-task-tab.tsx +0 -63
- package/components/layout/notes-panel-types.ts +0 -44
- package/components/layout/notes-panel.tsx +0 -476
- package/components/layout/notification-bell.tsx +0 -251
- package/components/layout/paywall-screen.tsx +0 -41
- package/components/layout/pro-banner.tsx +0 -76
- package/components/layout/sw-register.tsx +0 -27
- package/components/layout/workspace-switcher.tsx +0 -90
- package/components/notes/mobile-bottom-sheet.tsx +0 -99
- package/components/notes/note-editor-context-menu.tsx +0 -47
- package/components/notes/note-editor-dom.ts +0 -33
- package/components/notes/note-editor-dropdowns.tsx +0 -484
- package/components/notes/note-editor-hooks.ts +0 -692
- package/components/notes/note-editor-keyboard.ts +0 -305
- package/components/notes/note-editor-overlay.tsx +0 -90
- package/components/notes/note-editor.test.tsx +0 -372
- package/components/notes/note-editor.tsx +0 -662
- package/components/notes/note-preview-pane.tsx +0 -156
- package/components/notes/note-tabs.tsx +0 -120
- package/components/notes/note-types.tsx +0 -157
- package/components/settings/accept-invite.tsx +0 -108
- package/components/settings/agent-token-settings.tsx +0 -369
- package/components/settings/backup-restore-settings.test.tsx +0 -25
- package/components/settings/backup-restore-settings.tsx +0 -327
- package/components/settings/calendar-feeds-settings.tsx +0 -489
- package/components/settings/calendar-general-settings.tsx +0 -174
- package/components/settings/confirm-danger-action.test.tsx +0 -215
- package/components/settings/confirm-danger-action.tsx +0 -65
- package/components/settings/security-settings.tsx +0 -252
- package/components/settings/settings-guidance.test.tsx +0 -98
- package/components/settings/team-settings.tsx +0 -319
- package/components/settings/two-factor-auth.tsx +0 -296
- package/components/settings/workspace-settings-client.tsx +0 -363
- package/components/settings/workspace-settings-form.tsx +0 -73
- package/components/sync/conflict-viewer.tsx +0 -247
- package/components/sync/sync-indicator.tsx +0 -171
- package/components/tasks/snippet-thread.tsx +0 -119
- package/components/tasks/status-dot.tsx +0 -47
- package/components/tasks/task-badge.tsx +0 -43
- package/components/tasks/task-detail.test.tsx +0 -187
- package/components/tasks/task-detail.tsx +0 -458
- package/components/tasks/task-list-filters.test.tsx +0 -75
- package/components/tasks/task-list-filters.tsx +0 -163
- package/components/tasks/task-list-types.ts +0 -20
- package/components/tasks/task-list.test.tsx +0 -175
- package/components/tasks/task-list.tsx +0 -481
- package/components/tasks/task-row.tsx +0 -85
- package/components/tasks/task-table-row.tsx +0 -259
- package/components/ui/skeleton.tsx +0 -3
- package/components/ui/toast.test.tsx +0 -42
- package/components/ui/toast.tsx +0 -70
- package/electron/main.ts +0 -251
- package/electron/preload.ts +0 -56
- package/instrumentation.tsx +0 -23
- package/lib/api-error.ts +0 -50
- package/lib/backup/backup-runner.test.ts +0 -32
- package/lib/backup/backup-runner.ts +0 -19
- package/lib/backup/backup-schedule.test.ts +0 -23
- package/lib/backup/backup-schedule.ts +0 -55
- package/lib/backup/backup-settings.test.ts +0 -30
- package/lib/backup/backup-settings.ts +0 -27
- package/lib/backup/export-notes-zip.test.ts +0 -26
- package/lib/backup/export-notes-zip.ts +0 -82
- package/lib/backup/export-workspace-backup.test.ts +0 -17
- package/lib/backup/export-workspace-backup.ts +0 -77
- package/lib/backup/restore-workspace-from-export.test.ts +0 -18
- package/lib/backup/restore-workspace-from-export.ts +0 -183
- package/lib/backup/types.ts +0 -14
- package/lib/brand-icons.ts +0 -1
- package/lib/calendar-feed-crypto.ts +0 -38
- package/lib/calendar-feed.ts +0 -239
- package/lib/client/online-status.ts +0 -47
- package/lib/conflict-resolver.test.ts +0 -57
- package/lib/conflict-resolver.ts +0 -240
- package/lib/db-init.ts +0 -79
- package/lib/email.ts +0 -159
- package/lib/encryption.test.ts +0 -41
- package/lib/encryption.ts +0 -98
- package/lib/extract-snippet.test.ts +0 -123
- package/lib/extract-snippet.ts +0 -69
- package/lib/kanban-status.ts +0 -55
- package/lib/license.ts +0 -21
- package/lib/limits.ts +0 -31
- package/lib/mcp-auth.test.ts +0 -58
- package/lib/mcp-auth.ts +0 -65
- package/lib/mcp-contract.test.ts +0 -25
- package/lib/mcp-contract.ts +0 -210
- package/lib/mcp-handler.ts +0 -31
- package/lib/mcp-url.test.ts +0 -12
- package/lib/mcp-url.ts +0 -7
- package/lib/mentions.test.ts +0 -45
- package/lib/mentions.ts +0 -73
- package/lib/note-crypto.ts +0 -108
- package/lib/note-sync.ts +0 -201
- package/lib/note-title.ts +0 -93
- package/lib/prisma.ts +0 -193
- package/lib/pro-flush.ts +0 -292
- package/lib/rate-limit.ts +0 -57
- package/lib/stripe.ts +0 -38
- package/lib/sync-worker.ts +0 -388
- package/lib/task-parser.test.ts +0 -91
- package/lib/task-parser.ts +0 -81
- package/lib/task-utils.ts +0 -52
- package/lib/use-is-electron.ts +0 -19
- package/lib/use-is-mobile.ts +0 -22
- package/lib/validation/calendar-feed.ts +0 -31
- package/lib/validation/note.ts +0 -27
- package/lib/validation/task.ts +0 -26
- package/lib/view-preferences.test.ts +0 -54
- package/lib/view-preferences.ts +0 -28
- package/lib/workspace.ts +0 -66
- package/next.config.ts +0 -21
- package/postcss.config.mjs +0 -7
- package/prisma/migrations/20260519021916_init/migration.sql +0 -388
- package/prisma/migrations/20260519061113_drop_sync_password/migration.sql +0 -8
- package/prisma/migrations/20260520065016_add_task_start_date/migration.sql +0 -2
- package/prisma/migrations/20260529010600_remove_encryption_fields/migration.sql +0 -12
- package/prisma/migrations/20260529020000_restore_encryption_salt/migration.sql +0 -3
- package/prisma/migrations/20260529030000_add_folders/migration.sql +0 -17
- package/prisma/migrations/20260605000000_deferred_fixes/migration.sql +0 -31
- package/prisma/migrations/20260605020806_add_pending_sync_to_note_and_task/migration.sql +0 -5
- package/prisma/migrations/20260605063634_add_stripe_webhook_event_sync_lock/migration.sql +0 -14
- package/prisma/migrations/20260605100000_add_prod_indexes/migration.sql +0 -26
- package/prisma/migrations/20260608081404_add_kanban_statuses/migration.sql +0 -23
- package/prisma/migrations/20260611032723_add_calendar_feeds/migration.sql +0 -43
- package/prisma/migrations/20260611040000_add_calendar_feed_color/migration.sql +0 -2
- package/prisma/migrations/20260611050000_add_task_priority/migration.sql +0 -14
- package/prisma/migrations/20260612060000_add_critical_priority/migration.sql +0 -2
- package/prisma/migrations/20260613090000_add_backup_settings/migration.sql +0 -25
- package/prisma/migrations/20260614160000_add_feedback/migration.sql +0 -20
- package/prisma/migrations/20260614210000_add_2fa/migration.sql +0 -4
- package/prisma/migrations/migration_lock.toml +0 -3
- package/prisma/schema.prisma +0 -457
- package/public/Logo_icon.svg +0 -1
- package/public/file.svg +0 -1
- package/public/globe.svg +0 -1
- package/public/icon-192.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/icon.svg +0 -4
- package/public/icon_dark.svg +0 -1
- package/public/knotpad_icon.svg +0 -1
- package/public/knotpad_logo_full.svg +0 -1
- package/public/manifest.json +0 -14
- package/public/next.svg +0 -1
- package/public/sw.js +0 -137
- package/public/vercel.svg +0 -1
- package/public/window.svg +0 -1
- package/tsconfig.json +0 -35
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export type Task = {
|
|
2
|
-
id: string;
|
|
3
|
-
title: string;
|
|
4
|
-
status: string;
|
|
5
|
-
priority?: string | null;
|
|
6
|
-
startDate: string | Date | null;
|
|
7
|
-
dueDate: string | Date | null;
|
|
8
|
-
assigneeType: "HUMAN" | "AGENT";
|
|
9
|
-
claimedBy: string | null;
|
|
10
|
-
claimedByAlias: string | null;
|
|
11
|
-
assignee: { id: string; name: string | null; email: string | null; image: string | null } | null;
|
|
12
|
-
note: { id: string; title: string; folder?: { id: string; name: string } | null };
|
|
13
|
-
createdAt?: string | Date;
|
|
14
|
-
updatedAt?: string | Date;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type SortField = "title" | "status" | "dueDate" | "priority" | "assignee" | "note" | "updatedAt";
|
|
18
|
-
export type SortDirection = "asc" | "desc";
|
|
19
|
-
|
|
20
|
-
export type Props = { tasks: Task[]; groupBy?: "status" | "note" };
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
// @vitest-environment jsdom
|
|
2
|
-
import { cleanup, render, screen } from "@testing-library/react";
|
|
3
|
-
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
-
import { TaskList } from "@/components/tasks/task-list";
|
|
6
|
-
import type { Task } from "@/components/tasks/task-list-types";
|
|
7
|
-
|
|
8
|
-
const pushMock = vi.fn();
|
|
9
|
-
const refreshMock = vi.fn();
|
|
10
|
-
let pathname = "/list";
|
|
11
|
-
let searchParams = new URLSearchParams();
|
|
12
|
-
|
|
13
|
-
vi.mock("next/navigation", () => ({
|
|
14
|
-
useRouter: () => ({ push: pushMock, refresh: refreshMock }),
|
|
15
|
-
usePathname: () => pathname,
|
|
16
|
-
useSearchParams: () => searchParams,
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
vi.mock("@/components/kanban/kanban-status-context", () => ({
|
|
20
|
-
useKanbanStatuses: () => [
|
|
21
|
-
{ key: "TODO", label: "To Do", isVisible: true },
|
|
22
|
-
{ key: "DONE", label: "Done", isVisible: true },
|
|
23
|
-
],
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
vi.mock("@/components/tasks/task-table-row", () => ({
|
|
27
|
-
TaskTableRow: ({
|
|
28
|
-
task,
|
|
29
|
-
detailHref,
|
|
30
|
-
isSelected,
|
|
31
|
-
onSelect,
|
|
32
|
-
}: {
|
|
33
|
-
task: Task;
|
|
34
|
-
detailHref?: string;
|
|
35
|
-
isSelected: boolean;
|
|
36
|
-
onSelect: () => void;
|
|
37
|
-
}) => (
|
|
38
|
-
<tr data-testid="task-row" data-selected={isSelected ? "true" : "false"}>
|
|
39
|
-
<td>
|
|
40
|
-
<input
|
|
41
|
-
aria-label={`Select ${task.title}`}
|
|
42
|
-
type="checkbox"
|
|
43
|
-
checked={isSelected}
|
|
44
|
-
onChange={onSelect}
|
|
45
|
-
/>
|
|
46
|
-
</td>
|
|
47
|
-
<td>
|
|
48
|
-
{detailHref ? <a href={detailHref}>{task.title}</a> : task.title}
|
|
49
|
-
</td>
|
|
50
|
-
</tr>
|
|
51
|
-
),
|
|
52
|
-
}));
|
|
53
|
-
|
|
54
|
-
vi.mock("@/components/tasks/task-row", () => ({
|
|
55
|
-
TaskRow: () => <div data-testid="task-row" />,
|
|
56
|
-
}));
|
|
57
|
-
|
|
58
|
-
function makeTask(overrides: Partial<Task>): Task {
|
|
59
|
-
return {
|
|
60
|
-
id: overrides.id ?? "t1",
|
|
61
|
-
title: overrides.title ?? "Task",
|
|
62
|
-
status: overrides.status ?? "TODO",
|
|
63
|
-
priority: overrides.priority ?? "medium",
|
|
64
|
-
startDate: overrides.startDate ?? null,
|
|
65
|
-
dueDate: overrides.dueDate ?? null,
|
|
66
|
-
assigneeType: overrides.assigneeType ?? "HUMAN",
|
|
67
|
-
claimedBy: overrides.claimedBy ?? null,
|
|
68
|
-
claimedByAlias: overrides.claimedByAlias ?? null,
|
|
69
|
-
assignee: overrides.assignee ?? null,
|
|
70
|
-
note: overrides.note ?? { id: "n1", title: "Launch" },
|
|
71
|
-
createdAt: overrides.createdAt,
|
|
72
|
-
updatedAt: overrides.updatedAt,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
beforeEach(() => {
|
|
77
|
-
pushMock.mockReset();
|
|
78
|
-
refreshMock.mockReset();
|
|
79
|
-
pathname = "/list";
|
|
80
|
-
searchParams = new URLSearchParams();
|
|
81
|
-
window.localStorage.clear();
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
afterEach(() => {
|
|
85
|
-
cleanup();
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
describe("TaskList", () => {
|
|
89
|
-
it("shows a clearer bulk-selection bar after selecting a task", async () => {
|
|
90
|
-
const user = userEvent.setup();
|
|
91
|
-
|
|
92
|
-
render(<TaskList tasks={[makeTask({ id: "t1", title: "Alpha" })]} />);
|
|
93
|
-
|
|
94
|
-
await user.click(screen.getByLabelText("Select Alpha"));
|
|
95
|
-
|
|
96
|
-
expect(screen.getByText("1 task selected")).toBeInTheDocument();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it("applies the overdue saved view preset", async () => {
|
|
100
|
-
const user = userEvent.setup();
|
|
101
|
-
|
|
102
|
-
render(
|
|
103
|
-
<TaskList
|
|
104
|
-
tasks={[
|
|
105
|
-
makeTask({ id: "t1", title: "Overdue task", dueDate: "2026-06-01T00:00:00.000Z" }),
|
|
106
|
-
makeTask({ id: "t2", title: "Fresh task", dueDate: "2026-06-20T00:00:00.000Z" }),
|
|
107
|
-
]}
|
|
108
|
-
/>
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
await user.click(screen.getByRole("button", { name: "Overdue" }));
|
|
112
|
-
|
|
113
|
-
expect(screen.getAllByTestId("task-row")).toHaveLength(1);
|
|
114
|
-
expect(screen.getByText("Overdue task")).toBeInTheDocument();
|
|
115
|
-
expect(screen.queryByText("Fresh task")).not.toBeInTheDocument();
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it("loads saved sort preferences on first render", () => {
|
|
119
|
-
window.localStorage.setItem("brief:list-sort-field", JSON.stringify("updatedAt"));
|
|
120
|
-
window.localStorage.setItem("brief:list-sort-direction", JSON.stringify("desc"));
|
|
121
|
-
|
|
122
|
-
render(
|
|
123
|
-
<TaskList
|
|
124
|
-
tasks={[
|
|
125
|
-
makeTask({ id: "t1", title: "Older task", updatedAt: "2026-06-10T10:00:00.000Z" }),
|
|
126
|
-
makeTask({ id: "t2", title: "Newer task", updatedAt: "2026-06-12T10:00:00.000Z" }),
|
|
127
|
-
]}
|
|
128
|
-
/>
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
expect(screen.getAllByTestId("task-row").map((row) => row.textContent)).toEqual([
|
|
132
|
-
"Newer task",
|
|
133
|
-
"Older task",
|
|
134
|
-
]);
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it("persists sort preferences after a user changes the table sort", async () => {
|
|
138
|
-
const user = userEvent.setup();
|
|
139
|
-
|
|
140
|
-
render(
|
|
141
|
-
<TaskList
|
|
142
|
-
tasks={[
|
|
143
|
-
makeTask({ id: "t1", title: "Bravo" }),
|
|
144
|
-
makeTask({ id: "t2", title: "Alpha" }),
|
|
145
|
-
]}
|
|
146
|
-
/>
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
await user.click(screen.getByRole("columnheader", { name: /title/i }));
|
|
150
|
-
await user.click(screen.getByRole("columnheader", { name: /title/i }));
|
|
151
|
-
|
|
152
|
-
expect(window.localStorage.getItem("brief:list-sort-field")).toBe(JSON.stringify("title"));
|
|
153
|
-
expect(window.localStorage.getItem("brief:list-sort-direction")).toBe(JSON.stringify("desc"));
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it("shows filtered empty-state guidance when no tasks match the current view", () => {
|
|
157
|
-
searchParams = new URLSearchParams("status=DONE");
|
|
158
|
-
|
|
159
|
-
render(<TaskList tasks={[]} />);
|
|
160
|
-
|
|
161
|
-
expect(screen.getByText("No tasks match this view.")).toBeInTheDocument();
|
|
162
|
-
expect(
|
|
163
|
-
screen.getByText("Clear one or more filters, or create tasks from a note.")
|
|
164
|
-
).toBeInTheDocument();
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it("passes a task detail link for the title", () => {
|
|
168
|
-
render(<TaskList tasks={[makeTask({ id: "t1", title: "Alpha" })]} />);
|
|
169
|
-
|
|
170
|
-
expect(screen.getByRole("link", { name: "Alpha" })).toHaveAttribute(
|
|
171
|
-
"href",
|
|
172
|
-
"/tasks/t1?from=%2Flist%3F"
|
|
173
|
-
);
|
|
174
|
-
});
|
|
175
|
-
});
|
|
@@ -1,481 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import Link from "next/link";
|
|
5
|
-
import { usePathname, useSearchParams, useRouter } from "next/navigation";
|
|
6
|
-
import { useKanbanStatuses } from "@/components/kanban/kanban-status-context";
|
|
7
|
-
import { isOverdue } from "@/lib/task-utils";
|
|
8
|
-
import { loadPreference, savePreference } from "@/lib/view-preferences";
|
|
9
|
-
import { TaskRow } from "./task-row";
|
|
10
|
-
import { TaskTableRow } from "./task-table-row";
|
|
11
|
-
import type { Task, SortField, SortDirection, Props } from "./task-list-types";
|
|
12
|
-
|
|
13
|
-
type SavedView = "all" | "overdue" | "unscheduled" | "agent";
|
|
14
|
-
|
|
15
|
-
// Table header component with sort indicators
|
|
16
|
-
function TableHeader({ field, label, className = "", sortField, sortDirection, onSortClick }: {
|
|
17
|
-
field: SortField;
|
|
18
|
-
label: string;
|
|
19
|
-
className?: string;
|
|
20
|
-
sortField: SortField;
|
|
21
|
-
sortDirection: SortDirection;
|
|
22
|
-
onSortClick: (field: SortField) => void;
|
|
23
|
-
}) {
|
|
24
|
-
const isActive = sortField === field;
|
|
25
|
-
return (
|
|
26
|
-
<th
|
|
27
|
-
onClick={() => onSortClick(field)}
|
|
28
|
-
className={`cursor-pointer px-4 py-3 text-left text-xs font-medium text-zinc-400 hover:text-zinc-200 transition-colors ${className}`}
|
|
29
|
-
>
|
|
30
|
-
<div className="flex items-center gap-1">
|
|
31
|
-
{label}
|
|
32
|
-
{isActive && (
|
|
33
|
-
<span className="text-zinc-300">
|
|
34
|
-
{sortDirection === "asc" ? "↑" : "↓"}
|
|
35
|
-
</span>
|
|
36
|
-
)}
|
|
37
|
-
</div>
|
|
38
|
-
</th>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function TaskList({ tasks, groupBy = "status" }: Props) {
|
|
43
|
-
const router = useRouter();
|
|
44
|
-
const pathname = usePathname();
|
|
45
|
-
const searchParams = useSearchParams();
|
|
46
|
-
const kanbanStatuses = useKanbanStatuses();
|
|
47
|
-
const statusOrder = kanbanStatuses.filter((s) => s.isVisible).map((s) => s.key);
|
|
48
|
-
const statusOptions = kanbanStatuses.map((s) => s.key);
|
|
49
|
-
const [optimistic, setOptimistic] = useState<Record<string, string>>({});
|
|
50
|
-
const [updating, setUpdating] = useState<string | null>(null);
|
|
51
|
-
const [statusError, setStatusError] = useState<string | null>(null);
|
|
52
|
-
|
|
53
|
-
// Sorting state
|
|
54
|
-
const [sortField, setSortField] = useState<SortField>(() =>
|
|
55
|
-
loadPreference("brief:list-sort-field", "dueDate")
|
|
56
|
-
);
|
|
57
|
-
const [sortDirection, setSortDirection] = useState<SortDirection>(() =>
|
|
58
|
-
loadPreference("brief:list-sort-direction", "asc")
|
|
59
|
-
);
|
|
60
|
-
const [savedView, setSavedView] = useState<SavedView>(() =>
|
|
61
|
-
loadPreference("brief:list-saved-view", "all")
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
// Selected tasks for bulk actions
|
|
65
|
-
const [selectedTasks, setSelectedTasks] = useState<Set<string>>(new Set());
|
|
66
|
-
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
savePreference("brief:list-sort-field", sortField);
|
|
69
|
-
savePreference("brief:list-sort-direction", sortDirection);
|
|
70
|
-
}, [sortDirection, sortField]);
|
|
71
|
-
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
savePreference("brief:list-saved-view", savedView);
|
|
74
|
-
}, [savedView]);
|
|
75
|
-
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
setSelectedTasks(new Set());
|
|
78
|
-
}, [savedView]);
|
|
79
|
-
|
|
80
|
-
function getStatus(t: Task): string {
|
|
81
|
-
return optimistic[t.id] ?? t.status;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function taskDetailHref(taskId: string) {
|
|
85
|
-
const from = `${pathname}?${searchParams.toString()}`;
|
|
86
|
-
return `/tasks/${taskId}?from=${encodeURIComponent(from)}`;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Sorting function
|
|
90
|
-
function sortTasks(tasksToSort: Task[]): Task[] {
|
|
91
|
-
return [...tasksToSort].sort((a, b) => {
|
|
92
|
-
let comparison = 0;
|
|
93
|
-
|
|
94
|
-
switch (sortField) {
|
|
95
|
-
case "title":
|
|
96
|
-
comparison = a.title.localeCompare(b.title);
|
|
97
|
-
break;
|
|
98
|
-
case "status":
|
|
99
|
-
const aStatusIndex = statusOrder.indexOf(getStatus(a));
|
|
100
|
-
const bStatusIndex = statusOrder.indexOf(getStatus(b));
|
|
101
|
-
comparison = (aStatusIndex === -1 ? 999 : aStatusIndex) - (bStatusIndex === -1 ? 999 : bStatusIndex);
|
|
102
|
-
break;
|
|
103
|
-
case "dueDate":
|
|
104
|
-
const aDue = a.dueDate ? new Date(a.dueDate).getTime() : Infinity;
|
|
105
|
-
const bDue = b.dueDate ? new Date(b.dueDate).getTime() : Infinity;
|
|
106
|
-
comparison = aDue - bDue;
|
|
107
|
-
break;
|
|
108
|
-
case "priority":
|
|
109
|
-
const priorityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
110
|
-
const aPriority = priorityOrder[(a.priority?.toLowerCase() || "medium") as keyof typeof priorityOrder] ?? 2;
|
|
111
|
-
const bPriority = priorityOrder[(b.priority?.toLowerCase() || "medium") as keyof typeof priorityOrder] ?? 2;
|
|
112
|
-
comparison = aPriority - bPriority;
|
|
113
|
-
break;
|
|
114
|
-
case "assignee":
|
|
115
|
-
const aAssignee = a.assignee?.name || a.claimedByAlias || "";
|
|
116
|
-
const bAssignee = b.assignee?.name || b.claimedByAlias || "";
|
|
117
|
-
comparison = aAssignee.localeCompare(bAssignee);
|
|
118
|
-
break;
|
|
119
|
-
case "note":
|
|
120
|
-
comparison = a.note.title.localeCompare(b.note.title);
|
|
121
|
-
break;
|
|
122
|
-
case "updatedAt":
|
|
123
|
-
const aUpdated = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
124
|
-
const bUpdated = b.updatedAt ? new Date(b.updatedAt).getTime() : 0;
|
|
125
|
-
comparison = aUpdated - bUpdated;
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return sortDirection === "asc" ? comparison : -comparison;
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// Handle column header click for sorting
|
|
134
|
-
function handleSortClick(field: SortField) {
|
|
135
|
-
if (sortField === field) {
|
|
136
|
-
setSortDirection(sortDirection === "asc" ? "desc" : "asc");
|
|
137
|
-
} else {
|
|
138
|
-
setSortField(field);
|
|
139
|
-
setSortDirection("asc");
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Toggle task selection
|
|
144
|
-
function toggleTaskSelection(taskId: string) {
|
|
145
|
-
const newSelected = new Set(selectedTasks);
|
|
146
|
-
if (newSelected.has(taskId)) {
|
|
147
|
-
newSelected.delete(taskId);
|
|
148
|
-
} else {
|
|
149
|
-
newSelected.add(taskId);
|
|
150
|
-
}
|
|
151
|
-
setSelectedTasks(newSelected);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Select/deselect all tasks
|
|
155
|
-
function toggleAllTasks() {
|
|
156
|
-
if (selectedTasks.size === filteredTasks.length) {
|
|
157
|
-
setSelectedTasks(new Set());
|
|
158
|
-
} else {
|
|
159
|
-
setSelectedTasks(new Set(filteredTasks.map((task) => task.id)));
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
async function changeStatus(taskId: string, newStatus: string) {
|
|
164
|
-
const prevStatus = getStatus(tasks.find((t) => t.id === taskId)!);
|
|
165
|
-
setOptimistic((prev) => ({ ...prev, [taskId]: newStatus }));
|
|
166
|
-
setUpdating(taskId);
|
|
167
|
-
setStatusError(null);
|
|
168
|
-
try {
|
|
169
|
-
const res = await fetch(`/api/tasks/${taskId}`, {
|
|
170
|
-
method: "PATCH",
|
|
171
|
-
headers: { "Content-Type": "application/json" },
|
|
172
|
-
body: JSON.stringify({ status: newStatus }),
|
|
173
|
-
});
|
|
174
|
-
if (!res.ok) throw new Error(`${res.status}`);
|
|
175
|
-
router.refresh();
|
|
176
|
-
} catch {
|
|
177
|
-
// Revert optimistic state and surface the error
|
|
178
|
-
setOptimistic((prev) => ({ ...prev, [taskId]: prevStatus }));
|
|
179
|
-
setStatusError("Couldn't update status — please try again.");
|
|
180
|
-
} finally {
|
|
181
|
-
setUpdating(null);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Inline edit handlers (Tasks 2.3.1-2.3.3)
|
|
186
|
-
async function updateDueDate(taskId: string, dueDate: string | null) {
|
|
187
|
-
try {
|
|
188
|
-
const res = await fetch(`/api/tasks/${taskId}`, {
|
|
189
|
-
method: "PATCH",
|
|
190
|
-
headers: { "Content-Type": "application/json" },
|
|
191
|
-
body: JSON.stringify({ dueDate }),
|
|
192
|
-
});
|
|
193
|
-
if (!res.ok) throw new Error(`${res.status}`);
|
|
194
|
-
router.refresh();
|
|
195
|
-
} catch {
|
|
196
|
-
setStatusError("Couldn't update due date — please try again.");
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
async function updateAssignee(taskId: string, assigneeType: "HUMAN" | "AGENT", assigneeId?: string) {
|
|
201
|
-
try {
|
|
202
|
-
const body: Record<string, unknown> = { assigneeType };
|
|
203
|
-
if (assigneeType === "AGENT") {
|
|
204
|
-
body.assigneeId = null;
|
|
205
|
-
} else {
|
|
206
|
-
// Explicitly send assigneeId (or null to unassign)
|
|
207
|
-
body.assigneeId = assigneeId ?? null;
|
|
208
|
-
}
|
|
209
|
-
const res = await fetch(`/api/tasks/${taskId}`, {
|
|
210
|
-
method: "PATCH",
|
|
211
|
-
headers: { "Content-Type": "application/json" },
|
|
212
|
-
body: JSON.stringify(body),
|
|
213
|
-
});
|
|
214
|
-
if (!res.ok) throw new Error(`${res.status}`);
|
|
215
|
-
router.refresh();
|
|
216
|
-
} catch {
|
|
217
|
-
setStatusError("Couldn't update assignee — please try again.");
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const errorBanner = statusError ? (
|
|
222
|
-
<div className="flex items-center justify-between gap-2 border-b border-red-800/40 bg-red-950/40 px-3 md:px-6 py-2">
|
|
223
|
-
<span className="text-sm text-red-300">{statusError}</span>
|
|
224
|
-
<button onClick={() => setStatusError(null)} className="text-zinc-500 hover:text-zinc-300 text-xs">✕</button>
|
|
225
|
-
</div>
|
|
226
|
-
) : null;
|
|
227
|
-
|
|
228
|
-
const hasActiveFilters = [
|
|
229
|
-
"note",
|
|
230
|
-
"folder",
|
|
231
|
-
"status",
|
|
232
|
-
"assigneeType",
|
|
233
|
-
"overdue",
|
|
234
|
-
"hasDueDate",
|
|
235
|
-
].some((key) => {
|
|
236
|
-
const value = searchParams.get(key);
|
|
237
|
-
return value !== null && value !== "";
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
const filteredTasks = tasks.filter((task) => {
|
|
241
|
-
if (savedView === "overdue") {
|
|
242
|
-
return isOverdue({ ...task, status: getStatus(task) });
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if (savedView === "unscheduled") {
|
|
246
|
-
return !task.startDate && !task.dueDate;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if (savedView === "agent") {
|
|
250
|
-
return task.assigneeType === "AGENT";
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return true;
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
const showFilteredEmptyState = hasActiveFilters || savedView !== "all";
|
|
257
|
-
const savedViewOptions: { key: SavedView; label: string }[] = [
|
|
258
|
-
{ key: "all", label: "All" },
|
|
259
|
-
{ key: "overdue", label: "Overdue" },
|
|
260
|
-
{ key: "unscheduled", label: "Unscheduled" },
|
|
261
|
-
{ key: "agent", label: "Agent" },
|
|
262
|
-
];
|
|
263
|
-
|
|
264
|
-
const savedViewBar = (
|
|
265
|
-
<div className="flex flex-wrap items-center gap-2 border-b border-zinc-800/60 px-3 py-3 md:px-6">
|
|
266
|
-
<span className="text-xs uppercase tracking-wide text-zinc-500">Views</span>
|
|
267
|
-
<div className="inline-flex flex-wrap rounded-md border border-zinc-800 bg-zinc-950 p-1">
|
|
268
|
-
{savedViewOptions.map((option) => (
|
|
269
|
-
<button
|
|
270
|
-
key={option.key}
|
|
271
|
-
type="button"
|
|
272
|
-
onClick={() => setSavedView(option.key)}
|
|
273
|
-
className={
|
|
274
|
-
savedView === option.key
|
|
275
|
-
? "rounded px-2 py-1 text-xs bg-zinc-800 text-zinc-200"
|
|
276
|
-
: "rounded px-2 py-1 text-xs text-zinc-500 hover:text-zinc-300"
|
|
277
|
-
}
|
|
278
|
-
>
|
|
279
|
-
{option.label}
|
|
280
|
-
</button>
|
|
281
|
-
))}
|
|
282
|
-
</div>
|
|
283
|
-
</div>
|
|
284
|
-
);
|
|
285
|
-
|
|
286
|
-
if (filteredTasks.length === 0) {
|
|
287
|
-
return (
|
|
288
|
-
<>
|
|
289
|
-
{errorBanner}
|
|
290
|
-
{savedViewBar}
|
|
291
|
-
<div className="flex flex-col items-center justify-center gap-3 py-24 text-center">
|
|
292
|
-
{showFilteredEmptyState ? (
|
|
293
|
-
<>
|
|
294
|
-
<p className="text-zinc-500">No tasks match this view.</p>
|
|
295
|
-
<p className="text-sm text-zinc-600">
|
|
296
|
-
Clear one or more filters, or create tasks from a note.
|
|
297
|
-
</p>
|
|
298
|
-
</>
|
|
299
|
-
) : (
|
|
300
|
-
<>
|
|
301
|
-
<p className="text-zinc-500">No tasks yet.</p>
|
|
302
|
-
<p className="text-sm text-zinc-600">
|
|
303
|
-
Write{" "}
|
|
304
|
-
<code className="rounded bg-zinc-800 px-1 py-0.5 text-xs text-zinc-400">
|
|
305
|
-
- [ ] task
|
|
306
|
-
</code>{" "}
|
|
307
|
-
in a note to create tasks automatically.
|
|
308
|
-
</p>
|
|
309
|
-
</>
|
|
310
|
-
)}
|
|
311
|
-
</div>
|
|
312
|
-
</>
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
if (groupBy === "note") {
|
|
317
|
-
const noteMap = new Map<string, { title: string; tasks: Task[] }>();
|
|
318
|
-
for (const t of filteredTasks) {
|
|
319
|
-
if (!noteMap.has(t.note.id)) {
|
|
320
|
-
noteMap.set(t.note.id, { title: t.note.title, tasks: [] });
|
|
321
|
-
}
|
|
322
|
-
noteMap.get(t.note.id)!.tasks.push(t);
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
return (
|
|
326
|
-
<>
|
|
327
|
-
{errorBanner}
|
|
328
|
-
{savedViewBar}
|
|
329
|
-
<div className="divide-y divide-zinc-800/60">
|
|
330
|
-
{[...noteMap.entries()].map(([noteId, { title, tasks: noteTasks }]) => (
|
|
331
|
-
<div key={noteId} className="px-3 md:px-6 py-4">
|
|
332
|
-
<div className="mb-3 flex items-center gap-2">
|
|
333
|
-
<Link href={`/notes/${noteId}`} className="text-sm font-medium text-zinc-300 hover:text-white">
|
|
334
|
-
{title}
|
|
335
|
-
</Link>
|
|
336
|
-
<span className="text-xs text-zinc-600">{noteTasks.length}</span>
|
|
337
|
-
</div>
|
|
338
|
-
<div className="space-y-1">
|
|
339
|
-
{noteTasks
|
|
340
|
-
.sort((a, b) => statusOrder.indexOf(getStatus(a)) - statusOrder.indexOf(getStatus(b)))
|
|
341
|
-
.map((task) => (
|
|
342
|
-
<TaskRow
|
|
343
|
-
key={task.id}
|
|
344
|
-
task={task}
|
|
345
|
-
status={getStatus(task)}
|
|
346
|
-
overdue={isOverdue({ ...task, status: getStatus(task) })}
|
|
347
|
-
updating={updating === task.id}
|
|
348
|
-
detailHref={taskDetailHref(task.id)}
|
|
349
|
-
onStatusChange={changeStatus}
|
|
350
|
-
/>
|
|
351
|
-
))}
|
|
352
|
-
</div>
|
|
353
|
-
</div>
|
|
354
|
-
))}
|
|
355
|
-
</div>
|
|
356
|
-
</>
|
|
357
|
-
);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// When groupBy === "status", show sortable table view
|
|
361
|
-
// Collect orphaned tasks (status not in visible statusOrder) so they aren't shown twice
|
|
362
|
-
const visibleTasks = filteredTasks.filter((t) => statusOrder.includes(getStatus(t)));
|
|
363
|
-
const orphanedTasks = filteredTasks.filter((t) => !statusOrder.includes(getStatus(t)));
|
|
364
|
-
const sortedTasks = sortTasks(visibleTasks);
|
|
365
|
-
const sortedOrphanedTasks = sortTasks(orphanedTasks);
|
|
366
|
-
|
|
367
|
-
// Return sortable table view for status grouping
|
|
368
|
-
return (
|
|
369
|
-
<>
|
|
370
|
-
{errorBanner}
|
|
371
|
-
{savedViewBar}
|
|
372
|
-
|
|
373
|
-
{/* Bulk action bar */}
|
|
374
|
-
{selectedTasks.size > 0 && (
|
|
375
|
-
<div className="sticky top-0 z-10 flex items-center gap-4 border-b border-blue-900/30 bg-blue-950/30 px-4 py-3">
|
|
376
|
-
<span className="text-sm text-blue-100">
|
|
377
|
-
{selectedTasks.size} task{selectedTasks.size === 1 ? "" : "s"} selected
|
|
378
|
-
</span>
|
|
379
|
-
<div className="flex items-center gap-2">
|
|
380
|
-
<select
|
|
381
|
-
onChange={(e) => {
|
|
382
|
-
if (e.target.value) {
|
|
383
|
-
// Bulk status change - would need API endpoint
|
|
384
|
-
alert(`Would change ${selectedTasks.size} tasks to ${e.target.value}`);
|
|
385
|
-
e.target.value = "";
|
|
386
|
-
}
|
|
387
|
-
}}
|
|
388
|
-
className="rounded border border-blue-900/40 bg-zinc-900 px-2 py-1 text-xs text-zinc-200"
|
|
389
|
-
>
|
|
390
|
-
<option value="">Set status...</option>
|
|
391
|
-
{statusOptions.map((s) => (
|
|
392
|
-
<option key={s} value={s}>{s}</option>
|
|
393
|
-
))}
|
|
394
|
-
</select>
|
|
395
|
-
<button
|
|
396
|
-
onClick={() => setSelectedTasks(new Set())}
|
|
397
|
-
className="text-xs text-blue-200/80 hover:text-blue-100"
|
|
398
|
-
>
|
|
399
|
-
Clear
|
|
400
|
-
</button>
|
|
401
|
-
</div>
|
|
402
|
-
</div>
|
|
403
|
-
)}
|
|
404
|
-
|
|
405
|
-
{/* Sortable Table View */}
|
|
406
|
-
<div className="overflow-x-auto">
|
|
407
|
-
<table className="w-full">
|
|
408
|
-
<thead className="border-b border-zinc-800 bg-zinc-900/50">
|
|
409
|
-
<tr>
|
|
410
|
-
<th className="px-3 py-3 w-8">
|
|
411
|
-
<input
|
|
412
|
-
type="checkbox"
|
|
413
|
-
checked={selectedTasks.size === filteredTasks.length && filteredTasks.length > 0}
|
|
414
|
-
onChange={toggleAllTasks}
|
|
415
|
-
className="rounded border-zinc-600 bg-zinc-800 text-blue-600"
|
|
416
|
-
/>
|
|
417
|
-
</th>
|
|
418
|
-
<TableHeader field="title" label="Title" className="w-[35%]" sortField={sortField} sortDirection={sortDirection} onSortClick={handleSortClick} />
|
|
419
|
-
<TableHeader field="status" label="Status" sortField={sortField} sortDirection={sortDirection} onSortClick={handleSortClick} />
|
|
420
|
-
<TableHeader field="dueDate" label="Due" sortField={sortField} sortDirection={sortDirection} onSortClick={handleSortClick} />
|
|
421
|
-
<TableHeader field="priority" label="Priority" sortField={sortField} sortDirection={sortDirection} onSortClick={handleSortClick} />
|
|
422
|
-
<TableHeader field="assignee" label="Assignee" sortField={sortField} sortDirection={sortDirection} onSortClick={handleSortClick} />
|
|
423
|
-
<TableHeader field="note" label="Note/Folder" sortField={sortField} sortDirection={sortDirection} onSortClick={handleSortClick} />
|
|
424
|
-
<TableHeader field="updatedAt" label="Updated" sortField={sortField} sortDirection={sortDirection} onSortClick={handleSortClick} />
|
|
425
|
-
</tr>
|
|
426
|
-
</thead>
|
|
427
|
-
<tbody className="divide-y divide-zinc-800/60">
|
|
428
|
-
{sortedTasks.map((task) => (
|
|
429
|
-
<TaskTableRow
|
|
430
|
-
key={task.id}
|
|
431
|
-
task={task}
|
|
432
|
-
status={getStatus(task)}
|
|
433
|
-
overdue={isOverdue({ ...task, status: getStatus(task) })}
|
|
434
|
-
updating={updating === task.id}
|
|
435
|
-
onStatusChange={changeStatus}
|
|
436
|
-
isSelected={selectedTasks.has(task.id)}
|
|
437
|
-
onSelect={() => toggleTaskSelection(task.id)}
|
|
438
|
-
kanbanStatuses={kanbanStatuses}
|
|
439
|
-
detailHref={taskDetailHref(task.id)}
|
|
440
|
-
onUpdateDueDate={updateDueDate}
|
|
441
|
-
onUpdateAssignee={updateAssignee}
|
|
442
|
-
/>
|
|
443
|
-
))}
|
|
444
|
-
</tbody>
|
|
445
|
-
</table>
|
|
446
|
-
</div>
|
|
447
|
-
|
|
448
|
-
{/* Orphaned tasks section */}
|
|
449
|
-
{sortedOrphanedTasks.length > 0 && (
|
|
450
|
-
<div className="mt-6 border-t border-zinc-800">
|
|
451
|
-
<div className="px-4 py-3 bg-zinc-900/30">
|
|
452
|
-
<span className="inline-flex items-center rounded border border-zinc-600 bg-zinc-800/60 px-2 py-0.5 text-xs font-medium text-zinc-400">
|
|
453
|
-
Uncategorized
|
|
454
|
-
</span>
|
|
455
|
-
<span className="ml-2 text-xs text-zinc-600">{sortedOrphanedTasks.length} tasks with custom status</span>
|
|
456
|
-
</div>
|
|
457
|
-
<table className="w-full">
|
|
458
|
-
<tbody className="divide-y divide-zinc-800/60">
|
|
459
|
-
{sortedOrphanedTasks.map((task) => (
|
|
460
|
-
<TaskTableRow
|
|
461
|
-
key={task.id}
|
|
462
|
-
task={task}
|
|
463
|
-
status={getStatus(task)}
|
|
464
|
-
overdue={isOverdue({ ...task, status: getStatus(task) })}
|
|
465
|
-
updating={updating === task.id}
|
|
466
|
-
onStatusChange={changeStatus}
|
|
467
|
-
isSelected={selectedTasks.has(task.id)}
|
|
468
|
-
onSelect={() => toggleTaskSelection(task.id)}
|
|
469
|
-
kanbanStatuses={kanbanStatuses}
|
|
470
|
-
detailHref={taskDetailHref(task.id)}
|
|
471
|
-
onUpdateDueDate={updateDueDate}
|
|
472
|
-
onUpdateAssignee={updateAssignee}
|
|
473
|
-
/>
|
|
474
|
-
))}
|
|
475
|
-
</tbody>
|
|
476
|
-
</table>
|
|
477
|
-
</div>
|
|
478
|
-
)}
|
|
479
|
-
</>
|
|
480
|
-
);
|
|
481
|
-
}
|