feat: track upload progress in attachment preview components#3060
feat: track upload progress in attachment preview components#3060
Conversation
1c15431 to
6c93b9b
Compare
src/components/MessageComposer/AttachmentPreviewList/AttachmentUploadProgressIndicator.tsx
Show resolved
Hide resolved
6c93b9b to
50c8b11
Compare
src/components/MessageComposer/AttachmentPreviewList/AudioAttachmentPreview.tsx
Outdated
Show resolved
Hide resolved
src/components/MessageComposer/AttachmentPreviewList/AudioAttachmentPreview.tsx
Outdated
Show resolved
Hide resolved
e3e0a90 to
db938aa
Compare
src/components/MessageComposer/AttachmentPreviewList/AttachmentUploadProgressIndicator.tsx
Outdated
Show resolved
Hide resolved
src/components/MessageComposer/AttachmentPreviewList/AttachmentUploadProgressIndicator.tsx
Outdated
Show resolved
Hide resolved
| export type AttachmentUploadProgressIndicatorProps = { | ||
| className?: string; | ||
| /** Shown when `uploadProgress` is `undefined` (e.g. progress tracking disabled). */ | ||
| fallback?: ReactNode; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Actually this prop can be removed if the LoadingIndicator is consumed from the context
There was a problem hiding this comment.
I wanted to do that, but I think there are two loading indicators:
LoadingIndicatorIconinMessageComposer: https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageComposer/icons.tsx#L6 - without any override inComponentContext, but this is what is used currently for loading hereLoadingIndicator- https://github.com/GetStream/stream-chat-react/blob/master/src/components/Loading/LoadingIndicator.tsx#L6 - this one has override inComponentContext. I'm not sure why we have two, should I use this here instead of theLoadingIndicatorIcon?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
We could introduce UploadIndicator into component context or into the props of this component.
There was a problem hiding this comment.
Added AttachmentUploadProgressIndicator to ComponentContext in 0a8d65d
There was a problem hiding this comment.
Could use property UploadIndicator instead of AttachmentUploadProgressIndicator as it is more generic?
There was a problem hiding this comment.
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.
src/components/MessageComposer/AttachmentPreviewList/AudioAttachmentPreview.tsx
Show resolved
Hide resolved
Co-authored-by: MartinCupela <32706194+MartinCupela@users.noreply.github.com>
e400abb to
77ba34c
Compare
…ressIndicator overridable
🎯 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
ProgressIndicator-> displays a circular progress indicator to track progress from 0 - 100%AttachmentUploadProgressIndicator-> if upload progress is available, it displaysProgressIndicator, otherwise theLoadingIndicator. When is upload progress not available?AttachmentUploadedSizeIndicatorPropsto display file size:🎨 UI Changes
Implementing this design: https://www.figma.com/design/Us73erK1xFNcB5EH3hyq6Y/Chat-SDK-Design-System?node-id=3517-102932&t=fizGA6SsyGt3g08F-0