Repository navigation
feat: add worker to upload CSV file - #3117
lariciamota merged 120 commits into
Conversation
|
The changelog needs to be added. |
|
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. |
|
Adiciona por favor na descrição do PR o arquivo .csv que estão usando no desenvolvimento |
| "react-dom": "^18.2.0" | ||
| }, | ||
| "dependencies": { | ||
| "papaparse": "^5.5.3", |
There was a problem hiding this comment.
Precisamos checar com o time da faststore a opinião sobre a adição desse pacote, consegue explicar um pouco a necessidade dele?
There was a problem hiding this comment.
Foi utilizado visando desempenho e simplicidade para processar arquivos CSV grandes. Foi indicado o uso na RFC. Ele lê o CSV em partes (streaming), não trava a tela, já usa Web Worker, detecta separador, trata aspas, dá progresso, permite cancelar e manipula arquivos grandes sem prejudicar a memória.
| 'application/vnd.ms-excel': ['.xls'], | ||
| 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': [ | ||
| '.xlsx', |
There was a problem hiding this comment.
Acredito que na RFC foi proposto o upload apenas de formato csv, surgiu a necessidade de xls e xlsx tb?
There was a problem hiding this comment.
Ajustado, aceitando apenas CSV
ArthurTriis1
left a comment
There was a problem hiding this comment.
A funcionalidade parece estar funcionando bem, mas reforço que precisamos da avaliação do time da faststore sobre a adição da lib papaparse e averiguar se devemos de fato permitir o upload de xls e xlsx.
A adição da lib do papaparse foi indicado para uso na RFC. |
|
Para desenvolver utilizamos o arquvio fornecido pela propria RFC |
|
Oie, pessoal! |
## What's the purpose of this pull request? This PR refers to the creation of the Quick Order Drawer, a new component developed for the Quick Order By File functionality. The main advantage of the Quick Order functionality is the ability to add products directly to the cart from the search, which significantly reduces the number of clicks and browsing time. <!--- Considering the context, what is the problem we'll solve? Where in VTEX's big picture our issue fits in? Write a tweet about the context and the problem itself. ---> ## How it works? <!--- Tell us the role of the new feature, or component, in its context. Provide details about what you have implemented and screenshots if applicable. ---> Creating the Quick Order Drawer layout according to Figma. <img width="1912" height="966" alt="image (3)" src="https://github.com/user-attachments/assets/65a66428-8db2-45f4-86f5-c28f4236a2e4" /> ## How to test it? <!--- Describe the steps with bullet points. Is there any external link that can be used to better test it or an example? ---> • The user uploads the file in the Quick Order interface. • After the upload is completed, the Search button becomes enabled. • The user clicks the Search button to start processing. • The system begins processing the file data. • The Dropdown enters a loading state. • Even while loading, the Dropdown can be closed without interrupting the processing. • Once processing is finished, the system automatically opens the Quick Order Drawer. ### 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 [Figma](https://www.figma.com/design/0c3DOaXs6rS25LyDWi7uap/Cubos-%C2%B7-FastStore-Features-(H2-2024)?node-id=1-23&node-type=canvas&t=EiFoKx4kFwgKhNEP-0) <!--- Spread the knowledge: is there any content you used to create this PR that is worth sharing? ---> <!--- Extra tip: adding references to related issues or mentioning people important to this PR may be good for the documentation and reviewing process ---> ## 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** - [x] 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** * Added Quick Order Drawer component enabling streamlined product ordering with header, product selection table, quantity adjustments, and checkout from a side panel. * **Documentation** * Added Storybook examples demonstrating Quick Order Drawer with multiple configuration scenarios. * **Chores** * Updated TypeScript React type definitions to latest compatible versions. <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: renato <[email protected]> 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]>
d9e0250 to
87df01e
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds CSV upload and parsing with a Dropzone UI: new hooks ( Changes
Sequence DiagramsequenceDiagram
autonumber
actor User as "User"
participant SI as "SearchInput"
participant UFD as "UploadFileDropdown"
participant DZ as "Dropzone"
participant CSV as "useCSVParser"
participant WW as "WebWorker (PapaParse)"
participant FUS as "FileUploadStatus"
User->>SI: open upload UI
SI->>UFD: render dropdown
User->>DZ: drop/select CSV file
DZ->>UFD: onFilesAccepted(files)
UFD->>CSV: onParseFile(file)
CSV->>WW: parse (worker: true, chunked)
WW-->>CSV: chunk results + progress
CSV-->>UFD: resolve CSVData (rows, totals)
UFD->>FUS: display results / status
User->>FUS: click Search
FUS->>SI: emit parsed CSVData
SI->>SI: call onFileSearch(CSVData)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 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 |
87df01e to
d9e0250
Compare
- Updated `useFileUpload` to use `FileRejection` type for better type safety. - Introduced `UploadFileDropdown` component with improved CSV file handling using `useCSVParser` hook. - Simplified error handling and template generation for CSV uploads. - Added lazy loading for `UploadFileDropdown` in `SearchInput` component.
This PR refers to the creation of the Quick Order Drawer, a new component developed for the Quick Order By File functionality. The main advantage of the Quick Order functionality is the ability to add products directly to the cart from the search, which significantly reduces the number of clicks and browsing time. <!--- Considering the context, what is the problem we'll solve? Where in VTEX's big picture our issue fits in? Write a tweet about the context and the problem itself. ---> <!--- Tell us the role of the new feature, or component, in its context. Provide details about what you have implemented and screenshots if applicable. ---> Creating the Quick Order Drawer layout according to Figma. <img width="1912" height="966" alt="image (3)" src="https://github.com/user-attachments/assets/65a66428-8db2-45f4-86f5-c28f4236a2e4" /> <!--- Describe the steps with bullet points. Is there any external link that can be used to better test it or an example? ---> • The user uploads the file in the Quick Order interface. • After the upload is completed, the Search button becomes enabled. • The user clicks the Search button to start processing. • The system begins processing the file data. • The Dropdown enters a loading state. • Even while loading, the Dropdown can be closed without interrupting the processing. • Once processing is finished, the system automatically opens the Quick Order Drawer. <!--- 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. ---> [Figma](https://www.figma.com/design/0c3DOaXs6rS25LyDWi7uap/Cubos-%C2%B7-FastStore-Features-(H2-2024)?node-id=1-23&node-type=canvas&t=EiFoKx4kFwgKhNEP-0) <!--- Spread the knowledge: is there any content you used to create this PR that is worth sharing? ---> <!--- Extra tip: adding references to related issues or mentioning people important to this PR may be good for the documentation and reviewing process ---> <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** - [x] 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** * Added Quick Order Drawer component enabling streamlined product ordering with header, product selection table, quantity adjustments, and checkout from a side panel. * **Documentation** * Added Storybook examples demonstrating Quick Order Drawer with multiple configuration scenarios. * **Chores** * Updated TypeScript React type definitions to latest compatible versions. <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: renato <[email protected]> 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]>
a38c730
into
vtex:feat/quick-order-by-file-feature-branch
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]>
## Summary - Replace hardcoded version references (`^3.97.0-dev.2`) with `workspace:*` protocol for `@faststore/components` and `@faststore/ui` in `packages/ui/package.json` and `packages/storybook/package.json` - This ensures local packages are always resolved from the monorepo workspace during development ## Motivation Extracted from PR #3117 as requested in [code review](#3117) by @lariciamota, so we can identify possible problems easier by isolating this change. ## Changed files - `packages/ui/package.json` — `@faststore/components` dependency and peerDependency changed to `workspace:*` - `packages/storybook/package.json` — `@faststore/components` and `@faststore/ui` dependencies changed to `workspace:*` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Switched internal package references in Storybook and UI to workspace-based declarations to improve build consistency. * Aligned dependency declarations across the monorepo to reduce version mismatch risks and streamline local development and local testing. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor <[email protected]> Co-authored-by: Larícia Mota <[email protected]>
What's the purpose of this pull request?
This pull request introduces a new file upload and CSV parsing feature to the
componentspackage, including reusable hooks and UI components. The main changes are the addition of aFileUploadCardcomponent for uploading files, auseCSVParserhook for parsing CSV files in a web worker, and auseFileUploadhook 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:
useCSVParserhook for parsing CSV files in a web worker, with error handling and CSV template generation.useFileUploadhook to manage file upload errors, validation, and rejection reasons.New UI components:
FileUploadCardcomponent for file selection, drag-and-drop, and template download, with error state and file validation.FileUploadCardandFileUploadStatuscomponents and their types.Dependency updates:
papaparseto dependencies for running CSV parsing in a web worker.How to test it?
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
@Mariana-Caetanoto review and update (Or submit a doc request)Summary by CodeRabbit
New Features
Enhancements
Refactor
Style