Skip to content

Commit e686dca

Browse files
committed
refactor: rename AttachmentUploadProgressIndicator to UploadProgressIndicator
1 parent ff1e879 commit e686dca

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

src/components/MessageComposer/AttachmentPreviewList/AttachmentUploadProgressIndicator.tsx renamed to src/components/Loading/UploadProgressIndicator.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
import clsx from 'clsx';
22
import React from 'react';
33

4-
import {
5-
CircularProgressIndicator as DefaultCircularProgressIndicator,
6-
LoadingIndicator as DefaultLoadingIndicator,
7-
} from '../../Loading';
8-
import { useComponentContext } from '../../../context';
4+
import { useComponentContext } from '../../context';
5+
import { CircularProgressIndicator as DefaultCircularProgressIndicator } from './CircularProgressIndicator';
6+
import { LoadingIndicator as DefaultLoadingIndicator } from './LoadingIndicator';
97

10-
export type AttachmentUploadProgressIndicatorProps = {
8+
export type UploadProgressIndicatorProps = {
119
className?: string;
1210
uploadProgress?: number;
1311
};
1412

15-
export const AttachmentUploadProgressIndicator = ({
13+
export const UploadProgressIndicator = ({
1614
className,
1715
uploadProgress,
18-
}: AttachmentUploadProgressIndicatorProps) => {
16+
}: UploadProgressIndicatorProps) => {
1917
const {
2018
CircularProgressIndicator = DefaultCircularProgressIndicator,
2119
LoadingIndicator = DefaultLoadingIndicator,

src/components/Loading/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './LoadingChannels';
33
export * from './LoadingErrorIndicator';
44
export * from './LoadingIndicator';
55
export * from './CircularProgressIndicator';
6+
export * from './UploadProgressIndicator';

src/components/MediaRecorder/AudioRecorder/AudioRecorderRecordingControls.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import { IconDelete, IconPauseFill, IconVoice } from '../../Icons';
33
import React from 'react';
44
import {
55
useChatContext,
6+
useComponentContext,
67
useMessageComposerContext,
78
useTranslationContext,
89
} from '../../../context';
910
import { isRecording } from './recordingStateIdentity';
1011
import { Button } from '../../Button';
1112
import { addNotificationTargetTag, useNotificationTarget } from '../../Notifications';
12-
import { AttachmentUploadProgressIndicator } from '../../MessageComposer/AttachmentPreviewList/AttachmentUploadProgressIndicator';
13+
import { UploadProgressIndicator as DefaultUploadProgressIndicator } from '../../Loading/UploadProgressIndicator';
1314

1415
const ToggleRecordingButton = () => {
1516
const {
@@ -35,6 +36,8 @@ const ToggleRecordingButton = () => {
3536
export const AudioRecorderRecordingControls = () => {
3637
const { client } = useChatContext();
3738
const { t } = useTranslationContext();
39+
const { UploadProgressIndicator = DefaultUploadProgressIndicator } =
40+
useComponentContext();
3841
const {
3942
recordingController: { completeRecording, recorder, recording, recordingState },
4043
} = useMessageComposerContext();
@@ -82,7 +85,7 @@ export const AudioRecorderRecordingControls = () => {
8285
variant='primary'
8386
>
8487
{isUploadingFile ? (
85-
<AttachmentUploadProgressIndicator uploadProgress={uploadProgress} />
88+
<UploadProgressIndicator uploadProgress={uploadProgress} />
8689
) : (
8790
<CheckSignIcon />
8891
)}

src/components/MessageComposer/AttachmentPreviewList/AudioAttachmentPreview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { useComponentContext, useTranslationContext } from '../../../context';
88
import React, { useEffect } from 'react';
99
import clsx from 'clsx';
10-
import { AttachmentUploadProgressIndicator as DefaultAttachmentUploadProgressIndicator } from './AttachmentUploadProgressIndicator';
10+
import { UploadProgressIndicator as DefaultUploadProgressIndicator } from '../../Loading/UploadProgressIndicator';
1111
import { RemoveAttachmentPreviewButton } from '../RemoveAttachmentPreviewButton';
1212
import { AttachmentPreviewRoot } from './utils/AttachmentPreviewRoot';
1313
import { IconExclamationMark, IconExclamationTriangleFill } from '../../Icons';
@@ -44,7 +44,7 @@ export const AudioAttachmentPreview = ({
4444
const { t } = useTranslationContext();
4545
const {
4646
AttachmentUploadedSizeIndicator = DefaultAttachmentUploadedSizeIndicator,
47-
AttachmentUploadProgressIndicator = DefaultAttachmentUploadProgressIndicator,
47+
UploadProgressIndicator = DefaultUploadProgressIndicator,
4848
} = useComponentContext();
4949
const { id, previewUri, uploadPermissionCheck, uploadProgress, uploadState } =
5050
attachment.localMetadata ?? {};
@@ -98,7 +98,7 @@ export const AudioAttachmentPreview = ({
9898
</div>
9999
<div className='str-chat__attachment-preview-file__data'>
100100
{uploadState === 'uploading' && (
101-
<AttachmentUploadProgressIndicator uploadProgress={uploadProgress} />
101+
<UploadProgressIndicator uploadProgress={uploadProgress} />
102102
)}
103103
{showProgressControls ? (
104104
<>

src/components/MessageComposer/AttachmentPreviewList/FileAttachmentPreview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { useComponentContext, useTranslationContext } from '../../../context';
33
import { FileIcon } from '../../FileIcon';
4-
import { AttachmentUploadProgressIndicator as DefaultAttachmentUploadProgressIndicator } from './AttachmentUploadProgressIndicator';
4+
import { UploadProgressIndicator as DefaultUploadProgressIndicator } from '../../Loading/UploadProgressIndicator';
55
import { AttachmentUploadedSizeIndicator as DefaultAttachmentUploadedSizeIndicator } from './AttachmentUploadedSizeIndicator';
66
import type { LocalAudioAttachment, LocalFileAttachment } from 'stream-chat';
77
import type { UploadAttachmentPreviewProps } from './types';
@@ -22,7 +22,7 @@ export const FileAttachmentPreview = ({
2222
const { t } = useTranslationContext('FilePreview');
2323
const {
2424
AttachmentUploadedSizeIndicator = DefaultAttachmentUploadedSizeIndicator,
25-
AttachmentUploadProgressIndicator = DefaultAttachmentUploadProgressIndicator,
25+
UploadProgressIndicator = DefaultUploadProgressIndicator,
2626
} = useComponentContext();
2727
const { id, uploadPermissionCheck, uploadProgress, uploadState } =
2828
attachment.localMetadata ?? {};
@@ -47,7 +47,7 @@ export const FileAttachmentPreview = ({
4747
</div>
4848
<div className='str-chat__attachment-preview-file__data'>
4949
{uploadState === 'uploading' && (
50-
<AttachmentUploadProgressIndicator uploadProgress={uploadProgress} />
50+
<UploadProgressIndicator uploadProgress={uploadProgress} />
5151
)}
5252
<AttachmentUploadedSizeIndicator attachment={attachment} />
5353
{hasFatalError && (

src/components/MessageComposer/AttachmentPreviewList/MediaAttachmentPreview.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import clsx from 'clsx';
1717
import { IconExclamationMark, IconRetry, IconVideoFill } from '../../Icons';
1818
import { RemoveAttachmentPreviewButton } from '../RemoveAttachmentPreviewButton';
1919
import { Button } from '../../Button';
20-
import { AttachmentUploadProgressIndicator as DefaultAttachmentUploadProgressIndicator } from './AttachmentUploadProgressIndicator';
20+
import { UploadProgressIndicator as DefaultUploadProgressIndicator } from '../../Loading/UploadProgressIndicator';
2121
import { AttachmentPreviewRoot } from './utils/AttachmentPreviewRoot';
2222

2323
export type MediaAttachmentPreviewProps<CustomLocalMetadata = Record<string, unknown>> =
@@ -35,8 +35,8 @@ export const MediaAttachmentPreview = ({
3535
}: MediaAttachmentPreviewProps) => {
3636
const { t } = useTranslationContext();
3737
const {
38-
AttachmentUploadProgressIndicator = DefaultAttachmentUploadProgressIndicator,
3938
BaseImage = DefaultBaseImage,
39+
UploadProgressIndicator = DefaultUploadProgressIndicator,
4040
} = useComponentContext();
4141
const [thumbnailPreviewError, setThumbnailPreviewError] = useState(false);
4242

@@ -97,9 +97,7 @@ export const MediaAttachmentPreview = ({
9797
)}
9898

9999
<div className={clsx('str-chat__attachment-preview-media__overlay')}>
100-
{isUploading && (
101-
<AttachmentUploadProgressIndicator uploadProgress={uploadProgress} />
102-
)}
100+
{isUploading && <UploadProgressIndicator uploadProgress={uploadProgress} />}
103101

104102
{isVideoAttachment(attachment) &&
105103
!hasUploadError &&

src/context/ComponentContext.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ import type { EditedMessagePreviewProps } from '../components/MessageComposer/Ed
7575
import type { FileIconProps } from '../components/FileIcon/FileIcon';
7676
import type { CommandChipProps } from '../components/MessageComposer/CommandChip';
7777
import type { CircularProgressIndicatorProps } from '../components/Loading/CircularProgressIndicator';
78-
import type { AttachmentUploadProgressIndicatorProps } from '../components/MessageComposer/AttachmentPreviewList/AttachmentUploadProgressIndicator';
78+
import type { UploadProgressIndicatorProps } from '../components/Loading/UploadProgressIndicator';
7979
import type { AttachmentUploadedSizeIndicatorProps } from '../components/MessageComposer/AttachmentPreviewList/AttachmentUploadedSizeIndicator';
8080

8181
export type ComponentContextValue = {
@@ -89,8 +89,6 @@ export type ComponentContextValue = {
8989
AttachmentPreviewList?: React.ComponentType<AttachmentPreviewListProps>;
9090
/** Custom UI component to control adding attachments to MessageComposer, defaults to and accepts same props as: [AttachmentSelector](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageComposer/AttachmentSelector.tsx) */
9191
AttachmentSelector?: React.ComponentType;
92-
/** Custom UI component for upload progress on attachment previews in MessageComposer, defaults to and accepts same props as: [AttachmentUploadProgressIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageComposer/AttachmentPreviewList/AttachmentUploadProgressIndicator.tsx) */
93-
AttachmentUploadProgressIndicator?: React.ComponentType<AttachmentUploadProgressIndicatorProps>;
9492
/** Custom UI component for uploaded/total size on attachment previews in MessageComposer, defaults to and accepts same props as: [AttachmentUploadedSizeIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageComposer/AttachmentPreviewList/AttachmentUploadedSizeIndicator.tsx) */
9593
AttachmentUploadedSizeIndicator?: React.ComponentType<AttachmentUploadedSizeIndicatorProps>;
9694
/** Custom UI component for the dedicated voice recording preview slot above composer attachments (REACT-794), defaults to and accepts same props as: [VoiceRecordingPreviewSlot](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageComposer/AttachmentPreviewList/VoiceRecordingPreviewSlot.tsx) */
@@ -272,6 +270,8 @@ export type ComponentContextValue = {
272270
UnreadMessagesNotification?: React.ComponentType<UnreadMessagesNotificationProps>;
273271
/** Custom UI component that separates read messages from unread, defaults to and accepts same props as: [UnreadMessagesSeparator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageList/UnreadMessagesSeparator.tsx) */
274272
UnreadMessagesSeparator?: React.ComponentType<UnreadMessagesSeparatorProps>;
273+
/** Custom UI component for upload progress (e.g. attachment previews, audio recording), defaults to and accepts same props as: [UploadProgressIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Loading/UploadProgressIndicator.tsx) */
274+
UploadProgressIndicator?: React.ComponentType<UploadProgressIndicatorProps>;
275275
/** Component used to play video. If not provided, ReactPlayer is used as a default video player. */
276276
VideoPlayer?: React.ComponentType<VideoPlayerProps>;
277277
/** Custom UI component to display a message in the `VirtualizedMessageList`, does not have a default implementation */

0 commit comments

Comments
 (0)