-
Notifications
You must be signed in to change notification settings - Fork 4
[ENG-509] Convert existing page to node #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughThe 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
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
Possibly related PRs
Suggested reviewers
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this 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
📒 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 && !isSubmittingprevents 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.
mdroidian
left a comment
There was a problem hiding this 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.
https://www.loom.com/share/9fede979081b4db1ad611bf8c3835bc1
Summary by CodeRabbit