@autobe/ui 0.19.1 → 0.20.0
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/lib/AutoBeChatUploadSendButton.d.ts +15 -0
- package/lib/AutoBeChatUploadSendButton.js +38 -0
- package/lib/AutoBeChatUploadSendButton.js.map +1 -0
- package/lib/AutoBeFileUploadBox.d.ts +10 -0
- package/lib/AutoBeFileUploadBox.js +68 -0
- package/lib/AutoBeFileUploadBox.js.map +1 -0
- package/lib/AutoBeVoiceRecoderButton.d.ts +11 -0
- package/lib/AutoBeVoiceRecoderButton.js +58 -0
- package/lib/AutoBeVoiceRecoderButton.js.map +1 -0
- package/lib/events/AutoBeCompleteEventMovie.d.ts +7 -0
- package/lib/events/AutoBeCompleteEventMovie.js +210 -0
- package/lib/events/AutoBeCompleteEventMovie.js.map +1 -0
- package/lib/events/AutoBeProgressEventMovie.js +2 -61
- package/lib/events/AutoBeProgressEventMovie.js.map +1 -1
- package/lib/events/AutoBeScenarioEventMovie.js +2 -44
- package/lib/events/AutoBeScenarioEventMovie.js.map +1 -1
- package/lib/events/AutoBeValidateEventMovie.d.ts +6 -0
- package/lib/events/AutoBeValidateEventMovie.js +115 -0
- package/lib/events/AutoBeValidateEventMovie.js.map +1 -0
- package/lib/events/common/CollapsibleEventGroup.d.ts +28 -0
- package/lib/events/common/CollapsibleEventGroup.js +89 -0
- package/lib/events/common/CollapsibleEventGroup.js.map +1 -0
- package/lib/events/common/EventCard.d.ts +13 -0
- package/lib/events/common/EventCard.js +43 -0
- package/lib/events/common/EventCard.js.map +1 -0
- package/lib/events/common/EventContent.d.ts +11 -0
- package/lib/events/common/EventContent.js +14 -0
- package/lib/events/common/EventContent.js.map +1 -0
- package/lib/events/common/EventHeader.d.ts +15 -0
- package/lib/events/common/EventHeader.js +41 -0
- package/lib/events/common/EventHeader.js.map +1 -0
- package/lib/events/common/EventIcon.d.ts +11 -0
- package/lib/events/common/EventIcon.js +50 -0
- package/lib/events/common/EventIcon.js.map +1 -0
- package/lib/events/common/ProgressBar.d.ts +14 -0
- package/lib/events/common/ProgressBar.js +33 -0
- package/lib/events/common/ProgressBar.js.map +1 -0
- package/lib/events/common/index.d.ts +6 -0
- package/lib/events/common/index.js +16 -0
- package/lib/events/common/index.js.map +1 -0
- package/lib/events/groups/ValidateEventGroup.d.ts +12 -0
- package/lib/events/groups/ValidateEventGroup.js +78 -0
- package/lib/events/groups/ValidateEventGroup.js.map +1 -0
- package/lib/events/groups/index.d.ts +1 -0
- package/lib/events/groups/index.js +6 -0
- package/lib/events/groups/index.js.map +1 -0
- package/lib/events/index.d.ts +5 -0
- package/lib/events/index.js +25 -1
- package/lib/events/index.js.map +1 -1
- package/lib/events/utils/eventGrouper.d.ts +20 -0
- package/lib/events/utils/eventGrouper.js +74 -0
- package/lib/events/utils/eventGrouper.js.map +1 -0
- package/lib/events/utils/index.d.ts +1 -0
- package/lib/events/utils/index.js +6 -0
- package/lib/events/utils/index.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +7 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/AutoBeFileUploader.d.ts +28 -0
- package/lib/utils/AutoBeFileUploader.js +237 -0
- package/lib/utils/AutoBeFileUploader.js.map +1 -0
- package/lib/utils/AutoBeVoiceRecorder.d.ts +7 -0
- package/lib/utils/AutoBeVoiceRecorder.js +94 -0
- package/lib/utils/AutoBeVoiceRecorder.js.map +1 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +20 -0
- package/lib/utils/index.js.map +1 -0
- package/package.json +17 -2
- package/src/AutoBeChatUploadSendButton.tsx +66 -0
- package/src/AutoBeFileUploadBox.tsx +124 -0
- package/src/AutoBeVoiceRecoderButton.tsx +100 -0
- package/src/events/AutoBeCompleteEventMovie.tsx +402 -0
- package/src/events/AutoBeProgressEventMovie.tsx +12 -125
- package/src/events/AutoBeScenarioEventMovie.tsx +5 -93
- package/src/events/AutoBeValidateEventMovie.tsx +326 -0
- package/src/events/README.md +169 -0
- package/src/events/common/CollapsibleEventGroup.tsx +220 -0
- package/src/events/common/EventCard.tsx +61 -0
- package/src/events/common/EventContent.tsx +31 -0
- package/src/events/common/EventHeader.tsx +85 -0
- package/src/events/common/EventIcon.tsx +82 -0
- package/src/events/common/ProgressBar.tsx +63 -0
- package/src/events/common/index.ts +13 -0
- package/src/events/groups/ValidateEventGroup.tsx +150 -0
- package/src/events/groups/index.ts +4 -0
- package/src/events/index.ts +14 -0
- package/src/events/utils/eventGrouper.tsx +118 -0
- package/src/events/utils/index.ts +1 -0
- package/src/index.ts +6 -0
- package/src/utils/AutoBeFileUploader.ts +279 -0
- package/src/utils/AutoBeVoiceRecorder.ts +95 -0
- package/src/utils/index.ts +3 -0
|
@@ -0,0 +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;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 percentage = Math.round((current / total) * 100);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
<div
|
|
29
|
+
style={{
|
|
30
|
+
width: "100%",
|
|
31
|
+
height,
|
|
32
|
+
backgroundColor,
|
|
33
|
+
borderRadius: "10px",
|
|
34
|
+
overflow: "hidden",
|
|
35
|
+
marginBottom: showLabel ? "0.5rem" : "0",
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
style={{
|
|
40
|
+
width: `${percentage}%`,
|
|
41
|
+
height: "100%",
|
|
42
|
+
backgroundColor: color,
|
|
43
|
+
borderRadius: "10px",
|
|
44
|
+
transition: "width 0.3s ease",
|
|
45
|
+
}}
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
{showLabel && (
|
|
49
|
+
<div
|
|
50
|
+
style={{
|
|
51
|
+
fontSize: "0.75rem",
|
|
52
|
+
color: "#64748b",
|
|
53
|
+
textAlign: "center",
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{current} / {total} completed
|
|
57
|
+
</div>
|
|
58
|
+
)}
|
|
59
|
+
</>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default ProgressBar;
|
|
@@ -0,0 +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";
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AutoBeInterfaceComplementEvent,
|
|
3
|
+
AutoBeInterfaceOperationsReviewEvent,
|
|
4
|
+
AutoBePrismaInsufficientEvent,
|
|
5
|
+
AutoBePrismaValidateEvent,
|
|
6
|
+
AutoBeRealizeAuthorizationValidateEvent,
|
|
7
|
+
AutoBeRealizeValidateEvent,
|
|
8
|
+
AutoBeTestValidateEvent,
|
|
9
|
+
} from "@autobe/interface";
|
|
10
|
+
|
|
11
|
+
import { AutoBeValidateEventMovie } from "../AutoBeValidateEventMovie";
|
|
12
|
+
import { CollapsibleEventGroup } from "../common/CollapsibleEventGroup";
|
|
13
|
+
|
|
14
|
+
type ValidateEvent =
|
|
15
|
+
| AutoBePrismaInsufficientEvent
|
|
16
|
+
| AutoBePrismaValidateEvent
|
|
17
|
+
| AutoBeInterfaceOperationsReviewEvent
|
|
18
|
+
| AutoBeInterfaceComplementEvent
|
|
19
|
+
| AutoBeTestValidateEvent
|
|
20
|
+
| AutoBeRealizeValidateEvent
|
|
21
|
+
| AutoBeRealizeAuthorizationValidateEvent;
|
|
22
|
+
|
|
23
|
+
export interface IValidateEventGroupProps {
|
|
24
|
+
events: ValidateEvent[];
|
|
25
|
+
defaultCollapsed?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Specialized group component for validation events Shows validation summary
|
|
30
|
+
* and error statistics
|
|
31
|
+
*/
|
|
32
|
+
export const ValidateEventGroup = (props: IValidateEventGroupProps) => {
|
|
33
|
+
const { events, defaultCollapsed = true } = props;
|
|
34
|
+
|
|
35
|
+
if (events.length === 0) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Calculate validation statistics
|
|
40
|
+
const errorEvents = events.filter((event) => {
|
|
41
|
+
switch (event.type) {
|
|
42
|
+
case "prismaValidate":
|
|
43
|
+
case "realizeValidate":
|
|
44
|
+
case "prismaInsufficient":
|
|
45
|
+
return true;
|
|
46
|
+
case "testValidate":
|
|
47
|
+
case "realizeAuthorizationValidate":
|
|
48
|
+
return event.result.type !== "success";
|
|
49
|
+
case "interfaceOperationsReview":
|
|
50
|
+
case "interfaceComplement":
|
|
51
|
+
return false;
|
|
52
|
+
default:
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}).length;
|
|
56
|
+
|
|
57
|
+
const successEvents = events.length - errorEvents;
|
|
58
|
+
const eventTypes = Array.from(new Set(events.map((e) => e.type)));
|
|
59
|
+
|
|
60
|
+
const renderSummary = (events: ValidateEvent[]) => (
|
|
61
|
+
<>
|
|
62
|
+
Validation and review events from various components
|
|
63
|
+
<br />
|
|
64
|
+
<br />
|
|
65
|
+
<strong>Success Rate:</strong>{" "}
|
|
66
|
+
{events.length > 0
|
|
67
|
+
? Math.round((successEvents / events.length) * 100)
|
|
68
|
+
: 0}
|
|
69
|
+
%
|
|
70
|
+
<br />
|
|
71
|
+
<strong>Successful:</strong> {successEvents} events
|
|
72
|
+
<br />
|
|
73
|
+
<strong>Failed/Issues:</strong> {errorEvents} events
|
|
74
|
+
<br />
|
|
75
|
+
<strong>Event Types:</strong> {eventTypes.join(", ")}
|
|
76
|
+
<br />
|
|
77
|
+
<br />
|
|
78
|
+
<div
|
|
79
|
+
style={{
|
|
80
|
+
display: "flex",
|
|
81
|
+
gap: "0.5rem",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<div
|
|
86
|
+
style={{
|
|
87
|
+
display: "flex",
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
gap: "0.25rem",
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<div
|
|
93
|
+
style={{
|
|
94
|
+
width: "12px",
|
|
95
|
+
height: "12px",
|
|
96
|
+
backgroundColor: "#4caf50",
|
|
97
|
+
borderRadius: "2px",
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
<span style={{ fontSize: "0.75rem" }}>Success: {successEvents}</span>
|
|
101
|
+
</div>
|
|
102
|
+
<div
|
|
103
|
+
style={{
|
|
104
|
+
display: "flex",
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
gap: "0.25rem",
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<div
|
|
110
|
+
style={{
|
|
111
|
+
width: "12px",
|
|
112
|
+
height: "12px",
|
|
113
|
+
backgroundColor: "#ef4444",
|
|
114
|
+
borderRadius: "2px",
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
<span style={{ fontSize: "0.75rem" }}>Issues: {errorEvents}</span>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
</>
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const getGroupIconType = () => {
|
|
124
|
+
if (errorEvents === 0) return "success"; // All successful
|
|
125
|
+
if (successEvents === 0) return "error"; // All failed
|
|
126
|
+
return "warning"; // Mixed results
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const getGroupVariant = () => {
|
|
130
|
+
if (errorEvents === 0) return "success"; // All successful
|
|
131
|
+
if (successEvents === 0) return "error"; // All failed
|
|
132
|
+
return "warning"; // Mixed results
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<CollapsibleEventGroup
|
|
137
|
+
events={events}
|
|
138
|
+
title="Validation Events"
|
|
139
|
+
iconType={getGroupIconType()}
|
|
140
|
+
variant={getGroupVariant()}
|
|
141
|
+
getTimestamp={(event) => event.created_at}
|
|
142
|
+
renderEvent={(event) => <AutoBeValidateEventMovie event={event} />}
|
|
143
|
+
renderSummary={renderSummary}
|
|
144
|
+
defaultCollapsed={defaultCollapsed}
|
|
145
|
+
description="Validation and review events"
|
|
146
|
+
/>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export default ValidateEventGroup;
|
package/src/events/index.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
export { default as AutoBeStartEventMovie } from "./AutoBeStartEventMovie";
|
|
2
2
|
export { default as AutoBeScenarioEventMovie } from "./AutoBeScenarioEventMovie";
|
|
3
3
|
export { default as AutoBeProgressEventMovie } from "./AutoBeProgressEventMovie";
|
|
4
|
+
export { default as AutoBeValidateEventMovie } from "./AutoBeValidateEventMovie";
|
|
5
|
+
export {
|
|
6
|
+
default as AutoBeCompleteEventMovie,
|
|
7
|
+
type IAutoBeCompleteEventMovieProps,
|
|
8
|
+
} from "./AutoBeCompleteEventMovie";
|
|
9
|
+
|
|
10
|
+
// Common components
|
|
11
|
+
export * from "./common";
|
|
12
|
+
|
|
13
|
+
// Event groups
|
|
14
|
+
export * from "./groups";
|
|
15
|
+
|
|
16
|
+
// Utilities
|
|
17
|
+
export * from "./utils";
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { AutoBeEvent } from "@autobe/interface";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
import { ValidateEventGroup } from "../groups";
|
|
5
|
+
|
|
6
|
+
/** Configuration for event grouping */
|
|
7
|
+
export interface IEventGrouperConfig {
|
|
8
|
+
/** Minimum number of events to form a group (default: 2) */
|
|
9
|
+
minGroupSize?: number;
|
|
10
|
+
/** Whether groups should be collapsed by default (default: true) */
|
|
11
|
+
defaultCollapsed?: boolean;
|
|
12
|
+
/** Whether to group events at all (default: true) */
|
|
13
|
+
enableGrouping?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Groups events by type and renders appropriate group components
|
|
18
|
+
*
|
|
19
|
+
* @param events Array of AutoBe events to group
|
|
20
|
+
* @param config Configuration options for grouping
|
|
21
|
+
* @returns Array of ReactNode components (grouped or individual)
|
|
22
|
+
*/
|
|
23
|
+
export function groupEvents(
|
|
24
|
+
events: AutoBeEvent[],
|
|
25
|
+
config: IEventGrouperConfig = {},
|
|
26
|
+
): ReactNode[] {
|
|
27
|
+
const {
|
|
28
|
+
minGroupSize = 2,
|
|
29
|
+
defaultCollapsed = true,
|
|
30
|
+
enableGrouping = true,
|
|
31
|
+
} = config;
|
|
32
|
+
|
|
33
|
+
if (!enableGrouping) {
|
|
34
|
+
// Return individual event components without grouping
|
|
35
|
+
return events.map((event, index) => (
|
|
36
|
+
<div key={`${event.type}-${index}`}>{renderIndividualEvent(event)}</div>
|
|
37
|
+
));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Group events by category
|
|
41
|
+
const groupedEvents = groupEventsByCategory(events);
|
|
42
|
+
const components: ReactNode[] = [];
|
|
43
|
+
|
|
44
|
+
// Validation Events
|
|
45
|
+
if (groupedEvents.validate.length >= minGroupSize) {
|
|
46
|
+
components.push(
|
|
47
|
+
<ValidateEventGroup
|
|
48
|
+
key="validate-group"
|
|
49
|
+
events={groupedEvents.validate}
|
|
50
|
+
defaultCollapsed={defaultCollapsed}
|
|
51
|
+
/>,
|
|
52
|
+
);
|
|
53
|
+
} else {
|
|
54
|
+
groupedEvents.validate.forEach((event, index) => {
|
|
55
|
+
components.push(
|
|
56
|
+
<div key={`validate-${index}`}>{renderIndividualEvent(event)}</div>,
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// All other events (ungrouped)
|
|
62
|
+
groupedEvents.other.forEach((event, index) => {
|
|
63
|
+
components.push(
|
|
64
|
+
<div key={`other-${index}`}>{renderIndividualEvent(event)}</div>,
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
return components;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Groups events by their category */
|
|
72
|
+
function groupEventsByCategory(events: AutoBeEvent[]) {
|
|
73
|
+
const grouped = {
|
|
74
|
+
validate: [] as any[],
|
|
75
|
+
other: [] as AutoBeEvent[],
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
events.forEach((event) => {
|
|
79
|
+
switch (event.type) {
|
|
80
|
+
// Validation events
|
|
81
|
+
case "prismaValidate":
|
|
82
|
+
case "testValidate":
|
|
83
|
+
case "realizeValidate":
|
|
84
|
+
case "realizeAuthorizationValidate":
|
|
85
|
+
case "prismaInsufficient":
|
|
86
|
+
case "interfaceComplement":
|
|
87
|
+
case "interfaceOperationsReview":
|
|
88
|
+
grouped.validate.push(event);
|
|
89
|
+
break;
|
|
90
|
+
|
|
91
|
+
default:
|
|
92
|
+
grouped.other.push(event);
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
return grouped;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Renders individual event components based on event type */
|
|
101
|
+
function renderIndividualEvent(event: AutoBeEvent): ReactNode {
|
|
102
|
+
// This would import and use the actual event components
|
|
103
|
+
// For now, returning a placeholder
|
|
104
|
+
return (
|
|
105
|
+
<div
|
|
106
|
+
style={{
|
|
107
|
+
padding: "1rem",
|
|
108
|
+
border: "1px solid #e2e8f0",
|
|
109
|
+
borderRadius: "0.5rem",
|
|
110
|
+
marginBottom: "0.5rem",
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
<strong>{event.type}</strong> - {event.created_at}
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export default groupEvents;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { groupEvents, type IEventGrouperConfig } from "./eventGrouper";
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
export * from "./events";
|
|
2
2
|
export { default as AutoBeAssistantMessageMovie } from "./AutoBeAssistantMessageMovie";
|
|
3
3
|
export { default as AutoBeUserMessageMovie } from "./AutoBeUserMessageMovie";
|
|
4
|
+
export {
|
|
5
|
+
default as AutoBeFileUploadBox,
|
|
6
|
+
type AutoBeFileUploadBox as IAutoBeFileUploadBox,
|
|
7
|
+
} from "./AutoBeFileUploadBox";
|
|
4
8
|
export { default as ChatBubble } from "./common/ChatBubble";
|
|
9
|
+
export { AutoBeChatUploadSendButton } from "./AutoBeChatUploadSendButton";
|
|
5
10
|
export type {
|
|
6
11
|
IChatBubbleProps,
|
|
7
12
|
IContentRendererProps,
|
|
8
13
|
} from "./common/ChatBubble";
|
|
14
|
+
export { AutoBeVoiceRecoderButton } from "./AutoBeVoiceRecoderButton";
|