Skip to content

Commit 43be503

Browse files
authored
Merge pull request #1293 from GetStream/develop
Release 6.12.0
2 parents 9f7be76 + 5dc3a12 commit 43be503

File tree

28 files changed

+5148
-189
lines changed

28 files changed

+5148
-189
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
release:
9+
name: Release
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: 'lts/*'
20+
- name: Install dependencies
21+
run: yarn install --frozen-lockfile
22+
- name: Release
23+
env:
24+
NPM_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }}
25+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
26+
run: npx semantic-release

docusaurus/docs/React/contexts/channel-state-context.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ The configurations object for the currently active channel.
4949
| ------ |
5050
| object |
5151

52+
### dragAndDropWindow
53+
54+
If true, chat users will be able to drag and drop file uploads to the entire channel window.
55+
56+
| Type | Default |
57+
| ------- | ------- |
58+
| boolean | false |
59+
5260
### error
5361

5462
Error object (if any) in loading the `channel`, otherwise null.

docusaurus/docs/React/core-components/channel.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ Custom action handler to override the default `client.updateMessage` request fun
174174
| -------- |
175175
| function |
176176

177+
### dragAndDropWindow
178+
179+
If true, chat users will be able to drag and drop file uploads to the entire channel window.
180+
181+
| Type | Default |
182+
| ------- | ------- |
183+
| boolean | false |
184+
177185
### EditMessageInput
178186

179187
Custom UI component to override default edit message input.
@@ -390,6 +398,14 @@ Custom action handler function to run on hover of an @mention in a message.
390398
| -------- |
391399
| function |
392400

401+
### optionalMessageInputProps
402+
403+
If `dragAndDropWindow` prop is true, the props to pass to the MessageInput component (overrides props placed directly on MessageInput).
404+
405+
| Type |
406+
| ------ |
407+
| object |
408+
393409
### PinIndicator
394410

395411
Custom UI component to override default pinned message indicator.

docusaurus/docs/React/core-components/message-list.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ pinned [message object](https://getstream.io/chat/docs/javascript/message_format
166166
| ---------------------------------- |
167167
| (message: StreamMessage) => string |
168168

169+
### groupStyles
170+
171+
Callback function to set group styles for each message.
172+
173+
| Type |
174+
| -------------------------------------------------------------------------------------------------------------------------- |
175+
| (message: StreamMessage, previousMessage: StreamMessage, nextMessage: StreamMessage, noGroupByUser: boolean) => GroupStyle |
176+
169177
### hasMore
170178

171179
Whether or not the list has more items to load.

examples/typescript/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11135,10 +11135,10 @@ stream-browserify@^2.0.1:
1113511135
inherits "~2.0.1"
1113611136
readable-stream "^2.0.2"
1113711137

11138-
stream-chat-css@^1.0.17:
11139-
version "1.0.17"
11140-
resolved "https://registry.yarnpkg.com/stream-chat-css/-/stream-chat-css-1.0.17.tgz#aad79b5c8e6f62334305d73e8cffe8ad2ac46f0e"
11141-
integrity sha512-CgfqyWAqFa2QMBn3Srk4sBnMdjMhd/ufErplnGeYZFlzL/C1czRmr2MN/ZgxWwW5uLO7ArGyETRqslYZxFMN1Q==
11138+
stream-chat-css@^1.0.21:
11139+
version "1.0.21"
11140+
resolved "https://registry.yarnpkg.com/stream-chat-css/-/stream-chat-css-1.0.21.tgz#3a923e349ce01820333f6ec75482226c8868815b"
11141+
integrity sha512-Ei7bq1rAHCRShSPqJcTEkLesOVWA+xvG5jEy6pSr71taeJyHN/QIKLQg44gwCWwA8yBeAqbrFW3vgsyiwUQKkw==
1114211142

1114311143
"stream-chat-react@link:../..":
1114411144
version "0.0.0"

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stream-chat-react",
3-
"version": "6.11.0",
3+
"version": "0.0.0-development",
44
"description": "React components to create chat conversations or livestream style chat",
55
"author": "GetStream",
66
"homepage": "https://getstream.io/chat/",
@@ -50,7 +50,7 @@
5050
"react-player": "^2.7.0",
5151
"react-textarea-autosize": "^8.3.0",
5252
"react-virtuoso": "2.2.6",
53-
"stream-chat-css": "^1.0.17",
53+
"stream-chat-css": "^1.0.21",
5454
"textarea-caret": "^3.1.0",
5555
"uuid": "^8.3.1"
5656
},
@@ -151,6 +151,7 @@
151151
"rollup-plugin-terser": "^7.0.2",
152152
"rollup-plugin-url": "^3.0.1",
153153
"rollup-plugin-visualizer": "^4.2.0",
154+
"semantic-release-cli": "^5.4.4",
154155
"stream-chat": "4.2.0",
155156
"style-loader": "^2.0.0",
156157
"ts-jest": "^26.5.1",
@@ -159,7 +160,8 @@
159160
"url-loader": "^4.1.1",
160161
"webpack": "4.44.2",
161162
"webpack-cli": "^3.3.12",
162-
"webpack-dev-server": "~3.11.0"
163+
"webpack-dev-server": "~3.11.0",
164+
"semantic-release": "^18.0.0"
163165
},
164166
"husky": {
165167
"hooks": {
@@ -185,7 +187,8 @@
185187
"preversion": "yarn install && yarn lint && yarn test",
186188
"test": "jest",
187189
"types": "tsc --strict",
188-
"validate-translations": "node scripts/validate-translations.js"
190+
"validate-translations": "node scripts/validate-translations.js",
191+
"semantic-release": "semantic-release"
189192
},
190193
"resolutions": {
191194
"ast-types": "^0.14.0"

src/components/Channel/Channel.tsx

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
LoadingErrorIndicatorProps,
4141
} from '../Loading';
4242
import { MessageSimple } from '../Message/MessageSimple';
43+
import { DropzoneProvider } from '../MessageInput/DropzoneProvider';
4344

4445
import {
4546
ChannelActionContextValue,
@@ -61,7 +62,10 @@ import defaultEmojiData from '../../stream-emoji.json';
6162

6263
import type { Data as EmojiMartData } from 'emoji-mart';
6364

65+
import type { MessageInputProps } from '../MessageInput/MessageInput';
66+
6467
import type {
68+
CustomTrigger,
6569
DefaultAttachmentType,
6670
DefaultChannelType,
6771
DefaultCommandType,
@@ -78,7 +82,8 @@ export type ChannelProps<
7882
Ev extends DefaultEventType = DefaultEventType,
7983
Me extends DefaultMessageType = DefaultMessageType,
8084
Re extends DefaultReactionType = DefaultReactionType,
81-
Us extends DefaultUserType<Us> = DefaultUserType
85+
Us extends DefaultUserType<Us> = DefaultUserType,
86+
V extends CustomTrigger = CustomTrigger
8287
> = {
8388
/** List of accepted file types */
8489
acceptedFiles?: string[];
@@ -138,6 +143,8 @@ export type ChannelProps<
138143
cid: string,
139144
updatedMessage: UpdatedMessage<At, Ch, Co, Me, Re, Us>,
140145
) => ReturnType<StreamChat<At, Ch, Co, Ev, Me, Re, Us>['updateMessage']>;
146+
/** If true, chat users will be able to drag and drop file uploads to the entire channel window */
147+
dragAndDropWindow?: boolean;
141148
/** Custom UI component to override default edit message input, defaults to and accepts same props as: [EditMessageForm](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/EditMessageForm.tsx) */
142149
EditMessageInput?: ComponentContextValue<At, Ch, Co, Ev, Me, Re, Us>['EditMessageInput'];
143150
/** Custom UI component to override default `NimbleEmoji` from `emoji-mart` */
@@ -208,6 +215,8 @@ export type ChannelProps<
208215
onMentionsClick?: OnMentionAction<Us>;
209216
/** Custom action handler function to run on hover of an @mention in a message */
210217
onMentionsHover?: OnMentionAction<Us>;
218+
/** If `dragAndDropWindow` prop is true, the props to pass to the MessageInput component (overrides props placed directly on MessageInput) */
219+
optionalMessageInputProps?: MessageInputProps<At, Ch, Co, Ev, Me, Re, Us, V>;
211220
/** Custom UI component to override default pinned message indicator, defaults to and accepts same props as: [PinIndicator](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/icons.tsx) */
212221
PinIndicator?: ComponentContextValue<At, Ch, Co, Ev, Me, Re, Us>['PinIndicator'];
213222
/** Custom UI component to override quoted message UI on a sent message, defaults to and accepts same props as: [QuotedMessage](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/QuotedMessage.tsx) */
@@ -241,9 +250,10 @@ const UnMemoizedChannel = <
241250
Ev extends DefaultEventType = DefaultEventType,
242251
Me extends DefaultMessageType = DefaultMessageType,
243252
Re extends DefaultReactionType = DefaultReactionType,
244-
Us extends DefaultUserType<Us> = DefaultUserType
253+
Us extends DefaultUserType<Us> = DefaultUserType,
254+
V extends CustomTrigger = CustomTrigger
245255
>(
246-
props: PropsWithChildren<ChannelProps<At, Ch, Co, Ev, Me, Re, Us>>,
256+
props: PropsWithChildren<ChannelProps<At, Ch, Co, Ev, Me, Re, Us, V>>,
247257
) => {
248258
const { channel: propsChannel, EmptyPlaceholder = null } = props;
249259

@@ -263,10 +273,11 @@ const ChannelInner = <
263273
Ev extends DefaultEventType = DefaultEventType,
264274
Me extends DefaultMessageType = DefaultMessageType,
265275
Re extends DefaultReactionType = DefaultReactionType,
266-
Us extends DefaultUserType<Us> = DefaultUserType
276+
Us extends DefaultUserType<Us> = DefaultUserType,
277+
V extends CustomTrigger = CustomTrigger
267278
>(
268279
props: PropsWithChildren<
269-
ChannelProps<At, Ch, Co, Ev, Me, Re, Us> & {
280+
ChannelProps<At, Ch, Co, Ev, Me, Re, Us, V> & {
270281
channel: StreamChannel<At, Ch, Co, Ev, Me, Re, Us>;
271282
key: string;
272283
}
@@ -280,13 +291,15 @@ const ChannelInner = <
280291
doMarkReadRequest,
281292
doSendMessageRequest,
282293
doUpdateMessageRequest,
294+
dragAndDropWindow = false,
283295
emojiData = defaultEmojiData,
284296
LoadingErrorIndicator = DefaultLoadingErrorIndicator,
285297
LoadingIndicator = DefaultLoadingIndicator,
286298
maxNumberOfFiles,
287299
multipleUploads = true,
288300
onMentionsClick,
289301
onMentionsHover,
302+
optionalMessageInputProps = {},
290303
skipMessageDataMemoization,
291304
} = props;
292305

@@ -739,6 +752,7 @@ const ChannelInner = <
739752
channel,
740753
channelCapabilitiesArray,
741754
channelConfig,
755+
dragAndDropWindow,
742756
maxNumberOfFiles,
743757
multipleUploads,
744758
mutes,
@@ -831,6 +845,13 @@ const ChannelInner = <
831845
? 'str-chat--windows-flags'
832846
: '';
833847

848+
const NullProvider: React.FC = ({ children }) => <>{children}</>;
849+
850+
const OptionalMessageInputProvider = useMemo(
851+
() => (dragAndDropWindow ? DropzoneProvider : NullProvider),
852+
[dragAndDropWindow],
853+
);
854+
834855
if (state.error) {
835856
return (
836857
<div className={`${chatClass} ${channelClass} ${theme}`}>
@@ -862,7 +883,11 @@ const ChannelInner = <
862883
<ComponentProvider value={componentContextValue}>
863884
<EmojiProvider value={emojiContextValue}>
864885
<TypingProvider value={typingContextValue}>
865-
<div className={`${chatContainerClass}`}>{children}</div>
886+
<div className={`${chatContainerClass}`}>
887+
<OptionalMessageInputProvider {...optionalMessageInputProps}>
888+
{children}
889+
</OptionalMessageInputProvider>
890+
</div>
866891
</TypingProvider>
867892
</EmojiProvider>
868893
</ComponentProvider>

src/components/Channel/hooks/useCreateChannelStateContext.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const useCreateChannelStateContext = <
3333
channel,
3434
channelCapabilitiesArray = [],
3535
channelConfig,
36+
dragAndDropWindow,
3637
error,
3738
hasMore,
3839
loading,
@@ -105,6 +106,7 @@ export const useCreateChannelStateContext = <
105106
channel,
106107
channelCapabilities,
107108
channelConfig,
109+
dragAndDropWindow,
108110
error,
109111
hasMore,
110112
loading,

src/components/ChannelList/hooks/usePaginatedChannels.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ export const usePaginatedChannels = <
4242
const sortString = useMemo(() => JSON.stringify(sort), [sort]);
4343

4444
const queryChannels = async (queryType?: string) => {
45+
setError(false);
46+
4547
if (queryType === 'reload') {
4648
setChannels([]);
4749
setLoadingChannels(true);

src/components/Chat/Chat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ export const Chat = <
9393
} = props;
9494

9595
const {
96-
appSettings,
9796
channel,
9897
closeMobileNav,
98+
getAppSettings,
9999
mutes,
100100
navOpen,
101101
openMobileNav,
@@ -106,11 +106,11 @@ export const Chat = <
106106
useCustomStyles(darkMode ? darkModeTheme : customStyles);
107107

108108
const chatContextValue = useCreateChatContext({
109-
appSettings,
110109
channel,
111110
client,
112111
closeMobileNav,
113112
customClasses,
113+
getAppSettings,
114114
mutes,
115115
navOpen,
116116
openMobileNav,

0 commit comments

Comments
 (0)