chordia-ui 3.9.2 → 3.9.4
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/dist/ChatMessage.cjs.js +5 -5
- package/dist/ChatMessage.cjs.js.map +1 -1
- package/dist/ChatMessage.es.js +583 -353
- package/dist/ChatMessage.es.js.map +1 -1
- package/dist/MessageThread.cjs.js +15 -0
- package/dist/MessageThread.cjs.js.map +1 -0
- package/dist/MessageThread.es.js +1868 -0
- package/dist/MessageThread.es.js.map +1 -0
- package/dist/PerformancePanel.cjs.js +1 -1
- package/dist/PerformancePanel.cjs.js.map +1 -1
- package/dist/PerformancePanel.es.js +587 -749
- package/dist/PerformancePanel.es.js.map +1 -1
- package/dist/components/chat.cjs.js +1 -27
- package/dist/components/chat.cjs.js.map +1 -1
- package/dist/components/chat.es.js +276 -1617
- package/dist/components/chat.es.js.map +1 -1
- package/dist/components/layout.cjs.js +2 -2
- package/dist/components/layout.cjs.js.map +1 -1
- package/dist/components/layout.es.js +289 -272
- package/dist/components/layout.es.js.map +1 -1
- package/dist/components/media.cjs.js +1 -1
- package/dist/components/media.cjs.js.map +1 -1
- package/dist/components/media.es.js +4 -4
- package/dist/components/media.es.js.map +1 -1
- package/dist/components/reports.cjs.js +2 -2
- package/dist/components/reports.cjs.js.map +1 -1
- package/dist/components/reports.es.js +18 -18
- package/dist/components/reports.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +8 -8
- package/package.json +1 -1
- package/src/components/chat/ChatHistoryPanel.jsx +740 -388
- package/src/components/chat/ChatInterface.jsx +3 -3
- package/src/components/chat/ChatMessage.jsx +338 -48
- package/src/components/chat/ChatWelcome.jsx +386 -0
- package/src/components/chat/ThinkingIndicator.jsx +121 -275
- package/src/components/chat/index.js +1 -0
- package/src/components/layout/SplitPane.jsx +21 -13
- package/src/components/media/InteractionSummaryCard.jsx +1 -1
- package/src/components/performance/PerformanceDetailsPage.jsx +51 -52
- package/src/components/performance/performanceRangeFormat.js +3 -2
- package/src/components/reports/ReportsDetails.jsx +2 -2
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import {
|
|
5
|
+
Users,
|
|
6
|
+
Compass,
|
|
7
|
+
Smile,
|
|
8
|
+
Frown,
|
|
9
|
+
ShieldCheck,
|
|
10
|
+
AlertTriangle,
|
|
11
|
+
Clock,
|
|
12
|
+
Repeat,
|
|
13
|
+
Target,
|
|
14
|
+
Award,
|
|
15
|
+
TrendingUp,
|
|
16
|
+
TrendingDown,
|
|
17
|
+
MessageSquare,
|
|
18
|
+
Activity,
|
|
19
|
+
PieChart,
|
|
20
|
+
LineChart,
|
|
21
|
+
Search,
|
|
22
|
+
PhoneCall,
|
|
23
|
+
Calendar,
|
|
24
|
+
BarChart3,
|
|
25
|
+
FileText,
|
|
26
|
+
DollarSign,
|
|
27
|
+
History,
|
|
28
|
+
} from "lucide-react";
|
|
29
|
+
|
|
30
|
+
// Maps the backend's icon-name strings to lucide icon components.
|
|
31
|
+
const ICON_MAP = {
|
|
32
|
+
users: Users,
|
|
33
|
+
compass: Compass,
|
|
34
|
+
smile: Smile,
|
|
35
|
+
frown: Frown,
|
|
36
|
+
"shield-check": ShieldCheck,
|
|
37
|
+
"alert-triangle": AlertTriangle,
|
|
38
|
+
clock: Clock,
|
|
39
|
+
repeat: Repeat,
|
|
40
|
+
target: Target,
|
|
41
|
+
award: Award,
|
|
42
|
+
"trending-up": TrendingUp,
|
|
43
|
+
"trending-down": TrendingDown,
|
|
44
|
+
"message-square": MessageSquare,
|
|
45
|
+
activity: Activity,
|
|
46
|
+
"pie-chart": PieChart,
|
|
47
|
+
"line-chart": LineChart,
|
|
48
|
+
search: Search,
|
|
49
|
+
"phone-call": PhoneCall,
|
|
50
|
+
calendar: Calendar,
|
|
51
|
+
"bar-chart-3": BarChart3,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* ChatWelcome
|
|
56
|
+
* Empty / new-chat welcome screen: brand symbol, greeting, a compose input
|
|
57
|
+
* and a grid of "Suggested Topics" prompt cards.
|
|
58
|
+
*
|
|
59
|
+
* Props:
|
|
60
|
+
* greeting - heading text
|
|
61
|
+
* placeholder - compose input placeholder
|
|
62
|
+
* value - controlled compose value
|
|
63
|
+
* onChange - (string) => void
|
|
64
|
+
* onSubmit - () => void // invoked by the Send button / Enter
|
|
65
|
+
* onKeyDown - optional textarea keydown passthrough (e.g. Enter-to-send)
|
|
66
|
+
* topics - [{ icon, title, prompt }] // icon: a known icon-name string
|
|
67
|
+
* (see ICON_MAP) or a lucide component
|
|
68
|
+
* onTopicSelect - (prompt) => void
|
|
69
|
+
* disabled - disables input + cards (e.g. no project / streaming)
|
|
70
|
+
* sendDisabled - optional override for the Send button's disabled state
|
|
71
|
+
* logo - optional ReactNode to replace the built-in brand symbol
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
const COLORS = {
|
|
75
|
+
strong: "#2e3236", // grey/strong
|
|
76
|
+
muted: "#808183", // grey/muted
|
|
77
|
+
border: "#808183",
|
|
78
|
+
cardBorder: "#b2b2b0", // neutral/300
|
|
79
|
+
hoverBg: "#f3f7f7", // grey/hover — matches thread card hover
|
|
80
|
+
hoverBorder: "#d9d9d9", // grey/absent — matches thread card hover
|
|
81
|
+
iconBg: "#e6e6e6", // neutral/100
|
|
82
|
+
ink: "#0b0b0b", // neutral/900
|
|
83
|
+
sendText: "#f2f2f0", // neutral/50
|
|
84
|
+
sendBg: "#0B0B0B", // base/strong (black)
|
|
85
|
+
sendDisabledBg: "#ECEEF2",
|
|
86
|
+
sendDisabledText: "#9CA3AF",
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// Decorative icon palette — cycled across cards whose `icon` is missing or
|
|
90
|
+
// unrecognized. Suggestion text always comes from the caller (e.g. an API).
|
|
91
|
+
const FALLBACK_ICONS = [Users, TrendingUp, FileText, Calendar, DollarSign, BarChart3];
|
|
92
|
+
|
|
93
|
+
// Resolve a topic's `icon` (a known icon-name string, a lucide component, or
|
|
94
|
+
// nothing) to a renderable component.
|
|
95
|
+
function resolveIcon(icon, index) {
|
|
96
|
+
if (typeof icon === "string") {
|
|
97
|
+
return ICON_MAP[icon] || FALLBACK_ICONS[index % FALLBACK_ICONS.length];
|
|
98
|
+
}
|
|
99
|
+
return icon || FALLBACK_ICONS[index % FALLBACK_ICONS.length];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Chordia brand symbol: a dark disc with five concentric green rings.
|
|
103
|
+
export function BrandSymbol({ size = 48 }) {
|
|
104
|
+
return (
|
|
105
|
+
<div
|
|
106
|
+
style={{
|
|
107
|
+
width: size,
|
|
108
|
+
height: size,
|
|
109
|
+
borderRadius: "9999px",
|
|
110
|
+
background: "#2e3236",
|
|
111
|
+
overflow: "hidden",
|
|
112
|
+
position: "relative",
|
|
113
|
+
flexShrink: 0,
|
|
114
|
+
}}
|
|
115
|
+
aria-hidden="true"
|
|
116
|
+
>
|
|
117
|
+
<svg
|
|
118
|
+
viewBox="0 0 40.1436 40.1436"
|
|
119
|
+
fill="none"
|
|
120
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
121
|
+
style={{ position: "absolute", inset: "8.33%", display: "block" }}
|
|
122
|
+
>
|
|
123
|
+
<path d="M38.7803 20.0713C38.7803 15.3098 37.002 10.9639 34.0723 7.66113C30.6441 3.7964 25.6419 1.36331 20.0713 1.36328C14.5958 1.36328 9.67176 3.71492 6.24902 7.46484C3.2131 10.7919 1.36329 15.2146 1.36328 20.0723C1.36328 25.4538 3.63513 30.3049 7.27441 33.7188L7.5918 34.0098C10.9101 36.9752 15.4232 38.7803 20.0723 38.7803C24.8742 38.7803 29.2527 36.9725 32.5654 33.998C36.3821 30.5709 38.7803 25.6014 38.7803 20.0713ZM40.1436 20.0713C40.1435 26.0044 37.5678 31.3371 33.4756 35.0117C29.9225 38.202 25.2231 40.1436 20.0723 40.1436C14.919 40.1436 9.93329 38.0823 6.3418 34.7129C2.43938 31.0522 0 25.8457 0 20.0723C1.16301e-05 14.8616 1.98619 10.1142 5.24219 6.5459C8.91209 2.52517 14.1968 0 20.0713 0C26.0479 3.16876e-05 31.416 2.61368 35.0918 6.75781C38.2339 10.3002 40.1436 14.964 40.1436 20.0713Z" fill="#E8D4A3" />
|
|
124
|
+
<path d="M36.3329 20.0725C36.3329 15.8532 34.7227 12.0101 32.0829 9.12519L32.081 9.12324C29.1125 5.85837 24.8319 3.80981 20.0712 3.80976C15.3004 3.80976 11.0105 5.86398 8.0351 9.13691C5.40915 12.0255 3.80853 15.8614 3.80853 20.0725C3.80858 24.7008 6.06831 28.4553 9.26166 31.4572C12.2161 34.2351 15.9065 36.3342 20.0712 36.3342C24.2887 36.3341 28.131 34.7276 31.0195 32.093L31.3222 31.8107C34.411 28.852 36.3329 24.6868 36.3329 20.0725ZM37.5253 20.0725C37.5253 25.1849 35.3251 29.7853 31.8222 32.9748C28.7228 35.8015 24.5971 37.5265 20.0712 37.5266C15.4922 37.5266 11.5242 35.2213 8.44525 32.3264C5.09746 29.1794 2.61718 25.1312 2.61713 20.0725C2.61713 15.5535 4.33486 11.4345 7.15228 8.33515C10.3441 4.82411 14.9505 2.61836 20.0712 2.61836C25.1807 2.6184 29.7769 4.81737 32.9619 8.31953C35.7951 11.4157 37.5253 15.5436 37.5253 20.0725Z" fill="#C1D89F" />
|
|
125
|
+
<path d="M33.8868 20.0725C33.8868 16.3937 32.4371 13.0596 30.0919 10.5842C27.5739 7.92608 24.0201 6.25613 20.0714 6.25609C16.0052 6.25609 12.3494 8.01185 9.82142 10.8079C7.60429 13.2591 6.25501 16.508 6.25501 20.0725C6.25509 23.9518 8.49268 26.595 11.2511 29.1965C13.8273 31.6258 16.5284 33.8879 20.0714 33.8879C23.7055 33.8879 27.0114 32.4826 29.4757 30.1868C32.1895 27.6665 33.8868 24.0684 33.8868 20.0725ZM34.9093 20.0725C34.9093 24.3641 33.0841 28.2293 30.171 30.9348C27.5252 33.3999 23.9742 34.9104 20.0714 34.9104C16.0773 34.9104 13.1053 32.3484 10.5509 29.9397H10.5499C7.76745 27.3154 5.2336 24.4103 5.23353 20.0725C5.23353 16.245 6.68314 12.7541 9.06361 10.1223L9.32142 9.84496C12.023 7.00547 15.8408 5.23461 20.0714 5.23461C24.3152 5.23465 28.1332 7.02997 30.8341 9.88109C33.3498 12.5365 34.9093 16.1189 34.9093 20.0725Z" fill="#9BDB9C" />
|
|
126
|
+
<path d="M31.4395 20.0714C31.4395 16.9342 30.1592 14.1018 28.1026 12.0441C26.0462 9.98654 23.2107 8.70232 20.0714 8.70227H19.9923C16.6632 8.72458 13.6734 10.1773 11.6075 12.4786C9.8004 14.4925 8.70126 17.1527 8.70126 20.0714C8.70131 21.6405 9.25407 22.8047 10.0919 23.8497C10.9514 24.9218 12.0707 25.8275 13.2393 26.9337C13.7746 27.4408 14.2979 27.9914 14.8097 28.5109C15.3269 29.0358 15.84 29.5377 16.3809 29.9747C17.4581 30.845 18.6195 31.4415 20.0704 31.4415C23.1212 31.4414 25.8897 30.2383 27.9298 28.2814V28.2804C30.0922 26.2142 31.4395 23.2082 31.4395 20.0714ZM32.2911 20.0714C32.2911 23.3411 30.9334 26.4713 28.7335 28.6847L28.5186 28.8956C26.3265 30.9984 23.3497 32.293 20.0704 32.2931C18.356 32.2931 17.0107 31.578 15.8458 30.6368C15.2658 30.1682 14.725 29.6381 14.2032 29.1085C13.6759 28.5734 13.1755 28.0456 12.6544 27.5519V27.5529C11.5516 26.509 10.335 25.5147 9.42685 24.382C8.49711 23.2222 7.84975 21.8758 7.8497 20.0714C7.8497 16.9344 9.03178 14.0733 10.9737 11.9093H10.9747C13.2113 9.41789 16.4584 7.84973 20.0704 7.84973H20.2462L20.2491 7.85364C23.5553 7.90127 26.5354 9.27265 28.7042 11.4425L29.1085 11.8663C31.0791 14.0333 32.2911 16.9075 32.2911 20.0714Z" fill="#74DF98" />
|
|
127
|
+
<path d="M28.9943 20.0726C28.9943 17.475 27.8846 15.1376 26.1134 13.5062C24.5338 12.0514 22.4294 11.1609 20.1154 11.1497H20.0705C17.4138 11.1497 15.0293 12.3095 13.3947 14.1517C11.9962 15.7271 11.1476 17.8001 11.1476 20.0726C11.1477 21.2559 11.6747 21.9577 12.4513 22.5892C12.85 22.9133 13.2999 23.2072 13.7853 23.5413C14.2637 23.8706 14.7654 24.2328 15.2287 24.6741C15.6677 25.0922 16.0479 25.5869 16.4035 26.0774C16.765 26.5764 17.0961 27.0626 17.4581 27.5052C18.1755 28.3819 18.9427 28.9954 20.0705 28.9954C22.537 28.9953 24.769 27.9944 26.3849 26.3763C27.9975 24.7615 28.9942 22.5337 28.9943 20.0726ZM29.6749 20.0726C29.6749 22.7214 28.6023 25.1204 26.8673 26.8577C25.1288 28.5986 22.7252 29.676 20.0705 29.6761C18.6374 29.6761 17.696 28.8721 16.9308 27.9368C16.5518 27.4736 16.1974 26.9548 15.8517 26.4778C15.5879 26.1138 15.3251 25.7685 15.0451 25.4612L14.7589 25.1673C14.3366 24.7649 13.8722 24.4282 13.3996 24.1028C12.9342 23.7825 12.448 23.4651 12.0216 23.1185C11.1476 22.4078 10.466 21.5291 10.466 20.0726C10.466 17.6272 11.38 15.3949 12.8849 13.6995L13.2238 13.3362C14.9319 11.6 17.2966 10.5141 19.9162 10.4729L19.921 10.4671H20.0714C22.5803 10.4672 24.8639 11.4299 26.5744 13.0052C28.4798 14.7601 29.6749 17.2765 29.6749 20.0726Z" fill="#4DE294" />
|
|
128
|
+
</svg>
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export default function ChatWelcome({
|
|
134
|
+
greeting = "Hello! I'm here to assist you. How can I help you today?",
|
|
135
|
+
placeholder = "Ask Compass about conversations, agents, quality, performance...",
|
|
136
|
+
value = "",
|
|
137
|
+
onChange,
|
|
138
|
+
onSubmit,
|
|
139
|
+
onKeyDown,
|
|
140
|
+
topics = [],
|
|
141
|
+
onTopicSelect,
|
|
142
|
+
disabled = false,
|
|
143
|
+
sendDisabled,
|
|
144
|
+
logo,
|
|
145
|
+
onBrowseHistory, // optional: renders a "Browse History" button below the topics
|
|
146
|
+
}) {
|
|
147
|
+
const canSend = sendDisabled != null ? !sendDisabled : !disabled && !!value.trim();
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<div
|
|
151
|
+
style={{
|
|
152
|
+
flex: 1,
|
|
153
|
+
minHeight: 0,
|
|
154
|
+
overflowY: "auto",
|
|
155
|
+
display: "flex",
|
|
156
|
+
flexDirection: "column",
|
|
157
|
+
alignItems: "center",
|
|
158
|
+
justifyContent: "center",
|
|
159
|
+
gap: "16px",
|
|
160
|
+
padding: "32px",
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
{logo || <BrandSymbol size={48} />}
|
|
164
|
+
|
|
165
|
+
<h2
|
|
166
|
+
style={{
|
|
167
|
+
margin: 0,
|
|
168
|
+
fontSize: "24px",
|
|
169
|
+
fontWeight: 550,
|
|
170
|
+
lineHeight: "normal",
|
|
171
|
+
color: COLORS.strong,
|
|
172
|
+
textAlign: "center",
|
|
173
|
+
whiteSpace: "nowrap",
|
|
174
|
+
maxWidth: "100%",
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
{greeting}
|
|
178
|
+
</h2>
|
|
179
|
+
|
|
180
|
+
{/* Compose input */}
|
|
181
|
+
<div
|
|
182
|
+
style={{
|
|
183
|
+
width: "100%",
|
|
184
|
+
maxWidth: "744px",
|
|
185
|
+
display: "flex",
|
|
186
|
+
alignItems: "flex-end",
|
|
187
|
+
gap: "12px",
|
|
188
|
+
padding: "12px",
|
|
189
|
+
background: "#FFFFFF",
|
|
190
|
+
border: `1px solid ${COLORS.border}`,
|
|
191
|
+
borderRadius: "8px",
|
|
192
|
+
}}
|
|
193
|
+
>
|
|
194
|
+
<style>{`.cui-welcome-compose::placeholder { color: ${COLORS.muted}; opacity: 1; }`}</style>
|
|
195
|
+
<textarea
|
|
196
|
+
value={value}
|
|
197
|
+
onChange={(e) => onChange?.(e.target.value)}
|
|
198
|
+
onKeyDown={onKeyDown}
|
|
199
|
+
placeholder={placeholder}
|
|
200
|
+
disabled={disabled}
|
|
201
|
+
rows={1}
|
|
202
|
+
className="cui-welcome-compose"
|
|
203
|
+
style={{
|
|
204
|
+
flex: 1,
|
|
205
|
+
minWidth: 0,
|
|
206
|
+
border: "none",
|
|
207
|
+
outline: "none",
|
|
208
|
+
resize: "none",
|
|
209
|
+
background: "transparent",
|
|
210
|
+
fontSize: "15px",
|
|
211
|
+
lineHeight: 1.5,
|
|
212
|
+
color: COLORS.strong,
|
|
213
|
+
fontFamily: "inherit",
|
|
214
|
+
maxHeight: "120px",
|
|
215
|
+
}}
|
|
216
|
+
/>
|
|
217
|
+
<button
|
|
218
|
+
type="button"
|
|
219
|
+
onClick={() => onSubmit?.()}
|
|
220
|
+
disabled={!canSend}
|
|
221
|
+
style={{
|
|
222
|
+
flexShrink: 0,
|
|
223
|
+
display: "inline-flex",
|
|
224
|
+
alignItems: "center",
|
|
225
|
+
justifyContent: "center",
|
|
226
|
+
height: "28px",
|
|
227
|
+
padding: "0 12px",
|
|
228
|
+
borderRadius: "8px",
|
|
229
|
+
border: "none",
|
|
230
|
+
fontSize: "14px",
|
|
231
|
+
fontWeight: 400,
|
|
232
|
+
lineHeight: "24px",
|
|
233
|
+
color: canSend ? COLORS.sendText : COLORS.sendDisabledText,
|
|
234
|
+
background: canSend ? COLORS.sendBg : COLORS.sendDisabledBg,
|
|
235
|
+
cursor: canSend ? "pointer" : "not-allowed",
|
|
236
|
+
}}
|
|
237
|
+
>
|
|
238
|
+
Send
|
|
239
|
+
</button>
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
{/* Suggested topics */}
|
|
243
|
+
{topics?.length > 0 && (
|
|
244
|
+
<div
|
|
245
|
+
style={{
|
|
246
|
+
width: "100%",
|
|
247
|
+
display: "flex",
|
|
248
|
+
flexDirection: "column",
|
|
249
|
+
alignItems: "center",
|
|
250
|
+
gap: "16px",
|
|
251
|
+
marginTop: "8px",
|
|
252
|
+
}}
|
|
253
|
+
>
|
|
254
|
+
<div
|
|
255
|
+
style={{
|
|
256
|
+
fontSize: "14px",
|
|
257
|
+
fontWeight: 600,
|
|
258
|
+
lineHeight: "normal",
|
|
259
|
+
color: COLORS.strong,
|
|
260
|
+
whiteSpace: "nowrap",
|
|
261
|
+
}}
|
|
262
|
+
>
|
|
263
|
+
Suggested Topics
|
|
264
|
+
</div>
|
|
265
|
+
<div
|
|
266
|
+
style={{
|
|
267
|
+
display: "flex",
|
|
268
|
+
flexWrap: "wrap",
|
|
269
|
+
gap: "16px",
|
|
270
|
+
justifyContent: "center",
|
|
271
|
+
maxWidth: "744px",
|
|
272
|
+
}}
|
|
273
|
+
>
|
|
274
|
+
{topics.map((topic, index) => {
|
|
275
|
+
const Icon = resolveIcon(topic.icon, index);
|
|
276
|
+
return (
|
|
277
|
+
<button
|
|
278
|
+
key={topic.id ?? `${topic.title || ""}-${topic.prompt}-${index}`}
|
|
279
|
+
type="button"
|
|
280
|
+
disabled={disabled}
|
|
281
|
+
onClick={() => {
|
|
282
|
+
if (disabled) return;
|
|
283
|
+
onTopicSelect?.(topic.prompt);
|
|
284
|
+
}}
|
|
285
|
+
style={{
|
|
286
|
+
width: "233px",
|
|
287
|
+
minHeight: "82px",
|
|
288
|
+
display: "flex",
|
|
289
|
+
alignItems: "flex-start",
|
|
290
|
+
gap: "16px",
|
|
291
|
+
padding: "16px",
|
|
292
|
+
background: "#FFFFFF",
|
|
293
|
+
border: `1px solid ${COLORS.cardBorder}`,
|
|
294
|
+
borderRadius: "8px",
|
|
295
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
296
|
+
textAlign: "left",
|
|
297
|
+
transition: "border-color 0.12s ease, background 0.12s ease",
|
|
298
|
+
}}
|
|
299
|
+
onMouseEnter={(e) => {
|
|
300
|
+
if (disabled) return;
|
|
301
|
+
e.currentTarget.style.borderColor = COLORS.hoverBorder;
|
|
302
|
+
e.currentTarget.style.background = COLORS.hoverBg;
|
|
303
|
+
}}
|
|
304
|
+
onMouseLeave={(e) => {
|
|
305
|
+
e.currentTarget.style.borderColor = COLORS.cardBorder;
|
|
306
|
+
e.currentTarget.style.background = "#FFFFFF";
|
|
307
|
+
}}
|
|
308
|
+
>
|
|
309
|
+
<div
|
|
310
|
+
style={{
|
|
311
|
+
flexShrink: 0,
|
|
312
|
+
width: "34px",
|
|
313
|
+
height: "34px",
|
|
314
|
+
borderRadius: "9999px",
|
|
315
|
+
background: COLORS.iconBg,
|
|
316
|
+
display: "flex",
|
|
317
|
+
alignItems: "center",
|
|
318
|
+
justifyContent: "center",
|
|
319
|
+
color: COLORS.ink,
|
|
320
|
+
}}
|
|
321
|
+
>
|
|
322
|
+
{Icon ? <Icon size={16} /> : null}
|
|
323
|
+
</div>
|
|
324
|
+
<div style={{ flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: "6px" }}>
|
|
325
|
+
{topic.title && (
|
|
326
|
+
<div style={{ fontSize: "13px", fontWeight: 600, color: COLORS.ink, lineHeight: 1.2 }}>
|
|
327
|
+
{topic.title}
|
|
328
|
+
</div>
|
|
329
|
+
)}
|
|
330
|
+
<div
|
|
331
|
+
title={topic.prompt}
|
|
332
|
+
style={{
|
|
333
|
+
fontSize: "13px",
|
|
334
|
+
fontWeight: 400,
|
|
335
|
+
color: COLORS.ink,
|
|
336
|
+
lineHeight: 1.2,
|
|
337
|
+
// Clamp the description to 3 lines, then ellipsis.
|
|
338
|
+
// Full text is available via the title tooltip.
|
|
339
|
+
display: "-webkit-box",
|
|
340
|
+
WebkitBoxOrient: "vertical",
|
|
341
|
+
WebkitLineClamp: 3,
|
|
342
|
+
overflow: "hidden",
|
|
343
|
+
textOverflow: "ellipsis",
|
|
344
|
+
}}
|
|
345
|
+
>
|
|
346
|
+
{topic.prompt}
|
|
347
|
+
</div>
|
|
348
|
+
</div>
|
|
349
|
+
</button>
|
|
350
|
+
);
|
|
351
|
+
})}
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
)}
|
|
355
|
+
|
|
356
|
+
{/* Browse History */}
|
|
357
|
+
{onBrowseHistory && (
|
|
358
|
+
<button
|
|
359
|
+
type="button"
|
|
360
|
+
onClick={onBrowseHistory}
|
|
361
|
+
style={{
|
|
362
|
+
display: "inline-flex",
|
|
363
|
+
alignItems: "center",
|
|
364
|
+
justifyContent: "center",
|
|
365
|
+
gap: "8px",
|
|
366
|
+
padding: "12px 16px",
|
|
367
|
+
borderRadius: "10px",
|
|
368
|
+
border: "1px solid #bfbfbf",
|
|
369
|
+
background: "#FFFFFF",
|
|
370
|
+
color: "#323232",
|
|
371
|
+
fontSize: "14px",
|
|
372
|
+
fontWeight: 400,
|
|
373
|
+
lineHeight: "24px",
|
|
374
|
+
cursor: "pointer",
|
|
375
|
+
transition: "background 0.12s ease",
|
|
376
|
+
}}
|
|
377
|
+
onMouseEnter={(e) => (e.currentTarget.style.background = COLORS.hoverBg)}
|
|
378
|
+
onMouseLeave={(e) => (e.currentTarget.style.background = "#FFFFFF")}
|
|
379
|
+
>
|
|
380
|
+
<History size={20} color="#676767" />
|
|
381
|
+
Browse History
|
|
382
|
+
</button>
|
|
383
|
+
)}
|
|
384
|
+
</div>
|
|
385
|
+
);
|
|
386
|
+
}
|