@autobe/ui 0.29.2 → 0.30.0-dev.20260315
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/LICENSE +661 -661
- package/README.md +261 -0
- package/lib/components/AutoBeChatMain.js +5 -5
- package/lib/components/AutoBeChatMain.js.map +1 -1
- package/lib/components/AutoBeConfigModal.js +9 -9
- package/lib/components/AutoBeStatusModal.js +4 -4
- package/lib/components/AutoBeStatusModal.js.map +1 -1
- package/lib/components/AutoBeUserMessageMovie.d.ts +2 -2
- package/lib/components/common/ChatBubble.d.ts +2 -2
- package/lib/components/common/openai/OpenAIContent.d.ts +2 -2
- package/lib/components/common/openai/OpenAIContent.js.map +1 -1
- package/lib/components/common/openai/OpenAIUserAudioContent.js +1 -1
- package/lib/components/common/openai/OpenAIUserAudioContent.js.map +1 -1
- package/lib/components/common/openai/OpenAIUserFileContent.js +1 -1
- package/lib/components/common/openai/OpenAIUserFileContent.js.map +1 -1
- package/lib/components/common/openai/OpenAIUserImageContent.d.ts +2 -2
- package/lib/components/events/AutoBeCompleteEventMovie.d.ts +2 -2
- package/lib/components/events/AutoBeCompleteEventMovie.js +5 -5
- package/lib/components/events/AutoBeCompleteEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeCorrectEventMovie.d.ts +2 -2
- package/lib/components/events/AutoBeCorrectEventMovie.js +4 -4
- package/lib/components/events/AutoBeCorrectEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeEventMovie.js +38 -17
- package/lib/components/events/AutoBeEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeProgressEventMovie.js +73 -13
- package/lib/components/events/AutoBeProgressEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeScenarioEventMovie.d.ts +2 -2
- package/lib/components/events/AutoBeScenarioEventMovie.js +18 -5
- package/lib/components/events/AutoBeScenarioEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeStartEventMovie.d.ts +2 -2
- package/lib/components/events/AutoBeStartEventMovie.js +2 -2
- package/lib/components/events/AutoBeStartEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeValidateEventMovie.d.ts +2 -2
- package/lib/components/events/AutoBeValidateEventMovie.js +3 -11
- package/lib/components/events/AutoBeValidateEventMovie.js.map +1 -1
- package/lib/components/events/groups/CorrectEventGroup.d.ts +2 -2
- package/lib/components/events/groups/CorrectEventGroup.js +1 -1
- package/lib/components/events/groups/CorrectEventGroup.js.map +1 -1
- package/lib/components/events/groups/ValidateEventGroup.d.ts +2 -2
- package/lib/components/events/groups/ValidateEventGroup.js +1 -2
- package/lib/components/events/groups/ValidateEventGroup.js.map +1 -1
- package/lib/components/events/utils/eventGrouper.js +1 -2
- package/lib/components/events/utils/eventGrouper.js.map +1 -1
- package/lib/components/upload/AutoBeChatUploadBox.d.ts +3 -4
- package/lib/components/upload/AutoBeChatUploadBox.js +2 -1
- package/lib/components/upload/AutoBeChatUploadBox.js.map +1 -1
- package/lib/components/upload/AutoBeChatUploadSendButton.js +1 -1
- package/lib/components/upload/AutoBeChatUploadSendButton.js.map +1 -1
- package/lib/context/AutoBeAgentContext.d.ts +1 -3
- package/lib/context/AutoBeAgentContext.js +0 -4
- package/lib/context/AutoBeAgentContext.js.map +1 -1
- package/lib/hooks/useSessionStorage.d.ts +4 -0
- package/lib/hooks/useSessionStorage.js +16 -0
- package/lib/hooks/useSessionStorage.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/strategy/AutoBeAgentSessionStorageStrategy.d.ts +10 -0
- package/lib/strategy/AutoBeAgentSessionStorageStrategy.js +117 -0
- package/lib/strategy/AutoBeAgentSessionStorageStrategy.js.map +1 -0
- package/lib/structure/AutoBeListener.js +91 -23
- package/lib/structure/AutoBeListener.js.map +1 -1
- package/lib/structure/AutoBeListenerState.d.ts +3 -3
- package/lib/structure/AutoBeListenerState.js +4 -4
- package/lib/structure/AutoBeListenerState.js.map +1 -1
- package/lib/structure/IAutoBeAgentSessionStorageStrategy.js +1 -1
- package/lib/structure/IAutoBeAgentSessionStorageStrategy.js.map +1 -1
- package/lib/utils/AutoBeFileUploader.d.ts +2 -2
- package/lib/utils/AutoBeFileUploader.js.map +1 -1
- package/package.json +3 -4
- package/src/components/AutoBeAssistantMessageMovie.tsx +22 -22
- package/src/components/AutoBeChatMain.tsx +376 -376
- package/src/components/AutoBeChatSidebar.tsx +414 -414
- package/src/components/AutoBeConfigButton.tsx +83 -83
- package/src/components/AutoBeConfigModal.tsx +443 -443
- package/src/components/AutoBeStatusButton.tsx +75 -75
- package/src/components/AutoBeStatusModal.tsx +486 -484
- package/src/components/AutoBeUserMessageMovie.tsx +27 -27
- package/src/components/common/ActionButton.tsx +205 -205
- package/src/components/common/ActionButtonGroup.tsx +80 -80
- package/src/components/common/AutoBeConfigInput.tsx +185 -185
- package/src/components/common/ChatBubble.tsx +119 -119
- package/src/components/common/Collapsible.tsx +95 -95
- package/src/components/common/CompactSessionIndicator.tsx +73 -73
- package/src/components/common/CompactSessionList.tsx +82 -82
- package/src/components/common/index.ts +8 -8
- package/src/components/common/openai/OpenAIContent.tsx +53 -53
- package/src/components/common/openai/OpenAIUserAudioContent.tsx +70 -70
- package/src/components/common/openai/OpenAIUserFileContent.tsx +76 -76
- package/src/components/common/openai/OpenAIUserImageContent.tsx +34 -34
- package/src/components/common/openai/OpenAIUserTextContent.tsx +15 -15
- package/src/components/common/openai/index.ts +5 -5
- package/src/components/events/AutoBeCompleteEventMovie.tsx +402 -402
- package/src/components/events/AutoBeCorrectEventMovie.tsx +354 -368
- package/src/components/events/AutoBeEventGroupMovie.tsx +18 -18
- package/src/components/events/AutoBeEventMovie.tsx +158 -139
- package/src/components/events/AutoBeProgressEventMovie.tsx +217 -157
- package/src/components/events/AutoBeScenarioEventMovie.tsx +135 -95
- package/src/components/events/AutoBeStartEventMovie.tsx +82 -82
- package/src/components/events/AutoBeValidateEventMovie.tsx +249 -286
- package/src/components/events/README.md +300 -300
- package/src/components/events/common/CollapsibleEventGroup.tsx +211 -211
- package/src/components/events/common/EventCard.tsx +61 -61
- package/src/components/events/common/EventContent.tsx +31 -31
- package/src/components/events/common/EventHeader.tsx +85 -85
- package/src/components/events/common/EventIcon.tsx +82 -82
- package/src/components/events/common/ProgressBar.tsx +64 -64
- package/src/components/events/common/index.ts +13 -13
- package/src/components/events/groups/CorrectEventGroup.tsx +183 -183
- package/src/components/events/groups/ValidateEventGroup.tsx +143 -146
- package/src/components/events/groups/index.ts +8 -8
- package/src/components/events/index.ts +16 -16
- package/src/components/events/utils/eventGrouper.tsx +116 -117
- package/src/components/events/utils/index.ts +1 -1
- package/src/components/index.ts +13 -13
- package/src/components/upload/AutoBeChatUploadBox.tsx +425 -424
- package/src/components/upload/AutoBeChatUploadSendButton.tsx +66 -66
- package/src/components/upload/AutoBeFileUploadBox.tsx +123 -123
- package/src/components/upload/AutoBeUploadConfig.ts +5 -5
- package/src/components/upload/AutoBeVoiceRecoderButton.tsx +100 -100
- package/src/components/upload/index.ts +5 -5
- package/src/constant/color.ts +28 -28
- package/src/context/AutoBeAgentContext.tsx +245 -258
- package/src/context/AutoBeAgentSessionList.tsx +58 -58
- package/src/context/SearchParamsContext.tsx +49 -49
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useEscapeKey.ts +24 -24
- package/src/hooks/useIsomorphicLayoutEffect.ts +8 -8
- package/src/hooks/useMediaQuery.ts +73 -73
- package/src/hooks/useSessionStorage.ts +10 -0
- package/src/icons/Receipt.tsx +74 -74
- package/src/index.ts +9 -8
- package/src/strategy/AutoBeAgentSessionStorageStrategy.ts +127 -0
- package/src/structure/AutoBeListener.ts +373 -304
- package/src/structure/AutoBeListenerState.ts +53 -53
- package/src/structure/IAutoBeAgentSessionStorageStrategy.ts +87 -87
- package/src/structure/IAutoBeEventGroup.ts +6 -6
- package/src/structure/index.ts +4 -4
- package/src/types/config.ts +44 -44
- package/src/types/index.ts +1 -1
- package/src/utils/AutoBeFileUploader.ts +279 -279
- package/src/utils/AutoBeVoiceRecorder.ts +95 -95
- package/src/utils/__tests__/crypto.test.ts +286 -286
- package/src/utils/__tests__/storage.test.ts +229 -229
- package/src/utils/crypto.ts +95 -95
- package/src/utils/index.ts +6 -6
- package/src/utils/number.ts +17 -17
- package/src/utils/storage.ts +96 -96
- package/src/utils/time.ts +14 -14
- package/tsconfig.json +9 -9
- package/vitest.config.ts +15 -15
|
@@ -1,211 +1,211 @@
|
|
|
1
|
-
import { ReactNode, useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { EventCard } from "./EventCard";
|
|
4
|
-
import { EventContent } from "./EventContent";
|
|
5
|
-
import { EventIcon, EventIconType } from "./EventIcon";
|
|
6
|
-
|
|
7
|
-
export interface ICollapsibleEventGroupProps<T = unknown> {
|
|
8
|
-
/** Array of events of the same type */
|
|
9
|
-
events: T[];
|
|
10
|
-
/** Title for the group */
|
|
11
|
-
title: string;
|
|
12
|
-
/** Icon type for the group header */
|
|
13
|
-
iconType: EventIconType;
|
|
14
|
-
/** Function to render individual events */
|
|
15
|
-
renderEvent: (event: T, index: number) => ReactNode;
|
|
16
|
-
/** Function to get timestamp from event (for header) */
|
|
17
|
-
getTimestamp: (event: T) => string;
|
|
18
|
-
/** Optional custom summary content */
|
|
19
|
-
renderSummary?: (events: T[]) => ReactNode;
|
|
20
|
-
/** Initial collapsed state */
|
|
21
|
-
defaultCollapsed?: boolean;
|
|
22
|
-
/** Custom group description */
|
|
23
|
-
description?: string;
|
|
24
|
-
/** Card variant based on event status */
|
|
25
|
-
variant?: "default" | "success" | "error" | "warning";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Collapsible event group component Groups multiple events of the same type
|
|
30
|
-
* with expand/collapse functionality
|
|
31
|
-
*/
|
|
32
|
-
export const CollapsibleEventGroup = <T,>(
|
|
33
|
-
props: ICollapsibleEventGroupProps<T>,
|
|
34
|
-
) => {
|
|
35
|
-
const {
|
|
36
|
-
events,
|
|
37
|
-
title,
|
|
38
|
-
iconType,
|
|
39
|
-
renderEvent,
|
|
40
|
-
getTimestamp,
|
|
41
|
-
renderSummary,
|
|
42
|
-
defaultCollapsed = true,
|
|
43
|
-
description,
|
|
44
|
-
variant = "default",
|
|
45
|
-
} = props;
|
|
46
|
-
|
|
47
|
-
const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);
|
|
48
|
-
|
|
49
|
-
if (events.length === 0) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Use the latest event's timestamp for the group header
|
|
54
|
-
const latestTimestamp = getTimestamp(events[events.length - 1]);
|
|
55
|
-
|
|
56
|
-
const toggleCollapse = () => {
|
|
57
|
-
setIsCollapsed(!isCollapsed);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const defaultSummary = (
|
|
61
|
-
<>
|
|
62
|
-
{description && (
|
|
63
|
-
<>
|
|
64
|
-
{description}
|
|
65
|
-
<br />
|
|
66
|
-
<br />
|
|
67
|
-
</>
|
|
68
|
-
)}
|
|
69
|
-
<strong>Total Events:</strong> {events.length}
|
|
70
|
-
<br />
|
|
71
|
-
<strong>Status:</strong> {isCollapsed ? "Collapsed" : "Expanded"}
|
|
72
|
-
</>
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<EventCard variant={variant}>
|
|
77
|
-
{/* Header */}
|
|
78
|
-
<div
|
|
79
|
-
style={{
|
|
80
|
-
display: "flex",
|
|
81
|
-
alignItems: "center",
|
|
82
|
-
justifyContent: "space-between",
|
|
83
|
-
marginBottom: "1rem",
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
<div
|
|
87
|
-
style={{
|
|
88
|
-
display: "flex",
|
|
89
|
-
alignItems: "center",
|
|
90
|
-
gap: "0.75rem",
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
<EventIcon type={iconType} />
|
|
94
|
-
|
|
95
|
-
<div>
|
|
96
|
-
<h3
|
|
97
|
-
style={{
|
|
98
|
-
fontSize: "1.125rem",
|
|
99
|
-
fontWeight: "600",
|
|
100
|
-
color: "#1e293b",
|
|
101
|
-
margin: 0,
|
|
102
|
-
marginBottom: "0.25rem",
|
|
103
|
-
}}
|
|
104
|
-
>
|
|
105
|
-
{title}
|
|
106
|
-
</h3>
|
|
107
|
-
<div
|
|
108
|
-
style={{
|
|
109
|
-
fontSize: "0.75rem",
|
|
110
|
-
color: "#64748b",
|
|
111
|
-
}}
|
|
112
|
-
>
|
|
113
|
-
{events.length} event{events.length !== 1 ? "s" : ""}
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
|
|
118
|
-
<div
|
|
119
|
-
style={{
|
|
120
|
-
fontSize: "0.75rem",
|
|
121
|
-
color: "#64748b",
|
|
122
|
-
textAlign: "right",
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
{latestTimestamp}
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
|
|
129
|
-
{/* Summary content when collapsed */}
|
|
130
|
-
{isCollapsed && (
|
|
131
|
-
<EventContent>
|
|
132
|
-
{renderSummary ? renderSummary(events) : defaultSummary}
|
|
133
|
-
</EventContent>
|
|
134
|
-
)}
|
|
135
|
-
|
|
136
|
-
{/* Individual events when expanded */}
|
|
137
|
-
{!isCollapsed && (
|
|
138
|
-
<div
|
|
139
|
-
style={{
|
|
140
|
-
display: "flex",
|
|
141
|
-
flexDirection: "column",
|
|
142
|
-
gap: "0.5rem",
|
|
143
|
-
}}
|
|
144
|
-
>
|
|
145
|
-
{events.map((event, index) => (
|
|
146
|
-
<div key={index}>{renderEvent(event, index)}</div>
|
|
147
|
-
))}
|
|
148
|
-
</div>
|
|
149
|
-
)}
|
|
150
|
-
|
|
151
|
-
{/* Expand/Collapse Button */}
|
|
152
|
-
<div
|
|
153
|
-
style={{
|
|
154
|
-
display: "flex",
|
|
155
|
-
justifyContent: "center",
|
|
156
|
-
marginTop: "1rem",
|
|
157
|
-
}}
|
|
158
|
-
>
|
|
159
|
-
<button
|
|
160
|
-
onClick={toggleCollapse}
|
|
161
|
-
style={{
|
|
162
|
-
display: "flex",
|
|
163
|
-
alignItems: "center",
|
|
164
|
-
gap: "0.5rem",
|
|
165
|
-
padding: "0.5rem 1rem",
|
|
166
|
-
backgroundColor: "#f8fafc",
|
|
167
|
-
border: "1px solid #e2e8f0",
|
|
168
|
-
borderRadius: "0.5rem",
|
|
169
|
-
cursor: "pointer",
|
|
170
|
-
fontSize: "0.875rem",
|
|
171
|
-
color: "#64748b",
|
|
172
|
-
transition: "all 0.2s ease",
|
|
173
|
-
}}
|
|
174
|
-
onMouseEnter={(e) => {
|
|
175
|
-
e.currentTarget.style.backgroundColor = "#f1f5f9";
|
|
176
|
-
e.currentTarget.style.borderColor = "#cbd5e1";
|
|
177
|
-
}}
|
|
178
|
-
onMouseLeave={(e) => {
|
|
179
|
-
e.currentTarget.style.backgroundColor = "#f8fafc";
|
|
180
|
-
e.currentTarget.style.borderColor = "#e2e8f0";
|
|
181
|
-
}}
|
|
182
|
-
>
|
|
183
|
-
<span>{isCollapsed ? "Expand" : "Collapse"}</span>
|
|
184
|
-
<div
|
|
185
|
-
style={{
|
|
186
|
-
width: "1rem",
|
|
187
|
-
height: "1rem",
|
|
188
|
-
display: "flex",
|
|
189
|
-
alignItems: "center",
|
|
190
|
-
justifyContent: "center",
|
|
191
|
-
transition: "transform 0.2s ease",
|
|
192
|
-
transform: isCollapsed ? "rotate(0deg)" : "rotate(180deg)",
|
|
193
|
-
}}
|
|
194
|
-
>
|
|
195
|
-
<svg
|
|
196
|
-
width="12"
|
|
197
|
-
height="12"
|
|
198
|
-
viewBox="0 0 24 24"
|
|
199
|
-
fill="currentColor"
|
|
200
|
-
style={{ color: "#64748b" }}
|
|
201
|
-
>
|
|
202
|
-
<path d="M7 10l5 5 5-5z" />
|
|
203
|
-
</svg>
|
|
204
|
-
</div>
|
|
205
|
-
</button>
|
|
206
|
-
</div>
|
|
207
|
-
</EventCard>
|
|
208
|
-
);
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
export default CollapsibleEventGroup;
|
|
1
|
+
import { ReactNode, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { EventCard } from "./EventCard";
|
|
4
|
+
import { EventContent } from "./EventContent";
|
|
5
|
+
import { EventIcon, EventIconType } from "./EventIcon";
|
|
6
|
+
|
|
7
|
+
export interface ICollapsibleEventGroupProps<T = unknown> {
|
|
8
|
+
/** Array of events of the same type */
|
|
9
|
+
events: T[];
|
|
10
|
+
/** Title for the group */
|
|
11
|
+
title: string;
|
|
12
|
+
/** Icon type for the group header */
|
|
13
|
+
iconType: EventIconType;
|
|
14
|
+
/** Function to render individual events */
|
|
15
|
+
renderEvent: (event: T, index: number) => ReactNode;
|
|
16
|
+
/** Function to get timestamp from event (for header) */
|
|
17
|
+
getTimestamp: (event: T) => string;
|
|
18
|
+
/** Optional custom summary content */
|
|
19
|
+
renderSummary?: (events: T[]) => ReactNode;
|
|
20
|
+
/** Initial collapsed state */
|
|
21
|
+
defaultCollapsed?: boolean;
|
|
22
|
+
/** Custom group description */
|
|
23
|
+
description?: string;
|
|
24
|
+
/** Card variant based on event status */
|
|
25
|
+
variant?: "default" | "success" | "error" | "warning";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Collapsible event group component Groups multiple events of the same type
|
|
30
|
+
* with expand/collapse functionality
|
|
31
|
+
*/
|
|
32
|
+
export const CollapsibleEventGroup = <T,>(
|
|
33
|
+
props: ICollapsibleEventGroupProps<T>,
|
|
34
|
+
) => {
|
|
35
|
+
const {
|
|
36
|
+
events,
|
|
37
|
+
title,
|
|
38
|
+
iconType,
|
|
39
|
+
renderEvent,
|
|
40
|
+
getTimestamp,
|
|
41
|
+
renderSummary,
|
|
42
|
+
defaultCollapsed = true,
|
|
43
|
+
description,
|
|
44
|
+
variant = "default",
|
|
45
|
+
} = props;
|
|
46
|
+
|
|
47
|
+
const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);
|
|
48
|
+
|
|
49
|
+
if (events.length === 0) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Use the latest event's timestamp for the group header
|
|
54
|
+
const latestTimestamp = getTimestamp(events[events.length - 1]);
|
|
55
|
+
|
|
56
|
+
const toggleCollapse = () => {
|
|
57
|
+
setIsCollapsed(!isCollapsed);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const defaultSummary = (
|
|
61
|
+
<>
|
|
62
|
+
{description && (
|
|
63
|
+
<>
|
|
64
|
+
{description}
|
|
65
|
+
<br />
|
|
66
|
+
<br />
|
|
67
|
+
</>
|
|
68
|
+
)}
|
|
69
|
+
<strong>Total Events:</strong> {events.length}
|
|
70
|
+
<br />
|
|
71
|
+
<strong>Status:</strong> {isCollapsed ? "Collapsed" : "Expanded"}
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<EventCard variant={variant}>
|
|
77
|
+
{/* Header */}
|
|
78
|
+
<div
|
|
79
|
+
style={{
|
|
80
|
+
display: "flex",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
justifyContent: "space-between",
|
|
83
|
+
marginBottom: "1rem",
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
<div
|
|
87
|
+
style={{
|
|
88
|
+
display: "flex",
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
gap: "0.75rem",
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
<EventIcon type={iconType} />
|
|
94
|
+
|
|
95
|
+
<div>
|
|
96
|
+
<h3
|
|
97
|
+
style={{
|
|
98
|
+
fontSize: "1.125rem",
|
|
99
|
+
fontWeight: "600",
|
|
100
|
+
color: "#1e293b",
|
|
101
|
+
margin: 0,
|
|
102
|
+
marginBottom: "0.25rem",
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
{title}
|
|
106
|
+
</h3>
|
|
107
|
+
<div
|
|
108
|
+
style={{
|
|
109
|
+
fontSize: "0.75rem",
|
|
110
|
+
color: "#64748b",
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
{events.length} event{events.length !== 1 ? "s" : ""}
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<div
|
|
119
|
+
style={{
|
|
120
|
+
fontSize: "0.75rem",
|
|
121
|
+
color: "#64748b",
|
|
122
|
+
textAlign: "right",
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
{latestTimestamp}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
{/* Summary content when collapsed */}
|
|
130
|
+
{isCollapsed && (
|
|
131
|
+
<EventContent>
|
|
132
|
+
{renderSummary ? renderSummary(events) : defaultSummary}
|
|
133
|
+
</EventContent>
|
|
134
|
+
)}
|
|
135
|
+
|
|
136
|
+
{/* Individual events when expanded */}
|
|
137
|
+
{!isCollapsed && (
|
|
138
|
+
<div
|
|
139
|
+
style={{
|
|
140
|
+
display: "flex",
|
|
141
|
+
flexDirection: "column",
|
|
142
|
+
gap: "0.5rem",
|
|
143
|
+
}}
|
|
144
|
+
>
|
|
145
|
+
{events.map((event, index) => (
|
|
146
|
+
<div key={index}>{renderEvent(event, index)}</div>
|
|
147
|
+
))}
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
150
|
+
|
|
151
|
+
{/* Expand/Collapse Button */}
|
|
152
|
+
<div
|
|
153
|
+
style={{
|
|
154
|
+
display: "flex",
|
|
155
|
+
justifyContent: "center",
|
|
156
|
+
marginTop: "1rem",
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
<button
|
|
160
|
+
onClick={toggleCollapse}
|
|
161
|
+
style={{
|
|
162
|
+
display: "flex",
|
|
163
|
+
alignItems: "center",
|
|
164
|
+
gap: "0.5rem",
|
|
165
|
+
padding: "0.5rem 1rem",
|
|
166
|
+
backgroundColor: "#f8fafc",
|
|
167
|
+
border: "1px solid #e2e8f0",
|
|
168
|
+
borderRadius: "0.5rem",
|
|
169
|
+
cursor: "pointer",
|
|
170
|
+
fontSize: "0.875rem",
|
|
171
|
+
color: "#64748b",
|
|
172
|
+
transition: "all 0.2s ease",
|
|
173
|
+
}}
|
|
174
|
+
onMouseEnter={(e) => {
|
|
175
|
+
e.currentTarget.style.backgroundColor = "#f1f5f9";
|
|
176
|
+
e.currentTarget.style.borderColor = "#cbd5e1";
|
|
177
|
+
}}
|
|
178
|
+
onMouseLeave={(e) => {
|
|
179
|
+
e.currentTarget.style.backgroundColor = "#f8fafc";
|
|
180
|
+
e.currentTarget.style.borderColor = "#e2e8f0";
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
<span>{isCollapsed ? "Expand" : "Collapse"}</span>
|
|
184
|
+
<div
|
|
185
|
+
style={{
|
|
186
|
+
width: "1rem",
|
|
187
|
+
height: "1rem",
|
|
188
|
+
display: "flex",
|
|
189
|
+
alignItems: "center",
|
|
190
|
+
justifyContent: "center",
|
|
191
|
+
transition: "transform 0.2s ease",
|
|
192
|
+
transform: isCollapsed ? "rotate(0deg)" : "rotate(180deg)",
|
|
193
|
+
}}
|
|
194
|
+
>
|
|
195
|
+
<svg
|
|
196
|
+
width="12"
|
|
197
|
+
height="12"
|
|
198
|
+
viewBox="0 0 24 24"
|
|
199
|
+
fill="currentColor"
|
|
200
|
+
style={{ color: "#64748b" }}
|
|
201
|
+
>
|
|
202
|
+
<path d="M7 10l5 5 5-5z" />
|
|
203
|
+
</svg>
|
|
204
|
+
</div>
|
|
205
|
+
</button>
|
|
206
|
+
</div>
|
|
207
|
+
</EventCard>
|
|
208
|
+
);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export default CollapsibleEventGroup;
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
export interface IEventCardProps {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
style?: React.CSSProperties;
|
|
6
|
-
className?: string;
|
|
7
|
-
variant?: "default" | "success" | "error" | "warning";
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Common event card container component Provides consistent styling across all
|
|
12
|
-
* event components
|
|
13
|
-
*/
|
|
14
|
-
export const EventCard = (props: IEventCardProps) => {
|
|
15
|
-
const { variant = "default" } = props;
|
|
16
|
-
|
|
17
|
-
const getVariantStyles = () => {
|
|
18
|
-
switch (variant) {
|
|
19
|
-
case "success":
|
|
20
|
-
return {
|
|
21
|
-
backgroundColor: "#f0fdf4",
|
|
22
|
-
border: "1px solid #bbf7d0",
|
|
23
|
-
boxShadow: "0 1px 3px 0 rgb(34 197 94 / 0.1)",
|
|
24
|
-
};
|
|
25
|
-
case "error":
|
|
26
|
-
return {
|
|
27
|
-
backgroundColor: "#fef2f2",
|
|
28
|
-
border: "1px solid #fecaca",
|
|
29
|
-
boxShadow: "0 1px 3px 0 rgb(239 68 68 / 0.1)",
|
|
30
|
-
};
|
|
31
|
-
case "warning":
|
|
32
|
-
return {
|
|
33
|
-
backgroundColor: "#fffbeb",
|
|
34
|
-
border: "1px solid #fed7aa",
|
|
35
|
-
boxShadow: "0 1px 3px 0 rgb(245 158 11 / 0.1)",
|
|
36
|
-
};
|
|
37
|
-
default:
|
|
38
|
-
return {
|
|
39
|
-
backgroundColor: "#f8fafc",
|
|
40
|
-
border: "1px solid #e2e8f0",
|
|
41
|
-
boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)",
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<div
|
|
48
|
-
className={props.className}
|
|
49
|
-
style={{
|
|
50
|
-
...getVariantStyles(),
|
|
51
|
-
borderRadius: "0.75rem",
|
|
52
|
-
padding: "1.5rem",
|
|
53
|
-
...props.style,
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
{props.children}
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export default EventCard;
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export interface IEventCardProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
className?: string;
|
|
7
|
+
variant?: "default" | "success" | "error" | "warning";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Common event card container component Provides consistent styling across all
|
|
12
|
+
* event components
|
|
13
|
+
*/
|
|
14
|
+
export const EventCard = (props: IEventCardProps) => {
|
|
15
|
+
const { variant = "default" } = props;
|
|
16
|
+
|
|
17
|
+
const getVariantStyles = () => {
|
|
18
|
+
switch (variant) {
|
|
19
|
+
case "success":
|
|
20
|
+
return {
|
|
21
|
+
backgroundColor: "#f0fdf4",
|
|
22
|
+
border: "1px solid #bbf7d0",
|
|
23
|
+
boxShadow: "0 1px 3px 0 rgb(34 197 94 / 0.1)",
|
|
24
|
+
};
|
|
25
|
+
case "error":
|
|
26
|
+
return {
|
|
27
|
+
backgroundColor: "#fef2f2",
|
|
28
|
+
border: "1px solid #fecaca",
|
|
29
|
+
boxShadow: "0 1px 3px 0 rgb(239 68 68 / 0.1)",
|
|
30
|
+
};
|
|
31
|
+
case "warning":
|
|
32
|
+
return {
|
|
33
|
+
backgroundColor: "#fffbeb",
|
|
34
|
+
border: "1px solid #fed7aa",
|
|
35
|
+
boxShadow: "0 1px 3px 0 rgb(245 158 11 / 0.1)",
|
|
36
|
+
};
|
|
37
|
+
default:
|
|
38
|
+
return {
|
|
39
|
+
backgroundColor: "#f8fafc",
|
|
40
|
+
border: "1px solid #e2e8f0",
|
|
41
|
+
boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)",
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div
|
|
48
|
+
className={props.className}
|
|
49
|
+
style={{
|
|
50
|
+
...getVariantStyles(),
|
|
51
|
+
borderRadius: "0.75rem",
|
|
52
|
+
padding: "1.5rem",
|
|
53
|
+
...props.style,
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{props.children}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default EventCard;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
export interface IEventContentProps {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
style?: React.CSSProperties;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Common event content component Provides consistent content area styling
|
|
10
|
-
* across all event components
|
|
11
|
-
*/
|
|
12
|
-
export const EventContent = (props: IEventContentProps) => {
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
style={{
|
|
16
|
-
fontSize: "0.875rem",
|
|
17
|
-
lineHeight: "1.5",
|
|
18
|
-
color: "#475569",
|
|
19
|
-
backgroundColor: "#ffffff",
|
|
20
|
-
padding: "1rem",
|
|
21
|
-
borderRadius: "0.5rem",
|
|
22
|
-
border: "1px solid #e2e8f0",
|
|
23
|
-
...props.style,
|
|
24
|
-
}}
|
|
25
|
-
>
|
|
26
|
-
{props.children}
|
|
27
|
-
</div>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default EventContent;
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export interface IEventContentProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Common event content component Provides consistent content area styling
|
|
10
|
+
* across all event components
|
|
11
|
+
*/
|
|
12
|
+
export const EventContent = (props: IEventContentProps) => {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
style={{
|
|
16
|
+
fontSize: "0.875rem",
|
|
17
|
+
lineHeight: "1.5",
|
|
18
|
+
color: "#475569",
|
|
19
|
+
backgroundColor: "#ffffff",
|
|
20
|
+
padding: "1rem",
|
|
21
|
+
borderRadius: "0.5rem",
|
|
22
|
+
border: "1px solid #e2e8f0",
|
|
23
|
+
...props.style,
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
{props.children}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default EventContent;
|