diff --git a/packages/collaboration/src/activitydotplot.tsx b/packages/collaboration/src/activitydotplot.tsx index e07320a..422f459 100644 --- a/packages/collaboration/src/activitydotplot.tsx +++ b/packages/collaboration/src/activitydotplot.tsx @@ -114,6 +114,8 @@ export const ActivityDotPlot: React.FC = ({tracker, app, chatPanel const handleDotClick = (data: any) => { + const username = data.points[0].text.split(' on ')[0]; + app.shell.activateById('jp-chat-panel'); const chatbox = chatPanel.widgets.find(widget => widget.id === 'jp-chatbox') as Chatbox | null; @@ -121,7 +123,7 @@ export const ActivityDotPlot: React.FC = ({tracker, app, chatPanel if (chatbox) { chatbox.show(); - chatbox.focusOnWritingField(); + chatbox.focusOnWritingField(username); } diff --git a/packages/collaboration/src/chatbox.tsx b/packages/collaboration/src/chatbox.tsx index 246c0a5..205ae9f 100644 --- a/packages/collaboration/src/chatbox.tsx +++ b/packages/collaboration/src/chatbox.tsx @@ -21,7 +21,7 @@ export class Chatbox extends ReactWidget { this.addClass('jp-Chat-Panel') } - focusOnWritingField() { + focusOnWritingField(username?: string) { const writingField = this.node?.querySelector('.jp-Chat-WritableField') as HTMLTextAreaElement | null; @@ -29,6 +29,12 @@ export class Chatbox extends ReactWidget { writingField.focus(); + if (username) { + + writingField.value = `@${username} `; + + } + } }