@truedat/ai 8.5.4 → 8.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/api.js +2 -0
- package/src/components/AiRoutes.js +3 -0
- package/src/components/assistant/Assistant.js +186 -78
- package/src/components/assistant/AssistantChat.js +91 -30
- package/src/components/assistant/AssistantConversations.js +78 -0
- package/src/components/assistant/AssistantPage.js +139 -0
- package/src/components/assistant/AssistantPageChat.js +447 -0
- package/src/components/assistant/__tests__/Assistant.spec.js +15 -0
- package/src/components/assistant/__tests__/AssistantChat.spec.js +18 -0
- package/src/components/assistant/__tests__/AssistantConversations.spec.js +111 -0
- package/src/components/assistant/__tests__/__snapshots__/Assistant.spec.js.snap +5 -5
- package/src/components/assistant/__tests__/__snapshots__/AssistantChat.spec.js.snap +18 -8
- package/src/components/assistant/__tests__/__snapshots__/AssistantConversations.spec.js.snap +73 -0
- package/src/components/assistant/hooks/useAgentConversation.js +9 -3
- package/src/components/assistant/hooks/useAssistantSocket.js +36 -3
- package/src/components/index.js +2 -1
- package/src/hooks/__tests__/useAgentConversations.spec.js +83 -0
- package/src/hooks/useAgentConversations.js +15 -0
- package/src/styles/assistant.less +281 -121
- package/src/components/assistant/AssistantBubble.js +0 -56
- package/src/components/assistant/__tests__/AssistantBubble.spec.js +0 -14
- package/src/components/assistant/__tests__/__snapshots__/AssistantBubble.spec.js.snap +0 -17
|
@@ -1,61 +1,3 @@
|
|
|
1
|
-
.assistant-container {
|
|
2
|
-
position: fixed;
|
|
3
|
-
bottom: calc(1.5rem + 10px);
|
|
4
|
-
right: calc(1.5rem + 10px);
|
|
5
|
-
z-index: 1000;
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
overflow: hidden;
|
|
9
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
10
|
-
transition:
|
|
11
|
-
width 0.3s ease,
|
|
12
|
-
height 0.3s ease,
|
|
13
|
-
border-radius 0.3s ease,
|
|
14
|
-
background 0.2s ease 0s,
|
|
15
|
-
color 0.2s ease 0s;
|
|
16
|
-
|
|
17
|
-
&--closed {
|
|
18
|
-
width: 5rem;
|
|
19
|
-
height: 5rem;
|
|
20
|
-
border-radius: 50%;
|
|
21
|
-
align-items: center;
|
|
22
|
-
justify-content: center;
|
|
23
|
-
background: #fff;
|
|
24
|
-
color: #013c54;
|
|
25
|
-
border: 2px solid #013c54;
|
|
26
|
-
cursor: pointer;
|
|
27
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
28
|
-
transition:
|
|
29
|
-
width 0.3s ease,
|
|
30
|
-
height 0.3s ease,
|
|
31
|
-
border-radius 0.3s ease,
|
|
32
|
-
box-shadow 0.3s ease,
|
|
33
|
-
background 0.2s ease 0.3s,
|
|
34
|
-
color 0.2s ease 0.3s;
|
|
35
|
-
|
|
36
|
-
&:hover {
|
|
37
|
-
animation: assistant-aurora-halo 0.65s ease-in 1 forwards;
|
|
38
|
-
width: 5.15rem;
|
|
39
|
-
height: 5.15rem;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&--open {
|
|
44
|
-
width: 33vw;
|
|
45
|
-
min-width: 400px;
|
|
46
|
-
height: 80vh;
|
|
47
|
-
border-radius: 1rem;
|
|
48
|
-
background: #fff;
|
|
49
|
-
color: inherit;
|
|
50
|
-
transition:
|
|
51
|
-
width 0.3s ease,
|
|
52
|
-
height 0.3s ease,
|
|
53
|
-
border-radius 0.3s ease,
|
|
54
|
-
background 0.2s ease 0s,
|
|
55
|
-
color 0.2s ease 0s;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
1
|
.assistant-content--fade-out {
|
|
60
2
|
opacity: 0;
|
|
61
3
|
transition: opacity 0.15s ease-out;
|
|
@@ -79,121 +21,198 @@
|
|
|
79
21
|
}
|
|
80
22
|
|
|
81
23
|
@keyframes assistant-aurora-halo {
|
|
82
|
-
0%
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
box-shadow:
|
|
114
|
-
0 0 18px rgba(1, 60, 84, 0.75),
|
|
115
|
-
0 0 28px rgba(1, 60, 84, 0.4),
|
|
116
|
-
0 2px 8px rgba(0, 0, 0, 0.2);
|
|
24
|
+
0% { box-shadow: 0.0px -3.0px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
25
|
+
5% { box-shadow: 0.9px -2.9px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
26
|
+
10% { box-shadow: 1.8px -2.4px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
27
|
+
15% { box-shadow: 2.4px -1.8px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
28
|
+
20% { box-shadow: 2.9px -0.9px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
29
|
+
25% { box-shadow: 3.0px 0.0px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
30
|
+
30% { box-shadow: 2.9px 0.9px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
31
|
+
35% { box-shadow: 2.4px 1.8px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
32
|
+
40% { box-shadow: 1.8px 2.4px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
33
|
+
45% { box-shadow: 0.9px 2.9px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
34
|
+
50% { box-shadow: 0.0px 3.0px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
35
|
+
55% { box-shadow: -0.9px 2.9px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
36
|
+
60% { box-shadow: -1.8px 2.4px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
37
|
+
65% { box-shadow: -2.4px 1.8px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
38
|
+
70% { box-shadow: -2.9px 0.9px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
39
|
+
75% { box-shadow: -3.0px 0.0px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
40
|
+
80% { box-shadow: -2.9px -0.9px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
41
|
+
85% { box-shadow: -2.4px -1.8px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
42
|
+
90% { box-shadow: -1.8px -2.4px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
43
|
+
95% { box-shadow: -0.9px -2.9px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
44
|
+
100% { box-shadow: 0.0px -3.0px 6px rgba(1,60,84,0.22), 0 0 3px rgba(1,60,84,0.07); }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@keyframes assistant-panel-open {
|
|
48
|
+
from {
|
|
49
|
+
opacity: 0;
|
|
50
|
+
transform: scaleY(0.92) translateY(-6px);
|
|
51
|
+
}
|
|
52
|
+
to {
|
|
53
|
+
opacity: 1;
|
|
54
|
+
transform: scaleY(1) translateY(0);
|
|
117
55
|
}
|
|
118
56
|
}
|
|
119
57
|
|
|
58
|
+
@keyframes assistant-panel-close {
|
|
59
|
+
from {
|
|
60
|
+
opacity: 1;
|
|
61
|
+
transform: scaleY(1) translateY(0);
|
|
62
|
+
}
|
|
63
|
+
to {
|
|
64
|
+
opacity: 0;
|
|
65
|
+
transform: scaleY(0.92) translateY(-6px);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.assistant-container {
|
|
70
|
+
position: relative;
|
|
71
|
+
display: inline-flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
120
75
|
.assistant-bubble {
|
|
121
76
|
display: flex;
|
|
122
77
|
align-items: center;
|
|
123
78
|
justify-content: center;
|
|
124
|
-
width:
|
|
125
|
-
height:
|
|
126
|
-
|
|
79
|
+
width: 2.25rem;
|
|
80
|
+
height: 2.25rem;
|
|
81
|
+
padding: 0;
|
|
82
|
+
border: 2px solid rgba(1, 60, 84, 0.5);
|
|
83
|
+
border-radius: 50%;
|
|
84
|
+
background: transparent;
|
|
85
|
+
color: inherit;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
opacity: 0.85;
|
|
88
|
+
transition:
|
|
89
|
+
border-color 0.2s ease,
|
|
90
|
+
opacity 0.2s ease;
|
|
91
|
+
|
|
92
|
+
&:hover,
|
|
93
|
+
&--active {
|
|
94
|
+
opacity: 1;
|
|
95
|
+
border-color: #013c54;
|
|
96
|
+
animation: assistant-aurora-halo 0.34s linear 1 forwards;
|
|
97
|
+
}
|
|
127
98
|
|
|
128
99
|
.ui.icon {
|
|
129
100
|
margin: 0;
|
|
130
|
-
font-size: 1.
|
|
101
|
+
font-size: 1.15rem;
|
|
131
102
|
}
|
|
132
103
|
|
|
133
104
|
&__logo {
|
|
134
105
|
display: block;
|
|
135
|
-
width:
|
|
136
|
-
height:
|
|
106
|
+
width: 1.5rem;
|
|
107
|
+
height: 1.5rem;
|
|
137
108
|
object-fit: contain;
|
|
138
109
|
}
|
|
139
110
|
}
|
|
140
111
|
|
|
112
|
+
.assistant-panel {
|
|
113
|
+
position: absolute;
|
|
114
|
+
top: 100%;
|
|
115
|
+
right: 0;
|
|
116
|
+
width: 33vw;
|
|
117
|
+
min-width: 400px;
|
|
118
|
+
height: 80vh;
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
background: #fff;
|
|
122
|
+
border-radius: 0 0 1rem 1rem;
|
|
123
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
|
|
124
|
+
z-index: 1000;
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
transform-origin: top right;
|
|
127
|
+
animation: assistant-panel-open 0.2s ease-out forwards;
|
|
128
|
+
|
|
129
|
+
&--closing {
|
|
130
|
+
animation: assistant-panel-close 0.2s ease-in forwards;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
141
134
|
.assistant-chat {
|
|
142
135
|
display: flex;
|
|
143
136
|
flex-direction: column;
|
|
144
137
|
width: 100%;
|
|
145
138
|
height: 100%;
|
|
146
139
|
|
|
147
|
-
&
|
|
140
|
+
&__header {
|
|
148
141
|
display: flex;
|
|
149
142
|
flex-shrink: 0;
|
|
150
143
|
align-items: center;
|
|
151
|
-
justify-content: space-between;
|
|
152
144
|
gap: 0.5rem;
|
|
153
|
-
padding: 0.
|
|
145
|
+
padding: 0.6rem 1rem;
|
|
154
146
|
background: #013c54;
|
|
155
147
|
color: #fff;
|
|
148
|
+
border-radius: 1rem 1rem 0 0;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&__header-title {
|
|
152
|
+
flex: 1;
|
|
153
|
+
font-size: 0.875rem;
|
|
154
|
+
font-weight: 600;
|
|
155
|
+
white-space: nowrap;
|
|
156
|
+
overflow: hidden;
|
|
157
|
+
text-overflow: ellipsis;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&__actions {
|
|
161
|
+
display: flex;
|
|
162
|
+
flex-shrink: 0;
|
|
163
|
+
align-items: center;
|
|
164
|
+
gap: 0.25rem;
|
|
165
|
+
padding: 0.4rem 0.75rem;
|
|
166
|
+
background: #f4f6f8;
|
|
167
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.07);
|
|
156
168
|
}
|
|
157
169
|
|
|
158
170
|
&__action {
|
|
159
171
|
display: inline-flex;
|
|
160
172
|
align-items: center;
|
|
161
|
-
gap: 0.
|
|
162
|
-
padding: 0;
|
|
163
|
-
border:
|
|
164
|
-
border-radius: 0.
|
|
173
|
+
gap: 0.3rem;
|
|
174
|
+
padding: 0.25rem 0.6rem;
|
|
175
|
+
border: 1px solid rgba(1, 60, 84, 0.25);
|
|
176
|
+
border-radius: 0.4rem;
|
|
165
177
|
background: transparent;
|
|
166
|
-
color:
|
|
167
|
-
font-size: 0.
|
|
178
|
+
color: #013c54;
|
|
179
|
+
font-size: 0.775rem;
|
|
168
180
|
cursor: pointer;
|
|
181
|
+
transition: background 0.15s ease;
|
|
182
|
+
|
|
183
|
+
&:hover {
|
|
184
|
+
background: rgba(1, 60, 84, 0.07);
|
|
185
|
+
}
|
|
169
186
|
|
|
170
187
|
.ui.icon {
|
|
171
188
|
margin: 0;
|
|
172
|
-
font-size:
|
|
189
|
+
font-size: 1rem;
|
|
173
190
|
display: flex;
|
|
174
191
|
align-items: center;
|
|
175
192
|
justify-content: center;
|
|
176
|
-
width:
|
|
177
|
-
height:
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&--new-chat {
|
|
181
|
-
font-weight: 600;
|
|
182
|
-
cursor: default;
|
|
193
|
+
width: 1rem;
|
|
194
|
+
height: 1rem;
|
|
183
195
|
}
|
|
184
196
|
|
|
185
197
|
&--close {
|
|
186
|
-
margin-left: auto;
|
|
187
198
|
padding: 0.25rem;
|
|
188
199
|
width: 2rem;
|
|
189
200
|
height: 2rem;
|
|
201
|
+
border: none;
|
|
190
202
|
border-radius: 999px;
|
|
191
203
|
background: transparent;
|
|
204
|
+
color: #fff;
|
|
192
205
|
|
|
193
206
|
&:hover,
|
|
194
207
|
&:focus,
|
|
195
208
|
&:active {
|
|
196
|
-
background:
|
|
209
|
+
background: rgba(255, 255, 255, 0.15);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.ui.icon {
|
|
213
|
+
font-size: 1.1rem;
|
|
214
|
+
width: 1.1rem;
|
|
215
|
+
height: 1.1rem;
|
|
197
216
|
}
|
|
198
217
|
}
|
|
199
218
|
}
|
|
@@ -434,8 +453,150 @@
|
|
|
434
453
|
text-align: center;
|
|
435
454
|
}
|
|
436
455
|
}
|
|
456
|
+
.ai-assistant-page {
|
|
457
|
+
display: flex;
|
|
458
|
+
flex-direction: row;
|
|
459
|
+
height: calc(100vh - 7rem);
|
|
460
|
+
max-width: 1200px;
|
|
461
|
+
margin: 0 auto;
|
|
462
|
+
overflow: hidden;
|
|
463
|
+
gap: 0;
|
|
464
|
+
}
|
|
437
465
|
|
|
438
|
-
|
|
466
|
+
.ai-conversation-list {
|
|
467
|
+
display: flex;
|
|
468
|
+
flex-direction: column;
|
|
469
|
+
width: 240px;
|
|
470
|
+
min-width: 240px;
|
|
471
|
+
border-right: 1px solid rgba(0, 0, 0, 0.08);
|
|
472
|
+
background: #f7f9fa;
|
|
473
|
+
overflow: hidden;
|
|
474
|
+
|
|
475
|
+
&__header {
|
|
476
|
+
flex-shrink: 0;
|
|
477
|
+
padding: 0.75rem;
|
|
478
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
&__new {
|
|
482
|
+
display: flex;
|
|
483
|
+
align-items: center;
|
|
484
|
+
gap: 0.4rem;
|
|
485
|
+
width: 100%;
|
|
486
|
+
padding: 0.4rem 0.6rem;
|
|
487
|
+
border: 1px solid rgba(1, 60, 84, 0.3);
|
|
488
|
+
border-radius: 0.5rem;
|
|
489
|
+
background: transparent;
|
|
490
|
+
color: #013c54;
|
|
491
|
+
font-size: 0.8125rem;
|
|
492
|
+
font-weight: 600;
|
|
493
|
+
cursor: pointer;
|
|
494
|
+
transition: background 0.15s ease;
|
|
495
|
+
|
|
496
|
+
.ui.icon {
|
|
497
|
+
margin: 0;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
&:hover {
|
|
501
|
+
background: rgba(1, 60, 84, 0.07);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
&__items {
|
|
506
|
+
flex: 1;
|
|
507
|
+
overflow-y: auto;
|
|
508
|
+
display: flex;
|
|
509
|
+
flex-direction: column;
|
|
510
|
+
padding: 0.5rem 0;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
&__item {
|
|
514
|
+
display: flex;
|
|
515
|
+
flex-direction: column;
|
|
516
|
+
gap: 0.2rem;
|
|
517
|
+
width: 100%;
|
|
518
|
+
padding: 0.5rem 0.75rem;
|
|
519
|
+
border: none;
|
|
520
|
+
background: transparent;
|
|
521
|
+
text-align: left;
|
|
522
|
+
cursor: pointer;
|
|
523
|
+
transition: background 0.12s ease;
|
|
524
|
+
|
|
525
|
+
&:hover {
|
|
526
|
+
background: rgba(1, 60, 84, 0.06);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
&--active {
|
|
530
|
+
background: rgba(1, 60, 84, 0.1);
|
|
531
|
+
|
|
532
|
+
&:hover {
|
|
533
|
+
background: rgba(1, 60, 84, 0.13);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
&__item-preview {
|
|
539
|
+
font-size: 0.8rem;
|
|
540
|
+
color: #333;
|
|
541
|
+
white-space: nowrap;
|
|
542
|
+
overflow: hidden;
|
|
543
|
+
text-overflow: ellipsis;
|
|
544
|
+
line-height: 1.3;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
&__item-date {
|
|
548
|
+
font-size: 0.7rem;
|
|
549
|
+
color: #999;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.ai-assistant-main {
|
|
554
|
+
display: flex;
|
|
555
|
+
flex-direction: column;
|
|
556
|
+
flex: 1;
|
|
557
|
+
min-width: 0;
|
|
558
|
+
overflow: hidden;
|
|
559
|
+
|
|
560
|
+
&__toolbar {
|
|
561
|
+
flex-shrink: 0;
|
|
562
|
+
display: flex;
|
|
563
|
+
align-items: center;
|
|
564
|
+
justify-content: flex-end;
|
|
565
|
+
padding: 0.4rem 0.75rem;
|
|
566
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.07);
|
|
567
|
+
background: #fff;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
&__continue {
|
|
571
|
+
display: inline-flex;
|
|
572
|
+
align-items: center;
|
|
573
|
+
gap: 0.35rem;
|
|
574
|
+
padding: 0.3rem 0.7rem;
|
|
575
|
+
border: 1px solid rgba(1, 60, 84, 0.3);
|
|
576
|
+
border-radius: 0.5rem;
|
|
577
|
+
background: transparent;
|
|
578
|
+
color: #013c54;
|
|
579
|
+
font-size: 0.8125rem;
|
|
580
|
+
cursor: pointer;
|
|
581
|
+
transition: background 0.15s ease;
|
|
582
|
+
|
|
583
|
+
.ui.icon {
|
|
584
|
+
margin: 0;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
&:hover {
|
|
588
|
+
background: rgba(1, 60, 84, 0.07);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.ai-assistant-chat {
|
|
594
|
+
display: flex;
|
|
595
|
+
flex-direction: column;
|
|
596
|
+
width: 100%;
|
|
597
|
+
height: 100%;
|
|
598
|
+
overflow: hidden;
|
|
599
|
+
}
|
|
439
600
|
|
|
440
601
|
.thinking-block {
|
|
441
602
|
align-self: stretch;
|
|
@@ -516,7 +677,6 @@
|
|
|
516
677
|
border-left: 2px solid rgba(1, 60, 84, 0.2);
|
|
517
678
|
}
|
|
518
679
|
|
|
519
|
-
/* Same layout as --2 (rallita + sangría); text and rail in red. */
|
|
520
680
|
&--3 {
|
|
521
681
|
font-size: 0.75rem;
|
|
522
682
|
color: #9b1c1c;
|
|
@@ -535,4 +695,4 @@
|
|
|
535
695
|
opacity: 0.65;
|
|
536
696
|
}
|
|
537
697
|
}
|
|
538
|
-
}
|
|
698
|
+
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
|
-
import { useIntl } from "react-intl";
|
|
3
|
-
import { Icon } from "semantic-ui-react";
|
|
4
|
-
import truedatLogo from "assets/truedat-logo-home-no-text.png";
|
|
5
|
-
|
|
6
|
-
const AssistantBubble = ({ onClick, fadeOut, fadeIn }) => {
|
|
7
|
-
const { formatMessage } = useIntl();
|
|
8
|
-
const className = [
|
|
9
|
-
"assistant-bubble",
|
|
10
|
-
fadeOut && "assistant-content--fade-out",
|
|
11
|
-
fadeIn && "assistant-content--fade-in",
|
|
12
|
-
]
|
|
13
|
-
.filter(Boolean)
|
|
14
|
-
.join(" ");
|
|
15
|
-
|
|
16
|
-
const isLogoSrcString = typeof truedatLogo === "string";
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div
|
|
20
|
-
className={className}
|
|
21
|
-
role="button"
|
|
22
|
-
aria-label={formatMessage({ id: "assistant.bubble.label" })}
|
|
23
|
-
onClick={onClick}
|
|
24
|
-
onKeyDown={(e) => {
|
|
25
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
26
|
-
e.preventDefault();
|
|
27
|
-
onClick();
|
|
28
|
-
}
|
|
29
|
-
}}
|
|
30
|
-
tabIndex={0}
|
|
31
|
-
>
|
|
32
|
-
{isLogoSrcString ? (
|
|
33
|
-
<img
|
|
34
|
-
src={truedatLogo}
|
|
35
|
-
alt={formatMessage({ id: "assistant.bubble.label" })}
|
|
36
|
-
className="assistant-bubble__logo"
|
|
37
|
-
/>
|
|
38
|
-
) : (
|
|
39
|
-
<Icon name="comments" />
|
|
40
|
-
)}
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
AssistantBubble.propTypes = {
|
|
46
|
-
onClick: PropTypes.func.isRequired,
|
|
47
|
-
fadeOut: PropTypes.bool,
|
|
48
|
-
fadeIn: PropTypes.bool,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
AssistantBubble.defaultProps = {
|
|
52
|
-
fadeOut: false,
|
|
53
|
-
fadeIn: false,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default AssistantBubble;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
|
-
|
|
4
|
-
import AssistantBubble from "../AssistantBubble";
|
|
5
|
-
|
|
6
|
-
describe("<AssistantBubble />", () => {
|
|
7
|
-
it("matches the latest snapshot", async () => {
|
|
8
|
-
const rendered = render(
|
|
9
|
-
<AssistantBubble onClick={jest.fn()} />
|
|
10
|
-
);
|
|
11
|
-
await waitForLoad(rendered);
|
|
12
|
-
expect(rendered.container).toMatchSnapshot();
|
|
13
|
-
});
|
|
14
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`<AssistantBubble /> matches the latest snapshot 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<div
|
|
6
|
-
aria-label="assistant.bubble.label"
|
|
7
|
-
class="assistant-bubble"
|
|
8
|
-
role="button"
|
|
9
|
-
tabindex="0"
|
|
10
|
-
>
|
|
11
|
-
<i
|
|
12
|
-
aria-hidden="true"
|
|
13
|
-
class="comments icon"
|
|
14
|
-
/>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
`;
|