Repository navigation
feat: add FileUploadCard and FileUploadStatus components - #3109
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
ArthurTriis1
left a comment
There was a problem hiding this comment.
O projeto da FS conta com storybook, pode adicionar uma versão simples para ajudar na revisão de novos componentes?
ArthurTriis1
left a comment
There was a problem hiding this comment.
Aprovado, muito bom o resultado dos componentes e o storybook ajudou na correção. Deixei alguns comentários, favor corrigir antes do merge
lucasfp13
left a comment
There was a problem hiding this comment.
Deixei algumas sugestões de ajustes, mas em relação à funcionalidade me parece ok.
- Introduced `FileUploadCard` for file selection and upload functionality, including drag-and-drop support. - Added `FileUploadStatus` to display upload progress and error handling. - Updated index files to export new components and types. - Enhanced `SearchInputField` to include an attachment button that triggers the file upload card. - Added styles for both new components to ensure proper UI integration.
- Replaced native input elements with custom Input and Button components for consistency. - Simplified accepted file types in FileUploadCard to only '.csv'. - Added TODO comment for file size formatting in FileUploadStatus. - Adjusted SCSS variable formatting for improved readability.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
📝 WalkthroughWalkthroughThis PR introduces FileUploadCard and FileUploadStatus React components with drag-and-drop file selection, state management for upload workflows, and integration into SearchInput. Includes comprehensive styling, public API exports, and Storybook demonstrations. Changes
Sequence DiagramsequenceDiagram
actor User
participant Card as FileUploadCard
participant Status as FileUploadStatus
participant Handler as Parent Component
User->>Card: Click "Select file" / Drag-drop
Card->>Card: Validate file (extension/type)
alt File valid
Card->>Card: Set selectedFile & uploadState='uploading'
Card->>Status: Render with uploading state
User->>Status: Monitor upload progress
Card->>Card: Simulate 2s upload delay
Card->>Card: uploadState='completed'
Status->>Status: Display success icon
User->>Status: Click "Search" or "Remove"
Status->>Handler: onSearch() / onRemove() callback
else File invalid
Card->>Card: Set uploadState='error'
Card->>Status: Render with error state
User->>Status: Click "Download template" or "Select file"
Status->>Handler: onDownloadTemplate() / onSelectFile() callback
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Fix all issues with AI agents
In `@packages/components/src/molecules/FileUploadCard/FileUploadCard.tsx`:
- Around line 108-111: The simulated upload setTimeout in FileUploadCard
currently calls setUploadState('completed') without cleanup, risking state
updates after unmount; modify the component to store the timer id (e.g., in a
ref) and set the timeout inside a useEffect that returns a cleanup which clears
the timeout, or cancel the timer in an existing unmount effect so setUploadState
is never called after the component unmounts.
In `@packages/components/src/molecules/FileUploadStatus/FileUploadStatus.tsx`:
- Around line 202-233: The action buttons in FileUploadStatus (the Search button
with data-fs-file-upload-status-search-button, and the Download template and
Select file buttons with data-fs-file-upload-status-download-button and
data-fs-file-upload-status-select-button) are missing an explicit type and will
default to submit when rendered inside a form; update each Button element
rendered under state === 'completed' (onSearch) and state === 'error'
(onDownloadTemplate, onSelectFile) to include type="button" so they do not
trigger form submission.
In `@packages/storybook/stories/fileupload.stories.tsx`:
- Around line 133-143: The handleDownloadTemplate function currently triggers a
download by clicking a detached anchor which can be ignored by some browsers
(e.g., Firefox); modify handleDownloadTemplate to append the created <a> element
to document.body before calling a.click(), then remove the anchor after the
click and revoke the object URL (keep creating the Blob, setting
a.href/a.download as-is) to improve cross-browser reliability.
In `@packages/ui/src/components/molecules/SearchInputField/styles.scss`:
- Around line 109-122: There is a duplicate CSS rule for the selector
[data-fs-search-input-field-input]; remove the second block (the one that sets
padding-right) and consolidate any unique properties (background-color,
transition, height, and the media query) into the first definition so the rule
uses padding-inline-end for RTL support; ensure the merged rule retains the
media query (`@include` media("<notebook") { border: 0; }) and the
transition/background-color/height settings from the duplicate block.
- Around line 69-78: Remove the orphaned CSS properties block (the standalone
rules: right, display, gap, align-items and the media query) that are present
without a selector; these are duplicate/leftover and will break SCSS. Locate the
stray block near the end of the file and delete it, keeping the existing valid
styling defined under the [data-fs-search-input-field-actions] selector (which
already defines the same rules), and ensure only the selector-scoped styles
remain.
🧹 Nitpick comments (8)
packages/core/src/components/search/SearchInput/SearchInput.tsx (2)
115-120: Incomplete file upload handling.The
handleFileSelectfunction sets state but has a TODO indicating the actual file upload logic is not implemented. The commented-outsetFileUploadVisible(false)suggests uncertainty about the intended behavior.Consider completing the implementation or tracking this as a follow-up task.
Would you like me to open an issue to track the implementation of the actual file upload logic?
212-219: RedundantisOpenprop condition.The
isOpenprop evaluates toisUploadOpen || hasFile || fileUploadVisible, but since this block only renders whenfileUploadVisibleis true,isOpenwill always betrue. TheisUploadOpenandhasFileconditions have no effect here.Simplify the condition
{fileUploadVisible && ( <FileUploadCard - isOpen={isUploadOpen || hasFile || fileUploadVisible} + isOpen={fileUploadVisible} onDismiss={() => setFileUploadVisible(false)} onFileSelect={handleFileSelect} onDownloadTemplate={handleDownloadTemplate} /> )}Or consider removing
isUploadOpenandhasFilestates if they're not needed elsewhere.packages/ui/src/components/molecules/FileUploadStatus/styles.scss (2)
13-15: Hardcoded colors reduce theming flexibility.The icon background colors use hardcoded hex values (
#08a822,#d31a15) instead of design tokens. This makes it harder to maintain consistent theming across the application.Consider using design tokens
- --fs-file-upload-status-icon-bg-completed: `#08a822`; - --fs-file-upload-status-icon-bg-uploading: `#08a822`; - --fs-file-upload-status-icon-bg-error: `#d31a15`; + --fs-file-upload-status-icon-bg-completed: var(--fs-color-success, `#08a822`); + --fs-file-upload-status-icon-bg-uploading: var(--fs-color-success, `#08a822`); + --fs-file-upload-status-icon-bg-error: var(--fs-color-danger, `#d31a15`);This applies to other hardcoded colors in this file as well (lines 48-49, 198-200, 220-226).
29-29: Remove commented-out code.The commented
height: 188px;should either be removed or documented if it serves as a reference.packages/ui/src/components/molecules/FileUploadCard/styles.scss (2)
49-51: Useremunits for fixed height.The fixed height of
285pxshould be converted toremunits for consistency with the design system. Based on past review comments, pixel units should be avoided except in stories.Convert to rem
&[data-fs-file-upload-card-open="true"] { - height: 285px; - max-height: 285px; + height: 17.8125rem; + max-height: 17.8125rem; pointer-events: auto;
17-18: Hardcoded colors reduce theming flexibility.The badge and shadow colors use hardcoded hex values. Consider using design tokens for better maintainability and theming support.
Consider using design tokens
- --fs-file-upload-card-badge-bg-color: `#0366dd`; - --fs-file-upload-card-shadow-color: `#bfdbfe`; + --fs-file-upload-card-badge-bg-color: var(--fs-color-primary, `#0366dd`); + --fs-file-upload-card-shadow-color: var(--fs-color-primary-bkg-light, `#bfdbfe`);This pattern applies to other hardcoded colors in this file (lines 161, 189-196).
packages/components/src/molecules/FileUploadCard/FileUploadCard.tsx (1)
92-117: Duplicate file processing logic.
handleFileChangeandhandleDropcontain nearly identical file processing logic (validation, state updates, simulated upload). Extract this into a shared helper function.Extract shared file processing logic
+ const processFile = (file: File, files: File[]) => { + setSelectedFile(file) + + if (!isValidFileType(file)) { + setUploadState('error') + setErrorType('unsupported') + return + } + + setUploadState('uploading') + setErrorType(undefined) + + // Simulate upload process + setTimeout(() => { + setUploadState('completed') + }, 2000) + + onFileSelect?.(files) + } + const handleFileChange = (e: ChangeEvent<HTMLInputElement>) => { const files = Array.from(e.target.files || []) if (files.length > 0) { - const file = files[0] - setSelectedFile(file) - - // Validate file type - if (!isValidFileType(file)) { - setUploadState('error') - setErrorType('unsupported') - return - } - - setUploadState('uploading') - setErrorType(undefined) - - // Simulate upload process - setTimeout(() => { - setUploadState('completed') - }, 2000) - - if (onFileSelect) { - onFileSelect(files) - } + processFile(files[0], files) } }Apply similar refactoring to
handleDrop.Also applies to: 130-160
packages/storybook/stories/fileupload.stories.tsx (1)
1-7: Use the public type export instead of a deep dist import.Deep imports can break with package refactors or alternate build outputs. Prefer the root export if available; otherwise consider exporting
FileUploadErrorTypefrom the package index.🔧 Proposed change
-import type { FileUploadErrorType } from '@faststore/components/dist/esm/molecules/FileUploadStatus' +import type { FileUploadErrorType } from '@faststore/components'
6a8e751
into
vtex:feat/quick-order-by-file-feature-branch
Tasks [https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69) [BE-70](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-70) Here's the completed PR description in English: - Introduced `FileUploadCard` for file selection and upload functionality, including drag-and-drop support. - Added `FileUploadStatus` to display upload progress and error handling. - Updated index files to export new components and types. - Enhanced `SearchInputField` to include an attachment button that triggers the file upload card. - Added styles for both new components to ensure proper UI integration. ## What's the purpose of this pull request? This PR introduces a new file upload feature that allows users to perform bulk searches by uploading CSV files. The feature provides a modern, user-friendly interface with drag-and-drop support, real-time upload status tracking, and comprehensive error handling to guide users through the file upload process. ## How it works? ### FileUploadCard Component - **File Selection**: Users can either click "Select file" button or drag-and-drop files into the dropzone - **Drag & Drop**: Visual feedback with border color and background changes when dragging files - **File Input**: Hidden file input that's always present in the DOM to ensure file picker works in all states - **Download Template**: Provides a CSV template download option for users who need guidance on file format - **Validation**: Only accepts CSV files (`.csv` extension) - **States**: Manages upload states (uploading, completed, error) with appropriate UI updates ### FileUploadStatus Component Displays the current status of the uploaded file with three distinct states: 1. **Uploading State** - Shows spinning CircleNotch icon - Displays "Uploading your file..." message - Shows filename 2. **Completed State** - Shows Table icon in green background - Displays filename and file size - Shows "Search" button to proceed with the uploaded file 3. **Error State** - Shows WarningOctagon icon in red background - Special styling: light pink background (#FDF6F5) with red border (#FFDFD9) - Displays error title and description in two lines - Shows two action buttons: "Download template" and "Select file" ### Error Types The component handles six different error scenarios: - **Unsupported**: Wrong file type (non-CSV files) - **Unreadable**: File can't be parsed or is corrupted - **Invalid Structure**: Missing headers or incorrect columns - **Empty**: File has no data - **Too Large**: File exceeds size limit - **Unexpected**: Generic error for unknown issues ### Integration - Added attachment icon button to `SearchInputField` component - Clicking the attachment button toggles the `FileUploadCard` visibility - Card appears as a dropdown below the search input - Smooth animations for show/hide transitions ### Key Features - **File validation**: Automatically checks file type on selection/drop - **Error recovery**: Users can easily select a new file or download template when errors occur - **Responsive design**: Components adapt to container width - **Accessibility**: Proper ARIA labels and keyboard navigation support - **Visual feedback**: Icons, colors, and animations provide clear status indication ## How to test it? ### Basic File Upload Flow 1. Navigate to a page with the search input 2. Click the attachment icon button (Paperclip icon) 3. The FileUploadCard should appear below the search input 4. Click "Select file" or drag-and-drop a CSV file 5. Observe the uploading state with spinning icon 6. After 2 seconds, see the completed state with "Search" button 7. Click the X button to remove the file and return to initial state ### Drag and Drop 1. Open the FileUploadCard 2. Drag a CSV file over the dropzone 3. Observe the visual feedback (border and background color change) 4. Drop the file to upload ### Error Handling - Unsupported File Type 1. Open the FileUploadCard 2. Select or drop a non-CSV file (e.g., .txt, .pdf, .xlsx) 3. Observe error state with red icon and pink background 4. Read error message: "Unsupported file type." / "Upload a CSV or use the template provided." 5. Click "Download template" to get a sample CSV 6. Click "Select file" to try uploading again ### File Removal 1. Upload a file successfully 2. Click the X button in the top-right of the file status 3. Component should return to initial dropzone state ### Starters Deploy Preview <!-- Add your deploy preview link here --> ## References - [Phosphor Icons](https://phosphoricons.com/) - Icon library used for UI elements - [Conventional Commits](https://www.conventionalcommits.org/) - Commit message format ## Checklist <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** - [ ] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. **Dependencies** - [ ] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [ ] PR description [BE-70]: https://vtex-dev.atlassian.net/browse/BE-70?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * File upload card component enabling file selection via drag-and-drop or file picker with status indicators * File upload status component displaying upload progress, success, and error states with customizable error handling * Attachment button in search input for quick file upload access * **Chores** * Added component styling and Storybook demonstrations <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Arthur Andrade <[email protected]>
Tasks [https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69) [BE-70](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-70) Here's the completed PR description in English: - Introduced `FileUploadCard` for file selection and upload functionality, including drag-and-drop support. - Added `FileUploadStatus` to display upload progress and error handling. - Updated index files to export new components and types. - Enhanced `SearchInputField` to include an attachment button that triggers the file upload card. - Added styles for both new components to ensure proper UI integration. ## What's the purpose of this pull request? This PR introduces a new file upload feature that allows users to perform bulk searches by uploading CSV files. The feature provides a modern, user-friendly interface with drag-and-drop support, real-time upload status tracking, and comprehensive error handling to guide users through the file upload process. ## How it works? ### FileUploadCard Component - **File Selection**: Users can either click "Select file" button or drag-and-drop files into the dropzone - **Drag & Drop**: Visual feedback with border color and background changes when dragging files - **File Input**: Hidden file input that's always present in the DOM to ensure file picker works in all states - **Download Template**: Provides a CSV template download option for users who need guidance on file format - **Validation**: Only accepts CSV files (`.csv` extension) - **States**: Manages upload states (uploading, completed, error) with appropriate UI updates ### FileUploadStatus Component Displays the current status of the uploaded file with three distinct states: 1. **Uploading State** - Shows spinning CircleNotch icon - Displays "Uploading your file..." message - Shows filename 2. **Completed State** - Shows Table icon in green background - Displays filename and file size - Shows "Search" button to proceed with the uploaded file 3. **Error State** - Shows WarningOctagon icon in red background - Special styling: light pink background (#FDF6F5) with red border (#FFDFD9) - Displays error title and description in two lines - Shows two action buttons: "Download template" and "Select file" ### Error Types The component handles six different error scenarios: - **Unsupported**: Wrong file type (non-CSV files) - **Unreadable**: File can't be parsed or is corrupted - **Invalid Structure**: Missing headers or incorrect columns - **Empty**: File has no data - **Too Large**: File exceeds size limit - **Unexpected**: Generic error for unknown issues ### Integration - Added attachment icon button to `SearchInputField` component - Clicking the attachment button toggles the `FileUploadCard` visibility - Card appears as a dropdown below the search input - Smooth animations for show/hide transitions ### Key Features - **File validation**: Automatically checks file type on selection/drop - **Error recovery**: Users can easily select a new file or download template when errors occur - **Responsive design**: Components adapt to container width - **Accessibility**: Proper ARIA labels and keyboard navigation support - **Visual feedback**: Icons, colors, and animations provide clear status indication ## How to test it? ### Basic File Upload Flow 1. Navigate to a page with the search input 2. Click the attachment icon button (Paperclip icon) 3. The FileUploadCard should appear below the search input 4. Click "Select file" or drag-and-drop a CSV file 5. Observe the uploading state with spinning icon 6. After 2 seconds, see the completed state with "Search" button 7. Click the X button to remove the file and return to initial state ### Drag and Drop 1. Open the FileUploadCard 2. Drag a CSV file over the dropzone 3. Observe the visual feedback (border and background color change) 4. Drop the file to upload ### Error Handling - Unsupported File Type 1. Open the FileUploadCard 2. Select or drop a non-CSV file (e.g., .txt, .pdf, .xlsx) 3. Observe error state with red icon and pink background 4. Read error message: "Unsupported file type." / "Upload a CSV or use the template provided." 5. Click "Download template" to get a sample CSV 6. Click "Select file" to try uploading again ### File Removal 1. Upload a file successfully 2. Click the X button in the top-right of the file status 3. Component should return to initial dropzone state ### Starters Deploy Preview <!-- Add your deploy preview link here --> ## References - [Phosphor Icons](https://phosphoricons.com/) - Icon library used for UI elements - [Conventional Commits](https://www.conventionalcommits.org/) - Commit message format ## Checklist <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** - [ ] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. **Dependencies** - [ ] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [ ] PR description [BE-70]: https://vtex-dev.atlassian.net/browse/BE-70?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * File upload card component enabling file selection via drag-and-drop or file picker with status indicators * File upload status component displaying upload progress, success, and error states with customizable error handling * Attachment button in search input for quick file upload access * **Chores** * Added component styling and Storybook demonstrations <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Arthur Andrade <[email protected]>
Tasks [https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69) [BE-70](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-70) Here's the completed PR description in English: - Introduced `FileUploadCard` for file selection and upload functionality, including drag-and-drop support. - Added `FileUploadStatus` to display upload progress and error handling. - Updated index files to export new components and types. - Enhanced `SearchInputField` to include an attachment button that triggers the file upload card. - Added styles for both new components to ensure proper UI integration. This PR introduces a new file upload feature that allows users to perform bulk searches by uploading CSV files. The feature provides a modern, user-friendly interface with drag-and-drop support, real-time upload status tracking, and comprehensive error handling to guide users through the file upload process. - **File Selection**: Users can either click "Select file" button or drag-and-drop files into the dropzone - **Drag & Drop**: Visual feedback with border color and background changes when dragging files - **File Input**: Hidden file input that's always present in the DOM to ensure file picker works in all states - **Download Template**: Provides a CSV template download option for users who need guidance on file format - **Validation**: Only accepts CSV files (`.csv` extension) - **States**: Manages upload states (uploading, completed, error) with appropriate UI updates Displays the current status of the uploaded file with three distinct states: 1. **Uploading State** - Shows spinning CircleNotch icon - Displays "Uploading your file..." message - Shows filename 2. **Completed State** - Shows Table icon in green background - Displays filename and file size - Shows "Search" button to proceed with the uploaded file 3. **Error State** - Shows WarningOctagon icon in red background - Special styling: light pink background (#FDF6F5) with red border (#FFDFD9) - Displays error title and description in two lines - Shows two action buttons: "Download template" and "Select file" The component handles six different error scenarios: - **Unsupported**: Wrong file type (non-CSV files) - **Unreadable**: File can't be parsed or is corrupted - **Invalid Structure**: Missing headers or incorrect columns - **Empty**: File has no data - **Too Large**: File exceeds size limit - **Unexpected**: Generic error for unknown issues - Added attachment icon button to `SearchInputField` component - Clicking the attachment button toggles the `FileUploadCard` visibility - Card appears as a dropdown below the search input - Smooth animations for show/hide transitions - **File validation**: Automatically checks file type on selection/drop - **Error recovery**: Users can easily select a new file or download template when errors occur - **Responsive design**: Components adapt to container width - **Accessibility**: Proper ARIA labels and keyboard navigation support - **Visual feedback**: Icons, colors, and animations provide clear status indication 1. Navigate to a page with the search input 2. Click the attachment icon button (Paperclip icon) 3. The FileUploadCard should appear below the search input 4. Click "Select file" or drag-and-drop a CSV file 5. Observe the uploading state with spinning icon 6. After 2 seconds, see the completed state with "Search" button 7. Click the X button to remove the file and return to initial state 1. Open the FileUploadCard 2. Drag a CSV file over the dropzone 3. Observe the visual feedback (border and background color change) 4. Drop the file to upload 1. Open the FileUploadCard 2. Select or drop a non-CSV file (e.g., .txt, .pdf, .xlsx) 3. Observe error state with red icon and pink background 4. Read error message: "Unsupported file type." / "Upload a CSV or use the template provided." 5. Click "Download template" to get a sample CSV 6. Click "Select file" to try uploading again 1. Upload a file successfully 2. Click the X button in the top-right of the file status 3. Component should return to initial dropzone state <!-- Add your deploy preview link here --> - [Phosphor Icons](https://phosphoricons.com/) - Icon library used for UI elements - [Conventional Commits](https://www.conventionalcommits.org/) - Commit message format <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** - [ ] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. **Dependencies** - [ ] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [ ] PR description [BE-70]: https://vtex-dev.atlassian.net/browse/BE-70?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> * **New Features** * File upload card component enabling file selection via drag-and-drop or file picker with status indicators * File upload status component displaying upload progress, success, and error states with customizable error handling * Attachment button in search input for quick file upload access * **Chores** * Added component styling and Storybook demonstrations <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Arthur Andrade <[email protected]>
Tasks [https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69) [BE-70](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-70) Here's the completed PR description in English: - Introduced `FileUploadCard` for file selection and upload functionality, including drag-and-drop support. - Added `FileUploadStatus` to display upload progress and error handling. - Updated index files to export new components and types. - Enhanced `SearchInputField` to include an attachment button that triggers the file upload card. - Added styles for both new components to ensure proper UI integration. ## What's the purpose of this pull request? This PR introduces a new file upload feature that allows users to perform bulk searches by uploading CSV files. The feature provides a modern, user-friendly interface with drag-and-drop support, real-time upload status tracking, and comprehensive error handling to guide users through the file upload process. ## How it works? ### FileUploadCard Component - **File Selection**: Users can either click "Select file" button or drag-and-drop files into the dropzone - **Drag & Drop**: Visual feedback with border color and background changes when dragging files - **File Input**: Hidden file input that's always present in the DOM to ensure file picker works in all states - **Download Template**: Provides a CSV template download option for users who need guidance on file format - **Validation**: Only accepts CSV files (`.csv` extension) - **States**: Manages upload states (uploading, completed, error) with appropriate UI updates ### FileUploadStatus Component Displays the current status of the uploaded file with three distinct states: 1. **Uploading State** - Shows spinning CircleNotch icon - Displays "Uploading your file..." message - Shows filename 2. **Completed State** - Shows Table icon in green background - Displays filename and file size - Shows "Search" button to proceed with the uploaded file 3. **Error State** - Shows WarningOctagon icon in red background - Special styling: light pink background (#FDF6F5) with red border (#FFDFD9) - Displays error title and description in two lines - Shows two action buttons: "Download template" and "Select file" ### Error Types The component handles six different error scenarios: - **Unsupported**: Wrong file type (non-CSV files) - **Unreadable**: File can't be parsed or is corrupted - **Invalid Structure**: Missing headers or incorrect columns - **Empty**: File has no data - **Too Large**: File exceeds size limit - **Unexpected**: Generic error for unknown issues ### Integration - Added attachment icon button to `SearchInputField` component - Clicking the attachment button toggles the `FileUploadCard` visibility - Card appears as a dropdown below the search input - Smooth animations for show/hide transitions ### Key Features - **File validation**: Automatically checks file type on selection/drop - **Error recovery**: Users can easily select a new file or download template when errors occur - **Responsive design**: Components adapt to container width - **Accessibility**: Proper ARIA labels and keyboard navigation support - **Visual feedback**: Icons, colors, and animations provide clear status indication ## How to test it? ### Basic File Upload Flow 1. Navigate to a page with the search input 2. Click the attachment icon button (Paperclip icon) 3. The FileUploadCard should appear below the search input 4. Click "Select file" or drag-and-drop a CSV file 5. Observe the uploading state with spinning icon 6. After 2 seconds, see the completed state with "Search" button 7. Click the X button to remove the file and return to initial state ### Drag and Drop 1. Open the FileUploadCard 2. Drag a CSV file over the dropzone 3. Observe the visual feedback (border and background color change) 4. Drop the file to upload ### Error Handling - Unsupported File Type 1. Open the FileUploadCard 2. Select or drop a non-CSV file (e.g., .txt, .pdf, .xlsx) 3. Observe error state with red icon and pink background 4. Read error message: "Unsupported file type." / "Upload a CSV or use the template provided." 5. Click "Download template" to get a sample CSV 6. Click "Select file" to try uploading again ### File Removal 1. Upload a file successfully 2. Click the X button in the top-right of the file status 3. Component should return to initial dropzone state ### Starters Deploy Preview <!-- Add your deploy preview link here --> ## References - [Phosphor Icons](https://phosphoricons.com/) - Icon library used for UI elements - [Conventional Commits](https://www.conventionalcommits.org/) - Commit message format ## Checklist <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** - [ ] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. **Dependencies** - [ ] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [ ] PR description [BE-70]: https://vtex-dev.atlassian.net/browse/BE-70?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * File upload card component enabling file selection via drag-and-drop or file picker with status indicators * File upload status component displaying upload progress, success, and error states with customizable error handling * Attachment button in search input for quick file upload access * **Chores** * Added component styling and Storybook demonstrations <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Arthur Andrade <[email protected]>
Tasks [https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69) [BE-70](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-70) Here's the completed PR description in English: - Introduced `FileUploadCard` for file selection and upload functionality, including drag-and-drop support. - Added `FileUploadStatus` to display upload progress and error handling. - Updated index files to export new components and types. - Enhanced `SearchInputField` to include an attachment button that triggers the file upload card. - Added styles for both new components to ensure proper UI integration. This PR introduces a new file upload feature that allows users to perform bulk searches by uploading CSV files. The feature provides a modern, user-friendly interface with drag-and-drop support, real-time upload status tracking, and comprehensive error handling to guide users through the file upload process. - **File Selection**: Users can either click "Select file" button or drag-and-drop files into the dropzone - **Drag & Drop**: Visual feedback with border color and background changes when dragging files - **File Input**: Hidden file input that's always present in the DOM to ensure file picker works in all states - **Download Template**: Provides a CSV template download option for users who need guidance on file format - **Validation**: Only accepts CSV files (`.csv` extension) - **States**: Manages upload states (uploading, completed, error) with appropriate UI updates Displays the current status of the uploaded file with three distinct states: 1. **Uploading State** - Shows spinning CircleNotch icon - Displays "Uploading your file..." message - Shows filename 2. **Completed State** - Shows Table icon in green background - Displays filename and file size - Shows "Search" button to proceed with the uploaded file 3. **Error State** - Shows WarningOctagon icon in red background - Special styling: light pink background (#FDF6F5) with red border (#FFDFD9) - Displays error title and description in two lines - Shows two action buttons: "Download template" and "Select file" The component handles six different error scenarios: - **Unsupported**: Wrong file type (non-CSV files) - **Unreadable**: File can't be parsed or is corrupted - **Invalid Structure**: Missing headers or incorrect columns - **Empty**: File has no data - **Too Large**: File exceeds size limit - **Unexpected**: Generic error for unknown issues - Added attachment icon button to `SearchInputField` component - Clicking the attachment button toggles the `FileUploadCard` visibility - Card appears as a dropdown below the search input - Smooth animations for show/hide transitions - **File validation**: Automatically checks file type on selection/drop - **Error recovery**: Users can easily select a new file or download template when errors occur - **Responsive design**: Components adapt to container width - **Accessibility**: Proper ARIA labels and keyboard navigation support - **Visual feedback**: Icons, colors, and animations provide clear status indication 1. Navigate to a page with the search input 2. Click the attachment icon button (Paperclip icon) 3. The FileUploadCard should appear below the search input 4. Click "Select file" or drag-and-drop a CSV file 5. Observe the uploading state with spinning icon 6. After 2 seconds, see the completed state with "Search" button 7. Click the X button to remove the file and return to initial state 1. Open the FileUploadCard 2. Drag a CSV file over the dropzone 3. Observe the visual feedback (border and background color change) 4. Drop the file to upload 1. Open the FileUploadCard 2. Select or drop a non-CSV file (e.g., .txt, .pdf, .xlsx) 3. Observe error state with red icon and pink background 4. Read error message: "Unsupported file type." / "Upload a CSV or use the template provided." 5. Click "Download template" to get a sample CSV 6. Click "Select file" to try uploading again 1. Upload a file successfully 2. Click the X button in the top-right of the file status 3. Component should return to initial dropzone state <!-- Add your deploy preview link here --> - [Phosphor Icons](https://phosphoricons.com/) - Icon library used for UI elements - [Conventional Commits](https://www.conventionalcommits.org/) - Commit message format <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** - [ ] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. **Dependencies** - [ ] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [ ] PR description [BE-70]: https://vtex-dev.atlassian.net/browse/BE-70?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> * **New Features** * File upload card component enabling file selection via drag-and-drop or file picker with status indicators * File upload status component displaying upload progress, success, and error states with customizable error handling * Attachment button in search input for quick file upload access * **Chores** * Added component styling and Storybook demonstrations <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Arthur Andrade <[email protected]>
## What's the purpose of this pull request? This pull request introduces a new file upload and CSV parsing feature to the `components` package, including reusable hooks and UI components. The main changes are the addition of a `FileUploadCard` component for uploading files, a `useCSVParser` hook for parsing CSV files in a web worker, and a `useFileUpload` hook for managing file upload errors and validation. These new utilities are exported for use in other parts of the application. This PR it was created from #3109 ## How it works? **New hooks and utilities:** * Added `useCSVParser` hook for parsing CSV files in a web worker, with error handling and CSV template generation. * Added `useFileUpload` hook to manage file upload errors, validation, and rejection reasons. * Exported new hooks from the hooks index for easier consumption. * Added type exports for CSV parsing to the main index file. **New UI components:** * Added `FileUploadCard` component for file selection, drag-and-drop, and template download, with error state and file validation. * Added exports for `FileUploadCard` and `FileUploadStatus` components and their types. **Dependency updates:** * Added `papaparse` to dependencies for running CSV parsing in a web worker. ## How to test it?  ### Starters Deploy Preview <!--- Add a link to a deploy preview from `starter.store` with this branch being used. ---> <!--- Tip: You can get an installable version of this branch from the CodeSandbox generated when this PR is created. ---> ## References - [Card](https://vtex-dev.atlassian.net/browse/BE-71) - [Figma](https://www.figma.com/design/YjU7SKqgLar3oxCP3SwagX/B2B-%C2%B7-Order-entry?node-id=53-3753&t=khUOMzHdN5djYyKo-0) ## Checklist <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** - [x] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. **Dependencies** - [ ] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [ ] PR description - [ ] For documentation changes, ping `@Mariana-Caetano` to review and update (Or submit a doc request) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * CSV parsing with worker-backed parsing, template generation, Dropzone upload UI and an Upload File dropdown; file-based search integration. * **Enhancements** * New file upload hooks, FileUploadCard and FileUploadStatus props for richer status, customizable labels, and improved file name/size formatting. * Template download and clearer upload error handling. * **Refactor** * Tightened public type signatures and expanded component/hook exports. * **Style** * Added Dropzone and upload-related styles and Storybook stories. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Giuliana Rigaud <[email protected]> Co-authored-by: renato <[email protected]> Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Arthur Andrade <[email protected]> Co-authored-by: BrunaCubos <[email protected]> Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Everton Ataide <[email protected]>
Tasks [https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69) [BE-70](https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-70) Here's the completed PR description in English: - Introduced `FileUploadCard` for file selection and upload functionality, including drag-and-drop support. - Added `FileUploadStatus` to display upload progress and error handling. - Updated index files to export new components and types. - Enhanced `SearchInputField` to include an attachment button that triggers the file upload card. - Added styles for both new components to ensure proper UI integration. ## What's the purpose of this pull request? This PR introduces a new file upload feature that allows users to perform bulk searches by uploading CSV files. The feature provides a modern, user-friendly interface with drag-and-drop support, real-time upload status tracking, and comprehensive error handling to guide users through the file upload process. ## How it works? ### FileUploadCard Component - **File Selection**: Users can either click "Select file" button or drag-and-drop files into the dropzone - **Drag & Drop**: Visual feedback with border color and background changes when dragging files - **File Input**: Hidden file input that's always present in the DOM to ensure file picker works in all states - **Download Template**: Provides a CSV template download option for users who need guidance on file format - **Validation**: Only accepts CSV files (`.csv` extension) - **States**: Manages upload states (uploading, completed, error) with appropriate UI updates ### FileUploadStatus Component Displays the current status of the uploaded file with three distinct states: 1. **Uploading State** - Shows spinning CircleNotch icon - Displays "Uploading your file..." message - Shows filename 2. **Completed State** - Shows Table icon in green background - Displays filename and file size - Shows "Search" button to proceed with the uploaded file 3. **Error State** - Shows WarningOctagon icon in red background - Special styling: light pink background (#FDF6F5) with red border (#FFDFD9) - Displays error title and description in two lines - Shows two action buttons: "Download template" and "Select file" ### Error Types The component handles six different error scenarios: - **Unsupported**: Wrong file type (non-CSV files) - **Unreadable**: File can't be parsed or is corrupted - **Invalid Structure**: Missing headers or incorrect columns - **Empty**: File has no data - **Too Large**: File exceeds size limit - **Unexpected**: Generic error for unknown issues ### Integration - Added attachment icon button to `SearchInputField` component - Clicking the attachment button toggles the `FileUploadCard` visibility - Card appears as a dropdown below the search input - Smooth animations for show/hide transitions ### Key Features - **File validation**: Automatically checks file type on selection/drop - **Error recovery**: Users can easily select a new file or download template when errors occur - **Responsive design**: Components adapt to container width - **Accessibility**: Proper ARIA labels and keyboard navigation support - **Visual feedback**: Icons, colors, and animations provide clear status indication ## How to test it? ### Basic File Upload Flow 1. Navigate to a page with the search input 2. Click the attachment icon button (Paperclip icon) 3. The FileUploadCard should appear below the search input 4. Click "Select file" or drag-and-drop a CSV file 5. Observe the uploading state with spinning icon 6. After 2 seconds, see the completed state with "Search" button 7. Click the X button to remove the file and return to initial state ### Drag and Drop 1. Open the FileUploadCard 2. Drag a CSV file over the dropzone 3. Observe the visual feedback (border and background color change) 4. Drop the file to upload ### Error Handling - Unsupported File Type 1. Open the FileUploadCard 2. Select or drop a non-CSV file (e.g., .txt, .pdf, .xlsx) 3. Observe error state with red icon and pink background 4. Read error message: "Unsupported file type." / "Upload a CSV or use the template provided." 5. Click "Download template" to get a sample CSV 6. Click "Select file" to try uploading again ### File Removal 1. Upload a file successfully 2. Click the X button in the top-right of the file status 3. Component should return to initial dropzone state ### Starters Deploy Preview <!-- Add your deploy preview link here --> ## References - [Phosphor Icons](https://phosphoricons.com/) - Icon library used for UI elements - [Conventional Commits](https://www.conventionalcommits.org/) - Commit message format ## Checklist <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** - [ ] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. **Dependencies** - [ ] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [ ] PR description [BE-70]: https://vtex-dev.atlassian.net/browse/BE-70?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * File upload card component enabling file selection via drag-and-drop or file picker with status indicators * File upload status component displaying upload progress, success, and error states with customizable error handling * Attachment button in search input for quick file upload access * **Chores** * Added component styling and Storybook demonstrations <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Arthur Andrade <[email protected]>
This pull request introduces a new file upload and CSV parsing feature to the `components` package, including reusable hooks and UI components. The main changes are the addition of a `FileUploadCard` component for uploading files, a `useCSVParser` hook for parsing CSV files in a web worker, and a `useFileUpload` hook for managing file upload errors and validation. These new utilities are exported for use in other parts of the application. This PR it was created from #3109 **New hooks and utilities:** * Added `useCSVParser` hook for parsing CSV files in a web worker, with error handling and CSV template generation. * Added `useFileUpload` hook to manage file upload errors, validation, and rejection reasons. * Exported new hooks from the hooks index for easier consumption. * Added type exports for CSV parsing to the main index file. **New UI components:** * Added `FileUploadCard` component for file selection, drag-and-drop, and template download, with error state and file validation. * Added exports for `FileUploadCard` and `FileUploadStatus` components and their types. **Dependency updates:** * Added `papaparse` to dependencies for running CSV parsing in a web worker.  <!--- Add a link to a deploy preview from `starter.store` with this branch being used. ---> <!--- Tip: You can get an installable version of this branch from the CodeSandbox generated when this PR is created. ---> - [Card](https://vtex-dev.atlassian.net/browse/BE-71) - [Figma](https://www.figma.com/design/YjU7SKqgLar3oxCP3SwagX/B2B-%C2%B7-Order-entry?node-id=53-3753&t=khUOMzHdN5djYyKo-0) <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** - [x] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. **Dependencies** - [ ] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [ ] PR description - [ ] For documentation changes, ping `@Mariana-Caetano` to review and update (Or submit a doc request) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> * **New Features** * CSV parsing with worker-backed parsing, template generation, Dropzone upload UI and an Upload File dropdown; file-based search integration. * **Enhancements** * New file upload hooks, FileUploadCard and FileUploadStatus props for richer status, customizable labels, and improved file name/size formatting. * Template download and clearer upload error handling. * **Refactor** * Tightened public type signatures and expanded component/hook exports. * **Style** * Added Dropzone and upload-related styles and Storybook stories. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Giuliana Rigaud <[email protected]> Co-authored-by: renato <[email protected]> Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Arthur Andrade <[email protected]> Co-authored-by: BrunaCubos <[email protected]> Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Everton Ataide <[email protected]>
Tasks https://vtex-dev.atlassian.net/jira/software/projects/BE/boards/2868?selectedIssue=BE-69 BE-70
Here's the completed PR description in English:
FileUploadCardfor file selection and upload functionality, including drag-and-drop support.FileUploadStatusto display upload progress and error handling.SearchInputFieldto include an attachment button that triggers the file upload card.What's the purpose of this pull request?
This PR introduces a new file upload feature that allows users to perform bulk searches by uploading CSV files. The feature provides a modern, user-friendly interface with drag-and-drop support, real-time upload status tracking, and comprehensive error handling to guide users through the file upload process.
How it works?
FileUploadCard Component
.csvextension)FileUploadStatus Component
Displays the current status of the uploaded file with three distinct states:
Uploading State
Completed State
Error State
Error Types
The component handles six different error scenarios:
Integration
SearchInputFieldcomponentFileUploadCardvisibilityKey Features
How to test it?
Basic File Upload Flow
Drag and Drop
Error Handling - Unsupported File Type
File Removal
Starters Deploy Preview
References
Checklist
You may erase this after checking them all 😉
PR Title and Commit Messages
feat,fix,chore,docs,style,refactor,ciandtestPR Description
breaking change,bug,contributing,performance,documentation..Dependencies
pnpm-lock.yamlfile when there were changes to the packagesDocumentation
Summary by CodeRabbit
Release Notes
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.