@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,85 +1,85 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
import { formatTime } from "../../../utils/time";
|
|
4
|
-
import { EventIcon, EventIconType } from "./EventIcon";
|
|
5
|
-
|
|
6
|
-
export interface IEventHeaderProps {
|
|
7
|
-
title: string;
|
|
8
|
-
subtitle?: ReactNode;
|
|
9
|
-
timestamp: string;
|
|
10
|
-
iconType: EventIconType;
|
|
11
|
-
step?: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Common event header component Provides consistent header layout with icon,
|
|
16
|
-
* title, and timestamp
|
|
17
|
-
*/
|
|
18
|
-
export const EventHeader = (props: IEventHeaderProps) => {
|
|
19
|
-
return (
|
|
20
|
-
<div
|
|
21
|
-
style={{
|
|
22
|
-
display: "flex",
|
|
23
|
-
alignItems: "center",
|
|
24
|
-
justifyContent: "space-between",
|
|
25
|
-
marginBottom: "1rem",
|
|
26
|
-
}}
|
|
27
|
-
>
|
|
28
|
-
<div
|
|
29
|
-
style={{
|
|
30
|
-
display: "flex",
|
|
31
|
-
alignItems: "center",
|
|
32
|
-
gap: "0.75rem",
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
<EventIcon type={props.iconType} />
|
|
36
|
-
|
|
37
|
-
<div>
|
|
38
|
-
<h3
|
|
39
|
-
style={{
|
|
40
|
-
fontSize: "1.125rem",
|
|
41
|
-
fontWeight: "600",
|
|
42
|
-
color: "#1e293b",
|
|
43
|
-
margin: 0,
|
|
44
|
-
marginBottom: "0.25rem",
|
|
45
|
-
}}
|
|
46
|
-
>
|
|
47
|
-
{props.title}
|
|
48
|
-
</h3>
|
|
49
|
-
{props.subtitle && (
|
|
50
|
-
<div
|
|
51
|
-
style={{
|
|
52
|
-
fontSize: "0.75rem",
|
|
53
|
-
color: "#64748b",
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
{props.subtitle}
|
|
57
|
-
</div>
|
|
58
|
-
)}
|
|
59
|
-
{props.step !== undefined && (
|
|
60
|
-
<div
|
|
61
|
-
style={{
|
|
62
|
-
fontSize: "0.75rem",
|
|
63
|
-
color: "#64748b",
|
|
64
|
-
}}
|
|
65
|
-
>
|
|
66
|
-
Step #{props.step}
|
|
67
|
-
</div>
|
|
68
|
-
)}
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
|
|
72
|
-
<div
|
|
73
|
-
style={{
|
|
74
|
-
fontSize: "0.75rem",
|
|
75
|
-
color: "#64748b",
|
|
76
|
-
textAlign: "right",
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
{formatTime(props.timestamp)}
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default EventHeader;
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
import { formatTime } from "../../../utils/time";
|
|
4
|
+
import { EventIcon, EventIconType } from "./EventIcon";
|
|
5
|
+
|
|
6
|
+
export interface IEventHeaderProps {
|
|
7
|
+
title: string;
|
|
8
|
+
subtitle?: ReactNode;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
iconType: EventIconType;
|
|
11
|
+
step?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Common event header component Provides consistent header layout with icon,
|
|
16
|
+
* title, and timestamp
|
|
17
|
+
*/
|
|
18
|
+
export const EventHeader = (props: IEventHeaderProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
style={{
|
|
22
|
+
display: "flex",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
justifyContent: "space-between",
|
|
25
|
+
marginBottom: "1rem",
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
<div
|
|
29
|
+
style={{
|
|
30
|
+
display: "flex",
|
|
31
|
+
alignItems: "center",
|
|
32
|
+
gap: "0.75rem",
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<EventIcon type={props.iconType} />
|
|
36
|
+
|
|
37
|
+
<div>
|
|
38
|
+
<h3
|
|
39
|
+
style={{
|
|
40
|
+
fontSize: "1.125rem",
|
|
41
|
+
fontWeight: "600",
|
|
42
|
+
color: "#1e293b",
|
|
43
|
+
margin: 0,
|
|
44
|
+
marginBottom: "0.25rem",
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
{props.title}
|
|
48
|
+
</h3>
|
|
49
|
+
{props.subtitle && (
|
|
50
|
+
<div
|
|
51
|
+
style={{
|
|
52
|
+
fontSize: "0.75rem",
|
|
53
|
+
color: "#64748b",
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{props.subtitle}
|
|
57
|
+
</div>
|
|
58
|
+
)}
|
|
59
|
+
{props.step !== undefined && (
|
|
60
|
+
<div
|
|
61
|
+
style={{
|
|
62
|
+
fontSize: "0.75rem",
|
|
63
|
+
color: "#64748b",
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
Step #{props.step}
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<div
|
|
73
|
+
style={{
|
|
74
|
+
fontSize: "0.75rem",
|
|
75
|
+
color: "#64748b",
|
|
76
|
+
textAlign: "right",
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
{formatTime(props.timestamp)}
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default EventHeader;
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
export type EventIconType =
|
|
2
|
-
| "success"
|
|
3
|
-
| "progress"
|
|
4
|
-
| "warning"
|
|
5
|
-
| "error"
|
|
6
|
-
| "info"
|
|
7
|
-
| "start";
|
|
8
|
-
|
|
9
|
-
export interface IEventIconProps {
|
|
10
|
-
type: EventIconType;
|
|
11
|
-
size?: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const ICON_CONFIGS = {
|
|
15
|
-
success: {
|
|
16
|
-
backgroundColor: "#4caf50",
|
|
17
|
-
icon: (
|
|
18
|
-
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" />
|
|
19
|
-
),
|
|
20
|
-
},
|
|
21
|
-
progress: {
|
|
22
|
-
backgroundColor: "#4caf50",
|
|
23
|
-
icon: (
|
|
24
|
-
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" />
|
|
25
|
-
),
|
|
26
|
-
},
|
|
27
|
-
warning: {
|
|
28
|
-
backgroundColor: "#f59e0b",
|
|
29
|
-
icon: <path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" />,
|
|
30
|
-
},
|
|
31
|
-
error: {
|
|
32
|
-
backgroundColor: "#ef4444",
|
|
33
|
-
icon: (
|
|
34
|
-
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm3.5 6L12 10.5 8.5 8 7 9.5 10.5 12 7 15.5 8.5 17 12 13.5 15.5 17 17 15.5 13.5 12 17 8.5 15.5 7z" />
|
|
35
|
-
),
|
|
36
|
-
},
|
|
37
|
-
info: {
|
|
38
|
-
backgroundColor: "#3b82f6",
|
|
39
|
-
icon: (
|
|
40
|
-
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" />
|
|
41
|
-
),
|
|
42
|
-
},
|
|
43
|
-
start: {
|
|
44
|
-
backgroundColor: "#10b981",
|
|
45
|
-
icon: <path d="M8 5v14l11-7z" />,
|
|
46
|
-
},
|
|
47
|
-
} as const;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Common event icon component Provides consistent icon styling across all event
|
|
51
|
-
* components
|
|
52
|
-
*/
|
|
53
|
-
export const EventIcon = (props: IEventIconProps) => {
|
|
54
|
-
const { type, size = 16 } = props;
|
|
55
|
-
const config = ICON_CONFIGS[type];
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<div
|
|
59
|
-
style={{
|
|
60
|
-
width: "2rem",
|
|
61
|
-
height: "2rem",
|
|
62
|
-
backgroundColor: config.backgroundColor,
|
|
63
|
-
borderRadius: "50%",
|
|
64
|
-
display: "flex",
|
|
65
|
-
alignItems: "center",
|
|
66
|
-
justifyContent: "center",
|
|
67
|
-
}}
|
|
68
|
-
>
|
|
69
|
-
<svg
|
|
70
|
-
width={size}
|
|
71
|
-
height={size}
|
|
72
|
-
viewBox="0 0 24 24"
|
|
73
|
-
fill="currentColor"
|
|
74
|
-
style={{ color: "#ffffff" }}
|
|
75
|
-
>
|
|
76
|
-
{config.icon}
|
|
77
|
-
</svg>
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export default EventIcon;
|
|
1
|
+
export type EventIconType =
|
|
2
|
+
| "success"
|
|
3
|
+
| "progress"
|
|
4
|
+
| "warning"
|
|
5
|
+
| "error"
|
|
6
|
+
| "info"
|
|
7
|
+
| "start";
|
|
8
|
+
|
|
9
|
+
export interface IEventIconProps {
|
|
10
|
+
type: EventIconType;
|
|
11
|
+
size?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const ICON_CONFIGS = {
|
|
15
|
+
success: {
|
|
16
|
+
backgroundColor: "#4caf50",
|
|
17
|
+
icon: (
|
|
18
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" />
|
|
19
|
+
),
|
|
20
|
+
},
|
|
21
|
+
progress: {
|
|
22
|
+
backgroundColor: "#4caf50",
|
|
23
|
+
icon: (
|
|
24
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" />
|
|
25
|
+
),
|
|
26
|
+
},
|
|
27
|
+
warning: {
|
|
28
|
+
backgroundColor: "#f59e0b",
|
|
29
|
+
icon: <path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" />,
|
|
30
|
+
},
|
|
31
|
+
error: {
|
|
32
|
+
backgroundColor: "#ef4444",
|
|
33
|
+
icon: (
|
|
34
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm3.5 6L12 10.5 8.5 8 7 9.5 10.5 12 7 15.5 8.5 17 12 13.5 15.5 17 17 15.5 13.5 12 17 8.5 15.5 7z" />
|
|
35
|
+
),
|
|
36
|
+
},
|
|
37
|
+
info: {
|
|
38
|
+
backgroundColor: "#3b82f6",
|
|
39
|
+
icon: (
|
|
40
|
+
<path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z" />
|
|
41
|
+
),
|
|
42
|
+
},
|
|
43
|
+
start: {
|
|
44
|
+
backgroundColor: "#10b981",
|
|
45
|
+
icon: <path d="M8 5v14l11-7z" />,
|
|
46
|
+
},
|
|
47
|
+
} as const;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Common event icon component Provides consistent icon styling across all event
|
|
51
|
+
* components
|
|
52
|
+
*/
|
|
53
|
+
export const EventIcon = (props: IEventIconProps) => {
|
|
54
|
+
const { type, size = 16 } = props;
|
|
55
|
+
const config = ICON_CONFIGS[type];
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
style={{
|
|
60
|
+
width: "2rem",
|
|
61
|
+
height: "2rem",
|
|
62
|
+
backgroundColor: config.backgroundColor,
|
|
63
|
+
borderRadius: "50%",
|
|
64
|
+
display: "flex",
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
justifyContent: "center",
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
<svg
|
|
70
|
+
width={size}
|
|
71
|
+
height={size}
|
|
72
|
+
viewBox="0 0 24 24"
|
|
73
|
+
fill="currentColor"
|
|
74
|
+
style={{ color: "#ffffff" }}
|
|
75
|
+
>
|
|
76
|
+
{config.icon}
|
|
77
|
+
</svg>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default EventIcon;
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
export interface IProgressBarProps {
|
|
2
|
-
current: number;
|
|
3
|
-
total: number;
|
|
4
|
-
color?: string;
|
|
5
|
-
backgroundColor?: string;
|
|
6
|
-
height?: string;
|
|
7
|
-
showLabel?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Common progress bar component Provides consistent progress visualization
|
|
12
|
-
* across event components
|
|
13
|
-
*/
|
|
14
|
-
export const ProgressBar = (props: IProgressBarProps) => {
|
|
15
|
-
const {
|
|
16
|
-
current,
|
|
17
|
-
total,
|
|
18
|
-
color = "#4caf50",
|
|
19
|
-
backgroundColor = "#e2e8f0",
|
|
20
|
-
height = "10px",
|
|
21
|
-
showLabel = true,
|
|
22
|
-
} = props;
|
|
23
|
-
|
|
24
|
-
const calibratedCurrent = current > total ? total : current;
|
|
25
|
-
const percentage = Math.round((calibratedCurrent / total) * 100);
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<>
|
|
29
|
-
<div
|
|
30
|
-
style={{
|
|
31
|
-
width: "100%",
|
|
32
|
-
height,
|
|
33
|
-
backgroundColor,
|
|
34
|
-
borderRadius: "10px",
|
|
35
|
-
overflow: "hidden",
|
|
36
|
-
marginBottom: showLabel ? "0.5rem" : "0",
|
|
37
|
-
}}
|
|
38
|
-
>
|
|
39
|
-
<div
|
|
40
|
-
style={{
|
|
41
|
-
width: `${percentage}%`,
|
|
42
|
-
height: "100%",
|
|
43
|
-
backgroundColor: color,
|
|
44
|
-
borderRadius: "10px",
|
|
45
|
-
transition: "width 0.3s ease",
|
|
46
|
-
}}
|
|
47
|
-
/>
|
|
48
|
-
</div>
|
|
49
|
-
{showLabel && (
|
|
50
|
-
<div
|
|
51
|
-
style={{
|
|
52
|
-
fontSize: "0.75rem",
|
|
53
|
-
color: "#64748b",
|
|
54
|
-
textAlign: "center",
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
{calibratedCurrent} / {total} completed
|
|
58
|
-
</div>
|
|
59
|
-
)}
|
|
60
|
-
</>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export default ProgressBar;
|
|
1
|
+
export interface IProgressBarProps {
|
|
2
|
+
current: number;
|
|
3
|
+
total: number;
|
|
4
|
+
color?: string;
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
height?: string;
|
|
7
|
+
showLabel?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Common progress bar component Provides consistent progress visualization
|
|
12
|
+
* across event components
|
|
13
|
+
*/
|
|
14
|
+
export const ProgressBar = (props: IProgressBarProps) => {
|
|
15
|
+
const {
|
|
16
|
+
current,
|
|
17
|
+
total,
|
|
18
|
+
color = "#4caf50",
|
|
19
|
+
backgroundColor = "#e2e8f0",
|
|
20
|
+
height = "10px",
|
|
21
|
+
showLabel = true,
|
|
22
|
+
} = props;
|
|
23
|
+
|
|
24
|
+
const calibratedCurrent = current > total ? total : current;
|
|
25
|
+
const percentage = Math.round((calibratedCurrent / total) * 100);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
width: "100%",
|
|
32
|
+
height,
|
|
33
|
+
backgroundColor,
|
|
34
|
+
borderRadius: "10px",
|
|
35
|
+
overflow: "hidden",
|
|
36
|
+
marginBottom: showLabel ? "0.5rem" : "0",
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
<div
|
|
40
|
+
style={{
|
|
41
|
+
width: `${percentage}%`,
|
|
42
|
+
height: "100%",
|
|
43
|
+
backgroundColor: color,
|
|
44
|
+
borderRadius: "10px",
|
|
45
|
+
transition: "width 0.3s ease",
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
{showLabel && (
|
|
50
|
+
<div
|
|
51
|
+
style={{
|
|
52
|
+
fontSize: "0.75rem",
|
|
53
|
+
color: "#64748b",
|
|
54
|
+
textAlign: "center",
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
{calibratedCurrent} / {total} completed
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default ProgressBar;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { EventCard, type IEventCardProps } from "./EventCard";
|
|
2
|
-
export {
|
|
3
|
-
EventIcon,
|
|
4
|
-
type EventIconType,
|
|
5
|
-
type IEventIconProps,
|
|
6
|
-
} from "./EventIcon";
|
|
7
|
-
export { EventHeader, type IEventHeaderProps } from "./EventHeader";
|
|
8
|
-
export { EventContent, type IEventContentProps } from "./EventContent";
|
|
9
|
-
export { ProgressBar, type IProgressBarProps } from "./ProgressBar";
|
|
10
|
-
export {
|
|
11
|
-
CollapsibleEventGroup,
|
|
12
|
-
type ICollapsibleEventGroupProps,
|
|
13
|
-
} from "./CollapsibleEventGroup";
|
|
1
|
+
export { EventCard, type IEventCardProps } from "./EventCard";
|
|
2
|
+
export {
|
|
3
|
+
EventIcon,
|
|
4
|
+
type EventIconType,
|
|
5
|
+
type IEventIconProps,
|
|
6
|
+
} from "./EventIcon";
|
|
7
|
+
export { EventHeader, type IEventHeaderProps } from "./EventHeader";
|
|
8
|
+
export { EventContent, type IEventContentProps } from "./EventContent";
|
|
9
|
+
export { ProgressBar, type IProgressBarProps } from "./ProgressBar";
|
|
10
|
+
export {
|
|
11
|
+
CollapsibleEventGroup,
|
|
12
|
+
type ICollapsibleEventGroupProps,
|
|
13
|
+
} from "./CollapsibleEventGroup";
|