Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
20af29d
refactor: split the god file apps/web/features/study-logs/presentatio…
HyperAfnan Nov 17, 2026
fd76060
refactor(tasks): extract task board mutation and move seams
HyperAfnan Nov 17, 2026
0af3f01
refactor(tasks): split drag-and-drop hook and retire the cockpit facade
HyperAfnan Nov 17, 2026
a5d622e
refactor(tasks): extract add and edit task dialogs
HyperAfnan Nov 17, 2026
636cd17
refactor(tasks): extract memoized task row, category card, and board …
HyperAfnan Nov 17, 2026
aee28be
refactor(tasks): move modal state to a hook and extract board chrome
HyperAfnan Nov 17, 2026
6939ebb
refactor(tasks): complete task board decomposition
HyperAfnan Nov 17, 2026
9a92cdf
fix: memoization for the tasks
HyperAfnan Nov 17, 2026
482f604
fix(tasks): persist taskType on moves and cascade category column cha…
HyperAfnan Nov 17, 2026
8fa7a12
fix(tasks): finish sync bug fixes, single-column categories, and add …
HyperAfnan Nov 18, 2026
fc25605
fix(tasks): show weekly goals from finished challenges instead of hid…
HyperAfnan Nov 18, 2026
c8d3cf5
next env revert back to prod values
HyperAfnan Nov 18, 2026
6fa7fdc
fix(tasks): close CodeRabbit security and data-integrity findings on …
HyperAfnan Nov 18, 2026
9af3621
fix(tasks): finish CodeRabbit follow-ups on locked goals and drafts
HyperAfnan Nov 18, 2026
b8f899d
fix(tasks): resolve the remaining CodeRabbit findings on merge and re…
HyperAfnan Nov 18, 2026
2a01952
fix(tasks): resolve the remaining PR #292 review findings
HyperAfnan Nov 18, 2026
440ce43
fix(tasks): close the second CodeRabbit review round on #292
HyperAfnan Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ pokemon_metadata.sqlite
# generated prisma client
packages/database/src/generated/
.commandcode/
packages/database/prisma/copy-user-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { describe, expect, it, vi } from "vitest";
import { createElement } from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { TaskMenuItems, CategoryMenuItems } from "./cockpit-task-menu";
import type { TaskItem, CategoryGroup } from "./cockpit-tasks-section";
import type {
BoardTask,
BoardCategory,
} from "@/features/tasks/presentation/task-board";
import type { ChallengeDayOption } from "@/features/study-logs/domain/challenge-day";

const MockItem = ({ children, ...props }: any) =>
Expand Down Expand Up @@ -48,7 +51,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
},
];

const mockTask: TaskItem = {
const mockTask: BoardTask = {
id: "t_test_1",
text: "Finish Chapter 4 Notes",
completed: false,
Expand All @@ -57,7 +60,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
createdAt: "2026-10-02T10:00:00Z",
};

const mockCategory: CategoryGroup = {
const mockCategory: BoardCategory = {
id: "cat_test_1",
name: "Core Subjects",
isCollapsed: false,
Expand Down Expand Up @@ -95,8 +98,35 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
expect(html).not.toContain("Delete Task (Locked)");
});

it("locks every status action when the challenge results are locked", () => {
const html = renderToStaticMarkup(
createElement(TaskMenuItems, {
task: mockTask,
catIdx: 0,
taskType: "weekly",
effectiveTodayDate: "2026-10-02",
dayOptions: mockDayOptions,
selectedDateKey: "2026-10-02",
isResultsLocked: true,
onSetStatus: vi.fn(),
onMoveToDay: vi.fn(),
onEditTask: vi.fn(),
onDeleteTask: vi.fn(),
Item: MockItem,
Separator: MockSeparator,
Label: MockLabel,
})
);

expect(html).toContain("Status (Locked)");
expect(html).not.toContain("Mark as Completed");
expect(html).not.toContain("In Progress");
expect(html).toContain("Edit Task (Locked)");
expect(html).toContain("Delete Task (Locked)");
});

it("renders TaskMenuItems with completed task options", () => {
const completedTask: TaskItem = {
const completedTask: BoardTask = {
...mockTask,
completed: true,
status: "COMPLETED",
Expand Down Expand Up @@ -126,7 +156,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
});

it("locks deletion when task is on a past challenge day", () => {
const pastTask: TaskItem = {
const pastTask: BoardTask = {
...mockTask,
dueDate: "2026-10-01",
createdAt: "2026-10-01T08:00:00Z",
Expand Down Expand Up @@ -154,7 +184,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
});

it("allows deletion when task is on a past day if not in an active challenge (GH-125)", () => {
const pastTask: TaskItem = {
const pastTask: BoardTask = {
...mockTask,
dueDate: "2026-10-01",
createdAt: "2026-10-01T08:00:00Z",
Expand Down Expand Up @@ -210,7 +240,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
});

it("locks delete category option when category contains past tasks", () => {
const categoryWithPastTask: CategoryGroup = {
const categoryWithPastTask: BoardCategory = {
...mockCategory,
tasks: [
{
Expand Down Expand Up @@ -245,7 +275,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
});

it("does NOT lock delete category option when category contains past tasks if not in an active challenge (GH-125)", () => {
const categoryWithPastTask: CategoryGroup = {
const categoryWithPastTask: BoardCategory = {
...mockCategory,
tasks: [
{
Expand Down Expand Up @@ -282,7 +312,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
});

it("does NOT lock delete category option for weekly challenge categories even with tasks on past dates (GH-130)", () => {
const weeklyCategoryWithPastTask: CategoryGroup = {
const weeklyCategoryWithPastTask: BoardCategory = {
...mockCategory,
name: "Weekly Goals",
tasks: [
Expand Down Expand Up @@ -319,7 +349,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
});

it("does not falsely lock weekly category when a daily category shares the same name (GH-130)", () => {
const dailyCatWithPastTask: CategoryGroup = {
const dailyCatWithPastTask: BoardCategory = {
id: "cat_daily_shared",
name: "General",
isCollapsed: false,
Expand All @@ -333,7 +363,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
},
],
};
const weeklyCat: CategoryGroup = {
const weeklyCat: BoardCategory = {
id: "cat_weekly_shared",
name: "General",
isCollapsed: false,
Expand Down Expand Up @@ -371,7 +401,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {

it("locks weekly category deletion when the same category ID contains daily tasks on past challenge days", () => {
const sharedCatId = "cat_shared_sprint";
const dailyCatWithPastTask: CategoryGroup = {
const dailyCatWithPastTask: BoardCategory = {
id: sharedCatId,
name: "Sprint Goals",
isCollapsed: false,
Expand All @@ -385,7 +415,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
},
],
};
const weeklyCat: CategoryGroup = {
const weeklyCat: BoardCategory = {
id: sharedCatId,
name: "Sprint Goals",
isCollapsed: false,
Expand Down Expand Up @@ -544,7 +574,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {

describe("Challenge Goal Scoping & Incomplete Rollover", () => {
it("renders Convert to Personal Goal for challenge-linked weekly task", () => {
const weeklyTask: TaskItem = {
const weeklyTask: BoardTask = {
id: "t_weekly_1",
text: "Pass midterms",
completed: false,
Expand Down Expand Up @@ -577,7 +607,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
});

it("renders Set as Challenge Goal for unlinked weekly task", () => {
const weeklyTask: TaskItem = {
const weeklyTask: BoardTask = {
id: "t_weekly_2",
text: "Personal book reading",
completed: false,
Expand Down Expand Up @@ -610,7 +640,7 @@ describe("CockpitTaskMenu (KAN-18 / Issue #100)", () => {
});

it("renders Roll over to Today when daily task is on a past day", () => {
const pastDailyTask: TaskItem = {
const pastDailyTask: BoardTask = {
id: "t_past_daily",
text: "Unfinished homework",
completed: false,
Expand Down Expand Up @@ -653,10 +683,10 @@ describe("CockpitTaskMenu weekly goal grace lock (Issue #98)", () => {
dueDate: null,
createdAt: new Date(Date.now() - ageHours * HOUR_MS).toISOString(),
challengeId,
} as TaskItem;
} as BoardTask;
}

function renderTaskMenu(task: TaskItem) {
function renderTaskMenu(task: BoardTask) {
return renderToStaticMarkup(
createElement(TaskMenuItems, {
task,
Expand Down Expand Up @@ -702,7 +732,7 @@ describe("CockpitTaskMenu weekly goal grace lock (Issue #98)", () => {
});

it("locks category deletion when it holds a locked weekly goal", () => {
const cat: CategoryGroup = {
const cat: BoardCategory = {
id: "cat_weekly",
name: "Problem Sets",
isCollapsed: false,
Expand Down
Loading
Loading