Skip to content

feat: enhance text properties panel with additional styling#469

Closed
dipanshurdev wants to merge 2 commits into
OpenCut-app:mainfrom
dipanshurdev:patch03
Closed

feat: enhance text properties panel with additional styling#469
dipanshurdev wants to merge 2 commits into
OpenCut-app:mainfrom
dipanshurdev:patch03

Conversation

@dipanshurdev
Copy link
Copy Markdown
Contributor

@dipanshurdev dipanshurdev commented Jul 27, 2025

Description

This PR introduces a significant enhancement to the TextProperties panel, enabling users to customize a wide range of text styles directly from the sidebar UI. This improvement provides a more complete and flexible editing experience.

Key Changes:

Added support for updating the following text properties:

  • backgroundColor
  • fontStyle, textDecoration
  • opacity
  • Positioning via x, y and rotation
  • Integrated with updateTextElement function from timeline-store to ensure centralized state updates.
  • Reused consistent UI components (Textarea, Slider, Input, FontPicker, etc.) from the existing system and Shadcn UI.

Screenshot

Screenshot 2025-07-27 135740

Notes:

  • The feature is fully functional and scoped to the TextProperties UI component.
  • No breaking changes or state management refactors outside of component usage.
  • Future enhancements could include support for presets or live previews.

Summary by CodeRabbit

  • New Features

    • Added controls for bold, italic, and underline text styles.
    • Introduced sliders for font size and opacity adjustments.
    • Added color pickers for text and background colors.
    • Included numeric inputs for text rotation and position (X and Y coordinates).
  • Style

    • Improved UI styling for sliders, color inputs, and toggle buttons in the properties panel.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jul 27, 2025

👷 Deploy request for appcut pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit d8ac753

@vercel
Copy link
Copy Markdown

vercel Bot commented Jul 27, 2025

@dipanshurdev is attempting to deploy a commit to the OpenCut OSS Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 27, 2025

Walkthrough

The TextProperties component was updated to introduce new UI controls for text elements, including toggles for bold, italic, and underline styles, background color selection, rotation, opacity, and position (X/Y) inputs. The component now allows more comprehensive text styling and positioning adjustments, with all new controls updating the text element state accordingly.

Changes

File(s) Change Summary
apps/web/src/components/editor/properties-panel/text-properties.tsx Enhanced TextProperties with toggles for bold/italic/underline, background color input, rotation, opacity, and position controls; improved styling and update logic for text attributes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TextProperties
    participant updateTextElement

    User->>TextProperties: Interacts with UI controls (e.g., toggles, sliders, inputs)
    TextProperties->>updateTextElement: Calls with updated property and value
    updateTextElement-->>TextProperties: Updates text element state
    TextProperties-->>User: Reflects changes in UI
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • feat: update text color #454: Also modifies TextProperties to extend text color functionality using updateTextElement, overlapping with the current PR's expanded text styling controls.

Poem

In the panel where the text resides,
New buttons and sliders now coincide.
Bold, italic, colors anew—
Opacity and rotation join the crew!
X and Y for perfect place,
A bunny hops to style with grace.
🐇✨


📜 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 8a987eb and d8ac753.

📒 Files selected for processing (1)
  • apps/web/src/components/editor/properties-panel/text-properties.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/components/editor/properties-panel/text-properties.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build (windows-latest)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 generate unit tests to generate unit tests for 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.

Copy link
Copy Markdown
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: 0

🧹 Nitpick comments (3)
apps/web/src/components/editor/properties-panel/text-properties.tsx (3)

13-24: Consider cleaning up commented imports.

The new imports are correctly structured and necessary for the enhanced functionality. However, consider removing the commented imports if they're not planned for immediate implementation, or document them with a TODO comment explaining the planned usage.

-  // AlignLeft,
-  // AlignCenter,
-  // AlignRight,
-  // RotateCw,
-  // Eye,
+  // TODO: Add alignment and visibility controls
+  // AlignLeft, AlignCenter, AlignRight, RotateCw, Eye,

149-163: Consider adding rotation value validation.

The rotation input implementation is correct with proper fallback and type conversion. However, consider adding validation to constrain rotation values to a meaningful range (e.g., 0-360 degrees) to prevent unexpected behavior.

onChange={(e) =>
  updateTextElement(trackId, element.id, {
-    rotation: parseInt(e.target.value),
+    rotation: Math.max(0, Math.min(360, parseInt(e.target.value) || 0)),
  })
}

178-214: Good position control implementation with minor styling suggestions.

The position inputs are well-implemented with proper fallback handling and visual clarity. Consider these minor improvements:

-        <PropertyItemValue className="flex gap-2 ">
-          <div className="flex w-2/4 flex-row items-center justify-center">
+        <PropertyItemValue className="flex gap-2">
+          <div className="flex w-1/2 flex-row items-center justify-center">
             <span>
               <TbLetterX className="text-base font-bold text-primary" />
             </span>
             <Input
               type="number"
               value={element.x ?? 0}
               onChange={(e) =>
                 updateTextElement(trackId, element.id, {
                   x: parseInt(e.target.value),
                 })
               }
               className="w-14"
               placeholder="X"
             />
           </div>
-          <div className="flex w-2/4 flex-row items-center justify-center">
+          <div className="flex w-1/2 flex-row items-center justify-center">
  • Use w-1/2 instead of w-2/4 for better semantic clarity
  • Remove trailing space in className
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14475dc and 8a987eb.

📒 Files selected for processing (1)
  • apps/web/src/components/editor/properties-panel/text-properties.tsx (3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: simonorzel26
PR: OpenCut-app/OpenCut#324
File: apps/web/src/components/editor/snap-indicator.tsx:43-43
Timestamp: 2025-07-17T08:26:10.961Z
Learning: In the timeline refactor PR #324, the snap indicator component in apps/web/src/components/editor/snap-indicator.tsx requires the hard-coded `ml-48` class in addition to the calculated `leftPosition` for proper alignment. This is intentional and needed for the new timeline layout.
apps/web/src/components/editor/properties-panel/text-properties.tsx (1)

Learnt from: simonorzel26
PR: #324
File: apps/web/src/components/editor/snap-indicator.tsx:43-43
Timestamp: 2025-07-17T08:26:10.961Z
Learning: In the timeline refactor PR #324, the snap indicator component in apps/web/src/components/editor/snap-indicator.tsx requires the hard-coded ml-48 class in addition to the calculated leftPosition for proper alignment. This is intentional and needed for the new timeline layout.

🔇 Additional comments (5)
apps/web/src/components/editor/properties-panel/text-properties.tsx (5)

68-68: Good UX improvement.

Adding cursor-pointer to the slider improves the user experience by providing visual feedback for interactivity.


87-98: Excellent UX improvements for text color control.

The changes enhance both clarity and usability:

  • More descriptive label "Text color" vs "Color"
  • Better visual styling with cursor-pointer and rounded-full
  • Proper fallback handling with #ffffff

99-113: Well-implemented background color control.

The implementation is consistent with the existing text color control and uses appropriate defaults:

  • Transparent fallback (#00000000) is suitable for background color
  • Consistent styling and update pattern
  • Proper integration with the timeline store

164-177: Excellent opacity control implementation.

The opacity slider is well-implemented:

  • Appropriate range (0-1) matching CSS opacity values
  • Good precision with 0.01 step for fine control
  • Proper fallback to 1 (fully opaque)
  • Consistent update pattern

114-148: Text style toggles implementation approved

I’ve verified that the TextElement interface (apps/web/src/types/timeline.ts:23–33) includes
• fontWeight: "normal" | "bold"
• fontStyle: "normal" | "italic"
• textDecoration: "none" | "underline" | "line-through"

No further changes required here. Great work!

@mazeincoding
Copy link
Copy Markdown
Collaborator

this has been resolved in #467 :)

@mazeincoding
Copy link
Copy Markdown
Collaborator

mazeincoding commented Jul 30, 2025

the scale/rotation/position will come after export by the way
https://opencut.app/roadmap

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.

2 participants