Skip to content

feat: improve declarations page#121

Merged
desoindx merged 1 commit intodevelopfrom
feat/declaration
Feb 25, 2026
Merged

feat: improve declarations page#121
desoindx merged 1 commit intodevelopfrom
feat/declaration

Conversation

@desoindx
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings February 23, 2026 13:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 UploadPanel and redesigns Upload as 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.

Comment on lines +19 to +33
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()
})
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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()

Copilot uses AI. Check for mistakes.
<>
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
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

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”).

Suggested change
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

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +28
uploadFile(file).then((error) => {
setUploading(false)
setFile(null)
if (error) {
setError(error)
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
uploadFile(file).then((error) => {
setUploading(false)
setFile(null)
if (error) {
setError(error)
uploadFile(file).then((uploadError) => {
setUploading(false)
setFile(null)
if (uploadError) {
setError(uploadError)

Copilot uses AI. Check for mistakes.
@desoindx desoindx force-pushed the feat/declaration branch 2 times, most recently from bc7cb50 to 655b9ac Compare February 25, 2026 12:41
@desoindx desoindx merged commit 3dbdaf4 into develop Feb 25, 2026
5 of 6 checks passed
@desoindx desoindx deleted the feat/declaration branch February 25, 2026 13:10
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