mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:01:32 +00:00
Add support for sending arbitrary TFW message on bot message click
This commit is contained in:
parent
f17fe18cef
commit
f7a2182ba6
@ -4,6 +4,7 @@ export interface MessageData {
|
|||||||
originator?: string;
|
originator?: string;
|
||||||
timestamp?: Date;
|
timestamp?: Date;
|
||||||
typing?: boolean;
|
typing?: boolean;
|
||||||
|
command?: any;
|
||||||
message: string;
|
message: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<div class="tfw-messages-main">
|
<div class="tfw-messages-main">
|
||||||
<div class="tfw-grid-message"
|
<div class="tfw-grid-message"
|
||||||
*ngFor="let message of messages.slice(); let last = last"
|
*ngFor="let message of messages.slice(); let last = last"
|
||||||
[class.highlighted-message]="last">
|
[class.highlighted-message]="last"
|
||||||
|
(click)="sendMessageCommand(message)">
|
||||||
<div class="tfw-grid-message-header">
|
<div class="tfw-grid-message-header">
|
||||||
<img class="tao-grid-center-left" src="images/avataobot.svg"/>
|
<img class="tao-grid-center-left" src="images/avataobot.svg"/>
|
||||||
<div class="tao-grid-center-left originator">{{message.originator}}</div>
|
<div class="tao-grid-center-left originator">{{message.originator}}</div>
|
||||||
|
@ -65,4 +65,10 @@ export class MessagesComponent implements OnInit {
|
|||||||
'key': 'message.queue.drain'
|
'key': 'message.queue.drain'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendMessageCommand(message: MessageData) {
|
||||||
|
if ('command' in message) {
|
||||||
|
this.websocketService.send(message.command);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user