Skip to content

feat: track upload progress in attachment preview components#3060

Open
szuperaz wants to merge 13 commits intomasterfrom
file-upload-on-progress
Open

feat: track upload progress in attachment preview components#3060
szuperaz wants to merge 13 commits intomasterfrom
file-upload-on-progress

Conversation

@szuperaz
Copy link
Copy Markdown
Contributor

@szuperaz szuperaz commented Mar 25, 2026

🎯 Goal

https://linear.app/stream/issue/REACT-925/upload-progress-tracking

Depends on: https://github.com/GetStream/stream-chat-js/pull/1708/changes#diff-61c3f170c2f20982af303989006c8317adf3006784ed2b37513e1c50487353d0

🛠 Implementation details

  • New component: ProgressIndicator -> displays a circular progress indicator to track progress from 0 - 100%
  • New component: AttachmentUploadProgressIndicator -> if upload progress is available, it displays ProgressIndicator, otherwise the LoadingIndicator. When is upload progress not available?
    • It's possible that axios can't retrieve upload progress info
    • If someone uses custom CDN uploads, they may not be able to/want to provide progress tracking
  • New component: AttachmentUploadedSizeIndicatorProps to display file size:
    • During upload: 4 MB / 24 MB
    • After upload finished: 24 MB

🎨 UI Changes

Implementing this design: https://www.figma.com/design/Us73erK1xFNcB5EH3hyq6Y/Chat-SDK-Design-System?node-id=3517-102932&t=fizGA6SsyGt3g08F-0

Screenshot 2026-03-25 at 13 51 12 Screenshot 2026-03-25 at 16 01 36

@szuperaz szuperaz force-pushed the file-upload-on-progress branch from 1c15431 to 6c93b9b Compare March 25, 2026 15:14
@szuperaz szuperaz force-pushed the file-upload-on-progress branch from 6c93b9b to 50c8b11 Compare March 25, 2026 15:19
@szuperaz szuperaz marked this pull request as ready for review March 26, 2026 09:59
@szuperaz szuperaz force-pushed the file-upload-on-progress branch 3 times, most recently from e3e0a90 to db938aa Compare April 1, 2026 14:37
export type AttachmentUploadProgressIndicatorProps = {
className?: string;
/** Shown when `uploadProgress` is `undefined` (e.g. progress tracking disabled). */
fallback?: ReactNode;
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.

Could this be made ComponentType instead of ReactNode? I am thinking that it provides more flexibility to render the component in place, where it is returned, instead somewhere up in the tree.

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.

Actually this prop can be removed if the LoadingIndicator is consumed from the context

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wanted to do that, but I think there are two loading indicators:

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.

Yes please, I think that is the remnant of not having the loading indicator finished according to the new designs.

<div className='str-chat__attachment-preview-file__data'>
{uploadState === 'uploading' && <LoadingIndicatorIcon />}
{uploadState === 'uploading' && (
<AttachmentUploadProgressIndicator
Copy link
Copy Markdown
Contributor

@MartinCupela MartinCupela Apr 6, 2026

Choose a reason for hiding this comment

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

We could introduce UploadIndicator into component context or into the props of this component.

Copy link
Copy Markdown
Contributor Author

@szuperaz szuperaz Apr 7, 2026

Choose a reason for hiding this comment

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

Added AttachmentUploadProgressIndicator to ComponentContext in 0a8d65d

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.

Could use property UploadIndicator instead of AttachmentUploadProgressIndicator as it is more generic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, for AttachmentUploadProgressIndicator we could do UploadIndicator I guess. For the other one: AttachmentUploadedSizeIndicator - we can't because that has a bit more complex logic depending on attachment-specific fields.

@szuperaz szuperaz force-pushed the file-upload-on-progress branch from e400abb to 77ba34c Compare April 7, 2026 15:30
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.

3 participants