Skip to content

Make Daily Notes collapsible and move above Entry Type selector#25

Merged
aidmax merged 1 commit intomainfrom
claude/add-daily-notes-field-3VeaZ
May 6, 2026
Merged

Make Daily Notes collapsible and move above Entry Type selector#25
aidmax merged 1 commit intomainfrom
claude/add-daily-notes-field-3VeaZ

Conversation

@aidmax
Copy link
Copy Markdown
Owner

@aidmax aidmax commented May 6, 2026

Summary

  • Registers "daily-notes" as a proper SectionId so it participates in Expand/Collapse All and persists open/closed state alongside other sections
  • Moves the Daily Notes block from below Entry Type to between Date and Entry Type — date-level context that is independent of entry type
  • Wraps Daily Notes in CollapsibleSection (open by default) instead of a plain static div

Changes

File What
use-section-state.ts Add "daily-notes" to SectionId union and ALL_SECTION_IDS
home.tsx Add "daily-notes" to SECTION_DEFAULTS (open), FIELD_TO_SECTION, and all three VISIBLE_SECTIONS_BY_TYPE arrays; swap plain div for CollapsibleSection; reorder Date → Daily Notes → Entry Type
use-section-state.test.ts Complete test fixtures to include all 8 section IDs (was already missing "rest-day" and "activity")
CLAUDE.md Update section IDs list and default expansion docs

Test plan

  • Daily Notes collapses and expands via its header chevron
  • Expand All / Collapse All includes Daily Notes
  • Open/closed state persists across page reloads
  • Daily Notes appears between Date and Entry Type on all three entry types (cycling, rest, other)
  • All 97 tests pass (npm run test:run)

https://claude.ai/code/session_01WCETrYAfnUPD7wzy3YZUyi


Generated by Claude Code

Registers "daily-notes" as a proper section ID so it participates in
expand/collapse all and persists open/closed state like other sections.
Moves the block from below Entry Type to between Date and Entry Type,
reflecting that daily notes are date-level context independent of type.

- use-section-state: add "daily-notes" to SectionId union and ALL_SECTION_IDS
- home.tsx: add "daily-notes" to SECTION_DEFAULTS (open), FIELD_TO_SECTION,
  and all three VISIBLE_SECTIONS_BY_TYPE arrays; wrap Daily Notes in
  CollapsibleSection; reorder Date → Daily Notes → Entry Type
- use-section-state.test.ts: add "daily-notes"/"rest-day"/"activity" to
  test defaults and persisted fixtures to match complete SectionId set
- CLAUDE.md: update section IDs list and default expansion docs

https://claude.ai/code/session_01WCETrYAfnUPD7wzy3YZUyi
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 6, 2026

Greptile Summary

This PR registers "daily-notes" as a first-class SectionId, moves the Daily Notes block above the Entry Type selector, and wraps it in a CollapsibleSection (open by default). All relevant data structures—SECTION_DEFAULTS, FIELD_TO_SECTION, and VISIBLE_SECTIONS_BY_TYPE—are updated consistently, and the test fixtures are brought in line with the full 8-ID SectionId union.

  • use-section-state.ts: "daily-notes" added to both the union type and ALL_SECTION_IDS, ensuring localStorage merge/migration works correctly for existing users.
  • home.tsx: Daily Notes moved between Date and Entry Type, plain div replaced with CollapsibleSection; all three VISIBLE_SECTIONS_BY_TYPE arrays include "daily-notes" so Expand All / Collapse All covers it on every entry type.
  • use-section-state.test.ts: Fixtures extended with the previously missing "rest-day", "activity", and new "daily-notes" keys, making the Record<SectionId, boolean> objects complete.

Confidence Score: 5/5

Safe to merge — all changes are additive, internally consistent, and well-tested.

Every data structure touched by the new section ID is updated together. The localStorage merge logic already handles new keys gracefully, so existing users' stored state will silently gain the new default. Test fixtures were correctly extended to cover the full key set, and the rendered component follows the same controlled CollapsibleSection pattern used by every other section in the form.

No files require special attention.

Important Files Changed

Filename Overview
client/src/hooks/use-section-state.ts Adds "daily-notes" to SectionId union and ALL_SECTION_IDS; no logic changes, straightforward extension.
client/src/pages/home.tsx Replaces the static Daily Notes div with a CollapsibleSection, moves it above Entry Type, and updates all section-state bookkeeping; changes are internally consistent across SECTION_DEFAULTS, FIELD_TO_SECTION, and VISIBLE_SECTIONS_BY_TYPE.
client/src/test/hooks/use-section-state.test.ts Test fixtures completed with the previously absent "rest-day", "activity", and new "daily-notes" keys; all test scenarios remain valid.
CLAUDE.md Documentation updated to reflect the new section ID and its default expansion state; matches production code.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Form renders] --> B[Date Section - unconditional]
    B --> C[Daily Notes CollapsibleSection - unconditional]
    C --> D{Entry Type Selector}
    D -->|cycling| E[Core Metrics\nFueling\nPerformance\nRecovery\nReflection]
    D -->|rest| F[Recovery\nRest Day]
    D -->|other| G[Activity]

    subgraph VISIBLE_SECTIONS_BY_TYPE
        cycling_ids[cycling: daily-notes, core-metrics, fueling, performance-metrics, recovery-metrics, reflection]
        rest_ids[rest: daily-notes, recovery-metrics, rest-day]
        other_ids[other: daily-notes, activity]
    end

    subgraph Expand_All_Collapse_All
        H[allExpanded = visibleSectionIds.every sectionStates]
        H --> I[expandAllOrCollapseAll toggles all visible including daily-notes]
    end

    subgraph localStorage_persistence
        J[ALL_SECTION_IDS - 8 keys including daily-notes]
        J --> K[Merge stored vs defaults on mount]
        K --> L[Unknown keys dropped, missing keys use defaults]
    end
Loading

Reviews (1): Last reviewed commit: "Make Daily Notes collapsible and move it..." | Re-trigger Greptile

@aidmax aidmax merged commit 0c698fe into main May 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants