Skip to content

Commit ec39fa0

Browse files
Updated @azure/communication-react to 1.17.0-beta.1 (#255)
1 parent faaad6e commit ec39fa0

File tree

11 files changed

+1253
-1639
lines changed

11 files changed

+1253
-1639
lines changed

ui-library-filesharing-chat-composite/app/package-lock.json

Lines changed: 154 additions & 235 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui-library-filesharing-chat-composite/app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@azure/communication-calling": "1.24.1-beta.2",
6+
"@azure/communication-calling": "1.25.1-beta.1",
77
"@azure/communication-calling-effects": "1.0.1",
88
"@azure/communication-chat": "1.6.0-beta.1",
9-
"@azure/communication-react": "1.16.0-beta.1",
9+
"@azure/communication-react": "1.17.0-beta.1",
1010
"axios": "^1.6.7",
1111
"form-data": "^4.0.0",
1212
"react": "^18.0.0",
Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,58 @@
1-
import { AttachmentDownloadOptions, AttachmentMetadata, ChatMessage, defaultAttachmentMenuAction } from "@azure/communication-react";
1+
import {
2+
AttachmentDownloadOptions,
3+
AttachmentMenuAction,
4+
AttachmentMetadata,
5+
ChatMessage,
6+
defaultAttachmentMenuAction,
7+
} from "@azure/communication-react";
28

39
const handler = () => {
410
// here we are returning a static action for all attachments and all messages
511
return [defaultAttachmentMenuAction];
612
};
713

814
// alternatively, you can return different actions based on the attachment or message
9-
export const customHandler = (attachment: AttachmentMetadata, message?: ChatMessage) => {
10-
if (attachment.extension === "pdf") {
15+
export const customHandler = (
16+
attachment: AttachmentMetadata,
17+
message?: ChatMessage
18+
): AttachmentMenuAction[] => {
19+
const extension = attachment.name.split(".").pop() || "";
20+
if (extension === "pdf") {
1121
return [
1222
{
13-
title: "Custom button",
14-
icon: (<i className="custom-icon"></i>),
23+
name: "Custom button",
24+
icon: <i className="custom-icon"></i>,
1525
onClick: () => {
1626
window.alert("Custom button clicked");
17-
}
27+
return Promise.resolve();
28+
},
1829
},
19-
defaultAttachmentMenuAction
30+
defaultAttachmentMenuAction,
2031
];
2132
} else if (message?.senderId === "user1") {
2233
return [
2334
{
24-
title: "Custom button 2",
25-
icon: (<i className="custom-icon-2"></i>),
35+
name: "Custom button 2",
36+
icon: <i className="custom-icon-2"></i>,
2637
onClick: () => {
2738
window.alert("Custom button 2 clicked");
28-
}
39+
return Promise.resolve();
40+
},
2941
},
3042
// you can also override the default action partially
3143
{
3244
...defaultAttachmentMenuAction,
3345
onClick: () => {
3446
window.alert("Default action clicked");
35-
}
36-
}
47+
return Promise.resolve();
48+
},
49+
},
3750
];
51+
} else {
52+
return [defaultAttachmentMenuAction];
3853
}
39-
}
54+
};
4055

4156
export const downloadOptions: AttachmentDownloadOptions = {
42-
actionsForAttachment: handler
43-
}
57+
actionsForAttachment: handler,
58+
};

ui-library-filesharing-chat-composite/package-lock.json

Lines changed: 1 addition & 168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)