machinaos 0.0.1
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/.env.template +71 -0
- package/LICENSE +21 -0
- package/README.md +87 -0
- package/bin/cli.js +159 -0
- package/client/.dockerignore +45 -0
- package/client/Dockerfile +68 -0
- package/client/eslint.config.js +29 -0
- package/client/index.html +13 -0
- package/client/nginx.conf +66 -0
- package/client/package.json +48 -0
- package/client/src/App.tsx +27 -0
- package/client/src/Dashboard.tsx +1173 -0
- package/client/src/ParameterPanel.tsx +301 -0
- package/client/src/components/AIAgentNode.tsx +321 -0
- package/client/src/components/APIKeyValidator.tsx +118 -0
- package/client/src/components/ClaudeChatModelNode.tsx +18 -0
- package/client/src/components/ConditionalEdge.tsx +189 -0
- package/client/src/components/CredentialsModal.tsx +306 -0
- package/client/src/components/EdgeConditionEditor.tsx +443 -0
- package/client/src/components/GeminiChatModelNode.tsx +18 -0
- package/client/src/components/GenericNode.tsx +357 -0
- package/client/src/components/LocationParameterPanel.tsx +154 -0
- package/client/src/components/ModelNode.tsx +286 -0
- package/client/src/components/OpenAIChatModelNode.tsx +18 -0
- package/client/src/components/OutputPanel.tsx +471 -0
- package/client/src/components/ParameterRenderer.tsx +1874 -0
- package/client/src/components/SkillEditorModal.tsx +417 -0
- package/client/src/components/SquareNode.tsx +797 -0
- package/client/src/components/StartNode.tsx +250 -0
- package/client/src/components/ToolkitNode.tsx +365 -0
- package/client/src/components/TriggerNode.tsx +463 -0
- package/client/src/components/auth/LoginPage.tsx +247 -0
- package/client/src/components/auth/ProtectedRoute.tsx +59 -0
- package/client/src/components/base/BaseChatModelNode.tsx +271 -0
- package/client/src/components/icons/AIProviderIcons.tsx +50 -0
- package/client/src/components/maps/GoogleMapsPicker.tsx +137 -0
- package/client/src/components/maps/MapsPreviewPanel.tsx +110 -0
- package/client/src/components/maps/index.ts +26 -0
- package/client/src/components/parameterPanel/InputSection.tsx +1094 -0
- package/client/src/components/parameterPanel/LocationPanelLayout.tsx +65 -0
- package/client/src/components/parameterPanel/MapsSection.tsx +92 -0
- package/client/src/components/parameterPanel/MiddleSection.tsx +571 -0
- package/client/src/components/parameterPanel/OutputSection.tsx +81 -0
- package/client/src/components/parameterPanel/ParameterPanelLayout.tsx +82 -0
- package/client/src/components/parameterPanel/ToolSchemaEditor.tsx +436 -0
- package/client/src/components/parameterPanel/index.ts +42 -0
- package/client/src/components/shared/DataPanel.tsx +142 -0
- package/client/src/components/shared/JSONTreeRenderer.tsx +106 -0
- package/client/src/components/ui/AIResultModal.tsx +204 -0
- package/client/src/components/ui/AndroidSettingsPanel.tsx +401 -0
- package/client/src/components/ui/CodeEditor.tsx +81 -0
- package/client/src/components/ui/CollapsibleSection.tsx +88 -0
- package/client/src/components/ui/ComponentItem.tsx +154 -0
- package/client/src/components/ui/ComponentPalette.tsx +321 -0
- package/client/src/components/ui/ConsolePanel.tsx +1074 -0
- package/client/src/components/ui/ErrorBoundary.tsx +196 -0
- package/client/src/components/ui/InputNodesPanel.tsx +204 -0
- package/client/src/components/ui/MapSelector.tsx +314 -0
- package/client/src/components/ui/Modal.tsx +149 -0
- package/client/src/components/ui/NodeContextMenu.tsx +192 -0
- package/client/src/components/ui/NodeOutputPanel.tsx +1150 -0
- package/client/src/components/ui/OutputDisplayPanel.tsx +381 -0
- package/client/src/components/ui/SettingsPanel.tsx +243 -0
- package/client/src/components/ui/TopToolbar.tsx +736 -0
- package/client/src/components/ui/WhatsAppSettingsPanel.tsx +345 -0
- package/client/src/components/ui/WorkflowSidebar.tsx +294 -0
- package/client/src/config/antdTheme.ts +186 -0
- package/client/src/config/api.ts +54 -0
- package/client/src/contexts/AuthContext.tsx +221 -0
- package/client/src/contexts/ThemeContext.tsx +42 -0
- package/client/src/contexts/WebSocketContext.tsx +1971 -0
- package/client/src/factories/baseChatModelFactory.ts +256 -0
- package/client/src/hooks/useAndroidOperations.ts +164 -0
- package/client/src/hooks/useApiKeyValidation.ts +107 -0
- package/client/src/hooks/useApiKeys.ts +238 -0
- package/client/src/hooks/useAppTheme.ts +17 -0
- package/client/src/hooks/useComponentPalette.ts +51 -0
- package/client/src/hooks/useCopyPaste.ts +155 -0
- package/client/src/hooks/useDragAndDrop.ts +124 -0
- package/client/src/hooks/useDragVariable.ts +88 -0
- package/client/src/hooks/useExecution.ts +313 -0
- package/client/src/hooks/useParameterPanel.ts +176 -0
- package/client/src/hooks/useReactFlowNodes.ts +189 -0
- package/client/src/hooks/useToolSchema.ts +209 -0
- package/client/src/hooks/useWhatsApp.ts +196 -0
- package/client/src/hooks/useWorkflowManagement.ts +46 -0
- package/client/src/index.css +315 -0
- package/client/src/main.tsx +19 -0
- package/client/src/nodeDefinitions/aiAgentNodes.ts +336 -0
- package/client/src/nodeDefinitions/aiModelNodes.ts +340 -0
- package/client/src/nodeDefinitions/androidDeviceNodes.ts +140 -0
- package/client/src/nodeDefinitions/androidServiceNodes.ts +383 -0
- package/client/src/nodeDefinitions/chatNodes.ts +135 -0
- package/client/src/nodeDefinitions/codeNodes.ts +54 -0
- package/client/src/nodeDefinitions/documentNodes.ts +379 -0
- package/client/src/nodeDefinitions/index.ts +15 -0
- package/client/src/nodeDefinitions/locationNodes.ts +463 -0
- package/client/src/nodeDefinitions/schedulerNodes.ts +220 -0
- package/client/src/nodeDefinitions/skillNodes.ts +211 -0
- package/client/src/nodeDefinitions/toolNodes.ts +198 -0
- package/client/src/nodeDefinitions/utilityNodes.ts +284 -0
- package/client/src/nodeDefinitions/whatsappNodes.ts +865 -0
- package/client/src/nodeDefinitions/workflowNodes.ts +41 -0
- package/client/src/nodeDefinitions.ts +104 -0
- package/client/src/schemas/workflowSchema.ts +264 -0
- package/client/src/services/dynamicParameterService.ts +96 -0
- package/client/src/services/execution/aiAgentExecutionService.ts +35 -0
- package/client/src/services/executionService.ts +232 -0
- package/client/src/services/workflowApi.ts +91 -0
- package/client/src/store/useAppStore.ts +582 -0
- package/client/src/styles/theme.ts +508 -0
- package/client/src/styles/zIndex.ts +17 -0
- package/client/src/types/ComponentTypes.ts +39 -0
- package/client/src/types/EdgeCondition.ts +231 -0
- package/client/src/types/INodeProperties.ts +288 -0
- package/client/src/types/NodeTypes.ts +28 -0
- package/client/src/utils/formatters.ts +33 -0
- package/client/src/utils/googleMapsLoader.ts +140 -0
- package/client/src/utils/locationUtils.ts +85 -0
- package/client/src/utils/nodeUtils.ts +31 -0
- package/client/src/utils/workflow.ts +30 -0
- package/client/src/utils/workflowExport.ts +120 -0
- package/client/src/vite-env.d.ts +12 -0
- package/client/tailwind.config.js +60 -0
- package/client/tsconfig.json +25 -0
- package/client/tsconfig.node.json +11 -0
- package/client/vite.config.js +35 -0
- package/docker-compose.prod.yml +107 -0
- package/docker-compose.yml +104 -0
- package/docs-MachinaOs/README.md +85 -0
- package/docs-MachinaOs/deployment/docker.mdx +228 -0
- package/docs-MachinaOs/deployment/production.mdx +345 -0
- package/docs-MachinaOs/docs.json +75 -0
- package/docs-MachinaOs/faq.mdx +309 -0
- package/docs-MachinaOs/favicon.svg +5 -0
- package/docs-MachinaOs/installation.mdx +160 -0
- package/docs-MachinaOs/introduction.mdx +114 -0
- package/docs-MachinaOs/logo/dark.svg +6 -0
- package/docs-MachinaOs/logo/light.svg +6 -0
- package/docs-MachinaOs/nodes/ai-agent.mdx +216 -0
- package/docs-MachinaOs/nodes/ai-models.mdx +240 -0
- package/docs-MachinaOs/nodes/android.mdx +411 -0
- package/docs-MachinaOs/nodes/overview.mdx +181 -0
- package/docs-MachinaOs/nodes/schedulers.mdx +316 -0
- package/docs-MachinaOs/nodes/webhooks.mdx +330 -0
- package/docs-MachinaOs/nodes/whatsapp.mdx +305 -0
- package/docs-MachinaOs/quickstart.mdx +119 -0
- package/docs-MachinaOs/tutorials/ai-agent-workflow.mdx +177 -0
- package/docs-MachinaOs/tutorials/android-automation.mdx +242 -0
- package/docs-MachinaOs/tutorials/first-workflow.mdx +134 -0
- package/docs-MachinaOs/tutorials/whatsapp-automation.mdx +185 -0
- package/nul +0 -0
- package/package.json +70 -0
- package/scripts/build.js +158 -0
- package/scripts/check-ports.ps1 +33 -0
- package/scripts/clean.js +40 -0
- package/scripts/docker.js +93 -0
- package/scripts/kill-port.ps1 +154 -0
- package/scripts/start.js +210 -0
- package/scripts/stop.js +325 -0
- package/server/.dockerignore +44 -0
- package/server/Dockerfile +45 -0
- package/server/constants.py +249 -0
- package/server/core/__init__.py +1 -0
- package/server/core/cache.py +461 -0
- package/server/core/config.py +128 -0
- package/server/core/container.py +99 -0
- package/server/core/database.py +1211 -0
- package/server/core/logging.py +314 -0
- package/server/main.py +289 -0
- package/server/middleware/__init__.py +5 -0
- package/server/middleware/auth.py +89 -0
- package/server/models/__init__.py +1 -0
- package/server/models/auth.py +52 -0
- package/server/models/cache.py +24 -0
- package/server/models/database.py +211 -0
- package/server/models/nodes.py +455 -0
- package/server/package.json +9 -0
- package/server/pyproject.toml +72 -0
- package/server/requirements.txt +83 -0
- package/server/routers/__init__.py +1 -0
- package/server/routers/android.py +294 -0
- package/server/routers/auth.py +203 -0
- package/server/routers/database.py +151 -0
- package/server/routers/maps.py +142 -0
- package/server/routers/nodejs_compat.py +289 -0
- package/server/routers/webhook.py +90 -0
- package/server/routers/websocket.py +2127 -0
- package/server/routers/whatsapp.py +761 -0
- package/server/routers/workflow.py +200 -0
- package/server/services/__init__.py +1 -0
- package/server/services/ai.py +2415 -0
- package/server/services/android/__init__.py +27 -0
- package/server/services/android/broadcaster.py +114 -0
- package/server/services/android/client.py +608 -0
- package/server/services/android/manager.py +78 -0
- package/server/services/android/protocol.py +165 -0
- package/server/services/android_service.py +588 -0
- package/server/services/auth.py +131 -0
- package/server/services/chat_client.py +160 -0
- package/server/services/deployment/__init__.py +12 -0
- package/server/services/deployment/manager.py +706 -0
- package/server/services/deployment/state.py +47 -0
- package/server/services/deployment/triggers.py +275 -0
- package/server/services/event_waiter.py +785 -0
- package/server/services/execution/__init__.py +77 -0
- package/server/services/execution/cache.py +769 -0
- package/server/services/execution/conditions.py +373 -0
- package/server/services/execution/dlq.py +132 -0
- package/server/services/execution/executor.py +1351 -0
- package/server/services/execution/models.py +531 -0
- package/server/services/execution/recovery.py +235 -0
- package/server/services/handlers/__init__.py +126 -0
- package/server/services/handlers/ai.py +355 -0
- package/server/services/handlers/android.py +260 -0
- package/server/services/handlers/code.py +278 -0
- package/server/services/handlers/document.py +598 -0
- package/server/services/handlers/http.py +193 -0
- package/server/services/handlers/polyglot.py +105 -0
- package/server/services/handlers/tools.py +845 -0
- package/server/services/handlers/triggers.py +107 -0
- package/server/services/handlers/utility.py +822 -0
- package/server/services/handlers/whatsapp.py +476 -0
- package/server/services/maps.py +289 -0
- package/server/services/memory_store.py +103 -0
- package/server/services/node_executor.py +375 -0
- package/server/services/parameter_resolver.py +218 -0
- package/server/services/polyglot_client.py +169 -0
- package/server/services/scheduler.py +155 -0
- package/server/services/skill_loader.py +417 -0
- package/server/services/status_broadcaster.py +826 -0
- package/server/services/temporal/__init__.py +23 -0
- package/server/services/temporal/activities.py +344 -0
- package/server/services/temporal/client.py +76 -0
- package/server/services/temporal/executor.py +147 -0
- package/server/services/temporal/worker.py +251 -0
- package/server/services/temporal/workflow.py +355 -0
- package/server/services/temporal/ws_client.py +236 -0
- package/server/services/text.py +111 -0
- package/server/services/user_auth.py +172 -0
- package/server/services/websocket_client.py +29 -0
- package/server/services/workflow.py +597 -0
- package/server/skills/android-skill/SKILL.md +82 -0
- package/server/skills/assistant-personality/SKILL.md +45 -0
- package/server/skills/code-skill/SKILL.md +140 -0
- package/server/skills/http-skill/SKILL.md +161 -0
- package/server/skills/maps-skill/SKILL.md +170 -0
- package/server/skills/memory-skill/SKILL.md +154 -0
- package/server/skills/scheduler-skill/SKILL.md +84 -0
- package/server/skills/whatsapp-skill/SKILL.md +283 -0
- package/server/uv.lock +2916 -0
- package/server/whatsapp-rpc/.dockerignore +30 -0
- package/server/whatsapp-rpc/Dockerfile +44 -0
- package/server/whatsapp-rpc/Dockerfile.web +17 -0
- package/server/whatsapp-rpc/README.md +139 -0
- package/server/whatsapp-rpc/cli.js +95 -0
- package/server/whatsapp-rpc/configs/config.yaml +7 -0
- package/server/whatsapp-rpc/docker-compose.yml +35 -0
- package/server/whatsapp-rpc/docs/API.md +410 -0
- package/server/whatsapp-rpc/go.mod +67 -0
- package/server/whatsapp-rpc/go.sum +203 -0
- package/server/whatsapp-rpc/package.json +30 -0
- package/server/whatsapp-rpc/schema.json +1294 -0
- package/server/whatsapp-rpc/scripts/clean.cjs +66 -0
- package/server/whatsapp-rpc/scripts/cli.js +162 -0
- package/server/whatsapp-rpc/src/go/cmd/server/main.go +91 -0
- package/server/whatsapp-rpc/src/go/config/config.go +49 -0
- package/server/whatsapp-rpc/src/go/rpc/rpc.go +446 -0
- package/server/whatsapp-rpc/src/go/rpc/server.go +112 -0
- package/server/whatsapp-rpc/src/go/whatsapp/history.go +166 -0
- package/server/whatsapp-rpc/src/go/whatsapp/messages.go +390 -0
- package/server/whatsapp-rpc/src/go/whatsapp/service.go +2130 -0
- package/server/whatsapp-rpc/src/go/whatsapp/types.go +261 -0
- package/server/whatsapp-rpc/src/python/pyproject.toml +15 -0
- package/server/whatsapp-rpc/src/python/whatsapp_rpc/__init__.py +4 -0
- package/server/whatsapp-rpc/src/python/whatsapp_rpc/client.py +427 -0
- package/server/whatsapp-rpc/web/app.py +609 -0
- package/server/whatsapp-rpc/web/requirements.txt +6 -0
- package/server/whatsapp-rpc/web/rpc_client.py +427 -0
- package/server/whatsapp-rpc/web/static/openapi.yaml +59 -0
- package/server/whatsapp-rpc/web/templates/base.html +150 -0
- package/server/whatsapp-rpc/web/templates/contacts.html +240 -0
- package/server/whatsapp-rpc/web/templates/dashboard.html +320 -0
- package/server/whatsapp-rpc/web/templates/groups.html +328 -0
- package/server/whatsapp-rpc/web/templates/messages.html +465 -0
- package/server/whatsapp-rpc/web/templates/messaging.html +681 -0
- package/server/whatsapp-rpc/web/templates/send.html +259 -0
- package/server/whatsapp-rpc/web/templates/settings.html +459 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { useWhatsApp } from '../../hooks/useWhatsApp';
|
|
3
|
+
import { useWhatsAppStatus } from '../../contexts/WebSocketContext';
|
|
4
|
+
import { useAppTheme } from '../../hooks/useAppTheme';
|
|
5
|
+
|
|
6
|
+
interface WhatsAppSettingsPanelProps {
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const WhatsAppSettingsPanel: React.FC<WhatsAppSettingsPanelProps> = ({ isOpen, onClose }) => {
|
|
12
|
+
const theme = useAppTheme();
|
|
13
|
+
const { getStatus, startConnection, restartConnection } = useWhatsApp();
|
|
14
|
+
const whatsappStatus = useWhatsAppStatus();
|
|
15
|
+
|
|
16
|
+
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
|
17
|
+
const [actionLoading, setActionLoading] = useState<'restart' | 'start' | 'refresh' | null>(null);
|
|
18
|
+
|
|
19
|
+
// Derive status from reactive WebSocket state
|
|
20
|
+
const status = whatsappStatus.connected ? 'connected' : 'disconnected';
|
|
21
|
+
|
|
22
|
+
// QR data comes from WebSocket status when pairing
|
|
23
|
+
const qrData = whatsappStatus.qr
|
|
24
|
+
? { qr: whatsappStatus.qr, connected: false }
|
|
25
|
+
: whatsappStatus.connected
|
|
26
|
+
? { connected: true }
|
|
27
|
+
: { connected: false, message: whatsappStatus.running ? 'Waiting for QR code...' : 'Service not running' };
|
|
28
|
+
|
|
29
|
+
// Fetch initial status when panel opens
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (isOpen) {
|
|
32
|
+
setErrorMessage(null);
|
|
33
|
+
getStatus().catch(err => console.error('[WhatsAppSettings] Initial status failed:', err));
|
|
34
|
+
}
|
|
35
|
+
}, [isOpen, getStatus]);
|
|
36
|
+
|
|
37
|
+
const handleRefreshStatus = async () => {
|
|
38
|
+
console.log('[WhatsAppSettings] Refresh status clicked');
|
|
39
|
+
setActionLoading('refresh');
|
|
40
|
+
setErrorMessage(null);
|
|
41
|
+
try {
|
|
42
|
+
await getStatus();
|
|
43
|
+
console.log('[WhatsAppSettings] Refresh status complete');
|
|
44
|
+
} catch (error: any) {
|
|
45
|
+
console.error('[WhatsAppSettings] Refresh status failed:', error);
|
|
46
|
+
setErrorMessage(error.message || 'Failed to refresh status');
|
|
47
|
+
} finally {
|
|
48
|
+
setActionLoading(null);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const handleRestart = async () => {
|
|
53
|
+
setActionLoading('restart');
|
|
54
|
+
setErrorMessage(null);
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
const result = await restartConnection();
|
|
58
|
+
if (!result.success && result.message) {
|
|
59
|
+
setErrorMessage(result.message);
|
|
60
|
+
}
|
|
61
|
+
} catch (error: any) {
|
|
62
|
+
setErrorMessage(error.message || 'Failed to restart service');
|
|
63
|
+
} finally {
|
|
64
|
+
setActionLoading(null);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const handleStart = async () => {
|
|
69
|
+
setActionLoading('start');
|
|
70
|
+
setErrorMessage(null);
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const result = await startConnection();
|
|
74
|
+
if (!result.success && result.message) {
|
|
75
|
+
setErrorMessage(result.message);
|
|
76
|
+
}
|
|
77
|
+
} catch (error: any) {
|
|
78
|
+
setErrorMessage(error.message || 'Failed to start service');
|
|
79
|
+
} finally {
|
|
80
|
+
setActionLoading(null);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
if (!isOpen) return null;
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<div
|
|
88
|
+
style={{
|
|
89
|
+
position: 'fixed',
|
|
90
|
+
top: 0,
|
|
91
|
+
left: 0,
|
|
92
|
+
right: 0,
|
|
93
|
+
bottom: 0,
|
|
94
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
95
|
+
display: 'flex',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
justifyContent: 'center',
|
|
98
|
+
zIndex: 1000,
|
|
99
|
+
}}
|
|
100
|
+
onClick={onClose}
|
|
101
|
+
>
|
|
102
|
+
<div
|
|
103
|
+
style={{
|
|
104
|
+
background: theme.colors.background,
|
|
105
|
+
borderRadius: '12px',
|
|
106
|
+
padding: '24px',
|
|
107
|
+
boxShadow: '0 10px 40px rgba(0, 0, 0, 0.4)',
|
|
108
|
+
minWidth: '400px',
|
|
109
|
+
maxWidth: '500px',
|
|
110
|
+
border: `1px solid ${theme.colors.border}`,
|
|
111
|
+
}}
|
|
112
|
+
onClick={(e) => e.stopPropagation()}
|
|
113
|
+
>
|
|
114
|
+
{/* Header */}
|
|
115
|
+
<div
|
|
116
|
+
style={{
|
|
117
|
+
marginBottom: '20px',
|
|
118
|
+
paddingBottom: '16px',
|
|
119
|
+
borderBottom: `2px solid ${theme.colors.border}`,
|
|
120
|
+
display: 'flex',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
justifyContent: 'space-between',
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
|
|
126
|
+
<span style={{ fontSize: '24px' }}>
|
|
127
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="#25D366">
|
|
128
|
+
<path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"/>
|
|
129
|
+
</svg>
|
|
130
|
+
</span>
|
|
131
|
+
<span style={{ fontWeight: '600', color: theme.colors.text, fontSize: '18px' }}>
|
|
132
|
+
WhatsApp Settings
|
|
133
|
+
</span>
|
|
134
|
+
</div>
|
|
135
|
+
<button
|
|
136
|
+
onClick={onClose}
|
|
137
|
+
style={{
|
|
138
|
+
background: 'none',
|
|
139
|
+
border: 'none',
|
|
140
|
+
fontSize: '20px',
|
|
141
|
+
cursor: 'pointer',
|
|
142
|
+
color: theme.colors.textSecondary,
|
|
143
|
+
padding: '4px 8px',
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
x
|
|
147
|
+
</button>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
{/* Connection Details */}
|
|
151
|
+
<div style={{
|
|
152
|
+
background: theme.colors.backgroundAlt,
|
|
153
|
+
padding: '16px',
|
|
154
|
+
borderRadius: '8px',
|
|
155
|
+
fontSize: '13px',
|
|
156
|
+
marginBottom: '16px'
|
|
157
|
+
}}>
|
|
158
|
+
<div style={{ fontWeight: '600', marginBottom: '12px', color: theme.colors.text, fontSize: '14px' }}>
|
|
159
|
+
Connection Status
|
|
160
|
+
</div>
|
|
161
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
|
|
162
|
+
{whatsappStatus.device_id && (
|
|
163
|
+
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
164
|
+
<span style={{ color: theme.colors.textSecondary }}>Device ID:</span>
|
|
165
|
+
<span style={{ color: theme.colors.text, fontWeight: '500', fontSize: '11px', maxWidth: '200px', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
|
166
|
+
{whatsappStatus.device_id}
|
|
167
|
+
</span>
|
|
168
|
+
</div>
|
|
169
|
+
)}
|
|
170
|
+
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
171
|
+
<span style={{ color: theme.colors.textSecondary }}>Status:</span>
|
|
172
|
+
<span style={{ color: status === 'connected' ? '#25D366' : '#ef4444', fontWeight: '500' }}>
|
|
173
|
+
{status === 'connected' ? 'Connected' : 'Disconnected'}
|
|
174
|
+
</span>
|
|
175
|
+
</div>
|
|
176
|
+
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
177
|
+
<span style={{ color: theme.colors.textSecondary }}>Session:</span>
|
|
178
|
+
<span style={{ color: whatsappStatus.has_session ? '#25D366' : '#ef4444', fontWeight: '500' }}>
|
|
179
|
+
{whatsappStatus.has_session ? 'Active' : 'Inactive'}
|
|
180
|
+
</span>
|
|
181
|
+
</div>
|
|
182
|
+
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
183
|
+
<span style={{ color: theme.colors.textSecondary }}>Service:</span>
|
|
184
|
+
<span style={{ color: whatsappStatus.running ? '#25D366' : '#ef4444', fontWeight: '500' }}>
|
|
185
|
+
{whatsappStatus.running ? 'Running' : 'Stopped'}
|
|
186
|
+
</span>
|
|
187
|
+
</div>
|
|
188
|
+
{whatsappStatus.pairing !== undefined && (
|
|
189
|
+
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
190
|
+
<span style={{ color: theme.colors.textSecondary }}>Pairing:</span>
|
|
191
|
+
<span style={{ color: whatsappStatus.pairing ? '#f59e0b' : theme.colors.textSecondary, fontWeight: '500' }}>
|
|
192
|
+
{whatsappStatus.pairing ? 'In Progress' : 'Complete'}
|
|
193
|
+
</span>
|
|
194
|
+
</div>
|
|
195
|
+
)}
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
{/* QR Code Section */}
|
|
200
|
+
<div style={{
|
|
201
|
+
background: theme.colors.backgroundAlt,
|
|
202
|
+
padding: '16px',
|
|
203
|
+
borderRadius: '8px',
|
|
204
|
+
marginBottom: '16px'
|
|
205
|
+
}}>
|
|
206
|
+
<div style={{ fontWeight: '600', marginBottom: '12px', color: theme.colors.text, fontSize: '14px', textAlign: 'center' }}>
|
|
207
|
+
QR Code Authentication
|
|
208
|
+
</div>
|
|
209
|
+
<div style={{
|
|
210
|
+
background: theme.colors.background,
|
|
211
|
+
padding: '20px',
|
|
212
|
+
borderRadius: '8px',
|
|
213
|
+
textAlign: 'center',
|
|
214
|
+
minHeight: '220px',
|
|
215
|
+
display: 'flex',
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
justifyContent: 'center',
|
|
218
|
+
flexDirection: 'column',
|
|
219
|
+
gap: '12px'
|
|
220
|
+
}}>
|
|
221
|
+
{qrData.connected ? (
|
|
222
|
+
<div style={{ color: '#25D366', fontSize: '14px' }}>
|
|
223
|
+
<div style={{ fontSize: '56px', marginBottom: '12px' }}>OK</div>
|
|
224
|
+
<div style={{ fontWeight: '600' }}>Already Connected!</div>
|
|
225
|
+
<div style={{ color: theme.colors.textSecondary, fontSize: '12px', marginTop: '4px' }}>No QR code needed</div>
|
|
226
|
+
</div>
|
|
227
|
+
) : qrData.qr ? (
|
|
228
|
+
<div style={{ width: '100%' }}>
|
|
229
|
+
<img
|
|
230
|
+
src={`data:image/png;base64,${qrData.qr}`}
|
|
231
|
+
alt="WhatsApp QR Code"
|
|
232
|
+
style={{ maxWidth: '200px', margin: '0 auto', display: 'block' }}
|
|
233
|
+
/>
|
|
234
|
+
<div style={{ color: theme.colors.textSecondary, fontSize: '12px', marginTop: '12px' }}>
|
|
235
|
+
Scan with WhatsApp mobile app
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
) : (
|
|
239
|
+
<div style={{ color: theme.colors.textSecondary, fontSize: '14px' }}>
|
|
240
|
+
<div style={{ fontSize: '40px', marginBottom: '12px' }}>[]</div>
|
|
241
|
+
<div>{qrData.message || 'QR code not available'}</div>
|
|
242
|
+
<a
|
|
243
|
+
href="http://localhost:5000"
|
|
244
|
+
target="_blank"
|
|
245
|
+
rel="noopener noreferrer"
|
|
246
|
+
style={{
|
|
247
|
+
color: '#3b82f6',
|
|
248
|
+
textDecoration: 'underline',
|
|
249
|
+
fontSize: '12px',
|
|
250
|
+
marginTop: '8px',
|
|
251
|
+
display: 'block'
|
|
252
|
+
}}
|
|
253
|
+
>
|
|
254
|
+
Open WhatsApp Dashboard
|
|
255
|
+
</a>
|
|
256
|
+
</div>
|
|
257
|
+
)}
|
|
258
|
+
</div>
|
|
259
|
+
</div>
|
|
260
|
+
|
|
261
|
+
{/* Error Message */}
|
|
262
|
+
{errorMessage && (
|
|
263
|
+
<div style={{
|
|
264
|
+
background: '#fef2f2',
|
|
265
|
+
border: '1px solid #fecaca',
|
|
266
|
+
padding: '12px',
|
|
267
|
+
borderRadius: '8px',
|
|
268
|
+
fontSize: '12px',
|
|
269
|
+
color: '#991b1b',
|
|
270
|
+
lineHeight: '1.5',
|
|
271
|
+
marginBottom: '16px'
|
|
272
|
+
}}>
|
|
273
|
+
<div style={{ fontWeight: '600', marginBottom: '4px' }}>Error:</div>
|
|
274
|
+
<div>{errorMessage}</div>
|
|
275
|
+
</div>
|
|
276
|
+
)}
|
|
277
|
+
|
|
278
|
+
{/* Action Buttons */}
|
|
279
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
|
|
280
|
+
<div style={{ display: 'flex', gap: '10px' }}>
|
|
281
|
+
<button
|
|
282
|
+
onClick={handleStart}
|
|
283
|
+
disabled={actionLoading !== null}
|
|
284
|
+
style={{
|
|
285
|
+
flex: 1,
|
|
286
|
+
padding: '12px 16px',
|
|
287
|
+
background: actionLoading === 'start' ? '#9ca3af' : '#16a34a',
|
|
288
|
+
color: 'white',
|
|
289
|
+
border: 'none',
|
|
290
|
+
borderRadius: '8px',
|
|
291
|
+
cursor: actionLoading !== null ? 'wait' : 'pointer',
|
|
292
|
+
fontSize: '14px',
|
|
293
|
+
fontWeight: '500',
|
|
294
|
+
transition: 'background 0.2s ease',
|
|
295
|
+
}}
|
|
296
|
+
>
|
|
297
|
+
{actionLoading === 'start' ? 'Starting...' : 'Start'}
|
|
298
|
+
</button>
|
|
299
|
+
|
|
300
|
+
<button
|
|
301
|
+
onClick={handleRestart}
|
|
302
|
+
disabled={actionLoading !== null}
|
|
303
|
+
style={{
|
|
304
|
+
flex: 1,
|
|
305
|
+
padding: '12px 16px',
|
|
306
|
+
background: actionLoading === 'restart' ? '#9ca3af' : '#f59e0b',
|
|
307
|
+
color: 'white',
|
|
308
|
+
border: 'none',
|
|
309
|
+
borderRadius: '8px',
|
|
310
|
+
cursor: actionLoading !== null ? 'wait' : 'pointer',
|
|
311
|
+
fontSize: '14px',
|
|
312
|
+
fontWeight: '500',
|
|
313
|
+
transition: 'background 0.2s ease',
|
|
314
|
+
}}
|
|
315
|
+
>
|
|
316
|
+
{actionLoading === 'restart' ? 'Restarting...' : 'Restart'}
|
|
317
|
+
</button>
|
|
318
|
+
</div>
|
|
319
|
+
|
|
320
|
+
<button
|
|
321
|
+
onClick={handleRefreshStatus}
|
|
322
|
+
disabled={actionLoading !== null}
|
|
323
|
+
style={{
|
|
324
|
+
width: '100%',
|
|
325
|
+
padding: '12px 16px',
|
|
326
|
+
background: actionLoading === 'refresh' ? '#60a5fa' : actionLoading !== null ? '#9ca3af' : '#3b82f6',
|
|
327
|
+
color: 'white',
|
|
328
|
+
border: 'none',
|
|
329
|
+
borderRadius: '8px',
|
|
330
|
+
cursor: actionLoading !== null ? 'wait' : 'pointer',
|
|
331
|
+
fontSize: '14px',
|
|
332
|
+
fontWeight: '500',
|
|
333
|
+
transition: 'background 0.2s ease',
|
|
334
|
+
pointerEvents: 'auto',
|
|
335
|
+
}}
|
|
336
|
+
>
|
|
337
|
+
{actionLoading === 'refresh' ? 'Refreshing...' : 'Refresh Status'}
|
|
338
|
+
</button>
|
|
339
|
+
</div>
|
|
340
|
+
</div>
|
|
341
|
+
</div>
|
|
342
|
+
);
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
export default WhatsAppSettingsPanel;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useAppTheme } from '../../hooks/useAppTheme';
|
|
3
|
+
|
|
4
|
+
export interface SavedWorkflow {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
lastModified: Date;
|
|
9
|
+
nodeCount: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface WorkflowSidebarProps {
|
|
13
|
+
workflows: SavedWorkflow[];
|
|
14
|
+
currentWorkflowId?: string;
|
|
15
|
+
onSelectWorkflow: (workflow: SavedWorkflow) => void;
|
|
16
|
+
onDeleteWorkflow?: (id: string) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const WorkflowSidebar: React.FC<WorkflowSidebarProps> = ({
|
|
20
|
+
workflows,
|
|
21
|
+
currentWorkflowId,
|
|
22
|
+
onSelectWorkflow,
|
|
23
|
+
onDeleteWorkflow,
|
|
24
|
+
}) => {
|
|
25
|
+
const theme = useAppTheme();
|
|
26
|
+
const [hoveredId, setHoveredId] = useState<string | null>(null);
|
|
27
|
+
|
|
28
|
+
const formatDate = (date: Date) => {
|
|
29
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
30
|
+
month: 'short',
|
|
31
|
+
day: 'numeric',
|
|
32
|
+
hour: '2-digit',
|
|
33
|
+
minute: '2-digit',
|
|
34
|
+
}).format(date);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Debug: Force component update when workflows change
|
|
38
|
+
const [, forceUpdate] = React.useReducer(x => x + 1, 0);
|
|
39
|
+
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
forceUpdate();
|
|
42
|
+
}, [workflows]);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div
|
|
46
|
+
style={{
|
|
47
|
+
width: theme.layout.workflowSidebarWidth,
|
|
48
|
+
height: '100%',
|
|
49
|
+
backgroundColor: theme.colors.backgroundPanel,
|
|
50
|
+
borderRight: `1px solid ${theme.colors.border}`,
|
|
51
|
+
display: 'flex',
|
|
52
|
+
flexDirection: 'column',
|
|
53
|
+
overflow: 'hidden',
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{/* Header */}
|
|
57
|
+
<div
|
|
58
|
+
style={{
|
|
59
|
+
padding: theme.spacing.xl,
|
|
60
|
+
borderBottom: `1px solid ${theme.colors.border}`,
|
|
61
|
+
background: `linear-gradient(135deg, ${theme.colors.background} 0%, ${theme.colors.backgroundAlt} 100%)`,
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<div
|
|
65
|
+
style={{
|
|
66
|
+
display: 'flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
gap: theme.spacing.sm,
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<div
|
|
72
|
+
style={{
|
|
73
|
+
width: theme.spacing.xxl,
|
|
74
|
+
height: theme.spacing.xxl,
|
|
75
|
+
borderRadius: theme.borderRadius.md,
|
|
76
|
+
background: `linear-gradient(135deg, ${theme.accent.blue}30 0%, ${theme.accent.cyan}30 100%)`,
|
|
77
|
+
display: 'flex',
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
justifyContent: 'center',
|
|
80
|
+
fontSize: theme.fontSize.lg,
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke={theme.accent.cyan} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
84
|
+
<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
|
|
85
|
+
</svg>
|
|
86
|
+
</div>
|
|
87
|
+
<div>
|
|
88
|
+
<h3
|
|
89
|
+
style={{
|
|
90
|
+
margin: 0,
|
|
91
|
+
fontSize: theme.fontSize.lg,
|
|
92
|
+
fontWeight: theme.fontWeight.semibold,
|
|
93
|
+
color: theme.colors.text,
|
|
94
|
+
fontFamily: 'system-ui, sans-serif',
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
Workflows
|
|
98
|
+
</h3>
|
|
99
|
+
<p
|
|
100
|
+
style={{
|
|
101
|
+
margin: 0,
|
|
102
|
+
fontSize: theme.fontSize.xs,
|
|
103
|
+
color: theme.colors.textSecondary,
|
|
104
|
+
fontFamily: 'system-ui, sans-serif',
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
{workflows.length} saved
|
|
108
|
+
</p>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
{/* Workflows List */}
|
|
114
|
+
<div
|
|
115
|
+
style={{
|
|
116
|
+
flex: 1,
|
|
117
|
+
overflowY: 'auto',
|
|
118
|
+
padding: theme.spacing.md,
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
{workflows.length === 0 ? (
|
|
122
|
+
<div
|
|
123
|
+
style={{
|
|
124
|
+
textAlign: 'center',
|
|
125
|
+
padding: `${theme.spacing.xxl} ${theme.spacing.lg}`,
|
|
126
|
+
color: theme.colors.textSecondary,
|
|
127
|
+
fontSize: theme.fontSize.sm,
|
|
128
|
+
fontFamily: 'system-ui, sans-serif',
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
<div
|
|
132
|
+
style={{
|
|
133
|
+
width: '64px',
|
|
134
|
+
height: '64px',
|
|
135
|
+
margin: `0 auto ${theme.spacing.lg}`,
|
|
136
|
+
borderRadius: theme.borderRadius.lg,
|
|
137
|
+
background: `linear-gradient(135deg, ${theme.colors.backgroundAlt} 0%, ${theme.colors.background} 100%)`,
|
|
138
|
+
border: `2px dashed ${theme.colors.border}`,
|
|
139
|
+
display: 'flex',
|
|
140
|
+
alignItems: 'center',
|
|
141
|
+
justifyContent: 'center',
|
|
142
|
+
}}
|
|
143
|
+
>
|
|
144
|
+
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke={theme.colors.textMuted} strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
|
|
145
|
+
<circle cx="12" cy="12" r="10"/>
|
|
146
|
+
<line x1="12" y1="8" x2="12" y2="16"/>
|
|
147
|
+
<line x1="8" y1="12" x2="16" y2="12"/>
|
|
148
|
+
</svg>
|
|
149
|
+
</div>
|
|
150
|
+
<p style={{ margin: 0, fontWeight: theme.fontWeight.medium, color: theme.colors.text }}>No workflows yet</p>
|
|
151
|
+
<p style={{ margin: `${theme.spacing.sm} 0 0`, fontSize: theme.fontSize.xs, lineHeight: '1.5' }}>
|
|
152
|
+
Create your first workflow<br />to get started
|
|
153
|
+
</p>
|
|
154
|
+
</div>
|
|
155
|
+
) : (
|
|
156
|
+
workflows.map((workflow) => {
|
|
157
|
+
const isSelected = currentWorkflowId === workflow.id;
|
|
158
|
+
const isHovered = hoveredId === workflow.id;
|
|
159
|
+
const accentColor = theme.accent.cyan;
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<div
|
|
163
|
+
key={workflow.id}
|
|
164
|
+
style={{
|
|
165
|
+
position: 'relative',
|
|
166
|
+
padding: theme.spacing.lg,
|
|
167
|
+
marginBottom: theme.spacing.sm,
|
|
168
|
+
backgroundColor: isSelected
|
|
169
|
+
? `${accentColor}20`
|
|
170
|
+
: isHovered
|
|
171
|
+
? theme.colors.backgroundAlt
|
|
172
|
+
: theme.colors.background,
|
|
173
|
+
border: `1px solid ${isSelected ? `${accentColor}50` : theme.colors.border}`,
|
|
174
|
+
borderLeft: isSelected ? `3px solid ${accentColor}` : `1px solid ${theme.colors.border}`,
|
|
175
|
+
borderRadius: theme.borderRadius.md,
|
|
176
|
+
cursor: 'pointer',
|
|
177
|
+
transition: `all ${theme.transitions.fast}`,
|
|
178
|
+
boxShadow: isSelected
|
|
179
|
+
? `0 2px 8px ${accentColor}25`
|
|
180
|
+
: `0 1px 3px ${theme.colors.shadowLight}`,
|
|
181
|
+
}}
|
|
182
|
+
onClick={() => {
|
|
183
|
+
onSelectWorkflow(workflow);
|
|
184
|
+
}}
|
|
185
|
+
onMouseEnter={() => setHoveredId(workflow.id)}
|
|
186
|
+
onMouseLeave={() => setHoveredId(null)}
|
|
187
|
+
>
|
|
188
|
+
<div
|
|
189
|
+
style={{
|
|
190
|
+
display: 'flex',
|
|
191
|
+
alignItems: 'center',
|
|
192
|
+
gap: theme.spacing.sm,
|
|
193
|
+
marginBottom: theme.spacing.xs,
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
<div
|
|
197
|
+
style={{
|
|
198
|
+
width: '24px',
|
|
199
|
+
height: '24px',
|
|
200
|
+
borderRadius: theme.borderRadius.sm,
|
|
201
|
+
background: isSelected
|
|
202
|
+
? `linear-gradient(135deg, ${accentColor}40 0%, ${accentColor}20 100%)`
|
|
203
|
+
: `linear-gradient(135deg, ${theme.colors.backgroundAlt} 0%, ${theme.colors.background} 100%)`,
|
|
204
|
+
border: `1px solid ${isSelected ? `${accentColor}50` : theme.colors.border}`,
|
|
205
|
+
display: 'flex',
|
|
206
|
+
alignItems: 'center',
|
|
207
|
+
justifyContent: 'center',
|
|
208
|
+
flexShrink: 0,
|
|
209
|
+
transition: `all ${theme.transitions.fast}`,
|
|
210
|
+
}}
|
|
211
|
+
>
|
|
212
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke={isSelected ? accentColor : theme.colors.textSecondary} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
213
|
+
<polyline points="16 18 22 12 16 6"/>
|
|
214
|
+
<polyline points="8 6 2 12 8 18"/>
|
|
215
|
+
</svg>
|
|
216
|
+
</div>
|
|
217
|
+
<h4
|
|
218
|
+
style={{
|
|
219
|
+
margin: 0,
|
|
220
|
+
fontSize: theme.fontSize.base,
|
|
221
|
+
fontWeight: theme.fontWeight.medium,
|
|
222
|
+
color: isSelected ? accentColor : theme.colors.text,
|
|
223
|
+
fontFamily: 'system-ui, sans-serif',
|
|
224
|
+
overflow: 'hidden',
|
|
225
|
+
textOverflow: 'ellipsis',
|
|
226
|
+
whiteSpace: 'nowrap',
|
|
227
|
+
flex: 1,
|
|
228
|
+
}}
|
|
229
|
+
>
|
|
230
|
+
{workflow.name}
|
|
231
|
+
</h4>
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<div
|
|
235
|
+
style={{
|
|
236
|
+
display: 'flex',
|
|
237
|
+
justifyContent: 'space-between',
|
|
238
|
+
alignItems: 'center',
|
|
239
|
+
fontSize: theme.fontSize.xs,
|
|
240
|
+
color: isSelected ? theme.colors.text : theme.colors.textSecondary,
|
|
241
|
+
fontFamily: 'system-ui, sans-serif',
|
|
242
|
+
}}
|
|
243
|
+
>
|
|
244
|
+
<span>{workflow.nodeCount} nodes</span>
|
|
245
|
+
<span>{formatDate(workflow.lastModified)}</span>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
{/* Delete button - show on hover */}
|
|
249
|
+
{isHovered && onDeleteWorkflow && (
|
|
250
|
+
<button
|
|
251
|
+
onClick={(e) => {
|
|
252
|
+
e.stopPropagation();
|
|
253
|
+
if (window.confirm(`Delete "${workflow.name}"?`)) {
|
|
254
|
+
onDeleteWorkflow(workflow.id);
|
|
255
|
+
}
|
|
256
|
+
}}
|
|
257
|
+
style={{
|
|
258
|
+
position: 'absolute',
|
|
259
|
+
top: theme.spacing.sm,
|
|
260
|
+
right: theme.spacing.sm,
|
|
261
|
+
width: '24px',
|
|
262
|
+
height: '24px',
|
|
263
|
+
borderRadius: '4px',
|
|
264
|
+
border: 'none',
|
|
265
|
+
backgroundColor: theme.dracula.red + '20',
|
|
266
|
+
color: theme.dracula.red,
|
|
267
|
+
cursor: 'pointer',
|
|
268
|
+
display: 'flex',
|
|
269
|
+
alignItems: 'center',
|
|
270
|
+
justifyContent: 'center',
|
|
271
|
+
fontSize: '14px',
|
|
272
|
+
transition: `all ${theme.transitions.fast}`,
|
|
273
|
+
}}
|
|
274
|
+
onMouseEnter={(e) => {
|
|
275
|
+
e.currentTarget.style.backgroundColor = theme.dracula.red + '40';
|
|
276
|
+
}}
|
|
277
|
+
onMouseLeave={(e) => {
|
|
278
|
+
e.currentTarget.style.backgroundColor = theme.dracula.red + '20';
|
|
279
|
+
}}
|
|
280
|
+
title="Delete workflow"
|
|
281
|
+
>
|
|
282
|
+
x
|
|
283
|
+
</button>
|
|
284
|
+
)}
|
|
285
|
+
</div>
|
|
286
|
+
);
|
|
287
|
+
})
|
|
288
|
+
)}
|
|
289
|
+
</div>
|
|
290
|
+
</div>
|
|
291
|
+
);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export default WorkflowSidebar;
|