@motiadev/workbench 0.5.8-beta.116 → 0.5.8-beta.117-718551
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/src/components/header/header.js +2 -1
- package/dist/src/components/logs/logs-page.js +1 -1
- package/dist/src/components/observability/trace-item/trace-item.js +1 -1
- package/dist/src/components/states/states-page.js +1 -1
- package/dist/src/components/ui/tutorial-button.d.ts +2 -0
- package/dist/src/components/ui/tutorial-button.js +43 -0
- package/dist/src/publicComponents/base-node/base-node.js +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/tsconfig.node.tsbuildinfo +1 -1
- package/package.json +4 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useThemeStore } from '@/stores/use-theme-store';
|
|
3
3
|
import { ThemeToggle } from '../ui/theme-toggle';
|
|
4
|
+
import { TutorialButton } from '../ui/tutorial-button';
|
|
4
5
|
export const Header = () => {
|
|
5
6
|
const theme = useThemeStore((state) => state.theme);
|
|
6
|
-
return (_jsxs("header", { className: "min-h-16 px-4 gap-1 flex items-center bg-default text-default-foreground border-b", children: [_jsx("img", { src: `/motia-${theme}.png`, className: "h-5", id: "logo-icon", "data-testid": "logo-icon" }), _jsx("div", { className: "flex-1" }), _jsx(ThemeToggle, {})] }));
|
|
7
|
+
return (_jsxs("header", { className: "min-h-16 px-4 gap-1 flex items-center bg-default text-default-foreground border-b", children: [_jsx("img", { src: `/motia-${theme}.png`, className: "h-5", id: "logo-icon", "data-testid": "logo-icon" }), _jsx("div", { className: "flex-1" }), _jsx(TutorialButton, {}), _jsx(ThemeToggle, {})] }));
|
|
7
8
|
};
|
|
@@ -22,7 +22,7 @@ export const LogsPage = () => {
|
|
|
22
22
|
log.step.toLowerCase().includes(search.toLowerCase()));
|
|
23
23
|
});
|
|
24
24
|
}, [logs, search]);
|
|
25
|
-
return (_jsxs("div", { className: "h-full flex flex-row", children: [_jsxs("div", { className: "flex-1 overflow-y-auto overflow-x-auto", children: [_jsxs("div", { className: "flex p-2 border-b gap-4", children: [_jsxs("div", { className: "flex-1 relative", children: [_jsx(Input, { variant: "shade", value: search, onChange: (e) => setSearch(e.target.value), className: "pr-10 font-medium" }), _jsx(CircleX, { className: "cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground", onClick: () => setSearch('') })] }), _jsxs(Button, { variant: "outline", onClick: resetLogs, children: [_jsx(Trash, {}), " Clear"] })] }), _jsx(Table, { children: _jsx(TableBody, { className: "font-mono font-medium", children: filteredLogs.map((log, index) => (_jsxs(TableRow, { className: cn('font-mono font-semibold cursor-pointer border-0', {
|
|
25
|
+
return (_jsxs("div", { className: "h-full flex flex-row", "data-testid": "logs-container", children: [_jsxs("div", { className: "flex-1 overflow-y-auto overflow-x-auto", children: [_jsxs("div", { className: "flex p-2 border-b gap-4", "data-testid": "logs-search-container", children: [_jsxs("div", { className: "flex-1 relative", children: [_jsx(Input, { variant: "shade", value: search, onChange: (e) => setSearch(e.target.value), className: "pr-10 font-medium" }), _jsx(CircleX, { className: "cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground", onClick: () => setSearch('') })] }), _jsxs(Button, { variant: "outline", onClick: resetLogs, children: [_jsx(Trash, {}), " Clear"] })] }), _jsx(Table, { children: _jsx(TableBody, { className: "font-mono font-medium", children: filteredLogs.map((log, index) => (_jsxs(TableRow, { className: cn('font-mono font-semibold cursor-pointer border-0', {
|
|
26
26
|
'bg-muted-foreground/10 hover:bg-muted-foreground/20': selectedLogId === log.id,
|
|
27
27
|
'hover:bg-muted-foreground/10': selectedLogId !== log.id,
|
|
28
28
|
}), onClick: () => selectLogId(log.id), children: [_jsxs(TableCell, { "data-testid": `time-${index}`, className: "whitespace-nowrap flex items-center gap-2 text-muted-foreground", children: [_jsx(LogLevelDot, { level: log.level }), formatTimestamp(log.time)] }), _jsx(TableCell, { "data-testid": `trace-${log.traceId}`, className: "whitespace-nowrap cursor-pointer hover:text-primary text-muted-foreground", onClick: () => setSearch(log.traceId), children: log.traceId }), _jsx(TableCell, { "data-testid": `step-${index}`, "aria-label": log.step, className: "whitespace-nowrap", children: log.step }), _jsx(TableCell, { "data-testid": `msg-${index}`, "aria-label": log.msg, className: "whitespace-nowrap max-w-[500px] truncate w-full", children: log.msg })] }, index))) }) })] }), _jsx(LogDetail, { log: selectedLog, onClose: () => selectLogId(undefined) })] }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from '@/lib/utils';
|
|
3
3
|
export const TraceItem = ({ trace, group, groupEndTime, onExpand }) => {
|
|
4
|
-
return (_jsxs("div", { className: "flex hover:bg-muted-foreground/10 relative cursor-pointer", onClick: () => onExpand(trace.id), children: [_jsx("div", { className: "flex items-center min-w-[200px] max-w-[200px] h-[32px] max-h-[32px] py-4 px-2 text-sm font-semibold text-foreground truncate sticky left-0 bg-card z-9", children: trace.name }), _jsx("div", { className: "flex w-full flex-row items-center hover:bg-muted/50 rounded-md", children: _jsx("div", { className: "relative w-full h-[32px] flex items-center", children: _jsx("div", { className: cn('h-[24px] rounded-[4px] hover:opacity-80 transition-all duration-200', {
|
|
4
|
+
return (_jsxs("div", { className: "flex hover:bg-muted-foreground/10 relative cursor-pointer", onClick: () => onExpand(trace.id), children: [_jsx("div", { className: "flex items-center min-w-[200px] max-w-[200px] h-[32px] max-h-[32px] py-4 px-2 text-sm font-semibold text-foreground truncate sticky left-0 bg-card z-9", children: trace.name }), _jsx("div", { className: "flex w-full flex-row items-center hover:bg-muted/50 rounded-md", "data-testid": "trace-timeline-item", children: _jsx("div", { className: "relative w-full h-[32px] flex items-center", children: _jsx("div", { className: cn('h-[24px] rounded-[4px] hover:opacity-80 transition-all duration-200', {
|
|
5
5
|
'bg-[repeating-linear-gradient(140deg,#BEFE29,#BEFE29_8px,#ABE625_8px,#ABE625_16px)]': trace.status === 'running',
|
|
6
6
|
'bg-[repeating-linear-gradient(140deg,#2862FE,#2862FE_8px,#2358E5_8px,#2358E5_16px)]': trace.status === 'completed',
|
|
7
7
|
'bg-[repeating-linear-gradient(140deg,#EA2069,#EA2069_8px,#D41E60_8px,#D41E60_16px)]': trace.status === 'failed',
|
|
@@ -12,7 +12,7 @@ export const StatesPage = () => {
|
|
|
12
12
|
const selectedItem = useMemo(() => (selectedStateId ? items.find((item) => `${item.groupId}:${item.key}` === selectedStateId) : null), [items, selectedStateId]);
|
|
13
13
|
const handleRowClick = (item) => selectStateId(`${item.groupId}:${item.key}`);
|
|
14
14
|
const onClose = () => selectStateId(undefined);
|
|
15
|
-
return (_jsxs("div", { className: "flex flex-row gap-4 h-full", children: [selectedItem && _jsx(StateSidebar, { state: selectedItem, onClose: onClose }), _jsxs(Table, { children: [_jsx(TableHeader, { className: "sticky top-0 bg-background", children: _jsxs(TableRow, { children: [_jsx(TableHead, { className: "rounded-0", children: "Group ID" }), _jsx(TableHead, { children: "Key" }), _jsx(TableHead, { children: "Type" })] }) }), _jsx(TableBody, { children: items.map((item) => (_jsxs(TableRow, { "data-testid": `item-${item}`, onClick: () => handleRowClick(item), className: cn('font-mono font-semibold cursor-pointer border-0', selectedItem === item
|
|
15
|
+
return (_jsxs("div", { className: "flex flex-row gap-4 h-full", "data-testid": "states-container", children: [selectedItem && _jsx(StateSidebar, { state: selectedItem, onClose: onClose }), _jsxs(Table, { children: [_jsx(TableHeader, { className: "sticky top-0 bg-background", children: _jsxs(TableRow, { children: [_jsx(TableHead, { className: "rounded-0", children: "Group ID" }), _jsx(TableHead, { children: "Key" }), _jsx(TableHead, { children: "Type" })] }) }), _jsx(TableBody, { children: items.map((item) => (_jsxs(TableRow, { "data-testid": `item-${item}`, onClick: () => handleRowClick(item), className: cn('font-mono font-semibold cursor-pointer border-0', selectedItem === item
|
|
16
16
|
? 'bg-muted-foreground/10 hover:bg-muted-foreground/20'
|
|
17
17
|
: 'hover:bg-muted-foreground/10'), children: [_jsx(TableCell, { className: "hover:bg-transparent", children: item.groupId }), _jsx(TableCell, { className: "hover:bg-transparent", children: item.key }), _jsx(TableCell, { className: "hover:bg-transparent", children: item.type })] }, `${item.groupId}:${item.key}`))) })] })] }));
|
|
18
18
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { MotiaTutorial } from '@motiadev/tutorial';
|
|
3
|
+
import { Button } from '@motiadev/ui';
|
|
4
|
+
import { Book } from 'lucide-react';
|
|
5
|
+
import { useStreamItem } from '@motiadev/stream-client-react';
|
|
6
|
+
import { useCallback, useEffect } from 'react';
|
|
7
|
+
import { useFlowStore } from '@/stores/use-flow-store';
|
|
8
|
+
export const TutorialButton = () => {
|
|
9
|
+
const selectFlowId = useFlowStore((state) => state.selectFlowId);
|
|
10
|
+
const { data: flowConfig } = useStreamItem({
|
|
11
|
+
streamName: '__motia.flowsConfig',
|
|
12
|
+
groupId: 'default',
|
|
13
|
+
id: 'basic-tutorial',
|
|
14
|
+
});
|
|
15
|
+
const startTutorial = useCallback((resetState = false) => {
|
|
16
|
+
const tutorialStepIndex = new URLSearchParams(window.location.search).get('tutorialStepIndex');
|
|
17
|
+
const config = {
|
|
18
|
+
resetSkipState: resetState,
|
|
19
|
+
};
|
|
20
|
+
if (tutorialStepIndex && !resetState) {
|
|
21
|
+
config.initialStepIndex = Number(tutorialStepIndex);
|
|
22
|
+
}
|
|
23
|
+
selectFlowId('basic-tutorial');
|
|
24
|
+
MotiaTutorial.start(config);
|
|
25
|
+
if (resetState) {
|
|
26
|
+
const url = new URL(window.location.href);
|
|
27
|
+
url.searchParams.delete('tutorialStepIndex');
|
|
28
|
+
window.history.replaceState(null, '', url);
|
|
29
|
+
}
|
|
30
|
+
}, [selectFlowId]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (import.meta.env.VITE_MOTIA_TUTORIAL_DISABLED || !flowConfig) {
|
|
33
|
+
console.log('Tutorial disabled or flow not found');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
startTutorial();
|
|
37
|
+
return () => MotiaTutorial.close();
|
|
38
|
+
}, [flowConfig, startTutorial]);
|
|
39
|
+
if (import.meta.env.VITE_MOTIA_TUTORIAL_DISABLED) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return (_jsxs(Button, { "data-testid": "tutorial-trigger", variant: "accent", size: "sm", onClick: () => startTutorial(true), children: [_jsx(Book, { className: "h-4 w-4" }), _jsx("span", { children: "Tutorial" })] }));
|
|
43
|
+
};
|
|
@@ -22,7 +22,7 @@ export const BaseNode = ({ title, variant, children, disableSourceHandle, disabl
|
|
|
22
22
|
}, [data.id, isOpen, fetchContent]);
|
|
23
23
|
return (_jsxs("div", { className: cn('p-1 rounded-lg max-w-[350px]', {
|
|
24
24
|
'bg-muted-foreground/20': isOpen,
|
|
25
|
-
}), children: [_jsx("div", { className: "rounded-lg bg-background border-1 border-muted-foreground/30 border-solid", "data-testid": `node-${title?.toLowerCase().replace(/ /g, '-')}`, children: _jsxs("div", { className: "group relative", children: [_jsx(NodeHeader, { text: title, variant: variant, className: "border-b-2 border-muted-foreground/10", children: _jsx("div", { className: "flex justify-end", children: _jsx(Button, { variant: "ghost", className: "h-5 p-0.5", onClick: () => setIsOpen(true), children: _jsx(ScanSearch, { className: "w-4 h-4" }) }) }) }), subtitle && _jsx("div", { className: "py-4 px-6 text-sm text-muted-foreground", children: subtitle }), children && (_jsx("div", { className: "p-2", children: _jsx("div", { className: cn('space-y-3 p-4 text-sm text-muted-foreground', {
|
|
25
|
+
}), children: [_jsx("div", { className: "rounded-lg bg-background border-1 border-muted-foreground/30 border-solid", "data-testid": `node-${title?.toLowerCase().replace(/ /g, '-')}`, children: _jsxs("div", { className: "group relative", children: [_jsx(NodeHeader, { text: title, variant: variant, className: "border-b-2 border-muted-foreground/10", children: _jsx("div", { className: "flex justify-end", children: _jsx(Button, { "data-testid": `open-code-preview-button-${title?.toLowerCase()}`, variant: "ghost", className: "h-5 p-0.5", onClick: () => setIsOpen(true), children: _jsx(ScanSearch, { className: "w-4 h-4" }) }) }) }), subtitle && _jsx("div", { className: "py-4 px-6 text-sm text-muted-foreground", children: subtitle }), children && (_jsx("div", { className: "p-2", children: _jsx("div", { className: cn('space-y-3 p-4 text-sm text-muted-foreground', {
|
|
26
26
|
'bg-card': variant !== 'noop',
|
|
27
27
|
}), children: children }) })), !disableTargetHandle && (_jsx(BaseHandle, { type: "target", position: targetPosition, onTogglePosition: toggleTargetPosition })), !disableSourceHandle && (_jsx(BaseHandle, { type: "source", position: sourcePosition, onTogglePosition: toggleSourcePosition }))] }) }), content && (_jsx(NodeSidebar, { content: content, title: title, subtitle: subtitle, variant: variant, language: language, isOpen: isOpen, onClose: () => setIsOpen(false) }))] }));
|
|
28
28
|
};
|