Conversation
There was a problem hiding this comment.
Pull request overview
This PR refreshes the “Déclarations” page UX by restructuring the upload flow into a dedicated panel with clearer help/resources, and adding a contact block.
Changes:
- Refactors the upload UI: moves upload logic into a new
UploadPaneland redesignsUploadas a two-column layout with DSFR Tiles and a CallOut. - Updates the declarations view to include a contact section and adjusts headings accordingly.
- Adds a new document icon asset and supporting CSS modules.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/views/Declarations.tsx | Adds the contact block and relies on the updated upload component for the “Nouvelle déclaration” section. |
| src/components/Upload/UploadPanel.tsx | New client component encapsulating file selection/upload + success/error alerts. |
| src/components/Upload/UploadPanel.module.css | Styles for the new upload panel card and button spacing. |
| src/components/Upload/Upload.tsx | Redesigns upload area layout; adds help tiles and callout; embeds UploadPanel. |
| src/components/Upload/Upload.module.css | Replaces prior layout styles with new two-column layout/tile styling. |
| public/images/document.svg | Adds an icon used by the new help tiles. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const upload = useCallback(() => { | ||
| setError("") | ||
| setSuccess(false) | ||
| setUploading(true) | ||
| if (file) { | ||
| uploadFile(file).then((error) => { | ||
| setUploading(false) | ||
| setFile(null) | ||
| if (error) { | ||
| setError(error) | ||
| } else { | ||
| setSuccess(true) | ||
| } | ||
| router.refresh() | ||
| }) |
There was a problem hiding this comment.
upload sets uploading to true before checking file, and there’s no .catch()/finally() around the server action call. If the button is triggered with no file (or if uploadFile rejects), the UI can remain stuck in the uploading/disabled state. Consider guarding early when !file, and wrapping the call in try/catch/finally (or .catch/.finally) to always reset uploading and refresh as needed.
| const upload = useCallback(() => { | |
| setError("") | |
| setSuccess(false) | |
| setUploading(true) | |
| if (file) { | |
| uploadFile(file).then((error) => { | |
| setUploading(false) | |
| setFile(null) | |
| if (error) { | |
| setError(error) | |
| } else { | |
| setSuccess(true) | |
| } | |
| router.refresh() | |
| }) | |
| const upload = useCallback(async () => { | |
| setError("") | |
| setSuccess(false) | |
| if (!file) { | |
| return | |
| } | |
| setUploading(true) | |
| try { | |
| const uploadError = await uploadFile(file) | |
| setFile(null) | |
| if (uploadError) { | |
| setError(uploadError) | |
| } else { | |
| setSuccess(true) | |
| } | |
| } catch { | |
| setError("Une erreur est survenue lors du téléversement du fichier.") | |
| } finally { | |
| setUploading(false) | |
| router.refresh() |
| <> | ||
| Le système va maintenant l'analyser pour vérifier qu'il contient l'ensemble des informations | ||
| réglementaires au bon format. Cette étape peut prendre quelques minutes en fonction de la taille de votre | ||
| CSV. <b>Une fois l'analyse terminée, vous recevrez un mail vous indiquant le résultat</b>. Vous pouvez |
There was a problem hiding this comment.
The success message mentions “la taille de votre CSV”, but the upload accepts both CSV and XLSX. This can mislead users who upload an XLSX; consider changing the wording to be format-agnostic (e.g., “fichier”).
| CSV. <b>Une fois l'analyse terminée, vous recevrez un mail vous indiquant le résultat</b>. Vous pouvez | |
| fichier. <b>Une fois l'analyse terminée, vous recevrez un mail vous indiquant le résultat</b>. Vous pouvez |
| uploadFile(file).then((error) => { | ||
| setUploading(false) | ||
| setFile(null) | ||
| if (error) { | ||
| setError(error) |
There was a problem hiding this comment.
The .then((error) => ...) callback parameter shadows the error state variable name, which makes the code harder to read. Consider renaming the callback parameter (e.g., uploadError) to avoid confusion.
| uploadFile(file).then((error) => { | |
| setUploading(false) | |
| setFile(null) | |
| if (error) { | |
| setError(error) | |
| uploadFile(file).then((uploadError) => { | |
| setUploading(false) | |
| setFile(null) | |
| if (uploadError) { | |
| setError(uploadError) |
bc7cb50 to
655b9ac
Compare
655b9ac to
7f68f91
Compare
No description provided.