Skip to content

Conversation

@mdroidian
Copy link
Collaborator

@mdroidian mdroidian commented Oct 1, 2025

RE: https://roamresearch.slack.com/archives/CN5MK4D2M/p1759244379313669

Hey guys, after this last update, the “day of the week” label under the DNP title date is no longer being displayed. It disappears when moving forward /backward, reappears if I click on “daily notes” . It’s such a wonderful little feature

This was caused by Roam changing the DOM and wrapping the h1.rm-title-display in adiv.rm-title-display-container flex container for Pages and Sidebar windows. DNP is currently unaffected.

This is still in draft because they are considering wrapping the DNP h1 in the same <div class="rm-title-display-container"> for a consistent DOM structure for dev's to hook into.

UPDATE
<div class="rm-title-display-container"> is now on all cases

Summary by CodeRabbit

  • New Features

    • Added Daily Note banner/subtitle showing weekday and date alongside the title.
    • Automatically adds banners to existing notes and updates banners when new headings or titles appear.
    • Honors the dailySubtitles setting so the feature can be turned off.
  • Chores

    • Package version updated to 1.7.1.

- Fix bug introduced by Roam DOM changes
- Introduced utility functions for parsing dates and creating banners, and implemented an observer for dynamic heading updates.
- Refactored initialization logic to improve readability and maintainability.
@coderabbitai
Copy link

coderabbitai bot commented Oct 1, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds Daily Note Subtitles/Banner: parses dates from H1 headings, creates/inserts day banners, detects duplicates, processes existing headings, and observes new headings via createHTMLObserver. Also bumps package version from 1.7.0 to 1.7.1 and refactors initialization/cleanup to use the new observer lifecycle when enabled.

Changes

Cohort / File(s) Summary
Version bump
package.json
Increment version from 1.7.0 to 1.7.1.
Daily Notes banner feature & observer lifecycle
src/features/dailyNotesPopup.tsx
Add date parsing from H1 headings, createDayBanner and insertBanner utilities, duplicate-banner detection, processing of existing headings, and observer-based dynamic updates via createHTMLObserver. Refactor init/cleanup to use setupHeadingObserver / cleanupHeadingObserver. No exported API changes.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    participant App as App Init
    participant Settings as User Settings
    participant DOM as Document
    participant Observer as createHTMLObserver
    participant Banner as Banner Utils

    App->>Settings: Read dailySubtitles setting
    alt dailySubtitles != "off"
        App->>DOM: processExistingHeadings()
        loop For each heading
            DOM->>Banner: parseDateFromHeading(h)
            alt date parsed and no existing banner
                Banner-->>DOM: createDayBanner(date)
                DOM->>DOM: insertBanner(after title)
            else No-op
            end
        end
        App->>Observer: setupHeadingObserver()
        Observer-->>App: observing
        Note right of Observer: On new/modified H1 nodes
        Observer->>Banner: parseDateFromHeading(new H1)
        alt valid and not duplicated
            Banner-->>DOM: createDayBanner(date)
            DOM->>DOM: insertBanner(after title)
        else No-op
        end
    else
        App->>App: Skip banner setup
    end

    rect rgba(220,240,255,0.5)
    Note over App,Observer: Toggle off triggers cleanupHeadingObserver()
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I nibbled code like clover sprigs,
And hung a banner on the day’s big twigs—
Dates now peek above the title line,
I watch new headings, quick as thyme.
Toggle me off, I’ll hop away, content to dig. 🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit's high-level summary is enabled.
Title Check ✅ Passed The title accurately and succinctly describes the primary change of adding date banners to headings in the Daily Notes Popup, directly reflecting the PR’s main enhancement.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd09fad and 1b96405.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json (1 hunks)
  • src/features/dailyNotesPopup.tsx (3 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mdroidian
Copy link
Collaborator Author

@CodeRabbit full review

@coderabbitai
Copy link

coderabbitai bot commented Oct 1, 2025

✅ Actions performed

Full review triggered.

@mdroidian mdroidian marked this pull request as ready for review October 2, 2025 21:08
@mdroidian
Copy link
Collaborator Author

@CodeRabbit full review

@coderabbitai
Copy link

coderabbitai bot commented Oct 2, 2025

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dd09fad and 1b96405.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json (1 hunks)
  • src/features/dailyNotesPopup.tsx (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/features/dailyNotesPopup.tsx (1)
src/settings.ts (1)
  • get (6-21)

@mdroidian mdroidian merged commit ab22977 into main Oct 2, 2025
2 checks passed
@mdroidian mdroidian deleted the daily-note-subtitle-fix-refactor branch October 2, 2025 21:13
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