Skip to content

Conversation

@sid597
Copy link
Collaborator

@sid597 sid597 commented Sep 28, 2025

refer eng-732-left-side-panel-for-suggestive-mode for main pr

@linear
Copy link

linear bot commented Sep 28, 2025

@supabase
Copy link

supabase bot commented Sep 28, 2025

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Copy link
Collaborator Author

sid597 commented Sep 28, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sid597 sid597 changed the title extract suggestive mode personal setting Render suggestive mode overlay button Sep 28, 2025
@sid597 sid597 marked this pull request as ready for review September 28, 2025 19:09
@sid597 sid597 requested a review from mdroidian September 28, 2025 19:09
@mdroidian
Copy link
Contributor

@CodeRabbit full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 28, 2025

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 28, 2025

📝 Walkthrough

Walkthrough

Adds a new Suggestive Mode overlay feature: implements a React overlay component with a render entry point, wires a new page-ref observer/handler to render it, and exposes a user setting to enable/disable the observer. Integration touches settings UI, observer initialization, and page-ref handler logic.

Changes

Cohort / File(s) Summary
Suggestive overlay component
apps/roam/src/components/SuggestiveModeOverlay.tsx
New React overlay component and render entry renderSuggestive. Includes lazy render wrapper, highlight toggling, panel open/close handling, and mounting via ExtensionApiContextProvider. Exports default SuggestiveModeOverlay and named renderSuggestive.
Observers and handlers
apps/roam/src/utils/pageRefObserverHandlers.ts, apps/roam/src/utils/initializeObserversAndListeners.ts
Adds suggestive overlay observer path: new getSuggestiveOverlayHandler and suggestiveOverlayPageRefHandler, marking nodes with data-discourse-suggestive-overlay and invoking renderSuggestive. Initializes the observer conditionally based on the setting in initializeObserversAndListeners.ts.
Settings UI
apps/roam/src/components/settings/HomePersonalSettings.tsx
Adds “Suggestive Mode Overlay” Checkbox tied to extensionAPI.settings["suggestive-mode-overlay"]. On change, updates setting and triggers onPageRefObserverChange(getSuggestiveOverlayHandler(onloadArgs)).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Settings as Settings UI
  participant Init as Observer Init
  participant Observer as PageRef Observer
  participant Handler as suggestiveOverlayPageRefHandler
  participant Renderer as renderSuggestive
  participant React as SuggestiveModeOverlay (React)

  User->>Settings: Toggle "Suggestive Mode Overlay"
  Settings-->>Init: onPageRefObserverChange(handler)
  Init->>Observer: addPageRefObserver(getSuggestiveOverlayHandler)

  Note over Observer,Handler: On matching page-ref span appears
  Observer->>Handler: handle(span, onloadArgs)
  Handler->>Handler: Gate checks (parent, tag, data attr)
  Handler->>Renderer: renderSuggestive({ tag, parent, onloadArgs })
  Renderer->>React: Mount component into parent
  React-->>Observer: Overlay mounted

  User->>React: Click toggle button
  React->>React: Open/close panel, toggle highlights
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Render suggestive mode overlay button” clearly and concisely conveys the primary change introduced by this pull request, namely the rendering of a UI button for the suggestive mode overlay, aligning with the core additions in the component and settings files without extraneous detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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.

Copy link
Contributor

@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 8464cf1 and 3db29ed.

📒 Files selected for processing (4)
  • apps/roam/src/components/SuggestiveModeOverlay.tsx (1 hunks)
  • apps/roam/src/components/settings/HomePersonalSettings.tsx (2 hunks)
  • apps/roam/src/utils/initializeObserversAndListeners.ts (2 hunks)
  • apps/roam/src/utils/pageRefObserverHandlers.ts (3 hunks)
🔇 Additional comments (3)
apps/roam/src/utils/initializeObserversAndListeners.ts (1)

146-148: Nice alignment with existing observer gating

Conditionally adding the suggestive observer before the shared enable step mirrors the other overlay flows and keeps the initialization order intact. Looks good.

apps/roam/src/components/settings/HomePersonalSettings.tsx (1)

80-104: Setting toggle wiring looks solid

The new checkbox mirrors the discourse overlay toggle, persists the setting, and hooks into onPageRefObserverChange with the cached handler. No concerns here.

apps/roam/src/utils/pageRefObserverHandlers.ts (1)

21-83: Parallel handler implementation looks good

The suggestive overlay handler mirrors the discourse overlay flow, including tag resolution, data-attribute gating, and parent insertion. This keeps the observer semantics consistent. Nicely done.

Copy link
Contributor

@mdroidian mdroidian left a comment

Choose a reason for hiding this comment

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

Added via Giphy

@sid597 sid597 merged commit 2460c97 into main Sep 29, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this to Done in General Sep 29, 2025
trangdoan982 pushed a commit that referenced this pull request Oct 3, 2025
* extract suggestive mode personal setting

* add home setting

* remove console log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants