Skip to content

Commit 23e9e31

Browse files
committed
chore: resolve conflict from base branch
2 parents 115b21a + 90bd97c commit 23e9e31

19 files changed

+178
-397
lines changed

package/src/components/Channel/Channel.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ import { AttachmentUploadProgressIndicator as AttachmentUploadProgressIndicatorD
167167
import { AudioAttachmentUploadPreview as AudioAttachmentUploadPreviewDefault } from '../MessageInput/components/AttachmentPreview/AudioAttachmentUploadPreview';
168168
import { FileAttachmentUploadPreview as FileAttachmentUploadPreviewDefault } from '../MessageInput/components/AttachmentPreview/FileAttachmentUploadPreview';
169169
import { ImageAttachmentUploadPreview as ImageAttachmentUploadPreviewDefault } from '../MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview';
170-
import { VideoAttachmentUploadPreview as VideoAttachmentUploadPreviewDefault } from '../MessageInput/components/AttachmentPreview/VideoAttachmentUploadPreview';
171170
import { AudioRecorder as AudioRecorderDefault } from '../MessageInput/components/AudioRecorder/AudioRecorder';
172171
import { AudioRecordingButton as AudioRecordingButtonDefault } from '../MessageInput/components/AudioRecorder/AudioRecordingButton';
173172
import { AudioRecordingInProgress as AudioRecordingInProgressDefault } from '../MessageInput/components/AudioRecorder/AudioRecordingInProgress';
@@ -535,7 +534,6 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
535534
numberOfAttachmentImagesToLoadPerCall = 60,
536535
numberOfAttachmentPickerImageColumns = 3,
537536

538-
autoCompleteSuggestionsLimit,
539537
bottomInset = 0,
540538
CameraSelectorIcon = DefaultCameraSelectorIcon,
541539
FileSelectorIcon = DefaultFileSelectorIcon,
@@ -606,7 +604,6 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
606604
ImageReloadIndicator = ImageReloadIndicatorDefault,
607605
ImageUploadPreview = ImageUploadPreviewDefault,
608606
initialScrollToFirstUnreadMessage = false,
609-
initialValue,
610607
InlineDateSeparator = InlineDateSeparatorDefault,
611608
InlineUnreadIndicator = InlineUnreadIndicatorDefault,
612609
Input,
@@ -628,8 +625,6 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
628625
markReadOnMount = true,
629626
maxNumberOfFiles = 10,
630627
maxTimeBetweenGroupedMessages,
631-
mentionAllAppUsersEnabled = false,
632-
mentionAllAppUsersQuery,
633628
Message = MessageDefault,
634629
MessageActionList = MessageActionListDefault,
635630
MessageActionListItem = MessageActionListItemDefault,
@@ -707,9 +702,9 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
707702
TypingIndicator = TypingIndicatorDefault,
708703
TypingIndicatorContainer = TypingIndicatorContainerDefault,
709704
UnreadMessagesNotification = UnreadMessagesNotificationDefault,
710-
UploadProgressIndicator = AttachmentUploadProgressIndicatorDefault,
705+
AttachmentUploadProgressIndicator = AttachmentUploadProgressIndicatorDefault,
711706
UrlPreview = CardDefault,
712-
VideoAttachmentUploadPreview = VideoAttachmentUploadPreviewDefault,
707+
VideoAttachmentUploadPreview = FileAttachmentUploadPreviewDefault,
713708
VideoThumbnail = VideoThumbnailDefault,
714709
} = props;
715710

@@ -1789,6 +1784,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
17891784
attachmentPickerBottomSheetHeight,
17901785
AttachmentPickerSelectionBar,
17911786
attachmentSelectionBarHeight,
1787+
AttachmentUploadProgressIndicator,
17921788
AudioAttachmentUploadPreview,
17931789
AudioRecorder,
17941790
audioRecordingEnabled,
@@ -1799,7 +1795,6 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
17991795
AutoCompleteSuggestionHeader,
18001796
AutoCompleteSuggestionItem,
18011797
AutoCompleteSuggestionList,
1802-
autoCompleteSuggestionsLimit,
18031798
CameraSelectorIcon,
18041799
channelId,
18051800
clearEditingState,
@@ -1823,15 +1818,12 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
18231818
ImageAttachmentUploadPreview,
18241819
ImageSelectorIcon,
18251820
ImageUploadPreview,
1826-
initialValue,
18271821
Input,
18281822
InputButtons,
18291823
InputEditingStateHeader,
18301824
InputReplyStateHeader,
18311825
isCommandUIEnabled,
18321826
maxNumberOfFiles,
1833-
mentionAllAppUsersEnabled,
1834-
mentionAllAppUsersQuery,
18351827
MoreOptionsButton,
18361828
openPollCreationDialog,
18371829
SendButton,
@@ -1841,7 +1833,6 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
18411833
ShowThreadMessageInChannelButton,
18421834
StartAudioRecordingButton,
18431835
StopMessageStreamingButton,
1844-
UploadProgressIndicator,
18451836
VideoAttachmentUploadPreview,
18461837
VideoRecorderSelectorIcon,
18471838
});

package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const useCreateInputMessageInputContext = ({
1414
attachmentPickerBottomSheetHeight,
1515
AttachmentPickerSelectionBar,
1616
attachmentSelectionBarHeight,
17+
AttachmentUploadProgressIndicator,
1718
AudioAttachmentUploadPreview,
1819
AudioRecorder,
1920
audioRecordingEnabled,
@@ -24,7 +25,6 @@ export const useCreateInputMessageInputContext = ({
2425
AutoCompleteSuggestionHeader,
2526
AutoCompleteSuggestionItem,
2627
AutoCompleteSuggestionList,
27-
autoCompleteSuggestionsLimit,
2828
channelId,
2929
clearEditingState,
3030
CameraSelectorIcon,
@@ -48,15 +48,12 @@ export const useCreateInputMessageInputContext = ({
4848
ImageAttachmentUploadPreview,
4949
ImageSelectorIcon,
5050
ImageUploadPreview,
51-
initialValue,
5251
Input,
5352
InputButtons,
5453
InputEditingStateHeader,
5554
InputReplyStateHeader,
5655
isCommandUIEnabled,
5756
maxNumberOfFiles,
58-
mentionAllAppUsersEnabled,
59-
mentionAllAppUsersQuery,
6057
MoreOptionsButton,
6158
openPollCreationDialog,
6259
SendButton,
@@ -67,7 +64,6 @@ export const useCreateInputMessageInputContext = ({
6764
ShowThreadMessageInChannelButton,
6865
StartAudioRecordingButton,
6966
StopMessageStreamingButton,
70-
UploadProgressIndicator,
7167
VideoAttachmentUploadPreview,
7268
VideoRecorderSelectorIcon,
7369
}: InputMessageInputContextValue & {
@@ -91,6 +87,7 @@ export const useCreateInputMessageInputContext = ({
9187
attachmentPickerBottomSheetHeight,
9288
AttachmentPickerSelectionBar,
9389
attachmentSelectionBarHeight,
90+
AttachmentUploadProgressIndicator,
9491
AudioAttachmentUploadPreview,
9592
AudioRecorder,
9693
audioRecordingEnabled,
@@ -101,7 +98,6 @@ export const useCreateInputMessageInputContext = ({
10198
AutoCompleteSuggestionHeader,
10299
AutoCompleteSuggestionItem,
103100
AutoCompleteSuggestionList,
104-
autoCompleteSuggestionsLimit,
105101
CameraSelectorIcon,
106102
clearEditingState,
107103
CommandInput,
@@ -124,15 +120,12 @@ export const useCreateInputMessageInputContext = ({
124120
ImageAttachmentUploadPreview,
125121
ImageSelectorIcon,
126122
ImageUploadPreview,
127-
initialValue,
128123
Input,
129124
InputButtons,
130125
InputEditingStateHeader,
131126
InputReplyStateHeader,
132127
isCommandUIEnabled,
133128
maxNumberOfFiles,
134-
mentionAllAppUsersEnabled,
135-
mentionAllAppUsersQuery,
136129
MoreOptionsButton,
137130
openPollCreationDialog,
138131
SendButton,
@@ -143,19 +136,11 @@ export const useCreateInputMessageInputContext = ({
143136
ShowThreadMessageInChannelButton,
144137
StartAudioRecordingButton,
145138
StopMessageStreamingButton,
146-
UploadProgressIndicator,
147139
VideoAttachmentUploadPreview,
148140
VideoRecorderSelectorIcon,
149141
}),
150142
// eslint-disable-next-line react-hooks/exhaustive-deps
151-
[
152-
compressImageQuality,
153-
channelId,
154-
editingDep,
155-
initialValue,
156-
CreatePollContent,
157-
showPollCreationDialog,
158-
],
143+
[compressImageQuality, channelId, editingDep, CreatePollContent, showPollCreationDialog],
159144
);
160145

161146
return inputMessageInputContext;

package/src/components/MessageInput/CommandsButton.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import { Lightning } from '../../icons/Lightning';
1212
export type CommandsButtonProps = {
1313
/** Function that opens commands selector */
1414
handleOnPress?: PressableProps['onPress'];
15+
/**
16+
* Determins if the text input has text
17+
*/
18+
hasText?: boolean;
1519
};
1620

1721
const textComposerStateSelector = (state: TextComposerState) => ({
@@ -24,10 +28,10 @@ const searchSourceStateSelector = (nextValue: SearchSourceState) => ({
2428
});
2529

2630
export const CommandsButton = (props: CommandsButtonProps) => {
27-
const { handleOnPress } = props;
31+
const { handleOnPress, hasText } = props;
2832
const messageComposer = useMessageComposer();
2933
const { textComposer } = messageComposer;
30-
const { suggestions, text } = useStateStore(textComposer.state, textComposerStateSelector);
34+
const { suggestions } = useStateStore(textComposer.state, textComposerStateSelector);
3135
const { items } = useStateStore(suggestions?.searchSource.state, searchSourceStateSelector) ?? {};
3236
const trigger = suggestions?.trigger;
3337

@@ -60,7 +64,7 @@ export const CommandsButton = (props: CommandsButtonProps) => {
6064
},
6165
} = useTheme();
6266

63-
if (text) {
67+
if (hasText) {
6468
return null;
6569
}
6670

package/src/components/MessageInput/FileUploadPreview.tsx

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ import {
88
isLocalImageAttachment,
99
isLocalVideoAttachment,
1010
isLocalVoiceRecordingAttachment,
11+
isVideoAttachment,
1112
isVoiceRecordingAttachment,
1213
LocalAudioAttachment,
1314
LocalFileAttachment,
15+
LocalVideoAttachment,
1416
LocalVoiceRecordingAttachment,
1517
} from 'stream-chat';
1618

@@ -28,20 +30,25 @@ const FILE_PREVIEW_HEIGHT = 60;
2830

2931
export type FileUploadPreviewPropsWithContext = Pick<
3032
MessageInputContextValue,
31-
'AudioAttachmentUploadPreview' | 'FileAttachmentUploadPreview'
33+
'AudioAttachmentUploadPreview' | 'FileAttachmentUploadPreview' | 'VideoAttachmentUploadPreview'
3234
>;
3335

3436
type FileAttachmentType<CustomLocalMetadata = Record<string, unknown>> =
3537
| LocalFileAttachment<CustomLocalMetadata>
3638
| LocalAudioAttachment<CustomLocalMetadata>
37-
| LocalVoiceRecordingAttachment<CustomLocalMetadata>;
39+
| LocalVoiceRecordingAttachment<CustomLocalMetadata>
40+
| LocalVideoAttachment<CustomLocalMetadata>;
3841

3942
/**
4043
* FileUploadPreview
4144
* UI Component to preview the files set for upload
4245
*/
4346
const UnMemoizedFileUploadPreview = (props: FileUploadPreviewPropsWithContext) => {
44-
const { AudioAttachmentUploadPreview, FileAttachmentUploadPreview } = props;
47+
const {
48+
AudioAttachmentUploadPreview,
49+
FileAttachmentUploadPreview,
50+
VideoAttachmentUploadPreview,
51+
} = props;
4552
const { attachmentManager } = useMessageComposer();
4653
const { attachments } = useAttachmentManagerState();
4754
const [audioAttachmentsStateMap, setAudioAttachmentsStateMap] = useState<
@@ -54,8 +61,9 @@ const UnMemoizedFileUploadPreview = (props: FileUploadPreviewPropsWithContext) =
5461
return attachments.filter(
5562
(attachment) =>
5663
isLocalFileAttachment(attachment) ||
57-
isAudioAttachment(attachment) ||
58-
isVoiceRecordingAttachment(attachment),
64+
isLocalFileAttachment(attachment) ||
65+
isLocalVoiceRecordingAttachment(attachment) ||
66+
isLocalVideoAttachment(attachment),
5967
);
6068
}, [attachments]);
6169

@@ -143,7 +151,7 @@ const UnMemoizedFileUploadPreview = (props: FileUploadPreviewPropsWithContext) =
143151

144152
const renderItem = useCallback(
145153
({ item }: { item: FileAttachmentType }) => {
146-
if (isLocalImageAttachment(item) || isLocalVideoAttachment(item)) {
154+
if (isLocalImageAttachment(item)) {
147155
// This is already handled in the `ImageUploadPreview` component
148156
return null;
149157
} else if (isLocalVoiceRecordingAttachment(item)) {
@@ -181,6 +189,15 @@ const UnMemoizedFileUploadPreview = (props: FileUploadPreviewPropsWithContext) =
181189
/>
182190
);
183191
}
192+
} else if (isVideoAttachment(item)) {
193+
return (
194+
<VideoAttachmentUploadPreview
195+
attachment={item}
196+
flatListWidth={flatListWidth}
197+
handleRetry={attachmentManager.uploadAttachment}
198+
removeAttachments={attachmentManager.removeAttachments}
199+
/>
200+
);
184201
} else if (isLocalFileAttachment(item)) {
185202
return (
186203
<FileAttachmentUploadPreview
@@ -195,6 +212,7 @@ const UnMemoizedFileUploadPreview = (props: FileUploadPreviewPropsWithContext) =
195212
[
196213
AudioAttachmentUploadPreview,
197214
FileAttachmentUploadPreview,
215+
VideoAttachmentUploadPreview,
198216
attachmentManager.removeAttachments,
199217
attachmentManager.uploadAttachment,
200218
audioAttachmentsStateMap,
@@ -250,12 +268,17 @@ const MemoizedFileUploadPreviewWithContext = React.memo(UnMemoizedFileUploadPrev
250268
* UI Component to preview the files set for upload
251269
*/
252270
export const FileUploadPreview = (props: FileUploadPreviewProps) => {
253-
const { AudioAttachmentUploadPreview, FileAttachmentUploadPreview } = useMessageInputContext();
271+
const {
272+
AudioAttachmentUploadPreview,
273+
FileAttachmentUploadPreview,
274+
VideoAttachmentUploadPreview,
275+
} = useMessageInputContext();
254276
return (
255277
<MemoizedFileUploadPreviewWithContext
256278
{...{
257279
AudioAttachmentUploadPreview,
258280
FileAttachmentUploadPreview,
281+
VideoAttachmentUploadPreview,
259282
}}
260283
{...props}
261284
/>

0 commit comments

Comments
 (0)