Skip to content

Feature/blocks-new-theming #33

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

Merged
merged 13 commits into from
Jun 21, 2024
Merged

Feature/blocks-new-theming #33

merged 13 commits into from
Jun 21, 2024

Conversation

nd0ut
Copy link
Member

@nd0ut nd0ut commented Jun 20, 2024

Description

Checklist

Summary by CodeRabbit

  • New Features

    • Introduced a new script to install dependencies for all example directories.
    • Added a custom file uploader with extended functionality and a custom template for improved file uploading.
  • Updates

    • Upgraded @uploadcare/blocks dependency to version 0.44.0 in various examples.
    • Improved js-uploader example by updating dependencies and including new build configurations.
    • Updated vue-router to version 4.3.2 in the vue-uploader example.
  • Enhancements

    • Improved styles and functionalities in js-custom-tab example, including custom attributes, event listeners, and CSS variables.
  • Configuration

    • Updated Vite build configurations in js-uploader and js-custom-tab with custom rollup input options.

Copy link

coderabbitai bot commented Jun 20, 2024

Walkthrough

In this update, multiple examples have been updated to the latest version of @uploadcare/blocks, enhancing integration and uniformity across different frameworks. Additionally, several configuration files have been adjusted, including adding a "type": "module" field and modifying Vite configs. A new script for dependency installation across example directories was introduced. These changes enhance dependency management, build optimization, and project structure consistency.

Changes

Files Change Summary
.../angular-uploader/..., .../composition/..., .../next-uploader/..., .../react-uploader/..., .../svelte-uploader/..., .../vue-uploader/... Updated @uploadcare/blocks version to 0.44.0. vue-router version also updated to 4.3.2 for Vue uploader.
.../js-uploader/... Added "type": "module", replaced dependency "@codesandbox/nodebox" with "@uploadcare/blocks", updated "serve" version, and modified Vite config for build options.
.../package.json Added "install-deps" script to automate dependency installation for example directories.
.../js-custom-tab/... Updated @uploadcare/blocks to 0.44.0, modified classes and CSS files for better integration and feature updates.
.../js-custom-tab/..., .../js-uploader/... Introduced Vite config changes for custom rollup input options.

Poem

In code's vast and rhythmic rhyme,
Dependencies now align just fine,
With Uploadcare blocks, we’re up to date,
In varied frameworks, we integrate.
Scripts refined and configs bright,
We build with ease into the night.
A coder’s joy, pure dynamite! 🚀✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3f888d9 and b52e48e.

Files ignored due to path filters (9)
  • examples/angular-uploader/package-lock.json is excluded by !**/package-lock.json
  • examples/composition/package-lock.json is excluded by !**/package-lock.json
  • examples/js-uploader/package-lock.json is excluded by !**/package-lock.json
  • examples/next-uploader-adapter/package-lock.json is excluded by !**/package-lock.json
  • examples/next-uploader/package-lock.json is excluded by !**/package-lock.json
  • examples/react-uploader-adapter/package-lock.json is excluded by !**/package-lock.json
  • examples/react-uploader/package-lock.json is excluded by !**/package-lock.json
  • examples/svelte-uploader/package-lock.json is excluded by !**/package-lock.json
  • examples/vue-uploader/package-lock.json is excluded by !**/package-lock.json
Files selected for processing (25)
  • examples/angular-uploader/package.json (1 hunks)
  • examples/angular-uploader/src/app/components/file-uploader/file-uploader.component.html (2 hunks)
  • examples/angular-uploader/src/app/components/file-uploader/file-uploader.component.scss (1 hunks)
  • examples/composition/package.json (1 hunks)
  • examples/js-uploader/headless.html (2 hunks)
  • examples/js-uploader/headless.js (1 hunks)
  • examples/js-uploader/minimal.html (1 hunks)
  • examples/js-uploader/minimal.js (1 hunks)
  • examples/js-uploader/package.json (1 hunks)
  • examples/js-uploader/regular.html (2 hunks)
  • examples/js-uploader/regular.js (1 hunks)
  • examples/js-uploader/styles.css (1 hunks)
  • examples/next-uploader/package.json (1 hunks)
  • examples/next-uploader/pages/minimal.js (1 hunks)
  • examples/next-uploader/pages/regular.js (1 hunks)
  • examples/react-uploader/package.json (1 hunks)
  • examples/react-uploader/src/components/FileUploader/FileUploader.module.scss (1 hunks)
  • examples/react-uploader/src/components/FileUploader/FileUploader.tsx (1 hunks)
  • examples/react-uploader/src/views/FormView/FormView.module.scss (3 hunks)
  • examples/svelte-uploader/package.json (1 hunks)
  • examples/svelte-uploader/src/lib/FileUploader/FileUploader.svelte (8 hunks)
  • examples/svelte-uploader/src/routes/form/+page.svelte (5 hunks)
  • examples/vue-uploader/package.json (1 hunks)
  • examples/vue-uploader/src/components/FileUploader/FileUploader.composition.vue (9 hunks)
  • examples/vue-uploader/src/components/FileUploader/FileUploader.options.vue (9 hunks)
Files skipped from review due to trivial changes (13)
  • examples/angular-uploader/package.json
  • examples/angular-uploader/src/app/components/file-uploader/file-uploader.component.scss
  • examples/composition/package.json
  • examples/js-uploader/regular.html
  • examples/js-uploader/styles.css
  • examples/next-uploader/package.json
  • examples/next-uploader/pages/minimal.js
  • examples/next-uploader/pages/regular.js
  • examples/react-uploader/package.json
  • examples/react-uploader/src/components/FileUploader/FileUploader.module.scss
  • examples/react-uploader/src/views/FormView/FormView.module.scss
  • examples/svelte-uploader/src/routes/form/+page.svelte
  • examples/vue-uploader/package.json
Additional comments not posted (34)
examples/js-uploader/package.json (3)

5-5: The addition of "type": "module" is appropriate for enabling ES Module support.


12-12: Updated dependency @uploadcare/blocks to 0.44.0-alpha.20 aligns with the PR's objectives.


15-15: Addition of "serve": "^14.2.3" in devDependencies is suitable for serving static files during development.

examples/svelte-uploader/package.json (1)

13-13: Updated dependency @uploadcare/blocks to 0.44.0-alpha.20 aligns with the PR's objectives.

examples/js-uploader/headless.html (2)

10-10: Correct use of type="module" for ES Module support in script tag.


21-21: Addition of class="uc-light" to lr-file-uploader-regular correctly applies the intended theme.

examples/js-uploader/minimal.html (2)

12-12: Correct use of type="module" for ES Module support in script tag.


20-20: Addition of class="uc-light" to lr-file-uploader-minimal correctly applies the intended theme.

examples/angular-uploader/src/app/components/file-uploader/file-uploader.component.html (1)

28-29: Correct implementation of dynamic theme switching using Angular's class bindings.

examples/js-uploader/regular.js (3)

1-3: Import statements are correctly placed and essential for uploader functionality.


16-16: Proper use of event binding to handle changes in file uploader state.


24-51: The renderFiles function is well-implemented, using modern JavaScript to dynamically create and manage DOM elements based on file data.

examples/js-uploader/minimal.js (3)

1-3: Import statements are correctly formatted and necessary for the functionality of the minimal uploader.


16-16: Consistent and correct setup of event binding for handling file changes, ensuring functionality across different uploader configurations.


24-51: The renderFiles function maintains consistency with the regular setup, effectively managing file display in a minimal interface.

examples/js-uploader/headless.js (3)

18-19: Effective use of the uploader's API to initiate the flow in headless mode via a custom button, enhancing user interaction flexibility.


27-27: Consistent event handling across different uploader modes, ensuring reliable data capture from user interactions.


35-61: Consistent implementation of the renderFiles function across different uploader modes, ensuring a uniform user experience and efficient code reuse.

examples/react-uploader/src/components/FileUploader/FileUploader.tsx (1)

142-142: Ensure dynamic class assignment is correctly implemented for theming.

This line correctly toggles the theme classes based on the theme prop. Good use of conditional class assignment.

examples/svelte-uploader/src/lib/FileUploader/FileUploader.svelte (5)

26-27: Ensure that the handleRemoveClick function correctly updates the files array.

This function correctly filters out the file with the specified UUID from the files array, which is reactive in Svelte.


32-32: Check that uploadedFiles is updated correctly on file status change.

This line ensures that only files with a status of "success" are kept in the uploadedFiles array.


52-53: Verify correct event listener setup and cleanup for the file uploader.

Listeners for 'change' and 'modal-close' events are correctly added and removed in the lifecycle of the component.


63-81: Ensure localization keys are correctly overridden.

The localization keys are appropriately set for various uploader states, ensuring the file uploader is properly localized.


121-122: Ensure correct theming class bindings.

Theming classes are correctly bound based on the theme prop, allowing dynamic theme switching.

examples/vue-uploader/src/components/FileUploader/FileUploader.composition.vue (5)

23-24: Ensure the theme prop validator works correctly.

The validator function correctly ensures that only 'light' or 'dark' can be set as valid themes.


49-52: Check that the handleRemoveClick method emits the correct update.

This method correctly filters the files and emits the updated list, ensuring reactivity.


57-59: Validate that uploadedFiles is correctly updated based on file status.

This function updates uploadedFiles to include only files with a 'success' status, which is typical for handling file uploads.


79-97: Review the localization settings for accuracy and completeness.

The localization settings are comprehensive and correctly structured, covering various states and actions of the file uploader.


135-138: Ensure dynamic class handling for theming works correctly.

The class binding syntax is correct and will dynamically apply the appropriate theme classes based on the theme prop.

examples/vue-uploader/src/components/FileUploader/FileUploader.options.vue (5)

23-24: Ensure the theme prop validator is functional.

The validator correctly restricts the theme values to 'light' or 'dark', which is essential for theming consistency.


51-54: Verify that the handleRemoveClick method correctly updates the files array.

This method appropriately emits the updated files array after filtering out the specified file by UUID.


58-60: Check the update mechanism for uploadedFiles on file status change.

The method correctly updates the uploadedFiles array to include only files with a 'success' status, which is standard for file upload handling.


80-98: Review the localization settings for their accuracy and completeness.

The localization overrides are comprehensive and accurately reflect various states and actions within the file uploader.


136-140: Ensure dynamic class handling for theming is correctly implemented.

The class binding is correctly implemented to dynamically apply theme-based classes based on the theme prop.

Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b52e48e and d63c3fc.

Files ignored due to path filters (10)
  • examples/angular-uploader/package-lock.json is excluded by !**/package-lock.json
  • examples/composition/package-lock.json is excluded by !**/package-lock.json
  • examples/js-uploader/package-lock.json is excluded by !**/package-lock.json
  • examples/next-uploader-adapter/package-lock.json is excluded by !**/package-lock.json
  • examples/next-uploader/package-lock.json is excluded by !**/package-lock.json
  • examples/react-uploader-adapter/package-lock.json is excluded by !**/package-lock.json
  • examples/react-uploader/package-lock.json is excluded by !**/package-lock.json
  • examples/svelte-uploader/package-lock.json is excluded by !**/package-lock.json
  • examples/vue-uploader/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (8)
  • examples/angular-uploader/package.json (1 hunks)
  • examples/composition/package.json (1 hunks)
  • examples/js-uploader/package.json (1 hunks)
  • examples/next-uploader/package.json (1 hunks)
  • examples/react-uploader/package.json (1 hunks)
  • examples/svelte-uploader/package.json (1 hunks)
  • examples/vue-uploader/package.json (1 hunks)
  • package.json (1 hunks)
Files skipped from review as they are similar to previous changes (7)
  • examples/angular-uploader/package.json
  • examples/composition/package.json
  • examples/js-uploader/package.json
  • examples/next-uploader/package.json
  • examples/react-uploader/package.json
  • examples/svelte-uploader/package.json
  • examples/vue-uploader/package.json
Additional comments not posted (1)
package.json (1)

7-7: New script addition is practical for managing dependencies in a monorepo style setup.

The install-deps script automates the installation of dependencies for each directory under ./examples/. This should streamline the setup process for multiple contained projects, which is particularly useful in a development environment where multiple small projects share a common setup but might have different dependencies.

Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d63c3fc and dfaa0f7.

Files ignored due to path filters (1)
  • examples/js-uploader/package-lock.json is excluded by !**/package-lock.json
Files selected for processing (2)
  • examples/js-uploader/package.json (1 hunks)
  • examples/js-uploader/vite.config.js (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • examples/js-uploader/package.json
Additional comments not posted (2)
examples/js-uploader/vite.config.js (2)

1-2: Ensure appropriate imports for usage.

The imports fileURLToPath from url and defineConfig from vite are correctly used in the file. It's important to ensure that these modules are available in the project's dependencies.


4-15: Review of the updated build configuration.

The updated build configuration in defineConfig uses rollupOptions to specify different HTML input files for various build targets. This is a good approach for handling multiple entry points in a Vite project. However, ensure that the paths provided are correct and that the HTML files exist at these locations.

Additionally, using fileURLToPath and new URL ensures that the paths are resolved correctly relative to the module, which is a robust way to handle path resolutions in ES modules.

Verification successful

Verification successful: All specified HTML files exist.

  • The files index.html, minimal.html, regular.html, and headless.html are present in the examples/js-uploader directory.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence of specified HTML files.

# Test: Check if the HTML files exist.
files=("index.html" "minimal.html" "regular.html" "headless.html")
for file in "${files[@]}"; do
  if [ ! -f "./examples/js-uploader/$file" ]; then
    echo "$file does not exist."
    exit 1
  fi
done
echo "All files exist."

Length of output: 434

Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dfaa0f7 and b50452d.

Files ignored due to path filters (1)
  • examples/vue-uploader/package-lock.json is excluded by !**/package-lock.json
Files selected for processing (1)
  • examples/vue-uploader/package.json (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • examples/vue-uploader/package.json

Copy link

@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: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b50452d and 1e2e6f8.

Files ignored due to path filters (1)
  • examples/js-custom-tab/package-lock.json is excluded by !**/package-lock.json
Files selected for processing (6)
  • examples/js-custom-tab/index.html (1 hunks)
  • examples/js-custom-tab/package.json (1 hunks)
  • examples/js-custom-tab/src/CustomFileUploader.js (1 hunks)
  • examples/js-custom-tab/src/UnsplashSource.js (6 hunks)
  • examples/js-custom-tab/src/main.js (2 hunks)
  • examples/js-custom-tab/src/unsplash-source.css (1 hunks)
Files skipped from review due to trivial changes (2)
  • examples/js-custom-tab/index.html
  • examples/js-custom-tab/package.json
Additional comments not posted (3)
examples/js-custom-tab/src/main.js (1)

16-16: Good addition of environment variable check.

Including a runtime check for VITE_UNSPLASH_TOKEN enhances the robustness of the application by ensuring necessary configurations are in place. This is a good practice, especially for features dependent on external services.

examples/js-custom-tab/src/CustomFileUploader.js (1)

3-3: Class definition is properly structured.

The CustomFileUploader class is well-defined and correctly extends FileUploaderRegular, ensuring that it inherits all the necessary properties and methods from the parent class.

examples/js-custom-tab/src/unsplash-source.css (1)

12-12: CSS updates align well with theming improvements.

The changes to background-color, width, max-height, and padding are consistent and enhance the UI's adaptability and appearance. Using CSS custom properties (--uc-background, --uc-padding) enhances maintainability and scalability.

Also applies to: 18-19, 22-22, 29-29

<lr-url-source></lr-url-source>
<lr-external-source></lr-external-source>
<lr-cloud-image-editor-activity></lr-cloud-image-editor-activity>
<lr-unsplash-source token="${import.meta.env.VITE_UNSPLASH_TOKEN}"></lr-unsplash-source>
Copy link

Choose a reason for hiding this comment

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

Consider handling environment variables more cautiously in templates.

Direct usage of import.meta.env.VITE_UNSPLASH_TOKEN in the template might cause issues if the environment variable is not set, as this might happen at build time. Consider adding checks or fallbacks.

@@ -17,7 +17,7 @@ const getRandomImages = async (token) => {

export class UnsplashSource extends UploaderBlock {
activityType = "unsplash";
_currentItemId = null
_currentItemId = null;
Copy link

Choose a reason for hiding this comment

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

Well-implemented class with robust functionality.

The UnsplashSource class is well-implemented with proper use of asynchronous operations and event handling. However, consider reviewing direct DOM manipulations in event handlers, as these might conflict with frameworks that use a virtual DOM.

Also applies to: 32-40, 58-61, 76-76, 99-111, 158-160

Copy link

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1e2e6f8 and 3e6d5e8.

Files ignored due to path filters (1)
  • examples/vue-uploader/package-lock.json is excluded by !**/package-lock.json
Files selected for processing (2)
  • examples/js-custom-tab/src/unsplash-source.css (1 hunks)
  • examples/js-custom-tab/vite.config.js (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • examples/js-custom-tab/src/unsplash-source.css
Additional comments not posted (1)
examples/js-custom-tab/vite.config.js (1)

1-2: Imports look good.

The imports for resolve from path and defineConfig from vite are appropriate for the configuration setup.

@nd0ut nd0ut merged commit 82a69d2 into main Jun 21, 2024
1 check passed
@nd0ut nd0ut deleted the feature/blocks-new-theming branch June 21, 2024 13:16
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