Skip to content

Commit 9a2e72c

Browse files
authored
Merge branch 'main' into claude/fix-activity-pagination-bRQDT
2 parents 467abf7 + 41fe44b commit 9a2e72c

6 files changed

Lines changed: 786 additions & 3 deletions

File tree

.claude/napkin.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
## Corrections
44
| Date | Source | What Went Wrong | What To Do Instead |
55
|------|--------|----------------|-------------------|
6+
| 2026-03-01 | self | Started repo exploration before reading `.claude/napkin.md` again | Always run `cat .claude/napkin.md` as the very first command in a new session |
7+
| 2026-03-01 | self | CSV row typing was too narrow (`string | number`) and failed once boolean `isNegative` values were added | For CSV builders, include all emitted scalar types up front (`string | number | boolean`) or coerce before push |
8+
| 2026-03-01 | self | After `pnpm -F web add ...`, got `lockfile only installation` warning and later typecheck failed on missing workspace modules | Run `pnpm install` after filtered add commands when warned about lockfile-only state, then re-run checks |
9+
| 2026-03-01 | self | Added `useMemo` in `LedgerContent` after early loading/null returns, causing hook-order mismatch once data resolved | In client components with async query states, call hooks unconditionally before conditional returns; guard inside hook callback instead |
10+
| 2026-03-01 | self | Set `grid.attributes = ...` on `canvas-datagrid` instance and hit `Cannot assign to read only property 'attributes'` in browser | For `canvas-datagrid` web component path, configure columns via init args (`schema`) and avoid writing DOM `attributes` property |
611
| 2026-02-27 | self | While patching `scripts/perf-test.mjs`, I left the old hardcoded sign-in `goto` line, causing duplicate navigation | Re-open the full file immediately after broad replacements to catch leftover lines before moving on |
712
| 2026-02-27 | self | Imported `@repo/backend/lib/streak` from web tests; package doesn't export that subpath | In web tests, import non-exported backend internals via repo-relative paths (or export them explicitly first) |
813
| 2026-02-27 | self | Ran `ls` before reading `.claude/napkin.md` at session start | Make the first command `cat .claude/napkin.md` before any other command, every session |
@@ -47,6 +52,7 @@
4752
- For production troubleshooting UX, do not add user-facing alerts for transient feed/connection issues; log to Sentry instead.
4853

4954
## Patterns That Work
55+
- In Next App Router root layout, avoid manual `<head>` blocks with `next/script`; keep scripts in `<body>` (or metadata APIs) to reduce head hydration mismatch risk.
5056
- For idea/research tasks, combine source reading with a quick scan of local CI/docs/testing files before proposing changes; recommendations become concrete and repo-specific.
5157
- For CI triage, `gh run view --log-failed <run-id>` plus a targeted local `pnpm -F web test --run <failing files>` quickly separates real assertion failures from suite-load/import failures.
5258
- For prod-to-local Convex refreshes, use `bash scripts/admin-sync-prod-to-local.sh` to avoid manual long-path command errors and keep destructive import behind a confirmation prompt.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
"use client";
2+
3+
import { useState } from "react";
4+
import { cn } from "@/lib/utils";
5+
import type { Id } from "@repo/backend/_generated/dataModel";
6+
import { ActivityTypesList } from "./activity-types-list";
7+
import { AvailabilityView } from "./availability-view";
8+
9+
interface Category {
10+
_id: string;
11+
name: string;
12+
sortOrder?: number;
13+
}
14+
15+
interface ActivityTypesPageContentProps {
16+
challengeId: Id<"challenges">;
17+
activityTypes: Parameters<typeof ActivityTypesList>[0]["activityTypes"];
18+
categoryMap: Map<string, Category>;
19+
streakMinPoints: number;
20+
}
21+
22+
type Tab = "reference" | "availability";
23+
24+
export function ActivityTypesPageContent({
25+
challengeId,
26+
activityTypes,
27+
categoryMap,
28+
streakMinPoints,
29+
}: ActivityTypesPageContentProps) {
30+
const [activeTab, setActiveTab] = useState<Tab>("reference");
31+
32+
return (
33+
<div>
34+
{/* Tab switcher */}
35+
<div className="mb-6 flex rounded-lg bg-zinc-900/50 p-1">
36+
<button
37+
onClick={() => setActiveTab("reference")}
38+
className={cn(
39+
"flex-1 rounded-md px-3 py-2 text-sm font-medium transition",
40+
activeTab === "reference"
41+
? "bg-zinc-800 text-white shadow-sm"
42+
: "text-zinc-400 hover:text-zinc-300"
43+
)}
44+
>
45+
Full Reference
46+
</button>
47+
<button
48+
onClick={() => setActiveTab("availability")}
49+
className={cn(
50+
"flex-1 rounded-md px-3 py-2 text-sm font-medium transition relative",
51+
activeTab === "availability"
52+
? "bg-zinc-800 text-white shadow-sm"
53+
: "text-zinc-400 hover:text-zinc-300"
54+
)}
55+
>
56+
For Me
57+
<span className="ml-1.5 rounded bg-indigo-500/20 px-1.5 py-0.5 text-[10px] font-semibold text-indigo-400">
58+
New
59+
</span>
60+
</button>
61+
</div>
62+
63+
{/* Tab content */}
64+
{activeTab === "reference" && (
65+
<ActivityTypesList
66+
activityTypes={activityTypes}
67+
categoryMap={categoryMap}
68+
streakMinPoints={streakMinPoints}
69+
/>
70+
)}
71+
{activeTab === "availability" && (
72+
<AvailabilityView challengeId={challengeId} />
73+
)}
74+
</div>
75+
);
76+
}

0 commit comments

Comments
 (0)