Skip to content

Conversation

@ronaldlangeveld
Copy link
Contributor

@ronaldlangeveld ronaldlangeveld commented Mar 12, 2025

ref https://linear.app/ghost/issue/PLG-367/image-upload-is-missing-progress-indicator

  • Wired up progress bar to MediaUploaderBeta, displaying upload progress with dynamic min-width adjustments for loading states
  • Updated CallToActionCard to integrate imageUploader with isLoading and progress props
  • Adjusted MediaUploader.jsx styles for consistency (borderStyle 'rounded' logic)
  • Enhanced e2e tests in call-to-action-card.test.js to verify progress bar visibility during upload and disappearance on completion
  • Minor tweaks to SettingsPanel.jsx and SignupCard.jsx for prop alignment

@coderabbitai
Copy link

coderabbitai bot commented Mar 12, 2025

Walkthrough

This pull request implements several modifications across media upload components. The changes adjust the conditional logic for applying CSS classes based on a borderStyle prop in the media uploader components. In one component, the class is now applied only when borderStyle is 'rounded' instead of 'dashed'. Similar alterations are reflected in the beta version of the uploader, where minimum width settings and loading indicator styles are also updated. Additionally, a new prop is introduced in the settings panel to control image styling based on layout, and the call-to-action card now accepts an imageUploader prop to manage upload state and progress. The signup card component receives a preset borderStyle value. A new end-to-end test verifies the presence and behavior of a progress bar during image uploads. No exported API changes occur other than the addition of new props.

Possibly related PRs

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/koenig-lexical/src/components/ui/cards/CallToActionCard.jsx

Oops! Something went wrong! :(

ESLint: 8.57.0

ESLint couldn't find the config "react-app" to extend from. Please check that the name of the config is correct.

The config "react-app" was referenced from the config file in "/packages/koenig-lexical/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

packages/koenig-lexical/src/components/ui/MediaUploaderBeta.jsx

Oops! Something went wrong! :(

ESLint: 8.57.0

ESLint couldn't find the config "react-app" to extend from. Please check that the name of the config is correct.

The config "react-app" was referenced from the config file in "/packages/koenig-lexical/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

packages/koenig-lexical/src/components/ui/SettingsPanel.jsx

Oops! Something went wrong! :(

ESLint: 8.57.0

ESLint couldn't find the config "react-app" to extend from. Please check that the name of the config is correct.

The config "react-app" was referenced from the config file in "/packages/koenig-lexical/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

  • 3 others

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 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 9c2fee4 and 6bc269f.

📒 Files selected for processing (6)
  • packages/koenig-lexical/src/components/ui/MediaUploader.jsx (1 hunks)
  • packages/koenig-lexical/src/components/ui/MediaUploaderBeta.jsx (2 hunks)
  • packages/koenig-lexical/src/components/ui/SettingsPanel.jsx (1 hunks)
  • packages/koenig-lexical/src/components/ui/cards/CallToActionCard.jsx (3 hunks)
  • packages/koenig-lexical/src/components/ui/cards/SignupCard.jsx (1 hunks)
  • packages/koenig-lexical/test/e2e/cards/call-to-action-card.test.js (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Node 22.13.1
  • GitHub Check: Node 20.11.1
🔇 Additional comments (11)
packages/koenig-lexical/src/components/ui/cards/SignupCard.jsx (1)

228-228: Appropriate border style specification for media uploader.

Setting the borderStyle to 'squared' for this particular instance of MediaUploader maintains consistency with the overall card design.

packages/koenig-lexical/src/components/ui/SettingsPanel.jsx (1)

363-363: Good enhancement to control image width conditionally.

Adding the imgClassName prop with conditional styling based on the stacked layout improves the component's flexibility. When in stacked mode, the image will take up the full width of its container, providing better visual consistency.

packages/koenig-lexical/src/components/ui/MediaUploader.jsx (1)

79-79: Improved border style implementation with more intuitive naming.

The changes correctly modify the conditions for applying rounded styles, changing from checking for 'dashed' to checking for 'rounded'. This makes the component's behavior more intuitive and self-documenting.

Also applies to: 82-83

packages/koenig-lexical/src/components/ui/MediaUploaderBeta.jsx (3)

81-86: Enhanced layout control with conditional minimum widths.

Adding different minimum widths based on the loading state improves the component's stability during state transitions. The loading state gets a slightly larger minimum width (min-w-[6.8rem]) compared to the normal state (min-w-[5.2rem]), which helps accommodate the progress bar.


89-89: Improved image sizing with minimum width.

Adding min-w-[5.2rem] to the image ensures it maintains a consistent size and doesn't collapse unexpectedly, which improves the overall stability of the layout.


113-113: Simplified and improved loading indicator styling.

Removing the border and changing the background from bg-grey-75 to bg-grey-100 creates a cleaner look for the progress bar container. The higher contrast background makes the progress indicator more visible.

packages/koenig-lexical/test/e2e/cards/call-to-action-card.test.js (1)

364-383: Good implementation of progress bar verification test.

The test correctly verifies that the progress bar appears during upload and disappears after completion, addressing the previous review comment. The test follows a clear structure:

  1. Setting up file path and inserting the card
  2. Triggering file upload and verifying progress bar visibility
  3. Confirming successful upload by checking the image source
  4. Verifying the progress bar disappears after upload completes
packages/koenig-lexical/src/components/ui/cards/CallToActionCard.jsx (4)

114-115: Good implementation of progress tracking.

The destructuring of isLoading and progress from imageUploader provides a clean way to access upload state data.


174-175: Good refactoring of loading state source.

The component now correctly uses the loading state from the imageUploader prop instead of the imageDragHandler.


178-179: Successful implementation of upload progress visualization.

Adding the progress prop to the MediaUploadSettingBeta component enables the visualization of upload progress, addressing the original issue of missing progress indication during image uploads.


385-386: Properly updated PropTypes.

The PropTypes have been updated to include the new imageUploader prop, ensuring type validation.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • 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.
  • @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.

imageUploadHandler: PropTypes.func,
imageDragHandler: PropTypes.object
imageDragHandler: PropTypes.object,
imageUploader: PropTypes.func
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is an object rather than a func? Worth keeping dev tools open and watching the console whilst developing, this sort of mismatch usually creates error logs

const fileChooser = await fileChooserPromise;
await fileChooser.setFiles([filePath]);
const progressBar = page.locator('[data-testid="progress-bar"]');
await expect(progressBar).toBeVisible();
Copy link
Member

@kevinansfield kevinansfield Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth expanding this test a bit to make sure the progress bar correctly disappears once the upload is finished?

@ronaldlangeveld ronaldlangeveld marked this pull request as ready for review March 13, 2025 01:20
@ronaldlangeveld ronaldlangeveld changed the title Wired up upload progress bar Wired up upload progress bar to CTA Card Mar 13, 2025
@ronaldlangeveld ronaldlangeveld merged commit 1d4ecdd into main Mar 13, 2025
3 checks passed
@ronaldlangeveld ronaldlangeveld deleted the added-progress-bar-cta branch March 13, 2025 22:41
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.

3 participants