Skip to content

feat: editor switch to liveblocks#52

Merged
carhartlewis merged 2 commits into
mainfrom
lewis/editor
Feb 15, 2025
Merged

feat: editor switch to liveblocks#52
carhartlewis merged 2 commits into
mainfrom
lewis/editor

Conversation

@carhartlewis
Copy link
Copy Markdown
Contributor

@carhartlewis carhartlewis commented Feb 14, 2025

Summary by CodeRabbit

  • New Features

    • Revamped the policy dashboard with a dynamic editor interface, including a publish button and real-time collaboration enhancements.
    • Introduced improved editing capabilities with features like live comment threads and responsive loading states.
  • Refactor

    • Streamlined policy interactions and session management for a more seamless user experience.
    • Updated navigation workflows with synchronous data retrieval for smoother page transitions.
  • Style

    • Refined layouts and spacing across pages for a modern, cleaner look.
    • Enhanced text editor styling, including improved syntax highlighting and collaboration indicators.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 14, 2025

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

Name Status Preview Comments Updated (UTC)
app ❌ Failed (Inspect) Feb 15, 2025 8:37pm
web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 15, 2025 8:37pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 14, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update spans several parts of the application. In the policies dashboard, components now pass a policyId prop for live collaboration, and the page has been restructured to use the useParams hook with a more interactive UI. The Providers component has been enhanced to verify session and policy data while wrapping content in live collaboration providers. In addition, the editor has received offline support improvements and new UI elements, and various layout and styling adjustments were made throughout the web and shared UI assets.

Changes

Files Change Summary
apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/{layout.tsx, providers.tsx, room.tsx, page.tsx, policy-overview.tsx} Updated policies dashboard components: added policyId to Providers, refactored PolicyPage to use useParams synchronously with publish functionality, removed the Room component, and updated AdvancedEditor usage to accept JSONContent.
apps/app/src/components/editor/{advanced-editor.tsx, extensions.ts, selectors/add-comment-selector.tsx, slash-command.tsx, threads.tsx} Enhanced editor functionality: enabled offline support in the liveblocks extension, added Threads and AddCommentSelector components, refined conditional rendering logic, and removed unused import statements.
apps/web/src/app/{(home)/layout.tsx, (home)/page.tsx, components/waitlist-form.tsx, layout.tsx} Modified Home page and overall layout styling: adjusted class names, removed autofocus from inputs, eliminated viewport settings, and refined scrolling and spacing behaviors.
packages/ui/src/{globals.css, text-editor.css} Updated global and text editor styles: removed redundant CSS rules, added new styles for collaboration cursors and dark mode variants, and refined styling for preformatted text and code blocks.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant L as Layout Component
  participant P as Providers
  participant H as usePolicy Hook
  participant LB as LiveblocksProvider/RoomProvider

  U->>L: Request policies dashboard (with ID)
  L->>P: Render Providers with policyId
  P->>H: Fetch policy data using policyId
  H-->>P: Return policy content & session info
  P->>LB: Construct roomId and wrap children
  LB-->>P: Initialize live collaboration session
  P-->>L: Render children with live features
Loading
sequenceDiagram
  participant U as User
  participant PP as PolicyPage
  participant A as useAction
  participant T as Toast

  U->>PP: Click publish button
  PP->>A: Execute publish action
  A-->>PP: Return success response
  PP->>T: Trigger success toast notification
  T-->>U: Display publish confirmation
Loading

Possibly related PRs

  • Mariano/stuff #45: The changes in the main PR are related to the modifications in the Providers component, which now accepts a policyId prop, while the retrieved PR introduces a new PolicyOverview component that also utilizes the policyId prop to fetch and display policy data.
  • Mariano/stuff #44: The changes in the main PR, specifically the addition of the policyId prop to the Providers component in layout.tsx, are related to the modifications in the retrieved PR where the content property is now explicitly typed as InputJsonValue[] in the createOrganizationPolicy function, indicating a connection through the handling of policy data.

Poem

I'm a rabbit hopping through the code,
With changes here and changes there bestowed.
Policy IDs now lead the live collaboration dance,
And editors shine with offline chance.
Hop along with me in this joyous code expanse! 🐇✨


📜 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 2bf6160 and 260c6dc.

📒 Files selected for processing (16)
  • apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/layout.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/page.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/providers.tsx (2 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/policies/[id]/room.tsx (0 hunks)
  • apps/app/src/components/editor/advanced-editor.tsx (4 hunks)
  • apps/app/src/components/editor/extensions.ts (1 hunks)
  • apps/app/src/components/editor/selectors/add-comment-selector.tsx (1 hunks)
  • apps/app/src/components/editor/slash-command.tsx (0 hunks)
  • apps/app/src/components/editor/threads.tsx (2 hunks)
  • apps/app/src/components/policies/policy-overview.tsx (1 hunks)
  • apps/web/src/app/(home)/layout.tsx (1 hunks)
  • apps/web/src/app/(home)/page.tsx (1 hunks)
  • apps/web/src/app/components/waitlist-form.tsx (0 hunks)
  • apps/web/src/app/layout.tsx (1 hunks)
  • packages/ui/src/globals.css (0 hunks)
  • packages/ui/src/text-editor.css (1 hunks)

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

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.

1 participant