Skip to content

[CCUBE-2188][GZ] refactor file upload - #1426

Open
ghazwan-gt wants to merge 21 commits into
masterfrom
CCUBE-2188/fileupload
Open

[CCUBE-2188][GZ] refactor file upload#1426
ghazwan-gt wants to merge 21 commits into
masterfrom
CCUBE-2188/fileupload

Conversation

@ghazwan-gt

Copy link
Copy Markdown
Contributor

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing apis or functionality to change)
  • Documentation (change to documentation, comments or API descriptions)
  • Tests (improvements to unit tests or E2E tests)
  • Other (technical improvements, refactoring, or changes that don't fall into the above categories)

Description of changes

  • Link to ticket
  • Link to Figma
  • Merged FileListItem (display/error) and FileItemEdit (edit) into a single unified component that manages its own mode internally
  • Reduced code complexity by extracting shared logic into reusable pieces
  • Simplified the parent FileList by removing mode-tracking state and replacing it with a simple predicate
  • Consolidated two separate style files into one

Checklist

  • Changes follow the project guidelines in CONTRIBUTING.md and CONVENTIONS.md
  • Looks good on mobile and tablet
  • Updated documentation
  • Added/updated unit tests
  • Added/updated E2E tests

Screenshots

Before After
image image

@ghazwan-gt ghazwan-gt self-assigned this Aug 17, 2026
@ghazwan-gt ghazwan-gt added the type: enhancement New feature or request label Aug 17, 2026
Comment thread src/file-upload/file-list/file-list.tsx
Comment thread src/file-upload/file-list/file-list.tsx Outdated
Comment thread src/file-upload/file-list-item/file-list-item.styles.ts Outdated
Comment thread src/file-upload/file-list-item/file-item-details.tsx Outdated
Comment thread src/file-upload/file-list-item/file-item-details.tsx
Comment thread src/file-upload/file-list-item/file-list-item.tsx Outdated
Comment thread src/file-upload/file-list-item/file-list-item.tsx

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

finding the split of renderModes into editingIds on the parent file list and currentMode on the child to be awkward, but will go with this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

did editingIds get removed? that's still needed to disable the sorting when at least 1 item is in edit mode

@qroll qroll added the type: chore For technical improvements or refactoring. label Aug 18, 2026
@ghazwan-gt
ghazwan-gt force-pushed the CCUBE-2188/fileupload branch from 03551f0 to c8b5e86 Compare August 25, 2026 08:23
@ghazwan-gt ghazwan-gt changed the title [CCUBE-2188] refactor file upload [CCUBE-2188][GZ] refactor file upload Aug 25, 2026
Comment thread src/file-upload/file-list/file-list.tsx Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

did editingIds get removed? that's still needed to disable the sorting when at least 1 item is in edit mode

Comment on lines +179 to +180
const disableSave =
descriptionRequired && currentDescription.trim().length === 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: move below the section header

Comment thread src/file-upload/file-list-item/file-list-item.tsx
sensors={sensors}
onDragEnd={handleDragEnd}
onDragStart={handleDragStart}
return (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the original intention for separate rendering was to avoid initialising the dnd context and its listeners when it's not needed

Comment on lines +229 to +231
setEditingCount((prev) =>
mode === "edit" ? prev + 1 : Math.max(0, prev - 1)
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this might not work if the fileItems prop updates separately; the count won't be removed?

@ghazwan-gt
ghazwan-gt force-pushed the CCUBE-2188/fileupload branch from 33753ad to 2b30da4 Compare August 28, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: chore For technical improvements or refactoring. type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants