cb2024f857
Once every elective set is pinned, the Top Plans panel now renders the user's completed selection as a single "Your Plan" card showing the achievement count and pinned courses. Previously the panel went blank because the all-pinned branch in useAppState cleared topPlans, even though the spec strip was already showing the achievement. Synthesizes a single PlanOutcome from pinnedAssignments + optimizationResult.achieved + the priority scorer; TopPlans detects the all-pinned state via ELECTIVE_SETS.every(...) and bypasses the length>0 filter so a 0-spec completed plan still renders honestly.
1.9 KiB
1.9 KiB
1. State synthesis
- 1.1 In
app/src/state/appState.ts, importmakePriorityScorerfrom../solver/priority - 1.2 Replace the
setTopPlans([])line in theopenSetIds.length === 0early-return branch with a synthesized single-element top-K:{ courseAssignments: pinnedAssignments, achievedSpecs: optimizationResult.achieved, priorityScore: scorer(optimizationResult.achieved) }. KeepsetTreeResults([]),setTopPlansPartial(false),setSearchProgress(null),setTreeLoading(false)as-is - 1.3 Confirm the synthesized state respects external credits implicitly via
optimizationResult.achieved(no extra plumbing needed)
2. UI: detect all-pinned and render
- 2.1 In
app/src/components/TopPlans.tsx, computeconst allPinned = ELECTIVE_SETS.every((s) => pinnedCourses[s.id]) - 2.2 Switch the visibility filter:
const visible = allPinned ? plans : plans.filter((p) => p.achievedSpecs.length > 0) - 2.3 Switch the header text: render
"Your Plan"whenallPinned, otherwise"Top Plans" - 2.4 Hide the "ranked by specs achieved" subtitle when
allPinned
3. Tests + verification
- 3.1 Run the existing 97-test suite; confirm all still pass
- 3.2 Browser verify: pin a single course in every set and observe that Top Plans now renders the completed plan with the same achievement count as the spec strip; header reads "Your Plan"
- 3.3 Browser verify the 0-spec edge case: pin courses that yield no achievement; the panel still shows the plan with
0achievements (no "No plans yet…" placeholder) - 3.4 Browser verify unpin: unpin one set, header reverts to "Top Plans", search runs normally
4. Version + changelog
- 4.1 Bump
__APP_VERSION__and__APP_VERSION_DATE__inapp/vite.config.ts(e.g.,1.5.1) - 4.2 Add a
CHANGELOG.mdentry: completed plan now surfaces in the Top Plans panel as "Your Plan" once every set is pinned; was previously empty