Skip to content

Conversation

@trangdoan982
Copy link
Collaborator

@trangdoan982 trangdoan982 commented Jun 25, 2025

https://www.loom.com/share/9fede979081b4db1ad611bf8c3835bc1

Summary by CodeRabbit

  • New Features
    • Added the ability to pre-fill the node title and type when opening the node creation modal.
    • Introduced a "Convert into" option in the file context menu, allowing users to convert files into discourse nodes of a selected type directly from the menu.
  • Improvements
    • The node creation form now only submits when valid and not already submitting, improving form usability.
  • Notifications
    • Users receive confirmation or error notices during the file-to-node conversion process.

@linear
Copy link

linear bot commented Jun 25, 2025

@vercel
Copy link

vercel bot commented Jun 25, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
discourse-graph ⬜️ Skipped (Inspect) Jun 25, 2025 8:31pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 25, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The changes introduce the ability to pre-fill the node creation modal and form with an initial title and node type. The plugin now adds a "Convert into" context menu for files, letting users convert a file into a discourse node of a selected type. This is supported by a new utility function that handles the conversion process, including renaming and updating frontmatter.

Changes

File(s) Change Summary
apps/obsidian/src/components/CreateNodeModal.tsx Added optional initialTitle and initialNodeType props to modal and form; updated state initialization and handlers
apps/obsidian/src/index.ts Registered file-menu event; added "Convert into" menu; opens modal pre-filled; invokes conversion utility
apps/obsidian/src/utils/createNode.ts Added async convertPageToDiscourseNode function for file-to-node conversion, renaming, and frontmatter updates

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Obsidian
    participant Plugin
    participant CreateNodeModal
    participant Utils

    User->>Obsidian: Open file context menu
    Obsidian->>Plugin: Emit "file-menu" event
    Plugin->>Plugin: Check file nodeTypeId
    Plugin->>Obsidian: Add "Convert into" menu if needed
    User->>Obsidian: Select node type from submenu
    Obsidian->>CreateNodeModal: Open modal with initial title & node type
    User->>CreateNodeModal: Confirm creation
    CreateNodeModal->>Plugin: Submit node creation
    Plugin->>Utils: convertPageToDiscourseNode(file, nodeType)
    Utils->>Plugin: Update file frontmatter, rename file
    Plugin->>User: Show confirmation notice
Loading

Possibly related PRs

Suggested reviewers

  • mdroidian

Poem

In the garden of notes, a menu appears,
"Convert into node!"—the bunny now cheers.
With titles and types, pre-filled with delight,
Files hop to new forms in the soft Obsidian light.
Rename and refresh, all with a click—
This bunny’s new feature is clever and quick! 🐇✨


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 docstrings to generate docstrings for this 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.

@supabase
Copy link

supabase bot commented Jun 25, 2025

This pull request has been ignored for the connected project plzkmulvmuhdpcmnyrhm because there are no changes detected in projects/database/supabase/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 review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 25, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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 12b2190 and 5c906e8.

📒 Files selected for processing (3)
  • apps/obsidian/src/components/CreateNodeModal.tsx (5 hunks)
  • apps/obsidian/src/index.ts (2 hunks)
  • apps/obsidian/src/utils/createNode.ts (1 hunks)
🔇 Additional comments (10)
apps/obsidian/src/index.ts (3)

1-1: LGTM! Import additions are appropriate.

The new imports support the file conversion functionality correctly.


7-12: LGTM! Import organization is clean.

The imports are properly organized and support the new conversion workflow.


35-79: Well-implemented file context menu integration.

The event listener logic is solid:

  • Correctly checks for existing nodeTypeId in frontmatter
  • Only shows convert menu for files that aren't already discourse nodes
  • Proper integration with the CreateNodeModal
  • Good use of submenu for node type selection

The @ts-ignore comments are acceptable here since they're documented and the unofficial API is stable in Obsidian.

apps/obsidian/src/components/CreateNodeModal.tsx (7)

12-13: LGTM! Optional props are well-typed.

The addition of optional initial value props enhances the modal's flexibility appropriately.


21-26: LGTM! State initialization with initial values.

The state initialization correctly uses the initial values with proper fallbacks.


40-40: Excellent UX improvement to the Enter key handler.

The enhanced condition isFormValid && !isSubmitting prevents accidental submissions and improves user experience.


158-159: LGTM! Props interface extension is consistent.

The modal props interface properly mirrors the form props for the initial values.


170-171: LGTM! Private member additions are appropriate.

The modal class correctly stores the initial values as private members.


178-179: LGTM! Constructor properly initializes members.

The constructor correctly assigns the initial values from props.


194-195: LGTM! Props are correctly passed to the form component.

The initial values are properly passed down to the CreateNodeForm component.

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.

🤘

Awesome that you noticed the whether we should put this in the specified folder or not. I'll go ahead and merge this as is, but that should be brought up with @jsmorabito. I'll tag him in the linear ticket.

@mdroidian mdroidian merged commit 5f582b8 into main Jun 25, 2025
4 checks passed
@mdroidian mdroidian deleted the eng-509-convert-page branch June 25, 2025 22:44
@github-project-automation github-project-automation bot moved this to Done in General Jun 25, 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