-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
chat-box.component.html
68 lines (60 loc) · 2.74 KB
/
chat-box.component.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<button mat-fab class="chat-button" (click)="toggleChatBox()" [@scrollAnimation]="showChatBox? 'hide' : 'show'">
<mat-icon>chat_bubble</mat-icon>
</button>
<div cdkDrag fxLayout='column' class="chat-box"
resizable [directions]="['bottom', 'top', 'left', 'right', 'top-left', 'bottom-left', 'top-right', 'bottom-right']"
[@scrollAnimation]="showChatBox? 'show' : 'hide'">
<mat-toolbar fxFlex fxLayout="row" fxLayoutAlign="start center"
class="header mat-elevation-z2" color="primary"
cdkDragHandle style="cursor: move">
<span fxFlex>ChatBox</span>
<span fxFlex="grow"><!-- fill space --></span>
<!--<ngx-led color="orange" size="10px" [blink]=true></ngx-led>-->
<button *ngIf="canUseSpeechSynthesis" mat-icon-button>
<mat-icon (click)="drawer.toggle()">settings</mat-icon>
</button>
<button mat-icon-button>
<mat-icon (click)="toggleChatBox()">close</mat-icon>
</button>
</mat-toolbar>
<mat-drawer-container fxFlex="grow" [hasBackdrop]="false">
<mat-drawer mode="over" position="end" #drawer>
<mat-toolbar color="accent">Preferences</mat-toolbar>
<mat-accordion>
<mat-expansion-panel [expanded]="true">
<mat-expansion-panel-header>
<mat-panel-title>Voice</mat-panel-title>
</mat-expansion-panel-header>
<ng-template matExpansionPanelContent>
<ngx-text-to-speech-preferences></ngx-text-to-speech-preferences>
</ng-template>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>Other</mat-panel-title>
</mat-expansion-panel-header>
<p>TODO: Other Settings</p>
</mat-expansion-panel>
</mat-accordion>
</mat-drawer>
<mat-drawer-content fxFlex="grow" class="body">
<div *ngFor="let message of (selectedConversation$ | async).messages"
class="message"
[ngClass]="{ 'from': message.isIncoming, 'to': message.isOutgoing }">
{{ message.render() }}
</div>
<div style="position: fixed; bottom: 60px;">
<typing-indicator *ngIf="typing"></typing-indicator>
</div>
<div #bottom></div><br/><br/><br/><br/>
</mat-drawer-content>
</mat-drawer-container>
<mat-divider></mat-divider>
<mat-form-field fxFlex class="input" color="primary">
<mat-icon matPrefix *ngIf="canUseSpeechRecognition" (click)="startTalkingToBot()">keyboard_voice</mat-icon>
<input #input matInput type="text"
(keyup.enter)="sendMessageToBot()" (keyup.escape)="showChatBox = false"
placeholder="Ask anything..." autocomplete="off" x-webkit-speech>
<mat-icon matSuffix (click)="sendMessageToBot()">send</mat-icon>
</mat-form-field>
</div>