-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for
@mentions
in the chat content (#2668)
add new styling on MessageThread component handle @mentions from the graph render a mention as an MGT person component handle mentions that can be nullish --------- Signed-off-by: Musale Martin <martinmusale@microsoft.com> Signed-off-by: Martin Musale <martinmusale@microsoft.com> Co-authored-by: Gavin Barron <gavinbarron@microsoft.com>
- Loading branch information
1 parent
3c00710
commit 7ff602b
Showing
37 changed files
with
207 additions
and
101 deletions.
There are no files selected for viewing
Binary file removed
BIN
-1.9 MB
.yarn/cache/@azure-communication-calling-npm-1.15.2-c0fbee1e34-37aafc6635.zip
Binary file not shown.
Binary file added
BIN
+1.92 MB
.yarn/cache/@azure-communication-calling-npm-1.16.3-44e73509d2-da044d19ca.zip
Binary file not shown.
Binary file removed
BIN
-103 KB
.yarn/cache/@azure-communication-chat-npm-1.3.1-0d456e78c0-8075ce8003.zip
Binary file not shown.
Binary file added
BIN
+103 KB
.yarn/cache/@azure-communication-chat-npm-1.3.2-2983034008-753596b815.zip
Binary file not shown.
Binary file removed
BIN
-644 KB
.yarn/cache/@azure-communication-signaling-npm-1.0.0-beta.16-db7d0c67ce-b8f0e1c41f.zip
Binary file not shown.
Binary file added
BIN
+655 KB
.yarn/cache/@azure-communication-signaling-npm-1.0.0-beta.20-2e863de36e-f023ac73f3.zip
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+6.01 KB
...t-js-npm-8.50.0-ee6c09328d-302478f2ac.zip → ...t-js-npm-8.51.0-51f088b88b-0228bf1e1e.zip
Binary file not shown.
Binary file renamed
BIN
+265 KB
...me-npm-8.107.42-ea497c5f06-fa3e175a04.zip → ...me-npm-8.107.43-361c6405d1-3fcec7280e.zip
Binary file not shown.
Binary file renamed
BIN
+15.5 MB
...ons-npm-2.0.218-8b9934544f-1c658ab367.zip → ...ons-npm-2.0.219-732b901255-6c70a843e7.zip
Binary file not shown.
Binary file renamed
BIN
+10.1 MB
...act-npm-8.112.1-94650a2e28-9e37d80d7e.zip → ...act-npm-8.112.2-12c7b6dd58-e3199942e8.zip
Binary file not shown.
Binary file removed
BIN
-7.01 KB
.yarn/cache/@pnpm-dependency-path-npm-2.1.3-1419664496-8e8d9f5924.zip
Binary file not shown.
Binary file added
BIN
+6.96 KB
.yarn/cache/@pnpm-dependency-path-npm-2.1.4-5dea48d222-e301b9eec7.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+167 KB
...lpers-npm-0.5.2-f81ca286ad-51d7e3d8bd.zip → ...lpers-npm-0.5.3-4782a7cae3-61c3f7ccd4.zip
Binary file not shown.
Binary file renamed
BIN
+674 KB
...de-npm-16.18.57-ca9a02d7be-db21a14416.zip → ...de-npm-16.18.58-6711b4ef3b-6d8404abc6.zip
Binary file not shown.
Binary file renamed
BIN
+755 KB
...node-npm-20.8.2-6691982ce3-3da73e25d8.zip → ...node-npm-20.8.3-bab45f3f77-bfb88b341f.zip
Binary file not shown.
Binary file renamed
BIN
+12.2 KB
...dom-npm-18.2.10-996210477a-ced70643d8.zip → ...dom-npm-18.2.11-6dcf52afe5-70dbdd2f88.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+771 KB
...lint-npm-8.50.0-8c6bf98cbd-9ebfe5615d.zip → ...lint-npm-8.51.0-77fce3ec74-214fa5d1fc.zip
Binary file not shown.
Binary file renamed
BIN
+34.5 KB
...book-npm-0.6.14-15c2a7ec8d-f2ba1d77da.zip → ...book-npm-0.6.15-f751412d22-e2c4d7be3e.zip
Binary file not shown.
Binary file renamed
BIN
+10.5 KB
...cache-npm-3.1.0-bc8074086c-99312601d5.zip → ...cache-npm-3.1.1-b79e22b54f-4958cfe0f4.zip
Binary file not shown.
Binary file renamed
BIN
+9.73 KB
.../keyv-npm-4.5.3-d2382300dd-3ffb4d5b72.zip → .../keyv-npm-4.5.4-4c8e2cf7f7-74a24395b1.zip
Binary file not shown.
Binary file renamed
BIN
+5.78 KB
...ditor-npm-2.6.0-0c6f590d3e-48e4230643.zip → ...ditor-npm-2.6.1-0aba6b0e98-e06d193075.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react'; | ||
import { PersonCardInteraction } from '@microsoft/mgt-components'; | ||
import { MgtTemplateProps, Person } from '@microsoft/mgt-react'; | ||
import { ChatMessageMention, User } from '@microsoft/microsoft-graph-types'; | ||
import { GraphChatClient } from 'src/statefulClient/StatefulGraphChatClient'; | ||
import { Mention } from '@azure/communication-react'; | ||
|
||
export const renderMGTMention = (chatState: GraphChatClient) => { | ||
return (mention: Mention, defaultRenderer: (mention: Mention) => JSX.Element): JSX.Element => { | ||
let render: JSX.Element = defaultRenderer(mention); | ||
|
||
const mentions = chatState?.mentions ?? []; | ||
const flatMentions = mentions.flat(); | ||
const teamsMention: ChatMessageMention | undefined = flatMentions.find( | ||
m => m.id?.toString() === mention?.id && m.mentionText === mention?.displayText | ||
); | ||
|
||
const user = teamsMention?.mentioned?.user as User; | ||
if (user) { | ||
const MGTMention = (_props: MgtTemplateProps) => { | ||
return defaultRenderer(mention); | ||
}; | ||
render = ( | ||
<Person userId={user?.id} personCardInteraction={PersonCardInteraction.hover}> | ||
<MGTMention template="default" /> | ||
</Person> | ||
); | ||
} | ||
return render; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.