Skip to content

Conversation

@trangdoan982
Copy link
Collaborator

@trangdoan982 trangdoan982 commented Jul 21, 2025

https://www.loom.com/share/6a80cb8386a1437c836a10a938c13622?sid=579a43b8-dfc3-490a-8cab-c5704aa085a1

Summary by CodeRabbit

  • New Features

    • Added a color field to node type settings, allowing users to assign and edit a color for each node type.
    • Node type lists and suggestion dropdowns now display a small colored circle next to each node type name, visually indicating its assigned color.
  • Style

    • Improved visual alignment and spacing for node type displays and suggestions, enhancing readability and aesthetics.

@linear
Copy link

linear bot commented Jul 21, 2025

@supabase
Copy link

supabase bot commented Jul 21, 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 ↗︎.

@trangdoan982
Copy link
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

📝 Walkthrough

Walkthrough

This change introduces visual color indicators for node types across several components and adds support for editing a "color" field in node type settings. A new color input is provided in the settings UI, and colored dots are displayed next to node type names in selection lists and context views.

Changes

File(s) Change Summary
apps/obsidian/src/components/DiscourseContextView.tsx Enhanced node type display: adds colored circular indicator before node type name if color is defined.
apps/obsidian/src/components/NodeTypeModal.tsx Updated suggestion rendering: adds colored dot before node type name in suggestion list if color is set.
apps/obsidian/src/components/NodeTypeSettings.tsx Adds editable "color" field, color input UI, and color indicator in node type list. Updates types and field configs.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant NodeTypeSettings
    participant DiscourseContextView
    participant NodeTypeModal

    User->>NodeTypeSettings: Opens node type settings
    NodeTypeSettings->>User: Displays editable fields (incl. color input)
    User->>NodeTypeSettings: Edits color and saves
    NodeTypeSettings->>DiscourseContextView: Passes updated color for node type
    NodeTypeSettings->>NodeTypeModal: Passes updated color for node type
    DiscourseContextView->>User: Renders node type with color indicator
    NodeTypeModal->>User: Renders node type suggestions with color indicator
Loading

Estimated code review effort

2 (~18 minutes)

Possibly related PRs


📜 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 e15ca50 and 88043fd.

📒 Files selected for processing (3)
  • apps/obsidian/src/components/DiscourseContextView.tsx (1 hunks)
  • apps/obsidian/src/components/NodeTypeModal.tsx (1 hunks)
  • apps/obsidian/src/components/NodeTypeSettings.tsx (5 hunks)
🧰 Additional context used
🧠 Learnings (2)
apps/obsidian/src/components/DiscourseContextView.tsx (3)

Learnt from: maparent
PR: #220
File: apps/roam/src/utils/conceptConversion.ts:42-56
Timestamp: 2025-06-17T23:37:45.289Z
Learning: In the DiscourseNode interface from apps/roam/src/utils/getDiscourseNodes.ts, the field node.type serves as the UID field rather than having a conventional node.uid field. This is an unusual naming convention where the type field actually contains the unique identifier.

Learnt from: maparent
PR: #220
File: apps/roam/src/utils/conceptConversion.ts:42-56
Timestamp: 2025-06-17T23:37:45.289Z
Learning: In the DiscourseNode interface from apps/roam/src/utils/getDiscourseNodes.ts, the field type serves as the unique identifier field, not a type classification field. The interface has no uid or id field, making node.type the correct field to use for UID-related operations.

Learnt from: sid597
PR: #232
File: apps/roam/src/utils/getAllDiscourseNodesSince.ts:18-31
Timestamp: 2025-06-22T10:40:52.752Z
Learning: In apps/roam/src/utils/getAllDiscourseNodesSince.ts, the user confirmed that querying for ?title with :node/title and mapping it to the text field in the DiscourseGraphContent type is the correct implementation for retrieving discourse node content from Roam Research, despite it appearing to query page titles rather than block text content.

apps/obsidian/src/components/NodeTypeSettings.tsx (2)

Learnt from: maparent
PR: #220
File: apps/roam/src/utils/conceptConversion.ts:42-56
Timestamp: 2025-06-17T23:37:45.289Z
Learning: In the DiscourseNode interface from apps/roam/src/utils/getDiscourseNodes.ts, the field node.type serves as the UID field rather than having a conventional node.uid field. This is an unusual naming convention where the type field actually contains the unique identifier.

Learnt from: maparent
PR: #220
File: apps/roam/src/utils/conceptConversion.ts:42-56
Timestamp: 2025-06-17T23:37:45.289Z
Learning: In the DiscourseNode interface from apps/roam/src/utils/getDiscourseNodes.ts, the field type serves as the unique identifier field, not a type classification field. The interface has no uid or id field, making node.type the correct field to use for UID-related operations.

🔇 Additional comments (8)
apps/obsidian/src/components/NodeTypeModal.tsx (1)

26-35: LGTM! Clean implementation of color indicators.

The color indicator implementation is well-structured with proper conditional rendering and consistent styling. The flex layout and color circle enhance the visual identification of node types.

apps/obsidian/src/components/DiscourseContextView.tsx (1)

52-58: LGTM! Consistent color indicator implementation.

The color indicator follows the same pattern as NodeTypeModal, using proper React styling conventions with the style prop for dynamic background colors.

apps/obsidian/src/components/NodeTypeSettings.tsx (6)

10-10: LGTM! Proper type extension for color support.

The type definition correctly includes "color" as an editable field by removing it from the omitted keys.


17-17: LGTM! Type union properly extended.

The BaseFieldConfig type correctly includes "color" as a valid field type alongside "text" and "select".


71-77: LGTM! Well-structured field configuration.

The color field configuration follows the established pattern with appropriate metadata and is correctly marked as optional.


102-117: LGTM! Robust ColorField component implementation.

The component properly handles color input with good fallback behavior (#000000 default) and consistent error styling patterns.


394-395: LGTM! Proper conditional rendering for color fields.

The render logic correctly identifies and handles color field types, maintaining the existing pattern for other field types.


420-428: LGTM! Consistent visual enhancement in node list.

The color indicator implementation matches the pattern used in other components, providing visual consistency across the application.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@trangdoan982 trangdoan982 requested a review from mdroidian July 21, 2025 20:37
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.

🔥

Let's also add the default colors to the shipped default nodes (clm, evd, etc)

from defaultDiscourseNodes.ts

Claim - #7DA13E (olive green)
Question - #99890e (dark yellow/amber)
Evidence - #DB134A (red)
Source - #9E9E9E (gray)

@trangdoan982 trangdoan982 merged commit 2aa8090 into main Jul 22, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this to Done in General Jul 22, 2025
@trangdoan982 trangdoan982 deleted the eng-602-color-setting-obs branch July 22, 2025 19:08
@coderabbitai coderabbitai bot mentioned this pull request Oct 14, 2025
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