Skip to content

Self-improving AI Employees for everyone

feat(ui): Phase 2 - antd visual chrome to shadcn + Tailwind

trohitg1222c8c8781c
diff --git a/client/src/components/APIKeyValidator.tsx b/client/src/components/APIKeyValidator.tsx
index 0dbbe7d5..e4c12306 100644
--- a/client/src/components/APIKeyValidator.tsx
+++ b/client/src/components/APIKeyValidator.tsx
@@ -1,7 +1,12 @@
import React, { useEffect } from 'react';
-import { Input, Button, Space, Tag, Tooltip } from 'antd';
-import { CheckCircleOutlined, CloseCircleOutlined, LoadingOutlined, DeleteOutlined } from '@ant-design/icons';
+import { CheckCircle, XCircle, Loader2, Trash2 } from 'lucide-react';
+
+import { Input } from '@/components/ui/input';
+import { Button } from '@/components/ui/button';
+import { Badge } from '@/components/ui/badge';
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
import { useApiKeyValidation } from '../hooks/useApiKeyValidation';
+import { cn } from '@/lib/utils';
interface APIKeyValidatorProps {
value: string;
@@ -34,85 +39,78 @@ const APIKeyValidator: React.FC<APIKeyValidatorProps> = ({
onSuccess: onValidationSuccess
});
- // Auto-load stored key on mount
useEffect(() => {
if (hasStoredKey && !value) {
- getStoredKey().then(storedKey => {
+ getStoredKey().then((storedKey) => {
if (storedKey) onChange(storedKey);
});
}
}, [hasStoredKey, value, onChange, getStoredKey]);
const handleValidate = () => validate(value);
-
const handleClear = async () => {
await clear();
onChange('');
};
- const getStatusIcon = () => {
- if (isValidating) return <LoadingOutlined />;
- if (isValid) return <CheckCircleOutlined style={{ color: '#52c41a' }} />;
- if (status === 'invalid') return <CloseCircleOutlined style={{ color: '#ff4d4f' }} />;
- return null;
- };
-
- const getStatusTag = () => {
- if (hasStoredKey && isValid) {
- return (
- <Tag color="success" icon={<CheckCircleOutlined />}>
- Validated
- </Tag>
- );
- }
- return null;
- };
-
return (
- <Space direction="vertical" style={{ width: '100%' }} size="small">
- <Space.Compact style={{ width: '100%' }}>
- <Input.Password
- value={value}
- onChange={(e) => onChange(e.target.value)}
- placeholder={placeholder || 'Enter API key...'}
- onDragOver={onDragOver}
- onDragLeave={onDragLeave}
- onDrop={onDrop}
- suffix={getStatusIcon()}
- status={status === 'invalid' ? 'error' : undefined}
- style={{
- fontFamily: 'monospace',
- borderColor: isDragOver ? '#1890ff' : undefined,
- backgroundColor: isDragOver ? '#e6f7ff' : undefined
- }}
- />
+ <div className="flex w-full flex-col gap-1.5">
+ <div className="flex w-full items-stretch gap-1">
+ <div className="relative flex-1">
+ <Input
+ type="password"
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder={placeholder || 'Enter API key...'}
+ onDragOver={onDragOver}
+ onDragLeave={onDragLeave}
+ onDrop={onDrop}
+ aria-invalid={status === 'invalid' || undefined}
+ className={cn(
+ 'font-mono pr-8',
+ isDragOver && 'border-primary bg-primary/10'
+ )}
+ />
+ <div className="pointer-events-none absolute top-1/2 right-2 -translate-y-1/2">
+ {isValidating && <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />}
+ {!isValidating && isValid && <CheckCircle className="h-4 w-4 text-success" />}
+ {!isValidating && status === 'invalid' && <XCircle className="h-4 w-4 text-destructive" />}
+ </div>
+ </div>
{validationConfig.showValidateButton && (
<Button
- type={isValid ? 'primary' : 'default'}
- loading={isValidating}
+ variant={isValid ? 'default' : 'outline'}
disabled={!value?.trim() || isValidating}
onClick={handleValidate}
>
+ {isValidating && <Loader2 className="h-4 w-4 animate-spin" />}
{isValidating ? 'Validating' : isValid ? 'Valid' : 'Validate'}
</Button>
)}
{hasStoredKey && (
- <Tooltip title="Clear stored API key">
- <Button
- icon={<DeleteOutlined />}
- onClick={handleClear}
- type="text"
- size="small"
- />
- </Tooltip>
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button variant="ghost" size="icon" onClick={handleClear}>
+ <Trash2 className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Clear stored API key</TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
)}
- </Space.Compact>
+ </div>
- {getStatusTag()}
- </Space>
+ {hasStoredKey && isValid && (
+ <Badge variant="success" className="w-fit gap-1">
+ <CheckCircle className="h-3 w-3" />
+ Validated
+ </Badge>
+ )}
+ </div>
);
};
-export default APIKeyValidator;
\ No newline at end of file
+export default APIKeyValidator;
diff --git a/client/src/components/PricingConfigModal.tsx b/client/src/components/PricingConfigModal.tsx
index e1cc96e5..bc16feec 100644
--- a/client/src/components/PricingConfigModal.tsx
+++ b/client/src/components/PricingConfigModal.tsx
@@ -4,7 +4,8 @@
*/
import React, { useState, useEffect, useCallback } from 'react';
-import { Button, Tabs, InputNumber, Collapse, Spin } from 'antd';
+import { Button, Tabs, InputNumber, Collapse } from 'antd';
+import { Loader2 } from 'lucide-react';
import { toast } from 'sonner';
import {
SaveOutlined,
@@ -384,8 +385,8 @@ const PricingConfigModal: React.FC<Props> = ({ visible, onClose }) => {
>
<div style={{ padding: 16 }}>
{loading ? (
- <div style={{ textAlign: 'center', padding: 40 }}>
- <Spin size="large" />
+ <div className="flex items-center justify-center p-10">
+ <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
</div>
) : config ? (
<>
diff --git a/client/src/components/credentials/CredentialsModal.tsx b/client/src/components/credentials/CredentialsModal.tsx
index 48b7d76b..e96a2fde 100644
--- a/client/src/components/credentials/CredentialsModal.tsx
+++ b/client/src/components/credentials/CredentialsModal.tsx
@@ -14,11 +14,10 @@
*/
import React, { useMemo } from 'react';
-import { Tag, Flex, Spin } from 'antd';
-import { SafetyOutlined } from '@ant-design/icons';
+import { Loader2, ShieldCheck } from 'lucide-react';
import Modal from '../ui/Modal';
-import { useAppTheme } from '../../hooks/useAppTheme';
+import { Badge } from '@/components/ui/badge';
import { CATEGORIES as CLIENT_CATEGORIES, PROVIDERS as CLIENT_PROVIDERS } from './providers';
import PanelRenderer from './PanelRenderer';
import CredentialsPalette from './CredentialsPalette';
@@ -32,8 +31,6 @@ interface Props {
}
const CredentialsModal: React.FC<Props> = ({ visible, onClose }) => {
- const theme = useAppTheme();
-
// UI state lives in the Zustand store (no catalogue data ever).
const selectedId = useCredentialRegistry((s) => s.selectedId);
const setSelectedId = useCredentialRegistry((s) => s.setSelectedId);
@@ -73,58 +70,24 @@ const CredentialsModal: React.FC<Props> = ({ visible, onClose }) => {
const isLoadingServer = catalogue.isLoading && !catalogue.data;
const headerActions = (
- <Flex align="center" gap={theme.spacing.md}>
- <Flex
- align="center"
- gap={theme.spacing.sm}
- style={{
- fontSize: theme.fontSize.base,
- fontWeight: theme.fontWeight.semibold,
- color: theme.colors.text,
- }}
- >
- <SafetyOutlined style={{ color: theme.dracula.yellow }} />
+ <div className="flex items-center gap-3">
+ <div className="flex items-center gap-2 text-base font-semibold">
+ <ShieldCheck className="h-4 w-4 text-dracula-yellow" />
<span>API Credentials</span>
- </Flex>
- <Tag
- style={{
- margin: 0,
- fontSize: theme.fontSize.xs,
- backgroundColor: `${theme.dracula.green}25`,
- borderColor: `${theme.dracula.green}60`,
- color: theme.dracula.green,
- }}
- >
- {providers.length} providers
- </Tag>
+ </div>
+ <Badge variant="success">{providers.length} providers</Badge>
{isLoadingServer && (
- <Tag
- style={{
- margin: 0,
- fontSize: theme.fontSize.xs,
- backgroundColor: `${theme.dracula.cyan}25`,
- borderColor: `${theme.dracula.cyan}60`,
- color: theme.dracula.cyan,
- }}
- >
- <Spin size="small" /> loading
- </Tag>
+ <Badge variant="info" className="gap-1">
+ <Loader2 className="h-3 w-3 animate-spin" />
+ loading
+ </Badge>
)}
{!usingServerData && !isLoadingServer && (
- <Tag
- style={{
- margin: 0,
- fontSize: theme.fontSize.xs,
- backgroundColor: `${theme.dracula.orange}25`,
- borderColor: `${theme.dracula.orange}60`,
- color: theme.dracula.orange,
- }}
- title="Using bundled fallback catalogue"
- >
+ <Badge variant="warning" title="Using bundled fallback catalogue">
offline
- </Tag>
+ </Badge>
)}
- </Flex>
+ </div>
);
return (
@@ -135,16 +98,8 @@ const CredentialsModal: React.FC<Props> = ({ visible, onClose }) => {
maxHeight="95vh"
headerActions={headerActions}
>
- <Flex style={{ height: '100%', overflow: 'hidden' }}>
- <div
- style={{
- width: parseInt(theme.layout?.parameterPanelWidth ?? '280px'),
- borderRight: `1px solid ${theme.colors.border}`,
- flexShrink: 0,
- display: 'flex',
- flexDirection: 'column',
- }}
- >
+ <div className="flex h-full overflow-hidden">
+ <div className="flex w-[280px] shrink-0 flex-col border-r border-border">
<CredentialsPalette
providers={providers}
categories={categories}
@@ -152,18 +107,10 @@ const CredentialsModal: React.FC<Props> = ({ visible, onClose }) => {
onSelect={setSelectedId}
/>
</div>
- <div
- style={{
- flex: 1,
- overflow: 'auto',
- backgroundColor: theme.colors.background,
- display: 'flex',
- flexDirection: 'column',
- }}
- >
+ <div className="flex flex-1 flex-col overflow-auto bg-background">
<PanelRenderer config={selected} visible={visible} />
</div>
- </Flex>
+ </div>
</Modal>
);
};
diff --git a/client/src/components/credentials/CredentialsPalette.tsx b/client/src/components/credentials/CredentialsPalette.tsx
index 5ae7a467..96004ebf 100644
--- a/client/src/components/credentials/CredentialsPalette.tsx
+++ b/client/src/components/credentials/CredentialsPalette.tsx
@@ -34,9 +34,9 @@ import React, {
import { Command } from 'cmdk';
import { GroupedVirtuoso } from 'react-virtuoso';
import fuzzysort from 'fuzzysort';
-import { Badge, Flex, Input } from 'antd';
-import { SearchOutlined } from '@ant-design/icons';
+import { Search, X } from 'lucide-react';
+import { Input } from '@/components/ui/input';
import type { ProviderConfig, CategoryGroup } from './types';
import { useAppTheme } from '../../hooks/useAppTheme';
@@ -170,18 +170,17 @@ const ProviderRow = memo<RowProps>(function ProviderRow({ provider, selected, on
fontSize: theme.fontSize.sm,
}}
>
- <Flex
- align="center"
- justify="center"
- style={{ width: 24, height: 24, flexShrink: 0, color: theme.colors.text }}
- >
+ <div className="flex h-6 w-6 shrink-0 items-center justify-center text-foreground">
<Icon size={parseInt(theme.iconSize.sm)} />
- </Flex>
- <span style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1 }}>
+ </div>
+ <span className="flex-1 overflow-hidden text-ellipsis whitespace-nowrap">
{provider.name}
</span>
{provider.stored && (
- <Badge status="success" />
+ <span
+ aria-label="Credential stored"
+ className="h-2 w-2 rounded-full bg-success"
+ />
)}
</Command.Item>
);
@@ -281,31 +280,36 @@ const CredentialsPalette: React.FC<CredentialsPaletteProps> = ({
label="Credential providers"
style={{ display: 'flex', flexDirection: 'column', height: '100%', width: '100%' }}
>
- <div style={{ padding: theme.spacing.sm, borderBottom: `1px solid ${theme.colors.border}` }}>
- <Input
- value={query}
- onChange={handleQueryChange}
- placeholder={placeholder}
- prefix={<SearchOutlined style={{ color: theme.colors.textSecondary }} />}
- allowClear
- size="middle"
- autoFocus
- />
+ <div className="border-b border-border p-2">
+ <div className="relative">
+ <Search className="pointer-events-none absolute top-1/2 left-2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
+ <Input
+ value={query}
+ onChange={handleQueryChange}
+ placeholder={placeholder}
+ className="h-9 pl-8 pr-8"
+ autoFocus
+ />
+ {query && (
+ <button
+ type="button"
+ onClick={() => {
+ setQuery('');
+ startTransition(() => setFiltered(filterProviders('', prepared)));
+ }}
+ className="absolute top-1/2 right-2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
+ aria-label="Clear search"
+ >
+ <X className="h-4 w-4" />
+ </button>
+ )}
+ </div>
</div>
- <div style={{ flex: 1, minHeight: 0 }}>
+ <div className="min-h-0 flex-1">
{grouped.flatItems.length === 0 ? (
- <Flex
- align="center"
- justify="center"
- style={{
- height: '100%',
- color: theme.colors.textSecondary,
- fontSize: theme.fontSize.sm,
- opacity: 0.7,
- }}
- >
+ <div className="flex h-full items-center justify-center text-sm text-muted-foreground opacity-70">
No providers match &ldquo;{query}&rdquo;
- </Flex>
+ </div>
) : (
<GroupedVirtuoso
style={{ height }}
diff --git a/client/src/components/credentials/PanelRenderer.tsx b/client/src/components/credentials/PanelRenderer.tsx
index 4e9058a8..08b494cc 100644
--- a/client/src/components/credentials/PanelRenderer.tsx
+++ b/client/src/components/credentials/PanelRenderer.tsx
@@ -12,7 +12,7 @@
*/
import React, { Suspense, useMemo } from 'react';
-import { Flex, Result, Spin } from 'antd';
+import { Loader2, Info, AlertTriangle } from 'lucide-react';
import type { ProviderConfig, PanelKind } from './types';
// Vite will emit one chunk per panel under dist/assets/ApiKeyPanel-*.js,
@@ -47,9 +47,16 @@ interface Props {
}
const PanelFallback: React.FC = () => (
- <Flex align="center" justify="center" style={{ width: '100%', height: '100%', minHeight: 240 }}>
- <Spin />
- </Flex>
+ <div className="flex h-full min-h-[240px] w-full items-center justify-center">
+ <Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
+ </div>
+);
+
+const EmptyState: React.FC<{ icon: React.ReactNode; message: string }> = ({ icon, message }) => (
+ <div className="flex h-full w-full flex-col items-center justify-center gap-3 p-8 text-center">
+ {icon}
+ <p className="text-sm text-muted-foreground">{message}</p>
+ </div>
);
const PanelRenderer: React.FC<Props> = ({ config, visible }) => {
@@ -59,10 +66,20 @@ const PanelRenderer: React.FC<Props> = ({ config, visible }) => {
}, [config]);
if (!config) {
- return <Result status="info" subTitle="Select a credential to configure" />;
+ return (
+ <EmptyState
+ icon={<Info className="h-8 w-8 text-muted-foreground" />}
+ message="Select a credential to configure"
+ />
+ );
}
if (!Lazy) {
- return <Result status="warning" subTitle={`Unknown credential kind: ${config.kind}`} />;
+ return (
+ <EmptyState
+ icon={<AlertTriangle className="h-8 w-8 text-warning" />}
+ message={`Unknown credential kind: ${config.kind}`}
+ />
+ );
}
return (
diff --git a/client/src/components/credentials/panels/ApiKeyPanel.tsx b/client/src/components/credentials/panels/ApiKeyPanel.tsx
index 63138ff6..54a3d969 100644
--- a/client/src/components/credentials/panels/ApiKeyPanel.tsx
+++ b/client/src/components/credentials/panels/ApiKeyPanel.tsx
@@ -4,8 +4,11 @@
*/
import React, { useState, useEffect } from 'react';
-import { Alert, Card, Tag, Flex } from 'antd';
-import { CheckCircleOutlined } from '@ant-design/icons';
+import { CheckCircle } from 'lucide-react';
+
+import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
+import { Badge } from '@/components/ui/badge';
+import { Alert, AlertDescription } from '@/components/ui/alert';
import ApiKeyInput from '../../ui/ApiKeyInput';
import { useAppTheme } from '../../../hooks/useAppTheme';
import { useCredentialPanel } from '../useCredentialPanel';
@@ -18,7 +21,6 @@ const ApiKeyPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ c
const color = (theme.colors as any)[config.color] ?? config.color;
const field = config.fields?.[0];
const iconSize = parseInt(theme.iconSize.md);
- const tagOk = { backgroundColor: `${theme.dracula.green}25`, borderColor: `${theme.dracula.green}60`, color: theme.dracula.green };
// Local state for the controlled input. antd Form.getFieldValue/setFieldValue
// are snapshots that don't trigger re-renders — using them as a controlled
@@ -41,31 +43,67 @@ const ApiKeyPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ c
}, [config.id]);
return (
- <Flex vertical gap={theme.spacing.xl} style={{ padding: theme.spacing.xl }}>
- <Card size="small" styles={{ body: { padding: theme.spacing.lg } }}
- title={
- <Flex align="center" gap={theme.spacing.md}>
- <Flex align="center" justify="center" style={{ width: 48, height: 48, borderRadius: theme.borderRadius.lg, backgroundColor: `${color}15` }}>
+ <div className="flex flex-col gap-5 p-5">
+ <Card>
+ <CardHeader className="flex flex-row items-center justify-between gap-3 space-y-0 pb-3">
+ <div className="flex items-center gap-3">
+ <div
+ className="flex h-12 w-12 items-center justify-center rounded-lg"
+ style={{ backgroundColor: `${color}15` }}
+ >
<config.icon size={iconSize} />
- </Flex>
- <span style={{ fontSize: theme.fontSize.lg, fontWeight: theme.fontWeight.semibold, color: theme.colors.text }}>{config.name}</span>
- </Flex>}
- extra={panel.stored ? <Tag icon={<CheckCircleOutlined />} style={tagOk}>Connected</Tag> : null}>
- {field && <ApiKeyInput
- value={inputValue}
- onChange={v => { setInputValue(v); panel.form.setFieldValue(field.key, v); panel.setStored(false); }}
- onSave={() => panel.actions.validate(config.id, inputValue.trim()).then(r => { if (r?.isValid) panel.setStored(true); })}
- onDelete={panel.stored ? () => { panel.actions.remove(config.id); setInputValue(''); } : undefined}
- placeholder={field.placeholder}
- loading={panel.loading === 'validate'}
- isStored={panel.stored}
- />}
+ </div>
+ <CardTitle className="text-lg">{config.name}</CardTitle>
+ </div>
+ {panel.stored && (
+ <Badge variant="success" className="gap-1">
+ <CheckCircle className="h-3 w-3" />
+ Connected
+ </Badge>
+ )}
+ </CardHeader>
+ <CardContent>
+ {field && (
+ <ApiKeyInput
+ value={inputValue}
+ onChange={(v) => {
+ setInputValue(v);
+ panel.form.setFieldValue(field.key, v);
+ panel.setStored(false);
+ }}
+ onSave={() =>
+ panel.actions
+ .validate(config.id, inputValue.trim())
+ .then((r) => {
+ if (r?.isValid) panel.setStored(true);
+ })
+ }
+ onDelete={
+ panel.stored
+ ? () => {
+ panel.actions.remove(config.id);
+ setInputValue('');
+ }
+ : undefined
+ }
+ placeholder={field.placeholder}
+ loading={panel.loading === 'validate'}
+ isStored={panel.stored}
+ />
+ )}
+ </CardContent>
</Card>
- {panel.error && <Alert type="error" message={panel.error} showIcon />}
+
+ {panel.error && (
+ <Alert variant="destructive">
+ <AlertDescription>{panel.error}</AlertDescription>
+ </Alert>
+ )}
+
{config.hasDefaults && <ProviderDefaultsSection providerId={config.id} />}
{config.hasDefaults && <LlmUsageSection providerId={config.id} providerName={config.name} />}
{config.usageService && <ApiUsageSection service={config.usageService} serviceName={config.name} />}
- </Flex>
+ </div>
);
};
diff --git a/client/src/components/credentials/panels/EmailPanel.tsx b/client/src/components/credentials/panels/EmailPanel.tsx
index 6a2bae23..c8c992c9 100644
--- a/client/src/components/credentials/panels/EmailPanel.tsx
+++ b/client/src/components/credentials/panels/EmailPanel.tsx
@@ -10,7 +10,9 @@
*/
import React, { useState, useEffect, useCallback } from 'react';
-import { Form, Select, Input, InputNumber, Button, Alert, Flex, Space } from 'antd';
+import { Form, Select, Input, InputNumber, Button } from 'antd';
+import { Loader2 } from 'lucide-react';
+import { Alert, AlertDescription } from '@/components/ui/alert';
import { useAppTheme } from '../../../hooks/useAppTheme';
import { useApiKeys } from '../../../hooks/useApiKeys';
import { StatusCard } from '../primitives';
@@ -149,7 +151,7 @@ const EmailPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co
const iconSize = parseInt(theme.iconSize.md);
return (
- <Flex vertical gap={theme.spacing.lg} style={{ padding: theme.spacing.xl, flex: 1, minHeight: 0 }}>
+ <div className="flex min-h-0 flex-1 flex-col gap-4 p-5">
<StatusCard icon={<config.icon size={iconSize} />} title={config.name} status={{ stored, address }}
rows={[
{ label: 'Status', ok: s => s.stored, trueText: 'Configured', falseText: 'Not configured' },
@@ -171,7 +173,16 @@ const EmailPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co
</Form.Item>
<Form.Item
- label={<Space>Password {stored && <span style={{ color: theme.colors.textMuted, fontWeight: theme.fontWeight.normal, fontSize: theme.fontSize.xs }}>(leave blank to keep existing)</span>}</Space>}
+ label={
+ <span className="flex items-center gap-2">
+ Password
+ {stored && (
+ <span className="text-xs font-normal text-muted-foreground">
+ (leave blank to keep existing)
+ </span>
+ )}
+ </span>
+ }
name="password"
extra={AUTH_NOTES[provider]}
>
@@ -190,33 +201,38 @@ const EmailPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co
<div style={{ fontSize: theme.fontSize.sm, fontWeight: theme.fontWeight.medium, color: theme.colors.text, marginBottom: theme.spacing.md }}>
Custom IMAP / SMTP
</div>
- <Flex gap={theme.spacing.md}>
+ <div className="flex gap-3">
<Form.Item label="IMAP Host" name="imapHost" style={{ flex: 2 }}>
<Input placeholder="imap.example.com" />
</Form.Item>
<Form.Item label="IMAP Port" name="imapPort" style={{ flex: 1 }}>
<InputNumber min={1} max={65535} style={{ width: '100%' }} />
</Form.Item>
- </Flex>
- <Flex gap={theme.spacing.md}>
+ </div>
+ <div className="flex gap-3">
<Form.Item label="SMTP Host" name="smtpHost" style={{ flex: 2 }}>
<Input placeholder="smtp.example.com" />
</Form.Item>
<Form.Item label="SMTP Port" name="smtpPort" style={{ flex: 1 }}>
<InputNumber min={1} max={65535} style={{ width: '100%' }} />
</Form.Item>
- </Flex>
+ </div>
</div>
)}
</Form.Item>
</Form>
- {error && <Alert type="error" message={error} showIcon />}
+ {error && (
+ <Alert variant="destructive">
+ <AlertDescription>{error}</AlertDescription>
+ </Alert>
+ )}
- <div style={{ flex: 1 }} />
+ <div className="flex-1" />
- <Flex gap={theme.spacing.sm} justify="center" style={{ paddingTop: theme.spacing.md, borderTop: `1px solid ${theme.colors.border}` }}>
+ <div className="flex justify-center gap-2 border-t border-border pt-3">
<Button onClick={handleSave} loading={loading === 'save'}
+ icon={loading === 'save' ? <Loader2 className="h-4 w-4 animate-spin" /> : undefined}
style={{ backgroundColor: `${theme.dracula.green}25`, borderColor: `${theme.dracula.green}60`, color: theme.dracula.green }}>
Save
</Button>
@@ -226,8 +242,8 @@ const EmailPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co
Remove
</Button>
)}
- </Flex>
- </Flex>
+ </div>
+ </div>
);
};
diff --git a/client/src/components/credentials/panels/OAuthPanel.tsx b/client/src/components/credentials/panels/OAuthPanel.tsx
index cddb2674..285f6e0d 100644
--- a/client/src/components/credentials/panels/OAuthPanel.tsx
+++ b/client/src/components/credentials/panels/OAuthPanel.tsx
@@ -4,7 +4,6 @@
*/
import React from 'react';
-import { Flex } from 'antd';
import { useAppTheme } from '../../../hooks/useAppTheme';
import { useCredentialPanel } from '../useCredentialPanel';
import { useProviderStatus } from '../hooks';
@@ -19,7 +18,7 @@ const OAuthPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co
const connected = !!status?.connected;
return (
- <Flex vertical style={{ padding: theme.spacing.xl, flex: 1, minHeight: 0 }}>
+ <div className="flex min-h-0 flex-1 flex-col p-5">
<OAuthConnect
config={config} form={panel.form} connected={connected}
stored={panel.stored} loading={panel.loading} error={panel.error}
@@ -38,7 +37,7 @@ const OAuthPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co
onRefresh={() => panel.actions.oauthRefresh()}
extraSection={config.usageService && <ApiUsageSection service={config.usageService} serviceName={config.name} />}
/>
- </Flex>
+ </div>
);
};
diff --git a/client/src/components/credentials/panels/QrPairingPanel.tsx b/client/src/components/credentials/panels/QrPairingPanel.tsx
index 37f2a8b4..2097bd2a 100644
--- a/client/src/components/credentials/panels/QrPairingPanel.tsx
+++ b/client/src/components/credentials/panels/QrPairingPanel.tsx
@@ -5,7 +5,7 @@
*/
import React, { useMemo } from 'react';
-import { Alert, Flex } from 'antd';
+import { Alert, AlertDescription } from '@/components/ui/alert';
import ApiKeyInput from '../../ui/ApiKeyInput';
import QRCodeDisplay from '../../ui/QRCodeDisplay';
import { useAppTheme } from '../../../hooks/useAppTheme';
@@ -54,7 +54,7 @@ const QrPairingPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = (
}));
return (
- <Flex vertical gap={theme.spacing.lg} style={{ padding: theme.spacing.xl, flex: 1, minHeight: 0 }}>
+ <div className="flex min-h-0 flex-1 flex-col gap-4 p-5">
{field && <ApiKeyInput
value={panel.form.getFieldValue(field.key) || ''}
onChange={(v: string) => panel.form.setFieldValue(field.key, v)}
@@ -63,17 +63,20 @@ const QrPairingPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = (
placeholder={field.placeholder} loading={panel.loading === 'save'} isStored={panel.stored}
/>}
{config.statusRows && <StatusCard icon={<config.icon size={parseInt(theme.iconSize.md)} />} title={config.name} rows={config.statusRows} status={status} />}
- <Flex vertical align="center" justify="center"
- style={{ backgroundColor: theme.colors.backgroundAlt, borderRadius: theme.borderRadius.lg, padding: theme.spacing.xl, flex: 1, minHeight: 300 }}>
+ <div className="flex min-h-[300px] flex-1 flex-col items-center justify-center rounded-lg bg-muted p-5">
<QRCodeDisplay value={qrData} isConnected={connected} size={280}
connectedTitle={qr.connectedTitle} connectedSubtitle={qr.connectedSubtitle(status)}
loading={qr.isLoading(status)} emptyText={qr.emptyText(status, panel.stored)} />
- {!connected && qrData && <div style={{ marginTop: theme.spacing.md, color: theme.colors.textSecondary, fontSize: theme.fontSize.sm }}>{qr.scanText}</div>}
- </Flex>
+ {!connected && qrData && <div className="mt-3 text-sm text-muted-foreground">{qr.scanText}</div>}
+ </div>
{config.hasRateLimits && connected && <RateLimitSection />}
- {panel.error && <Alert type="error" message={panel.error} showIcon />}
+ {panel.error && (
+ <Alert variant="destructive">
+ <AlertDescription>{panel.error}</AlertDescription>
+ </Alert>
+ )}
<ActionBar actions={actions} loading={panel.loading} />
- </Flex>
+ </div>
);
};
diff --git a/client/src/components/credentials/primitives/ActionBar.tsx b/client/src/components/credentials/primitives/ActionBar.tsx
index e2e605d1..8aa80b5d 100644
--- a/client/src/components/credentials/primitives/ActionBar.tsx
+++ b/client/src/components/credentials/primitives/ActionBar.tsx
@@ -4,8 +4,8 @@
*/
import React from 'react';
-import { Button, Flex } from 'antd';
-import { useAppTheme } from '../../../hooks/useAppTheme';
+import { Loader2 } from 'lucide-react';
+import { Button } from '@/components/ui/button';
export interface ActionDef {
key: string;
@@ -24,21 +24,30 @@ interface Props {
}
const ActionBar: React.FC<Props> = ({ actions, loading }) => {
- const theme = useAppTheme();
return (
- <Flex gap={theme.spacing.sm} justify="center"
- style={{ paddingTop: theme.spacing.md, borderTop: `1px solid ${theme.colors.border}` }}>
- {actions.filter(a => !a.hidden).map(a => (
- <Button key={a.key}
- onClick={a.onClick}
- loading={loading === a.key}
- disabled={a.disabled}
- icon={a.icon}
- style={{ backgroundColor: `${a.color}25`, borderColor: `${a.color}60`, color: a.color }}>
- {a.label}
- </Button>
- ))}
- </Flex>
+ <div className="flex justify-center gap-2 border-t border-border pt-3">
+ {actions
+ .filter((a) => !a.hidden)
+ .map((a) => {
+ const isLoading = loading === a.key;
+ return (
+ <Button
+ key={a.key}
+ variant="outline"
+ onClick={a.onClick}
+ disabled={a.disabled || isLoading}
+ style={{
+ backgroundColor: `${a.color}25`,
+ borderColor: `${a.color}60`,
+ color: a.color,
+ }}
+ >
+ {isLoading ? <Loader2 className="h-4 w-4 animate-spin" /> : a.icon}
+ {a.label}
+ </Button>
+ );
+ })}
+ </div>
);
};
diff --git a/client/src/components/credentials/primitives/FieldRenderer.tsx b/client/src/components/credentials/primitives/FieldRenderer.tsx
index f2ab72d5..e11220fa 100644
--- a/client/src/components/credentials/primitives/FieldRenderer.tsx
+++ b/client/src/components/credentials/primitives/FieldRenderer.tsx
@@ -5,7 +5,7 @@
*/
import React from 'react';
-import { Form, Input, Space } from 'antd';
+import { Form, Input } from 'antd';
import { useAppTheme } from '../../../hooks/useAppTheme';
import type { FieldDef } from '../types';
import type { FormInstance } from 'antd';
@@ -23,7 +23,7 @@ const FieldRenderer: React.FC<Props> = ({ fields, form }) => {
};
return (
- <Space direction="vertical" size="small" style={{ width: '100%' }}>
+ <div className="flex w-full flex-col gap-2">
{fields.map(f => (
<Form.Item key={f.key} label={f.label} required={f.required}
style={{ marginBottom: theme.spacing.xs }}>
@@ -44,7 +44,7 @@ const FieldRenderer: React.FC<Props> = ({ fields, form }) => {
)}
</Form.Item>
))}
- </Space>
+ </div>
);
};
diff --git a/client/src/components/credentials/primitives/OAuthConnect.tsx b/client/src/components/credentials/primitives/OAuthConnect.tsx
index 31bcc4e5..4ae12a09 100644
--- a/client/src/components/credentials/primitives/OAuthConnect.tsx
+++ b/client/src/components/credentials/primitives/OAuthConnect.tsx
@@ -5,8 +5,9 @@
*/
import React from 'react';
-import { Button, Alert, Flex, Space } from 'antd';
-import { ReloadOutlined } from '@ant-design/icons';
+import { Loader2, RotateCcw } from 'lucide-react';
+import { Button } from '@/components/ui/button';
+import { Alert, AlertDescription } from '@/components/ui/alert';
import { useAppTheme } from '../../../hooks/useAppTheme';
import FieldRenderer from './FieldRenderer';
import ActionBar, { type ActionDef } from './ActionBar';
@@ -44,46 +45,74 @@ const OAuthConnect: React.FC<Props> = ({
const actions: ActionDef[] = [
{ key: 'login', label: `Login with ${config.name}`, color: theme.dracula.green, onClick: onLogin, disabled: !stored, hidden: connected },
{ key: 'logout', label: 'Disconnect', color: theme.dracula.pink, onClick: onLogout, hidden: !connected },
- { key: 'refresh', label: 'Refresh', color: theme.dracula.cyan, onClick: onRefresh, icon: <ReloadOutlined /> },
+ { key: 'refresh', label: 'Refresh', color: theme.dracula.cyan, onClick: onRefresh, icon: <RotateCcw className="h-4 w-4" /> },
];
+ const isSaving = loading === 'save';
+
return (
- <Flex vertical gap={theme.spacing.lg} style={{ flex: 1, minHeight: 0 }}>
+ <div className="flex min-h-0 flex-1 flex-col gap-4">
<StatusCard icon={icon} title={config.name} rows={statusRows} status={null} />
{!connected && config.fields && (
- <Space direction="vertical" size="middle" style={{ width: '100%' }}>
+ <div className="flex w-full flex-col gap-3">
<FieldRenderer fields={config.fields} form={form} />
- <Button onClick={onSaveCredentials} loading={loading === 'save'}
- style={{ backgroundColor: `${theme.dracula.purple}25`, borderColor: `${theme.dracula.purple}60`, color: theme.dracula.purple }}>
+ <Button
+ variant="outline"
+ onClick={onSaveCredentials}
+ disabled={isSaving}
+ style={{
+ backgroundColor: `${theme.dracula.purple}25`,
+ borderColor: `${theme.dracula.purple}60`,
+ color: theme.dracula.purple,
+ }}
+ >
+ {isSaving && <Loader2 className="h-4 w-4 animate-spin" />}
Save Credentials
</Button>
{config.instructions && (
- <div style={{ fontSize: theme.fontSize.xs, color: theme.colors.textMuted, lineHeight: 1.5 }}>
+ <div className="text-xs leading-relaxed text-muted-foreground">
{config.instructions}
- {config.callbackUrl && <><br/>Callback URL: <code style={{ color: theme.dracula.cyan }}>{config.callbackUrl}</code></>}
+ {config.callbackUrl && (
+ <>
+ <br />
+ Callback URL:{' '}
+ <code className="text-dracula-cyan">{config.callbackUrl}</code>
+ </>
+ )}
</div>
)}
- </Space>
+ </div>
)}
- {error && <Alert type="error" message={error} showIcon />}
+ {error && (
+ <Alert variant="destructive">
+ <AlertDescription>{error}</AlertDescription>
+ </Alert>
+ )}
- <div style={{ padding: theme.spacing.md, borderRadius: theme.borderRadius.md,
- backgroundColor: `${theme.dracula.cyan}10`, border: `1px solid ${theme.dracula.cyan}30` }}>
- <div style={{ fontSize: theme.fontSize.sm, color: theme.colors.textSecondary, lineHeight: 1.5 }}>
- {connected ? `Your ${config.name} account is connected.`
- : stored ? 'Click Login to authorize.'
- : 'Enter your credentials above to get started.'}
+ <div
+ className="rounded-md border p-3"
+ style={{
+ backgroundColor: `${theme.dracula.cyan}10`,
+ borderColor: `${theme.dracula.cyan}30`,
+ }}
+ >
+ <div className="text-sm leading-relaxed text-muted-foreground">
+ {connected
+ ? `Your ${config.name} account is connected.`
+ : stored
+ ? 'Click Login to authorize.'
+ : 'Enter your credentials above to get started.'}
</div>
</div>
{extraSection}
- <div style={{ flex: 1 }} />
+ <div className="flex-1" />
<ActionBar actions={actions} loading={loading} />
- </Flex>
+ </div>
);
};
diff --git a/client/src/components/credentials/primitives/StatusCard.tsx b/client/src/components/credentials/primitives/StatusCard.tsx
index b73f9123..a2515d22 100644
--- a/client/src/components/credentials/primitives/StatusCard.tsx
+++ b/client/src/components/credentials/primitives/StatusCard.tsx
@@ -1,12 +1,10 @@
/**
- * StatusCard — config-driven status Descriptions.
+ * StatusCard — config-driven status list.
* Config provides data (ok/trueText/falseText); component resolves theme colors.
- * Matches original CredentialsModal's Descriptions density (bordered, column=1, small).
*/
import React from 'react';
-import { Descriptions, Tag, Space } from 'antd';
-import { useAppTheme } from '../../../hooks/useAppTheme';
+import { Badge } from '@/components/ui/badge';
import type { StatusRowDef } from '../types';
interface Props {
@@ -17,29 +15,32 @@ interface Props {
}
const StatusCard: React.FC<Props> = ({ icon, title, rows, status }) => {
- const theme = useAppTheme();
- const tagStyle = (ok: boolean, warn?: boolean): React.CSSProperties => {
- const c = ok ? theme.dracula.green : warn ? theme.dracula.orange : theme.dracula.pink;
- return { backgroundColor: `${c}25`, borderColor: `${c}60`, color: c };
- };
-
return (
- <Descriptions bordered column={1} size="small"
- title={<Space>{icon} {title}</Space>}
- style={{ borderRadius: theme.borderRadius.md }}
- styles={{
- label: { backgroundColor: theme.colors.backgroundPanel, color: theme.colors.textSecondary, fontWeight: theme.fontWeight.medium },
- content: { backgroundColor: theme.colors.background, color: theme.colors.text },
- }}>
- {rows.map(r => {
- const ok = r.ok(status);
- return (
- <Descriptions.Item key={r.label} label={r.label}>
- <Tag style={tagStyle(ok, r.warn)}>{ok ? r.trueText : r.falseText}</Tag>
- </Descriptions.Item>
- );
- })}
- </Descriptions>
+ <div className="overflow-hidden rounded-md border border-border">
+ <div className="flex items-center gap-2 border-b border-border bg-muted px-3 py-2 text-sm font-semibold">
+ {icon}
+ <span>{title}</span>
+ </div>
+ <div className="divide-y divide-border">
+ {rows.map((r) => {
+ const ok = r.ok(status);
+ const variant: 'success' | 'warning' | 'destructive' = ok
+ ? 'success'
+ : r.warn
+ ? 'warning'
+ : 'destructive';
+ return (
+ <div
+ key={r.label}
+ className="grid grid-cols-[1fr_auto] items-center gap-3 px-3 py-2 text-sm"
+ >
+ <span className="text-muted-foreground">{r.label}</span>
+ <Badge variant={variant}>{ok ? r.trueText : r.falseText}</Badge>
+ </div>
+ );
+ })}
+ </div>
+ </div>
);
};
diff --git a/client/src/components/credentials/sections/ApiUsageSection.tsx b/client/src/components/credentials/sections/ApiUsageSection.tsx
index c35d4e0e..088f8a36 100644
--- a/client/src/components/credentials/sections/ApiUsageSection.tsx
+++ b/client/src/components/credentials/sections/ApiUsageSection.tsx
@@ -4,9 +4,11 @@
*/
import React, { useState, useEffect, useCallback } from 'react';
-import { Collapse, Statistic, Alert, Button, Tag, Space, Spin, Flex, Descriptions } from 'antd';
-import { DollarOutlined, ReloadOutlined } from '@ant-design/icons';
-import { useAppTheme } from '../../../hooks/useAppTheme';
+import { Collapse, Button } from 'antd';
+import { DollarSign, RefreshCw, Loader2 } from 'lucide-react';
+
+import { Badge } from '@/components/ui/badge';
+import { Alert, AlertDescription } from '@/components/ui/alert';
import { useApiKeys, type APIUsageSummary } from '../../../hooks/useApiKeys';
interface Props {
@@ -15,7 +17,6 @@ interface Props {
}
const ApiUsageSection: React.FC<Props> = ({ service, serviceName }) => {
- const theme = useAppTheme();
const { getAPIUsageSummary, isConnected } = useApiKeys();
const [data, setData] = useState<APIUsageSummary | null>(null);
const [loading, setLoading] = useState(false);
@@ -25,7 +26,7 @@ const ApiUsageSection: React.FC<Props> = ({ service, serviceName }) => {
setLoading(true);
try {
const services = await getAPIUsageSummary(service);
- setData(services.find(s => s.service === service) ?? null);
+ setData(services.find((s) => s.service === service) ?? null);
} finally {
setLoading(false);
}
@@ -33,52 +34,81 @@ const ApiUsageSection: React.FC<Props> = ({ service, serviceName }) => {
useEffect(() => { load(); }, [load]);
- const costTag = data ? (
- <Tag style={{ backgroundColor: `${theme.dracula.green}25`, borderColor: `${theme.dracula.green}60`, color: theme.dracula.green }}>
- ${data.total_cost.toFixed(4)}
- </Tag>
+ const costBadge = data ? (
+ <Badge variant="success">${data.total_cost.toFixed(4)}</Badge>
) : null;
return (
- <Collapse items={[{
- key: 'usage',
- label: <Space><DollarOutlined style={{ color: theme.dracula.yellow }} /> API Usage &amp; Costs {costTag}</Space>,
- children: loading ? (
- <Flex justify="center" style={{ padding: theme.spacing.lg }}><Spin size="small" /></Flex>
- ) : !data ? (
- <Alert type="info" showIcon
- message={`No usage data yet. Use ${serviceName} nodes in your workflows to track costs.`} />
- ) : (
- <Space direction="vertical" size="middle" style={{ width: '100%' }}>
- <Flex gap={theme.spacing.md} wrap="wrap">
- <Statistic title="Total Cost" value={data.total_cost} precision={4} prefix="$"
- valueStyle={{ color: theme.dracula.green, fontSize: theme.fontSize.lg }} />
- <Statistic title="API Calls" value={data.execution_count}
- valueStyle={{ color: theme.dracula.cyan, fontSize: theme.fontSize.lg }} />
- <Statistic title="Resources" value={data.total_resources}
- valueStyle={{ color: theme.dracula.purple, fontSize: theme.fontSize.lg }} />
- </Flex>
+ <Collapse
+ items={[
+ {
+ key: 'usage',
+ label: (
+ <span className="flex items-center gap-2">
+ <DollarSign className="h-4 w-4 text-dracula-yellow" />
+ API Usage &amp; Costs {costBadge}
+ </span>
+ ),
+ children: loading ? (
+ <div className="flex justify-center p-4">
+ <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
+ </div>
+ ) : !data ? (
+ <Alert variant="info">
+ <AlertDescription>
+ No usage data yet. Use {serviceName} nodes in your workflows to track costs.
+ </AlertDescription>
+ </Alert>
+ ) : (
+ <div className="flex w-full flex-col gap-4">
+ <div className="flex flex-wrap gap-4">
+ <Stat label="Total Cost" value={`$${data.total_cost.toFixed(4)}`} className="text-dracula-green" />
+ <Stat label="API Calls" value={data.execution_count} className="text-dracula-cyan" />
+ <Stat label="Resources" value={data.total_resources} className="text-dracula-purple" />
+ </div>
- {data.operations?.length > 0 && (
- <Descriptions size="small" column={1} bordered title="Operations Breakdown">
- {data.operations.map(op => (
- <Descriptions.Item key={op.operation} label={<code>{op.operation}</code>}>
- <Space>
- <Tag>{op.resource_count} resources</Tag>
- <Tag style={{ backgroundColor: `${theme.dracula.green}15`, color: theme.dracula.green, border: 'none' }}>
- ${op.total_cost.toFixed(4)}
- </Tag>
- </Space>
- </Descriptions.Item>
- ))}
- </Descriptions>
- )}
+ {data.operations?.length > 0 && (
+ <div className="overflow-hidden rounded-md border border-border">
+ <div className="border-b border-border bg-muted px-3 py-1.5 text-xs font-semibold">
+ Operations Breakdown
+ </div>
+ <div className="divide-y divide-border">
+ {data.operations.map((op) => (
+ <div
+ key={op.operation}
+ className="grid grid-cols-[1fr_auto] items-center gap-3 px-3 py-2 text-sm"
+ >
+ <code className="text-xs text-muted-foreground">{op.operation}</code>
+ <div className="flex items-center gap-1.5">
+ <Badge variant="outline">{op.resource_count} resources</Badge>
+ <Badge variant="success">${op.total_cost.toFixed(4)}</Badge>
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ )}
- <Button size="small" icon={<ReloadOutlined />} onClick={load} loading={loading}>Refresh</Button>
- </Space>
- ),
- }]} />
+ <Button size="small" icon={<RefreshCw className="h-3 w-3" />} onClick={load} loading={loading}>
+ Refresh
+ </Button>
+ </div>
+ ),
+ },
+ ]}
+ />
);
};
+const Stat: React.FC<{ label: string; value: React.ReactNode; className?: string }> = ({
+ label,
+ value,
+ className,
+}) => (
+ <div className="flex flex-col">
+ <span className="text-xs text-muted-foreground">{label}</span>
+ <span className={`text-lg font-semibold ${className ?? ''}`}>{value}</span>
+ </div>
+);
+
export default ApiUsageSection;
diff --git a/client/src/components/credentials/sections/LlmUsageSection.tsx b/client/src/components/credentials/sections/LlmUsageSection.tsx
index 0117e166..746ec016 100644
--- a/client/src/components/credentials/sections/LlmUsageSection.tsx
+++ b/client/src/components/credentials/sections/LlmUsageSection.tsx
@@ -1,12 +1,12 @@
/**
* LlmUsageSection — token usage and costs for an AI provider.
- * Uses antd Collapse + Statistic + Descriptions for fully declarative display.
*/
import React, { useState, useEffect, useCallback } from 'react';
-import { Collapse, Statistic, Descriptions, Alert, Space, Button, Spin, Flex } from 'antd';
-import { DollarOutlined, ReloadOutlined } from '@ant-design/icons';
-import { useAppTheme } from '../../../hooks/useAppTheme';
+import { Collapse, Button } from 'antd';
+import { DollarSign, RefreshCw, Loader2 } from 'lucide-react';
+
+import { Alert, AlertDescription } from '@/components/ui/alert';
import { useApiKeys, type ProviderUsageSummary } from '../../../hooks/useApiKeys';
interface Props {
@@ -14,8 +14,18 @@ interface Props {
providerName: string;
}
+const Stat: React.FC<{ label: string; value: React.ReactNode; className?: string }> = ({
+ label,
+ value,
+ className,
+}) => (
+ <div className="flex flex-col">
+ <span className="text-xs text-muted-foreground">{label}</span>
+ <span className={`text-lg font-semibold ${className ?? ''}`}>{value}</span>
+ </div>
+);
+
const LlmUsageSection: React.FC<Props> = ({ providerId, providerName }) => {
- const theme = useAppTheme();
const { getProviderUsageSummary, isConnected } = useApiKeys();
const [data, setData] = useState<ProviderUsageSummary | null>(null);
const [loading, setLoading] = useState(false);
@@ -26,69 +36,104 @@ const LlmUsageSection: React.FC<Props> = ({ providerId, providerName }) => {
setLoading(true);
try {
const summary = await getProviderUsageSummary();
- setData(summary.find(p => p.provider === providerId) ?? null);
+ setData(summary.find((p) => p.provider === providerId) ?? null);
} finally {
setLoading(false);
}
}, [isConnected, providerId, getProviderUsageSummary]);
- useEffect(() => { if (expanded) load(); }, [expanded, load]);
+ useEffect(() => {
+ if (expanded) load();
+ }, [expanded, load]);
return (
- <Collapse ghost
- onChange={keys => setExpanded(Array.isArray(keys) ? keys.includes('usage') : keys === 'usage')}
- items={[{
- key: 'usage',
- label: <Space><DollarOutlined /> Usage &amp; Costs</Space>,
- children: loading ? (
- <Flex justify="center" style={{ padding: theme.spacing.lg }}><Spin size="small" /></Flex>
- ) : !data || data.execution_count === 0 ? (
- <Alert type="info" showIcon message={`No usage data yet for ${providerName}`} />
- ) : (
- <Space direction="vertical" size="middle" style={{ width: '100%' }}>
- <Flex gap={theme.spacing.lg} wrap="wrap">
- <Statistic title="Total Tokens" value={data.total_tokens}
- valueStyle={{ color: theme.dracula.cyan, fontSize: theme.fontSize.lg }} />
- <Statistic title="Total Cost" value={data.total_cost} precision={4} prefix="$"
- valueStyle={{ color: theme.dracula.green, fontSize: theme.fontSize.lg }} />
- <Statistic title="Executions" value={data.execution_count}
- valueStyle={{ color: theme.dracula.purple, fontSize: theme.fontSize.lg }} />
- </Flex>
+ <Collapse
+ ghost
+ onChange={(keys) =>
+ setExpanded(Array.isArray(keys) ? keys.includes('usage') : keys === 'usage')
+ }
+ items={[
+ {
+ key: 'usage',
+ label: (
+ <span className="flex items-center gap-2">
+ <DollarSign className="h-4 w-4" /> Usage &amp; Costs
+ </span>
+ ),
+ children: loading ? (
+ <div className="flex justify-center p-4">
+ <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
+ </div>
+ ) : !data || data.execution_count === 0 ? (
+ <Alert variant="info">
+ <AlertDescription>No usage data yet for {providerName}</AlertDescription>
+ </Alert>
+ ) : (
+ <div className="flex w-full flex-col gap-4">
+ <div className="flex flex-wrap gap-4">
+ <Stat label="Total Tokens" value={data.total_tokens.toLocaleString()} className="text-dracula-cyan" />
+ <Stat label="Total Cost" value={`$${data.total_cost.toFixed(4)}`} className="text-dracula-green" />
+ <Stat label="Executions" value={data.execution_count} className="text-dracula-purple" />
+ </div>
- <Descriptions size="small" column={2} bordered>
- <Descriptions.Item label="Input Tokens">
- {data.total_input_tokens.toLocaleString()}
- <span style={{ color: theme.dracula.green, marginLeft: theme.spacing.sm }}>
- (${data.total_input_cost.toFixed(4)})
- </span>
- </Descriptions.Item>
- <Descriptions.Item label="Output Tokens">
- {data.total_output_tokens.toLocaleString()}
- <span style={{ color: theme.dracula.green, marginLeft: theme.spacing.sm }}>
- (${data.total_output_cost.toFixed(4)})
- </span>
- </Descriptions.Item>
- {data.total_cache_cost > 0 && (
- <Descriptions.Item label="Cache Cost" span={2}>
- <span style={{ color: theme.dracula.green }}>${data.total_cache_cost.toFixed(4)}</span>
- </Descriptions.Item>
- )}
- </Descriptions>
+ <div className="overflow-hidden rounded-md border border-border">
+ <div className="grid grid-cols-2 divide-x divide-border border-b border-border">
+ <div className="px-3 py-2 text-sm">
+ <div className="text-xs text-muted-foreground">Input Tokens</div>
+ <div>
+ {data.total_input_tokens.toLocaleString()}{' '}
+ <span className="ml-1 text-dracula-green">
+ (${data.total_input_cost.toFixed(4)})
+ </span>
+ </div>
+ </div>
+ <div className="px-3 py-2 text-sm">
+ <div className="text-xs text-muted-foreground">Output Tokens</div>
+ <div>
+ {data.total_output_tokens.toLocaleString()}{' '}
+ <span className="ml-1 text-dracula-green">
+ (${data.total_output_cost.toFixed(4)})
+ </span>
+ </div>
+ </div>
+ </div>
+ {data.total_cache_cost > 0 && (
+ <div className="px-3 py-2 text-sm">
+ <span className="text-xs text-muted-foreground">Cache Cost: </span>
+ <span className="text-dracula-green">${data.total_cache_cost.toFixed(4)}</span>
+ </div>
+ )}
+ </div>
- {data.models.length > 1 && (
- <Descriptions size="small" column={1} title="By Model" bordered>
- {data.models.map(m => (
- <Descriptions.Item key={m.model} label={<code style={{ fontSize: theme.fontSize.xs }}>{m.model}</code>}>
- <span style={{ color: theme.dracula.green }}>${m.total_cost.toFixed(4)}</span>
- </Descriptions.Item>
- ))}
- </Descriptions>
- )}
+ {data.models.length > 1 && (
+ <div className="overflow-hidden rounded-md border border-border">
+ <div className="border-b border-border bg-muted px-3 py-1.5 text-xs font-semibold">
+ By Model
+ </div>
+ <div className="divide-y divide-border">
+ {data.models.map((m) => (
+ <div
+ key={m.model}
+ className="grid grid-cols-[1fr_auto] items-center gap-3 px-3 py-2 text-sm"
+ >
+ <code className="text-xs">{m.model}</code>
+ <span className="text-dracula-green">
+ ${m.total_cost.toFixed(4)}
+ </span>
+ </div>
+ ))}
+ </div>
+ </div>
+ )}
- <Button size="small" icon={<ReloadOutlined />} onClick={load} loading={loading}>Refresh</Button>
- </Space>
- ),
- }]} />
+ <Button size="small" icon={<RefreshCw className="h-3 w-3" />} onClick={load} loading={loading}>
+ Refresh
+ </Button>
+ </div>
+ ),
+ },
+ ]}
+ />
);
};
diff --git a/client/src/components/credentials/sections/ProviderDefaultsSection.tsx b/client/src/components/credentials/sections/ProviderDefaultsSection.tsx
index 9170a0ed..6ff1fed6 100644
--- a/client/src/components/credentials/sections/ProviderDefaultsSection.tsx
+++ b/client/src/components/credentials/sections/ProviderDefaultsSection.tsx
@@ -10,8 +10,10 @@
*/
import React, { useState, useEffect, useCallback } from 'react';
-import { Form, Collapse, Select, InputNumber, Switch, Button, Tag, Space, Spin } from 'antd';
-import { SettingOutlined } from '@ant-design/icons';
+import { Form, Collapse, Select, InputNumber, Switch, Button } from 'antd';
+import { Settings } from 'lucide-react';
+
+import { Badge } from '@/components/ui/badge';
import { useAppTheme } from '../../../hooks/useAppTheme';
import { useApiKeys, type ProviderDefaults, type ModelConstraints } from '../../../hooks/useApiKeys';
@@ -86,16 +88,19 @@ const ProviderDefaultsSection: React.FC<Props> = ({ providerId }) => {
const fixedTemp = constraints?.is_reasoning_model && tempMin === tempMax;
const chipStyle = (bg: string): React.CSSProperties => ({
- margin: 0, fontSize: theme.fontSize.xs,
backgroundColor: `${bg}20`, borderColor: `${bg}50`, color: bg,
});
return (
<Collapse ghost defaultActiveKey={['defaults']} items={[{
key: 'defaults',
- label: <Space><SettingOutlined /> Default Parameters</Space>,
+ label: (
+ <span className="flex items-center gap-2">
+ <Settings className="h-4 w-4" /> Default Parameters
+ </span>
+ ),
children: (
- <Spin spinning={loading}>
+ <div className={loading ? 'pointer-events-none opacity-60' : ''}>
<Form form={form} layout="vertical" size="small" onValuesChange={() => setDirty(true)} preserve>
<Form.Item
label="Default Model"
@@ -113,13 +118,13 @@ const ProviderDefaultsSection: React.FC<Props> = ({ providerId }) => {
</Form.Item>
{constraints && (
- <Space wrap size="small" style={{ marginBottom: theme.spacing.md }}>
- {maxOut != null && <Tag style={chipStyle(theme.dracula.green)}>Max Output: {maxOut.toLocaleString()}</Tag>}
- {constraints.context_length != null && <Tag style={chipStyle(theme.dracula.cyan)}>Context: {constraints.context_length.toLocaleString()}</Tag>}
- <Tag style={chipStyle(theme.dracula.purple)}>Temp: {tempMin}-{tempMax}</Tag>
- {canThink && <Tag style={chipStyle(theme.dracula.orange)}>Thinking: {thinkType}</Tag>}
- {constraints.is_reasoning_model && <Tag style={chipStyle(theme.dracula.pink)}>Reasoning</Tag>}
- </Space>
+ <div className="mb-3 flex flex-wrap items-center gap-1.5">
+ {maxOut != null && <Badge style={chipStyle(theme.dracula.green)}>Max Output: {maxOut.toLocaleString()}</Badge>}
+ {constraints.context_length != null && <Badge style={chipStyle(theme.dracula.cyan)}>Context: {constraints.context_length.toLocaleString()}</Badge>}
+ <Badge style={chipStyle(theme.dracula.purple)}>Temp: {tempMin}-{tempMax}</Badge>
+ {canThink && <Badge style={chipStyle(theme.dracula.orange)}>Thinking: {thinkType}</Badge>}
+ {constraints.is_reasoning_model && <Badge style={chipStyle(theme.dracula.pink)}>Reasoning</Badge>}
+ </div>
)}
{!fixedTemp && (
@@ -171,7 +176,7 @@ const ProviderDefaultsSection: React.FC<Props> = ({ providerId }) => {
Save Defaults
</Button>
</Form>
- </Spin>
+ </div>
),
}]} />
);
diff --git a/client/src/components/credentials/sections/RateLimitSection.tsx b/client/src/components/credentials/sections/RateLimitSection.tsx
index 0bf1810e..15b25833 100644
--- a/client/src/components/credentials/sections/RateLimitSection.tsx
+++ b/client/src/components/credentials/sections/RateLimitSection.tsx
@@ -4,10 +4,19 @@
*/
import React, { useState, useEffect, useCallback } from 'react';
-import { Form, Collapse, InputNumber, Switch, Button, Alert, Space, Statistic, Flex } from 'antd';
+import { Form, Collapse, InputNumber, Switch, Button } from 'antd';
+
+import { Alert, AlertDescription } from '@/components/ui/alert';
import { useAppTheme } from '../../../hooks/useAppTheme';
import { useWebSocket, type RateLimitConfig, type RateLimitStats } from '../../../contexts/WebSocketContext';
+const Stat: React.FC<{ label: string; value: React.ReactNode }> = ({ label, value }) => (
+ <div className="flex flex-col">
+ <span className="text-xs text-muted-foreground">{label}</span>
+ <span className="text-lg font-semibold">{value}</span>
+ </div>
+);
+
const RateLimitSection: React.FC = () => {
const theme = useAppTheme();
const { getWhatsAppRateLimitConfig, setWhatsAppRateLimitConfig, unpauseWhatsAppRateLimit } = useWebSocket();
@@ -71,48 +80,50 @@ const RateLimitSection: React.FC = () => {
</span>
),
children: !loaded ? (
- <Flex justify="center" style={{ padding: theme.spacing.lg }}>Loading...</Flex>
+ <div className="flex justify-center p-4 text-sm text-muted-foreground">Loading...</div>
) : (
<Form form={form} layout="vertical" size="small" onValuesChange={() => setDirty(true)}>
{stats && (
- <Flex gap={theme.spacing.md} wrap="wrap" style={{ marginBottom: theme.spacing.md }}>
- <Statistic title="Last Minute" value={stats.messages_sent_last_minute} />
- <Statistic title="Last Hour" value={stats.messages_sent_last_hour} />
- <Statistic title="Today" value={stats.messages_sent_today} />
- <Statistic title="New Contacts" value={stats.new_contacts_today} />
- <Statistic title="Responses" value={stats.responses_received} />
- <Statistic title="Response Rate" value={Math.round((stats.response_rate || 0) * 100)} suffix="%" />
- </Flex>
+ <div className="mb-3 flex flex-wrap gap-4">
+ <Stat label="Last Minute" value={stats.messages_sent_last_minute} />
+ <Stat label="Last Hour" value={stats.messages_sent_last_hour} />
+ <Stat label="Today" value={stats.messages_sent_today} />
+ <Stat label="New Contacts" value={stats.new_contacts_today} />
+ <Stat label="Responses" value={stats.responses_received} />
+ <Stat
+ label="Response Rate"
+ value={`${Math.round((stats.response_rate || 0) * 100)}%`}
+ />
+ </div>
)}
{stats?.is_paused && (
- <Alert type="warning" message={stats.pause_reason || 'Paused'}
- action={<Button size="small" onClick={handleUnpause}>Unpause</Button>}
- style={{ marginBottom: theme.spacing.md }} />
+ <Alert variant="warning" className="mb-3">
+ <AlertDescription className="flex items-center justify-between gap-3">
+ <span>{stats.pause_reason || 'Paused'}</span>
+ <Button size="small" onClick={handleUnpause}>Unpause</Button>
+ </AlertDescription>
+ </Alert>
)}
- <div style={{ fontSize: theme.fontSize.xs, color: theme.colors.textSecondary, marginBottom: theme.spacing.xs, fontWeight: theme.fontWeight.medium }}>
+ <div className="mb-1 text-xs font-medium text-muted-foreground">
Message Delays (milliseconds)
</div>
- <Flex gap={theme.spacing.sm} wrap="wrap">
+ <div className="flex flex-wrap gap-2">
<Form.Item label="Min Delay" name="min_delay_ms"><InputNumber style={{ width: 120 }} /></Form.Item>
<Form.Item label="Max Delay" name="max_delay_ms"><InputNumber style={{ width: 120 }} /></Form.Item>
<Form.Item label="Typing Duration" name="typing_delay_ms"><InputNumber style={{ width: 120 }} /></Form.Item>
<Form.Item label="Link Extra Delay" name="link_extra_delay_ms"><InputNumber style={{ width: 120 }} /></Form.Item>
- </Flex>
-
- <div style={{ fontSize: theme.fontSize.xs, color: theme.colors.textSecondary, marginBottom: theme.spacing.xs, fontWeight: theme.fontWeight.medium }}>
- Message Limits
</div>
- <Flex gap={theme.spacing.sm} wrap="wrap">
+
+ <div className="mb-1 text-xs font-medium text-muted-foreground">Message Limits</div>
+ <div className="flex flex-wrap gap-2">
<Form.Item label="Per Minute" name="max_messages_per_minute"><InputNumber style={{ width: 120 }} /></Form.Item>
<Form.Item label="Per Hour" name="max_messages_per_hour"><InputNumber style={{ width: 120 }} /></Form.Item>
<Form.Item label="New Contacts/Day" name="max_new_contacts_per_day"><InputNumber style={{ width: 140 }} /></Form.Item>
- </Flex>
-
- <div style={{ fontSize: theme.fontSize.xs, color: theme.colors.textSecondary, marginBottom: theme.spacing.xs, fontWeight: theme.fontWeight.medium }}>
- Behavior
</div>
- <Space direction="vertical" size="small" style={{ width: '100%', marginBottom: theme.spacing.md }}>
+
+ <div className="mb-1 text-xs font-medium text-muted-foreground">Behavior</div>
+ <div className="mb-3 flex w-full flex-col gap-2">
<Form.Item label="Simulate Typing" name="simulate_typing" valuePropName="checked"
extra="Show typing indicator before sending" style={{ marginBottom: 0 }}>
<Switch />
@@ -134,7 +145,7 @@ const RateLimitSection: React.FC = () => {
</Form.Item>
)}
</Form.Item>
- </Space>
+ </div>
<Button onClick={handleSave} loading={loading} disabled={!dirty} block
style={{
diff --git a/client/src/components/onboarding/OnboardingWizard.tsx b/client/src/components/onboarding/OnboardingWizard.tsx
index 2f09fd20..2dd40d06 100644
--- a/client/src/components/onboarding/OnboardingWizard.tsx
+++ b/client/src/components/onboarding/OnboardingWizard.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { Steps, Button, Space } from 'antd';
+import { Steps, Button } from 'antd';
import { ArrowLeftOutlined, ArrowRightOutlined, CheckOutlined } from '@ant-design/icons';
import Modal from '../ui/Modal';
import { useOnboarding } from '../../hooks/useOnboarding';
@@ -99,7 +99,7 @@ const OnboardingWizard: React.FC<OnboardingWizardProps> = ({ onOpenCredentials,
</Button>
{/* Right: Back + Next/Finish */}
- <Space>
+ <div className="flex items-center gap-2">
{currentStep > 0 && (
<Button
icon={<ArrowLeftOutlined />}
@@ -135,7 +135,7 @@ const OnboardingWizard: React.FC<OnboardingWizardProps> = ({ onOpenCredentials,
Next <ArrowRightOutlined />
</Button>
)}
- </Space>
+ </div>
</div>
</div>
</Modal>
diff --git a/client/src/components/onboarding/steps/ApiKeyStep.tsx b/client/src/components/onboarding/steps/ApiKeyStep.tsx
index 324543cd..b21137e8 100644
--- a/client/src/components/onboarding/steps/ApiKeyStep.tsx
+++ b/client/src/components/onboarding/steps/ApiKeyStep.tsx
@@ -1,12 +1,11 @@
import React from 'react';
-import { Typography, Button, Space, Alert } from 'antd';
-import { KeyOutlined, LinkOutlined } from '@ant-design/icons';
+import { Key, ExternalLink } from 'lucide-react';
+
+import { Button } from '@/components/ui/button';
+import { Alert, AlertDescription } from '@/components/ui/alert';
import {
OpenAIIcon, ClaudeIcon, GeminiIcon, GroqIcon, OpenRouterIcon, CerebrasIcon,
} from '../../icons/AIProviderIcons';
-import { useAppTheme } from '../../../hooks/useAppTheme';
-
-const { Title, Text } = Typography;
interface ApiKeyStepProps {
onOpenCredentials: () => void;
@@ -22,68 +21,48 @@ const providers = [
];
const ApiKeyStep: React.FC<ApiKeyStepProps> = ({ onOpenCredentials }) => {
- const theme = useAppTheme();
-
return (
- <div style={{ padding: '4px 0' }}>
- <div style={{ textAlign: 'center', marginBottom: 16 }}>
- <Title level={4} style={{ margin: '0 0 4px 0' }}>
- <KeyOutlined style={{ marginRight: 8, color: theme.dracula.yellow }} />
+ <div className="py-1">
+ <div className="mb-4 text-center">
+ <h4 className="m-0 mb-1 flex items-center justify-center gap-2 text-lg font-semibold">
+ <Key className="h-4 w-4 text-dracula-yellow" />
API Key Setup
- </Title>
- <Text type="secondary" style={{ fontSize: 12 }}>
+ </h4>
+ <p className="text-xs text-muted-foreground">
Configure at least one AI provider to use AI agents
- </Text>
+ </p>
</div>
- <Space direction="vertical" size={8} style={{ width: '100%' }}>
+ <div className="flex w-full flex-col gap-2">
{providers.map((p) => (
<div
key={p.name}
- style={{
- display: 'flex',
- alignItems: 'center',
- gap: 10,
- padding: '8px 12px',
- backgroundColor: theme.colors.backgroundAlt,
- border: `1px solid ${theme.colors.border}`,
- borderRadius: 6,
- }}
+ className="flex items-center gap-2.5 rounded-md border border-border bg-muted/50 px-3 py-2"
>
- <div style={{ width: 24, height: 24, display: 'flex', alignItems: 'center', justifyContent: 'center', flexShrink: 0 }}>
- {p.icon}
+ <div className="flex h-6 w-6 shrink-0 items-center justify-center">{p.icon}</div>
+ <div className="min-w-0 flex-1">
+ <div className="block text-sm font-semibold">{p.name}</div>
+ <div className="text-xs text-muted-foreground">{p.desc}</div>
</div>
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text strong style={{ fontSize: 13, display: 'block' }}>{p.name}</Text>
- <Text type="secondary" style={{ fontSize: 11 }}>{p.desc}</Text>
+ <div className="flex items-center gap-1 text-[10px] text-muted-foreground">
+ <ExternalLink className="h-3 w-3" /> {p.url}
</div>
- <Text type="secondary" style={{ fontSize: 10 }}>
- <LinkOutlined /> {p.url}
- </Text>
</div>
))}
- </Space>
+ </div>
- <div style={{ textAlign: 'center', marginTop: 20 }}>
- <Button
- type="primary"
- icon={<KeyOutlined />}
- onClick={onOpenCredentials}
- style={{
- backgroundColor: theme.dracula.cyan,
- borderColor: theme.dracula.cyan,
- }}
- >
+ <div className="mt-5 text-center">
+ <Button onClick={onOpenCredentials} className="gap-2">
+ <Key className="h-4 w-4" />
Open Credentials
</Button>
</div>
- <Alert
- type="info"
- showIcon
- message="You can always change API keys later from the toolbar credentials button."
- style={{ marginTop: 16, fontSize: 12 }}
- />
+ <Alert variant="info" className="mt-4">
+ <AlertDescription className="text-xs">
+ You can always change API keys later from the toolbar credentials button.
+ </AlertDescription>
+ </Alert>
</div>
);
};
diff --git a/client/src/components/onboarding/steps/CanvasStep.tsx b/client/src/components/onboarding/steps/CanvasStep.tsx
index 7198fbaa..523a330f 100644
--- a/client/src/components/onboarding/steps/CanvasStep.tsx
+++ b/client/src/components/onboarding/steps/CanvasStep.tsx
@@ -1,17 +1,8 @@
import React from 'react';
-import { Typography, Tag, Space } from 'antd';
-import {
- LayoutOutlined,
- ToolOutlined,
- CodeOutlined,
-} from '@ant-design/icons';
-import { useAppTheme } from '../../../hooks/useAppTheme';
-
-const { Title, Text } = Typography;
+import { Layout, Wrench, Terminal } from 'lucide-react';
+import { Badge } from '@/components/ui/badge';
const CanvasStep: React.FC = () => {
- const theme = useAppTheme();
-
const shortcuts = [
{ keys: 'Ctrl+S', action: 'Save workflow' },
{ keys: 'F2', action: 'Rename node' },
@@ -20,128 +11,95 @@ const CanvasStep: React.FC = () => {
];
return (
- <div style={{ padding: '4px 0' }}>
- <div style={{ textAlign: 'center', marginBottom: 16 }}>
- <Title level={4} style={{ margin: '0 0 4px 0' }}>Canvas Tour</Title>
- <Text type="secondary" style={{ fontSize: 12 }}>
+ <div className="py-1">
+ <div className="mb-4 text-center">
+ <h4 className="m-0 mb-1 text-lg font-semibold">Canvas Tour</h4>
+ <p className="text-xs text-muted-foreground">
Navigate the main interface regions
- </Text>
+ </p>
</div>
{/* Visual layout diagram */}
- <div style={{
- border: `1px solid ${theme.colors.border}`,
- borderRadius: 8,
- overflow: 'hidden',
- marginBottom: 16,
- }}>
+ <div className="mb-4 overflow-hidden rounded-lg border border-border">
{/* Toolbar */}
- <div style={{
- padding: '6px 10px',
- backgroundColor: `${theme.dracula.orange}15`,
- borderBottom: `1px solid ${theme.colors.border}`,
- display: 'flex',
- alignItems: 'center',
- gap: 6,
- }}>
- <ToolOutlined style={{ color: theme.dracula.orange, fontSize: 12 }} />
- <Text style={{ fontSize: 11, color: theme.dracula.orange }} strong>Toolbar</Text>
- <div style={{ flex: 1 }} />
- <Tag color="orange" style={{ fontSize: 10, margin: 0, lineHeight: '18px' }}>Run</Tag>
- <Tag color="purple" style={{ fontSize: 10, margin: 0, lineHeight: '18px' }}>Start</Tag>
- <Tag color="cyan" style={{ fontSize: 10, margin: 0, lineHeight: '18px' }}>Save</Tag>
+ <div
+ className="flex items-center gap-1.5 border-b border-border px-2.5 py-1.5"
+ style={{ backgroundColor: 'hsl(var(--dracula-orange) / 0.12)' }}
+ >
+ <Wrench className="h-3 w-3 text-dracula-orange" />
+ <span className="text-xs font-semibold text-dracula-orange">Toolbar</span>
+ <div className="flex-1" />
+ <Badge variant="warning" className="text-[10px]">Run</Badge>
+ <Badge variant="secondary" className="text-[10px]">Start</Badge>
+ <Badge variant="info" className="text-[10px]">Save</Badge>
</div>
{/* Main area */}
- <div style={{ display: 'flex', height: 120 }}>
+ <div className="flex h-[120px]">
{/* Sidebar */}
- <div style={{
- width: 80,
- backgroundColor: `${theme.dracula.cyan}10`,
- borderRight: `1px solid ${theme.colors.border}`,
- padding: 6,
- display: 'flex',
- flexDirection: 'column',
- gap: 3,
- }}>
- <Text style={{ fontSize: 9, color: theme.dracula.cyan }} strong>Sidebar</Text>
- {['Workflow 1', 'Workflow 2'].map(w => (
- <div key={w} style={{
- fontSize: 8,
- padding: '2px 4px',
- backgroundColor: theme.colors.backgroundAlt,
- borderRadius: 3,
- color: theme.colors.textSecondary,
- }}>{w}</div>
+ <div
+ className="flex w-20 flex-col gap-1 border-r border-border p-1.5"
+ style={{ backgroundColor: 'hsl(var(--dracula-cyan) / 0.08)' }}
+ >
+ <span className="text-[9px] font-semibold text-dracula-cyan">Sidebar</span>
+ {['Workflow 1', 'Workflow 2'].map((w) => (
+ <div key={w} className="rounded-sm bg-muted px-1 py-0.5 text-[8px] text-muted-foreground">
+ {w}
+ </div>
))}
</div>
{/* Canvas */}
- <div style={{
- flex: 1,
- backgroundColor: `${theme.dracula.purple}08`,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- position: 'relative',
- }}>
- <div style={{ textAlign: 'center' }}>
- <LayoutOutlined style={{ fontSize: 20, color: theme.dracula.purple, opacity: 0.5 }} />
- <div style={{ fontSize: 9, color: theme.dracula.purple, marginTop: 2 }}>Canvas</div>
+ <div
+ className="relative flex flex-1 items-center justify-center"
+ style={{ backgroundColor: 'hsl(var(--dracula-purple) / 0.06)' }}
+ >
+ <div className="text-center">
+ <Layout className="mx-auto h-5 w-5 text-dracula-purple opacity-50" />
+ <div className="mt-0.5 text-[9px] text-dracula-purple">Canvas</div>
</div>
</div>
{/* Palette */}
- <div style={{
- width: 80,
- backgroundColor: `${theme.dracula.green}10`,
- borderLeft: `1px solid ${theme.colors.border}`,
- padding: 6,
- display: 'flex',
- flexDirection: 'column',
- gap: 3,
- }}>
- <Text style={{ fontSize: 9, color: theme.dracula.green }} strong>Palette</Text>
- {['AI Agents', 'AI Models', 'Skills'].map(c => (
- <div key={c} style={{
- fontSize: 8,
- padding: '2px 4px',
- backgroundColor: theme.colors.backgroundAlt,
- borderRadius: 3,
- color: theme.colors.textSecondary,
- }}>{c}</div>
+ <div
+ className="flex w-20 flex-col gap-1 border-l border-border p-1.5"
+ style={{ backgroundColor: 'hsl(var(--dracula-green) / 0.08)' }}
+ >
+ <span className="text-[9px] font-semibold text-dracula-green">Palette</span>
+ {['AI Agents', 'AI Models', 'Skills'].map((c) => (
+ <div key={c} className="rounded-sm bg-muted px-1 py-0.5 text-[8px] text-muted-foreground">
+ {c}
+ </div>
))}
</div>
</div>
{/* Console */}
- <div style={{
- padding: '6px 10px',
- backgroundColor: `${theme.dracula.pink}10`,
- borderTop: `1px solid ${theme.colors.border}`,
- display: 'flex',
- alignItems: 'center',
- gap: 6,
- }}>
- <CodeOutlined style={{ color: theme.dracula.pink, fontSize: 12 }} />
- <Text style={{ fontSize: 11, color: theme.dracula.pink }} strong>Console</Text>
- <div style={{ flex: 1 }} />
- <Tag style={{ fontSize: 9, margin: 0, lineHeight: '16px' }}>Chat</Tag>
- <Tag style={{ fontSize: 9, margin: 0, lineHeight: '16px' }}>Logs</Tag>
+ <div
+ className="flex items-center gap-1.5 border-t border-border px-2.5 py-1.5"
+ style={{ backgroundColor: 'hsl(var(--dracula-pink) / 0.08)' }}
+ >
+ <Terminal className="h-3 w-3 text-dracula-pink" />
+ <span className="text-xs font-semibold text-dracula-pink">Console</span>
+ <div className="flex-1" />
+ <Badge variant="outline" className="text-[9px]">Chat</Badge>
+ <Badge variant="outline" className="text-[9px]">Logs</Badge>
</div>
</div>
{/* Keyboard shortcuts */}
<div>
- <Text strong style={{ fontSize: 12, display: 'block', marginBottom: 8 }}>Keyboard Shortcuts</Text>
- <Space wrap size={[8, 6]}>
+ <div className="mb-2 block text-xs font-semibold">Keyboard Shortcuts</div>
+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1.5">
{shortcuts.map((s) => (
- <span key={s.keys} style={{ fontSize: 12 }}>
- <Tag style={{ fontSize: 11, fontFamily: 'monospace' }}>{s.keys}</Tag>
- <Text type="secondary" style={{ fontSize: 11 }}>{s.action}</Text>
+ <span key={s.keys} className="inline-flex items-center gap-1.5 text-xs">
+ <Badge variant="outline" className="font-mono text-[11px]">
+ {s.keys}
+ </Badge>
+ <span className="text-xs text-muted-foreground">{s.action}</span>
</span>
))}
- </Space>
+ </div>
</div>
</div>
);
diff --git a/client/src/components/onboarding/steps/ConceptsStep.tsx b/client/src/components/onboarding/steps/ConceptsStep.tsx
index e3313931..326ec016 100644
--- a/client/src/components/onboarding/steps/ConceptsStep.tsx
+++ b/client/src/components/onboarding/steps/ConceptsStep.tsx
@@ -1,46 +1,37 @@
import React from 'react';
-import { Typography, Space } from 'antd';
-import {
- AppstoreOutlined,
- BranchesOutlined,
- RobotOutlined,
- ToolOutlined,
- SwapOutlined,
-} from '@ant-design/icons';
+import { LayoutGrid, GitBranch, Bot, Wrench, ArrowLeftRight } from 'lucide-react';
import { useAppTheme } from '../../../hooks/useAppTheme';
-const { Title, Text, Paragraph } = Typography;
-
const ConceptsStep: React.FC = () => {
const theme = useAppTheme();
const concepts = [
{
- icon: <AppstoreOutlined />,
+ Icon: LayoutGrid,
title: 'Nodes',
desc: 'Building blocks of your workflow. Each node performs a specific action like sending a message, calling an AI model, or processing data.',
color: theme.dracula.cyan,
},
{
- icon: <BranchesOutlined />,
+ Icon: GitBranch,
title: 'Edges',
desc: "Connections between nodes that define data flow. Drag from one node's output to another's input to connect them.",
color: theme.dracula.green,
},
{
- icon: <RobotOutlined />,
+ Icon: Bot,
title: 'AI Agents',
desc: 'Intelligent nodes that use LLMs (Claude, GPT, Gemini) to reason, call tools, and complete tasks autonomously.',
color: theme.dracula.purple,
},
{
- icon: <ToolOutlined />,
+ Icon: Wrench,
title: 'Skills & Tools',
desc: 'Connect skills and tools to agents to extend their capabilities. Skills provide instructions, tools provide actions.',
color: theme.dracula.orange,
},
{
- icon: <SwapOutlined />,
+ Icon: ArrowLeftRight,
title: 'Normal vs Dev Mode',
desc: 'Normal mode shows AI-focused nodes for simple workflows. Dev mode unlocks all 108+ nodes for advanced automation.',
color: theme.dracula.pink,
@@ -48,53 +39,41 @@ const ConceptsStep: React.FC = () => {
];
return (
- <div style={{ padding: '4px 0' }}>
- <div style={{ textAlign: 'center', marginBottom: 16 }}>
- <Title level={4} style={{ margin: '0 0 4px 0' }}>Key Concepts</Title>
- <Text type="secondary" style={{ fontSize: 12 }}>
+ <div className="py-1">
+ <div className="mb-4 text-center">
+ <h4 className="m-0 mb-1 text-lg font-semibold">Key Concepts</h4>
+ <p className="text-xs text-muted-foreground">
Understanding these will help you build powerful workflows
- </Text>
+ </p>
</div>
- <Space direction="vertical" size={10} style={{ width: '100%' }}>
+ <div className="flex w-full flex-col gap-2.5">
{concepts.map((c) => (
<div
key={c.title}
+ className="flex items-start gap-3 rounded-md border p-3"
style={{
- display: 'flex',
- alignItems: 'flex-start',
- gap: 12,
- padding: 12,
backgroundColor: `${c.color}10`,
- border: `1px solid ${c.color}25`,
- borderRadius: 6,
+ borderColor: `${c.color}25`,
}}
>
- <div style={{
- width: 32,
- height: 32,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- backgroundColor: `${c.color}20`,
- borderRadius: 6,
- fontSize: 16,
- color: c.color,
- flexShrink: 0,
- }}>
- {c.icon}
+ <div
+ className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md"
+ style={{ backgroundColor: `${c.color}20`, color: c.color }}
+ >
+ <c.Icon className="h-4 w-4" />
</div>
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text strong style={{ fontSize: 13, color: c.color, display: 'block', marginBottom: 2 }}>
+ <div className="min-w-0 flex-1">
+ <div className="mb-0.5 text-sm font-semibold" style={{ color: c.color }}>
{c.title}
- </Text>
- <Paragraph type="secondary" style={{ fontSize: 12, margin: 0, lineHeight: 1.5 }}>
+ </div>
+ <p className="m-0 text-xs leading-relaxed text-muted-foreground">
{c.desc}
- </Paragraph>
+ </p>
</div>
</div>
))}
- </Space>
+ </div>
</div>
);
};
diff --git a/client/src/components/onboarding/steps/GetStartedStep.tsx b/client/src/components/onboarding/steps/GetStartedStep.tsx
index cfd9dea1..b6f2a8ad 100644
--- a/client/src/components/onboarding/steps/GetStartedStep.tsx
+++ b/client/src/components/onboarding/steps/GetStartedStep.tsx
@@ -1,49 +1,44 @@
import React from 'react';
-import { Typography, Card, Space, Tag } from 'antd';
-import {
- PlayCircleOutlined,
- ExperimentOutlined,
- BookOutlined,
- SettingOutlined,
-} from '@ant-design/icons';
+import { Play, FlaskConical, BookOpen, Settings } from 'lucide-react';
+import { Card, CardContent } from '@/components/ui/card';
+import { Badge } from '@/components/ui/badge';
import { useAppTheme } from '../../../hooks/useAppTheme';
-const { Title, Text, Paragraph } = Typography;
-
const GetStartedStep: React.FC = () => {
const theme = useAppTheme();
const tips = [
{
- icon: <PlayCircleOutlined />,
+ Icon: Play,
title: 'Try an Example Workflow',
desc: 'Open the sidebar and click on one of the pre-loaded example workflows to see how things work.',
color: theme.dracula.green,
},
{
- icon: <ExperimentOutlined />,
+ Icon: FlaskConical,
title: 'Build Your First Workflow',
desc: (
<>
Quick recipe: drag{' '}
- <Tag style={{ fontSize: 10, lineHeight: '16px', margin: '0 2px' }}>Chat Trigger</Tag>
- <Text type="secondary" style={{ fontSize: 12 }}>{'\u2192'}</Text>{' '}
- <Tag style={{ fontSize: 10, lineHeight: '16px', margin: '0 2px' }}>Zeenie</Tag>
- <Text type="secondary" style={{ fontSize: 12 }}>{'\u2192'}</Text>{' '}
- <Tag style={{ fontSize: 10, lineHeight: '16px', margin: '0 2px' }}>Claude Model</Tag>
- {' '}then click <Tag color="green" style={{ fontSize: 10, lineHeight: '16px', margin: '0 2px' }}>Run</Tag>
+ <Badge variant="outline" className="mx-0.5 text-[10px]">Chat Trigger</Badge>
+ <span className="text-xs text-muted-foreground">{'\u2192'}</span>{' '}
+ <Badge variant="outline" className="mx-0.5 text-[10px]">Zeenie</Badge>
+ <span className="text-xs text-muted-foreground">{'\u2192'}</span>{' '}
+ <Badge variant="outline" className="mx-0.5 text-[10px]">Claude Model</Badge>
+ {' '}then click{' '}
+ <Badge variant="success" className="mx-0.5 text-[10px]">Run</Badge>
</>
),
color: theme.dracula.purple,
},
{
- icon: <BookOutlined />,
+ Icon: BookOpen,
title: 'Explore AI Skills',
desc: 'Use the Master Skill node to browse and enable built-in skills for your AI agents.',
color: theme.dracula.cyan,
},
{
- icon: <SettingOutlined />,
+ Icon: Settings,
title: 'Revisit This Guide',
desc: 'You can replay this welcome guide anytime from Settings.',
color: theme.dracula.orange,
@@ -51,51 +46,42 @@ const GetStartedStep: React.FC = () => {
];
return (
- <div style={{ padding: '4px 0' }}>
- <div style={{ textAlign: 'center', marginBottom: 16 }}>
- <Title level={4} style={{ margin: '0 0 4px 0' }}>Get Started</Title>
- <Text type="secondary" style={{ fontSize: 12 }}>
+ <div className="py-1">
+ <div className="mb-4 text-center">
+ <h4 className="m-0 mb-1 text-lg font-semibold">Get Started</h4>
+ <p className="text-xs text-muted-foreground">
Here are some things to try first
- </Text>
+ </p>
</div>
- <Space direction="vertical" size={10} style={{ width: '100%' }}>
- {tips.map((t, i) => (
+ <div className="flex w-full flex-col gap-2.5">
+ {tips.map(({ Icon, title, desc, color }, i) => (
<Card
key={i}
- size="small"
style={{
- borderColor: `${t.color}30`,
- backgroundColor: `${t.color}08`,
+ borderColor: `${color}30`,
+ backgroundColor: `${color}08`,
}}
>
- <div style={{ display: 'flex', alignItems: 'flex-start', gap: 10 }}>
- <div style={{
- width: 28,
- height: 28,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- backgroundColor: `${t.color}20`,
- borderRadius: 6,
- color: t.color,
- fontSize: 14,
- flexShrink: 0,
- }}>
- {t.icon}
+ <CardContent className="flex items-start gap-2.5 p-3">
+ <div
+ className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md"
+ style={{ backgroundColor: `${color}20`, color }}
+ >
+ <Icon className="h-3.5 w-3.5" />
</div>
- <div style={{ flex: 1, minWidth: 0 }}>
- <Text strong style={{ fontSize: 13, color: t.color, display: 'block', marginBottom: 2 }}>
- {t.title}
- </Text>
- <Paragraph type="secondary" style={{ fontSize: 12, margin: 0, lineHeight: 1.5 }}>
- {t.desc}
- </Paragraph>
+ <div className="min-w-0 flex-1">
+ <div className="mb-0.5 text-sm font-semibold" style={{ color }}>
+ {title}
+ </div>
+ <p className="m-0 text-xs leading-relaxed text-muted-foreground">
+ {desc}
+ </p>
</div>
- </div>
+ </CardContent>
</Card>
))}
- </Space>
+ </div>
</div>
);
};
diff --git a/client/src/components/onboarding/steps/WelcomeStep.tsx b/client/src/components/onboarding/steps/WelcomeStep.tsx
index e11e2881..404f5710 100644
--- a/client/src/components/onboarding/steps/WelcomeStep.tsx
+++ b/client/src/components/onboarding/steps/WelcomeStep.tsx
@@ -1,63 +1,49 @@
import React from 'react';
-import { Typography, Card, Row, Col } from 'antd';
-import {
- RocketOutlined,
- ApiOutlined,
- DragOutlined,
- ThunderboltOutlined,
-} from '@ant-design/icons';
-import { useAppTheme } from '../../../hooks/useAppTheme';
-
-const { Title, Text, Paragraph } = Typography;
+import { Rocket, Plug, Move, Zap } from 'lucide-react';
+import { Card, CardContent } from '@/components/ui/card';
const features = [
- { icon: <ApiOutlined />, label: '108+ Nodes', desc: 'Workflow building blocks' },
- { icon: <RocketOutlined />, label: '6 AI Providers', desc: 'OpenAI, Claude, Gemini & more' },
- { icon: <DragOutlined />, label: 'Drag & Drop', desc: 'Visual workflow builder' },
- { icon: <ThunderboltOutlined />, label: 'Real-time', desc: 'Live execution & monitoring' },
+ { Icon: Plug, label: '108+ Nodes', desc: 'Workflow building blocks' },
+ { Icon: Rocket, label: '6 AI Providers', desc: 'OpenAI, Claude, Gemini & more' },
+ { Icon: Move, label: 'Drag & Drop', desc: 'Visual workflow builder' },
+ { Icon: Zap, label: 'Real-time', desc: 'Live execution & monitoring' },
];
const WelcomeStep: React.FC = () => {
- const theme = useAppTheme();
-
return (
- <div style={{ textAlign: 'center', padding: '8px 0' }}>
- <RocketOutlined style={{ fontSize: 40, color: theme.dracula.purple, marginBottom: 8 }} />
+ <div className="py-2 text-center">
+ <Rocket className="mx-auto mb-2 h-10 w-10 text-dracula-purple" />
- <Title level={3} style={{ margin: '0 0 4px 0' }}>
- Welcome to MachinaOs
- </Title>
+ <h3 className="m-0 mb-1 text-xl font-semibold">Welcome to MachinaOs</h3>
- <Text strong style={{ color: theme.dracula.purple, fontSize: 15 }}>
+ <p className="text-[15px] font-semibold text-dracula-purple">
Visual workflow automation powered by AI agents
- </Text>
+ </p>
- <Paragraph type="secondary" style={{ maxWidth: 480, margin: '16px auto 24px auto', fontSize: 13 }}>
+ <p className="mx-auto mt-4 mb-6 max-w-[480px] text-sm text-muted-foreground">
MachinaOs lets you build intelligent automation workflows by connecting
AI models, tools, and services together on an interactive canvas.
No coding required for most tasks.
- </Paragraph>
-
- <Row gutter={[12, 12]} justify="center" style={{ maxWidth: 440, margin: '0 auto' }}>
- {features.map((f) => (
- <Col span={12} key={f.label}>
- <Card
- size="small"
- style={{
- textAlign: 'center',
- backgroundColor: `${theme.dracula.purple}12`,
- borderColor: `${theme.dracula.purple}30`,
- }}
- >
- <div style={{ fontSize: 22, color: theme.dracula.purple, marginBottom: 4 }}>
- {f.icon}
- </div>
- <Text strong style={{ fontSize: 13, display: 'block' }}>{f.label}</Text>
- <Text type="secondary" style={{ fontSize: 11 }}>{f.desc}</Text>
- </Card>
- </Col>
+ </p>
+
+ <div className="mx-auto grid max-w-[440px] grid-cols-2 gap-3">
+ {features.map(({ Icon, label, desc }) => (
+ <Card
+ key={label}
+ className="text-center"
+ style={{
+ backgroundColor: 'hsl(var(--dracula-purple) / 0.08)',
+ borderColor: 'hsl(var(--dracula-purple) / 0.3)',
+ }}
+ >
+ <CardContent className="flex flex-col items-center gap-1 p-3">
+ <Icon className="h-5 w-5 text-dracula-purple" />
+ <span className="block text-sm font-semibold">{label}</span>
+ <span className="text-xs text-muted-foreground">{desc}</span>
+ </CardContent>
+ </Card>
))}
- </Row>
+ </div>
</div>
);
};
diff --git a/client/src/components/output/OutputPanel.tsx b/client/src/components/output/OutputPanel.tsx
index 8826e995..49f30743 100644
--- a/client/src/components/output/OutputPanel.tsx
+++ b/client/src/components/output/OutputPanel.tsx
@@ -1,23 +1,30 @@
/**
* OutputPanel — execution output display.
*
- * Single component using antd (Collapse, Tag, Space) + ReactMarkdown
- * + @uiw/react-json-view. No custom widgets, no registry, no schema
- * renderer. Backend owns display logic via `_uiHints` (future);
- * frontend is pure UI.
+ * shadcn primitives (Badge, Button, Collapsible) + ReactMarkdown
+ * + @uiw/react-json-view. Backend owns display logic via `_uiHints` (future).
*/
-import { Collapse, Tag, Space, Flex } from 'antd';
+import { ChevronDown, X, Copy } from 'lucide-react';
+import { useState } from 'react';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import remarkBreaks from 'remark-breaks';
import JsonView from '@uiw/react-json-view';
import { githubDarkTheme } from '@uiw/react-json-view/githubDark';
import { githubLightTheme } from '@uiw/react-json-view/githubLight';
-import { useAppTheme } from '../../hooks/useAppTheme';
-import { ExecutionResult } from '../../services/executionService';
import { Node } from 'reactflow';
-import { copyToClipboard } from '../../utils/formatters';
+import { Badge } from '@/components/ui/badge';
+import { Button } from '@/components/ui/button';
+import {
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from '@/components/ui/collapsible';
+import { useTheme } from '@/contexts/ThemeContext';
+import { ExecutionResult } from '@/services/executionService';
+import { copyToClipboard } from '@/utils/formatters';
+import { cn } from '@/lib/utils';
/** Extract output data from ExecutionResult. */
const getData = (r: ExecutionResult) =>
@@ -27,12 +34,14 @@ const getData = (r: ExecutionResult) =>
const unwrap = (d: any) =>
d?.result && typeof d.result === 'object' && !Array.isArray(d.result) ? d.result : d;
-/** Convert escaped newlines to real ones (same pattern as ConsolePanel). */
+/** Convert escaped newlines to real ones. */
const fmt = (s: string) => s.replace(/\\n/g, '\n').replace(/\\t/g, '\t');
-/** Tag color by field name. */
-const TAG_COLOR: Record<string, string> = {
- model: 'purple', provider: 'cyan', agent_type: 'green',
+/** Map metadata field names to badge variants. */
+const TAG_VARIANT: Record<string, 'secondary' | 'info' | 'success'> = {
+ model: 'secondary',
+ provider: 'info',
+ agent_type: 'success',
};
interface Props {
@@ -41,18 +50,35 @@ interface Props {
selectedNode?: Node | null;
}
+interface SectionProps {
+ label: React.ReactNode;
+ defaultOpen?: boolean;
+ children: React.ReactNode;
+}
+
+function Section({ label, defaultOpen = false, children }: SectionProps) {
+ const [open, setOpen] = useState(defaultOpen);
+ return (
+ <Collapsible open={open} onOpenChange={setOpen} className="border-b border-border last:border-0">
+ <CollapsibleTrigger className="flex w-full items-center gap-2 py-2 text-sm font-medium text-foreground hover:text-primary">
+ <ChevronDown
+ className={cn('h-4 w-4 transition-transform', open && 'rotate-0', !open && '-rotate-90')}
+ />
+ <span className="flex-1 text-left">{label}</span>
+ </CollapsibleTrigger>
+ <CollapsibleContent className="pb-3 pl-6">{children}</CollapsibleContent>
+ </Collapsible>
+ );
+}
+
export default function OutputPanel({ results, onClear, selectedNode }: Props) {
- const theme = useAppTheme();
+ const { isDarkMode } = useTheme();
const filtered = selectedNode ? results.filter(r => r.nodeId === selectedNode.id) : results;
const latest = filtered[0];
if (!latest) {
return (
- <div style={{
- width: '100%', height: '100%', display: 'flex',
- alignItems: 'center', justifyContent: 'center',
- color: theme.colors.textMuted, fontSize: theme.fontSize.sm,
- }}>
+ <div className="flex h-full w-full items-center justify-center text-sm text-muted-foreground">
No output yet. Run a node to see results.
</div>
);
@@ -64,110 +90,92 @@ export default function OutputPanel({ results, onClear, selectedNode }: Props) {
const thinking = data?.thinking;
const metaTags = ['model', 'provider', 'agent_type'].filter(k => data?.[k]);
- const items = [
- response && {
- key: 'response',
- label: 'Response',
- children: (
- <div className="prose prose-sm dark:prose-invert max-w-none" style={{ whiteSpace: 'pre-wrap' }}>
- <ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]}>
- {fmt(typeof response === 'string' ? response : JSON.stringify(response, null, 2))}
- </ReactMarkdown>
- </div>
- ),
- },
- thinking && {
- key: 'thinking',
- label: 'Thinking',
- children: (
- <div className="prose prose-sm dark:prose-invert max-w-none" style={{ whiteSpace: 'pre-wrap', maxHeight: '300px', overflow: 'auto' }}>
- <ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]}>{fmt(thinking)}</ReactMarkdown>
- </div>
- ),
- },
- {
- key: 'json',
- label: (
- <Space>
- Raw JSON
- <button
- onClick={(e) => { e.stopPropagation(); copyToClipboard(raw, 'Copied!'); }}
- style={{
- fontSize: theme.fontSize.xs, cursor: 'pointer',
- color: theme.dracula.cyan, background: 'none', border: 'none', padding: 0,
- }}
- >
- Copy
- </button>
- </Space>
- ),
- children: (
- <JsonView
- value={raw}
- collapsed={2}
- displayDataTypes={false}
- style={theme.isDarkMode ? githubDarkTheme : githubLightTheme}
- />
- ),
- },
- ].filter(Boolean) as any[];
-
return (
- <div style={{
- width: '100%', height: '100%', backgroundColor: theme.colors.backgroundPanel,
- display: 'flex', flexDirection: 'column', overflow: 'hidden',
- }}>
+ <div className="flex h-full w-full flex-col overflow-hidden bg-card">
{/* Header */}
- <Flex
- align="center"
- justify="space-between"
- gap="small"
- style={{
- padding: `${theme.spacing.md} ${theme.spacing.lg}`,
- borderBottom: `1px solid ${theme.colors.border}`,
- backgroundColor: theme.colors.backgroundElevated,
- flexShrink: 0,
- }}
- >
- <Flex align="center" gap={4} wrap="wrap" flex="1 1 auto" style={{ minWidth: 0 }}>
- <span style={{ fontSize: theme.fontSize.base, fontWeight: theme.fontWeight.semibold, color: theme.colors.text, marginRight: theme.spacing.xs }}>
- Output
- </span>
- <Tag color={latest.success ? 'green' : 'red'}>{latest.success ? 'Success' : 'Error'}</Tag>
- {latest.executionTime > 0 && <Tag>{(latest.executionTime / 1000).toFixed(1)}s</Tag>}
+ <div className="flex shrink-0 items-center justify-between gap-2 border-b border-border bg-card px-4 py-2">
+ <div className="flex min-w-0 flex-1 flex-wrap items-center gap-1.5">
+ <span className="mr-1 text-sm font-semibold">Output</span>
+ <Badge variant={latest.success ? 'success' : 'destructive'}>
+ {latest.success ? 'Success' : 'Error'}
+ </Badge>
+ {latest.executionTime > 0 && (
+ <Badge variant="outline">{(latest.executionTime / 1000).toFixed(1)}s</Badge>
+ )}
{metaTags.map(k => (
- <Tag key={k} color={TAG_COLOR[k] || 'default'}>
+ <Badge key={k} variant={TAG_VARIANT[k] ?? 'secondary'}>
{String(data[k]).replace(/_/g, ' ')}
- </Tag>
+ </Badge>
))}
- </Flex>
+ </div>
{onClear && (
- <button onClick={onClear} style={{
- padding: `${theme.spacing.xs} ${theme.spacing.md}`,
- fontSize: theme.fontSize.xs, cursor: 'pointer', flexShrink: 0,
- color: theme.dracula.pink, backgroundColor: `${theme.dracula.pink}15`,
- border: `1px solid ${theme.dracula.pink}40`, borderRadius: theme.borderRadius.sm,
- }}>
- Clear
- </button>
+ <Button variant="ghost" size="xs" onClick={onClear} className="shrink-0 text-destructive">
+ <X /> Clear
+ </Button>
)}
- </Flex>
+ </div>
{/* Content */}
- <div style={{ flex: 1, overflow: 'auto', padding: theme.spacing.lg }}>
+ <div className="flex-1 overflow-auto p-4">
{latest.error && (
- <pre style={{
- margin: `0 0 ${theme.spacing.md}`, padding: theme.spacing.md,
- backgroundColor: `${theme.dracula.red}10`,
- border: `1px solid ${theme.dracula.red}40`,
- borderRadius: theme.borderRadius.md, borderLeft: `3px solid ${theme.dracula.red}`,
- fontFamily: theme.fontFamily.mono, fontSize: theme.fontSize.sm,
- color: theme.dracula.red, whiteSpace: 'pre-wrap', wordBreak: 'break-word',
- }}>
+ <pre className="mb-3 overflow-auto rounded-md border border-destructive/40 border-l-4 border-l-destructive bg-destructive/5 p-3 font-mono text-sm whitespace-pre-wrap break-words text-destructive">
{latest.error}
</pre>
)}
- <Collapse defaultActiveKey={['response']} items={items} ghost />
+
+ <div className="space-y-0">
+ {response && (
+ <Section label="Response" defaultOpen>
+ <div
+ className="prose prose-sm dark:prose-invert max-w-none"
+ style={{ whiteSpace: 'pre-wrap' }}
+ >
+ <ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]}>
+ {fmt(typeof response === 'string' ? response : JSON.stringify(response, null, 2))}
+ </ReactMarkdown>
+ </div>
+ </Section>
+ )}
+
+ {thinking && (
+ <Section label="Thinking">
+ <div
+ className="prose prose-sm dark:prose-invert max-w-none max-h-[300px] overflow-auto"
+ style={{ whiteSpace: 'pre-wrap' }}
+ >
+ <ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]}>
+ {fmt(thinking)}
+ </ReactMarkdown>
+ </div>
+ </Section>
+ )}
+
+ <Section
+ label={
+ <div className="flex items-center gap-2">
+ <span>Raw JSON</span>
+ <button
+ type="button"
+ onClick={(e) => {
+ e.stopPropagation();
+ copyToClipboard(raw, 'Copied!');
+ }}
+ className="inline-flex items-center gap-1 text-xs text-primary hover:underline"
+ >
+ <Copy className="h-3 w-3" />
+ Copy
+ </button>
+ </div>
+ }
+ >
+ <JsonView
+ value={raw}
+ collapsed={2}
+ displayDataTypes={false}
+ style={isDarkMode ? githubDarkTheme : githubLightTheme}
+ />
+ </Section>
+ </div>
</div>
</div>
);
diff --git a/client/src/components/parameterPanel/MasterSkillEditor.tsx b/client/src/components/parameterPanel/MasterSkillEditor.tsx
index 80bfc8e8..4a46125d 100644
--- a/client/src/components/parameterPanel/MasterSkillEditor.tsx
+++ b/client/src/components/parameterPanel/MasterSkillEditor.tsx
@@ -11,9 +11,11 @@
*/
import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
-import { Input, Select, Checkbox, Button, Spin, List, Badge, Empty, Tooltip, Alert, Popconfirm } from 'antd';
+import { Input, Select, Checkbox, Button, List, Badge, Empty, Tooltip, Popconfirm } from 'antd';
+import { Loader2, Info } from 'lucide-react';
+import { Alert as DSAlert, AlertDescription } from '@/components/ui/alert';
import { toast } from 'sonner';
-import { SearchOutlined, ReloadOutlined, InfoCircleOutlined, FolderOutlined, PlusOutlined, DeleteOutlined, SaveOutlined, CloseOutlined } from '@ant-design/icons';
+import { SearchOutlined, ReloadOutlined, FolderOutlined, PlusOutlined, DeleteOutlined, SaveOutlined, CloseOutlined } from '@ant-design/icons';
import { useAppTheme } from '../../hooks/useAppTheme';
import { useWebSocket } from '../../contexts/WebSocketContext';
import { skillNodes, SKILL_NODE_TYPES } from '../../nodeDefinitions/skillNodes';
@@ -641,8 +643,9 @@ const MasterSkillEditor: React.FC<MasterSkillEditorProps> = ({
{/* Skills List */}
<div style={{ flex: 1, overflowY: 'auto' }}>
{folderLoading ? (
- <div style={{ display: 'flex', justifyContent: 'center', marginTop: theme.spacing.lg }}>
- <Spin tip="Scanning folder..." />
+ <div className="mt-4 flex items-center justify-center gap-2 text-sm text-muted-foreground">
+ <Loader2 className="h-4 w-4 animate-spin" />
+ Scanning folder...
</div>
) : filteredSkills.length === 0 ? (
<Empty
@@ -1014,8 +1017,9 @@ const MasterSkillEditor: React.FC<MasterSkillEditorProps> = ({
{/* Skill Instructions Editor */}
<div ref={editorWrapperRef} style={{ flex: 1, padding: theme.spacing.md, overflow: 'hidden', display: 'flex', flexDirection: 'column' }}>
{isLoading ? (
- <div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
- <Spin tip="Loading..." />
+ <div className="flex flex-1 items-center justify-center gap-2 text-sm text-muted-foreground">
+ <Loader2 className="h-4 w-4 animate-spin" />
+ Loading...
</div>
) : (
<Input.TextArea
@@ -1051,17 +1055,12 @@ const MasterSkillEditor: React.FC<MasterSkillEditorProps> = ({
{/* Enable hint */}
{!selectedSkillConfig?.enabled && (
- <Alert
- type="info"
- showIcon
- icon={<InfoCircleOutlined />}
- message="Enable this skill to include it when running the AI Agent."
- style={{
- marginTop: theme.spacing.md,
- backgroundColor: `${theme.dracula.cyan}10`,
- border: `1px solid ${theme.dracula.cyan}30`,
- }}
- />
+ <DSAlert variant="info" className="mt-3">
+ <Info className="h-4 w-4" />
+ <AlertDescription>
+ Enable this skill to include it when running the AI Agent.
+ </AlertDescription>
+ </DSAlert>
)}
</div>
</>
diff --git a/client/src/components/parameterPanel/MiddleSection.tsx b/client/src/components/parameterPanel/MiddleSection.tsx
index afe3fe05..995f774a 100644
--- a/client/src/components/parameterPanel/MiddleSection.tsx
+++ b/client/src/components/parameterPanel/MiddleSection.tsx
@@ -1,5 +1,6 @@
import React, { useState, useEffect } from 'react';
-import { Collapse, Progress, Statistic, Spin, Row, Col, Typography, InputNumber, Button } from 'antd';
+import { Collapse, Progress, Statistic, Row, Col, InputNumber, Button } from 'antd';
+import { Loader2 } from 'lucide-react';
import { toast } from 'sonner';
import { ThunderboltOutlined, EditOutlined, SaveOutlined } from '@ant-design/icons';
import ParameterRenderer from '../ParameterRenderer';
@@ -789,15 +790,15 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({
<ThunderboltOutlined />
Token Usage
{compactionStats && displayMax > 0 && (
- <Typography.Text type="secondary" style={{ marginLeft: 'auto' }}>
+ <span className="ml-auto text-xs text-muted-foreground">
{Math.round(compactionStats.total / 1000)}K / {Math.round(displayMax / 1000)}K{ctxLen > 0 ? ' context' : ''}
- </Typography.Text>
+ </span>
)}
</span>
);
})(),
children: compactionLoading ? (
- <Spin />
+ <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
) : compactionStats ? (() => {
const ctxLen = compactionStats.context_length || 0;
const hasContext = ctxLen > 0;
@@ -813,16 +814,16 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({
status={isWarning ? 'exception' : 'active'}
/>
{hasContext && compactionStats.threshold > 0 && (
- <Typography.Text type="secondary" style={{ fontSize: 11, display: 'block', marginTop: 4 }}>
+ <span className="mt-1 block text-[11px] text-muted-foreground">
Compaction at {Math.round(compactionStats.threshold / 1000)}K ({Math.round(compactionStats.threshold / ctxLen * 100)}% of context)
- </Typography.Text>
+ </span>
)}
<Row gutter={16} style={{ marginTop: 12 }}>
<Col span={8}><Statistic title="Total" value={compactionStats.total} /></Col>
<Col span={8}>
{isEditingThreshold ? (
<div>
- <Typography.Text type="secondary" style={{ fontSize: 12 }}>Threshold</Typography.Text>
+ <span className="text-xs text-muted-foreground">Threshold</span>
<div style={{ display: 'flex', gap: 4, marginTop: 4 }}>
<InputNumber
size="small"
@@ -870,13 +871,13 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({
<Col span={4}><Statistic title="Context" value={`${Math.round(ctxLen / 1000)}K`} /></Col>
)}
</Row>
- <Typography.Text type="secondary" style={{ fontSize: 12, marginTop: 8, display: 'block' }}>
+ <span className="mt-2 block text-xs text-muted-foreground">
Session: {compactionStats.session_id}
- </Typography.Text>
+ </span>
</>
);
})() : (
- <Typography.Text type="secondary">No data yet. Run the agent to start tracking.</Typography.Text>
+ <span className="text-xs text-muted-foreground">No data yet. Run the agent to start tracking.</span>
)
}]}
/>
diff --git a/client/src/components/shared/DataPanel.tsx b/client/src/components/shared/DataPanel.tsx
index 54b08183..01656782 100644
--- a/client/src/components/shared/DataPanel.tsx
+++ b/client/src/components/shared/DataPanel.tsx
@@ -1,8 +1,4 @@
import React, { ReactNode } from 'react';
-import { Card, Space, Empty, Typography } from 'antd';
-import { useAppTheme } from '../../hooks/useAppTheme';
-
-const { Text } = Typography;
// Compound Component Pattern
interface DataPanelProps {
@@ -29,106 +25,39 @@ interface EmptyStateProps {
description: string;
}
-const DataPanelRoot: React.FC<DataPanelProps> = ({ children }) => {
- const theme = useAppTheme();
- return (
- <div style={{
- width: '350px',
- height: '100%',
- backgroundColor: theme.colors.backgroundPanel,
- borderLeft: `1px solid ${theme.colors.border}`,
- display: 'flex',
- flexDirection: 'column'
- }}>
- {children}
- </div>
- );
-};
+const DataPanelRoot: React.FC<DataPanelProps> = ({ children }) => (
+ <div className="flex h-full w-[350px] flex-col border-l border-border bg-card">
+ {children}
+ </div>
+);
-const DataPanelHeader: React.FC<HeaderProps> = ({ title, extra, children }) => {
- const theme = useAppTheme();
- return (
- <Card
- size="small"
- title={title}
- extra={extra}
- headStyle={{
- borderBottom: `1px solid ${theme.colors.border}`,
- padding: 8,
- backgroundColor: theme.colors.backgroundPanel
- }}
- bodyStyle={{ padding: children ? 8 : 0 }}
- style={{
- borderRadius: 0,
- border: 'none',
- borderBottom: `1px solid ${theme.colors.border}`,
- backgroundColor: theme.colors.backgroundPanel
- }}
- >
- {children}
- </Card>
- );
-};
+const DataPanelHeader: React.FC<HeaderProps> = ({ title, extra, children }) => (
+ <div className="border-b border-border bg-card">
+ <div className="flex items-center justify-between gap-2 p-2 text-sm font-semibold">
+ <div>{title}</div>
+ {extra && <div>{extra}</div>}
+ </div>
+ {children && <div className="p-2">{children}</div>}
+ </div>
+);
const DataPanelContent: React.FC<ContentProps> = ({ children }) => (
- <div style={{
- flex: 1,
- overflowY: 'auto',
- padding: '8px'
- }}>
+ <div className="flex-1 overflow-y-auto p-2">{children}</div>
+);
+
+const DataPanelFooter: React.FC<FooterProps> = ({ children }) => (
+ <div className="border-t border-border bg-card p-2 text-center">
{children}
</div>
);
-const DataPanelFooter: React.FC<FooterProps> = ({ children }) => {
- const theme = useAppTheme();
- return (
- <Card
- size="small"
- bodyStyle={{ padding: 8, textAlign: 'center' }}
- style={{
- borderRadius: 0,
- border: 'none',
- borderTop: `1px solid ${theme.colors.border}`,
- backgroundColor: theme.colors.backgroundPanel
- }}
- >
- {children}
- </Card>
- );
-};
-
-const DataPanelEmpty: React.FC<EmptyStateProps> = ({ icon, title, description }) => {
- const theme = useAppTheme();
- return (
- <div style={{
- width: '350px',
- height: '100%',
- backgroundColor: theme.colors.backgroundPanel,
- borderLeft: `1px solid ${theme.colors.border}`,
- display: 'flex',
- flexDirection: 'column'
- }}>
- <Empty
- image={icon}
- description={
- <Space direction="vertical" size="small">
- <Text style={{ color: theme.colors.textSecondary }}>{title}</Text>
- <Text style={{ fontSize: 12, color: theme.colors.textSecondary }}>
- {description}
- </Text>
- </Space>
- }
- style={{
- height: '100%',
- display: 'flex',
- flexDirection: 'column',
- justifyContent: 'center'
- }}
- />
- </div>
- );
-};
+const DataPanelEmpty: React.FC<EmptyStateProps> = ({ icon, title, description }) => (
+ <div className="flex h-full w-[350px] flex-col items-center justify-center border-l border-border bg-card p-6 text-center">
+ <div className="mb-3 text-muted-foreground">{icon}</div>
+ <div className="text-sm text-muted-foreground">{title}</div>
+ <div className="mt-1 text-xs text-muted-foreground">{description}</div>
+ </div>
+);
// Compound Component Export
const DataPanel = {
diff --git a/client/src/components/shared/JSONTreeRenderer.tsx b/client/src/components/shared/JSONTreeRenderer.tsx
index 9469fe3f..7aa773e8 100644
--- a/client/src/components/shared/JSONTreeRenderer.tsx
+++ b/client/src/components/shared/JSONTreeRenderer.tsx
@@ -1,23 +1,6 @@
-import React from 'react';
-import { Tree, Card, Space, Typography } from 'antd';
-import { DragOutlined } from '@ant-design/icons';
-import type { DataNode } from 'antd/es/tree';
-import styled from 'styled-components';
-
-const { Text } = Typography;
-
-const DraggableTreeNode = styled(Card)<{ $isDraggable: boolean }>`
- cursor: ${props => props.$isDraggable ? 'grab' : 'default'};
- background-color: #f0f9ff;
- border-color: #0ea5e9;
- margin-bottom: 4px;
- transition: all 0.2s ease;
-
- &:hover {
- background-color: ${props => props.$isDraggable ? '#e0f2fe' : '#f0f9ff'};
- transform: ${props => props.$isDraggable ? 'translateY(-1px)' : 'none'};
- }
-`;
+import React, { useState } from 'react';
+import { ChevronRight, GripVertical } from 'lucide-react';
+import { cn } from '@/lib/utils';
interface JSONTreeProps {
data: Record<string, any>;
@@ -26,81 +9,116 @@ interface JSONTreeProps {
templateName: string;
}
-interface TreeNodeData extends DataNode {
- path: string;
+interface NodeProps {
+ entryKey: string;
value: any;
- isDraggable: boolean;
+ path: string;
+ nodeName: string;
+ templateName: string;
+ onDragStart: JSONTreeProps['onDragStart'];
+ depth: number;
}
-const JSONTreeRenderer: React.FC<JSONTreeProps> = ({
- data,
+const TreeNode: React.FC<NodeProps> = ({
+ entryKey,
+ value,
+ path,
nodeName,
+ templateName,
onDragStart,
- templateName
+ depth,
}) => {
- const convertToTreeData = (
- obj: any,
- path: string = '',
- _parentKey: string = ''
- ): TreeNodeData[] => {
- return Object.entries(obj).map(([key, value]) => {
- const currentPath = path ? `${path}.${key}` : key;
- const isObject = typeof value === 'object' && value !== null && !Array.isArray(value);
- const isDraggable = !isObject;
-
- const node: TreeNodeData = {
- title: (
- <DraggableTreeNode
- size="small"
- $isDraggable={isDraggable}
- draggable={isDraggable}
- onDragStart={(e) => isDraggable && onDragStart(e, nodeName, currentPath, value)}
- bodyStyle={{ padding: 8 }}
- >
- <Space style={{ width: '100%', justifyContent: 'space-between' }}>
- <Space direction="vertical" size={0}>
- <Text code style={{ color: '#7c3aed', fontSize: 11 }}>
- {`{{${templateName}.${currentPath}}}`}
- </Text>
- <Space size={4}>
- <Text strong style={{ color: '#059669', fontSize: 10 }}>
- "{key}"
- </Text>
- <Text type="secondary" style={{ fontSize: 10 }}>:</Text>
- <Text style={{
- color: isObject ? '#7c2d12' : (typeof value === 'string' ? '#dc2626' : '#7c2d12'),
- fontSize: 10
- }}>
- {isObject ? '{object}' : JSON.stringify(value)}
- </Text>
- </Space>
- </Space>
- {isDraggable && <DragOutlined style={{ color: '#7c3aed', fontSize: 12 }} />}
- </Space>
- </DraggableTreeNode>
- ),
- key: currentPath,
- path: currentPath,
- value,
- isDraggable,
- children: isObject ? convertToTreeData(value, currentPath, key) : undefined
- };
-
- return node;
- });
- };
-
- const treeData = convertToTreeData(data);
+ const isObject = typeof value === 'object' && value !== null && !Array.isArray(value);
+ const isDraggable = !isObject;
+ const [open, setOpen] = useState(true);
return (
- <Tree
- treeData={treeData}
- defaultExpandAll
- showLine
- blockNode
- style={{ background: 'transparent' }}
- />
+ <div>
+ <div
+ draggable={isDraggable}
+ onDragStart={(e) => isDraggable && onDragStart(e, nodeName, path, value)}
+ style={{ paddingLeft: depth * 12 }}
+ className={cn(
+ 'mb-1 flex items-start justify-between gap-2 rounded-md border border-info/40 bg-info/5 p-2 transition-colors',
+ isDraggable && 'cursor-grab hover:-translate-y-px hover:bg-info/10'
+ )}
+ >
+ <div className="flex min-w-0 flex-1 items-start gap-1">
+ {isObject && (
+ <button
+ type="button"
+ onClick={() => setOpen((v) => !v)}
+ className="mt-0.5 text-muted-foreground hover:text-foreground"
+ aria-label={open ? 'Collapse' : 'Expand'}
+ >
+ <ChevronRight className={cn('h-3 w-3 transition-transform', open && 'rotate-90')} />
+ </button>
+ )}
+ <div className="min-w-0 flex-1">
+ <code className="block text-[11px] text-accent">
+ {`{{${templateName}.${path}}}`}
+ </code>
+ <div className="mt-0.5 flex items-center gap-1 text-[10px]">
+ <span className="font-semibold text-success">"{entryKey}"</span>
+ <span className="text-muted-foreground">:</span>
+ <span
+ className={cn(
+ 'truncate',
+ isObject
+ ? 'text-muted-foreground'
+ : typeof value === 'string'
+ ? 'text-destructive'
+ : 'text-foreground'
+ )}
+ >
+ {isObject ? '{object}' : JSON.stringify(value)}
+ </span>
+ </div>
+ </div>
+ </div>
+ {isDraggable && <GripVertical className="h-3 w-3 shrink-0 text-accent" />}
+ </div>
+
+ {isObject && open && (
+ <div>
+ {Object.entries(value).map(([childKey, childValue]) => (
+ <TreeNode
+ key={childKey}
+ entryKey={childKey}
+ value={childValue}
+ path={`${path}.${childKey}`}
+ nodeName={nodeName}
+ templateName={templateName}
+ onDragStart={onDragStart}
+ depth={depth + 1}
+ />
+ ))}
+ </div>
+ )}
+ </div>
);
};
-export default JSONTreeRenderer;
\ No newline at end of file
+const JSONTreeRenderer: React.FC<JSONTreeProps> = ({
+ data,
+ nodeName,
+ onDragStart,
+ templateName,
+}) => (
+ <div className="bg-transparent">
+ {Object.entries(data).map(([key, value]) => (
+ <TreeNode
+ key={key}
+ entryKey={key}
+ value={value}
+ path={key}
+ nodeName={nodeName}
+ templateName={templateName}
+ onDragStart={onDragStart}
+ depth={0}
+ />
+ ))}
+ </div>
+);
+
+export default JSONTreeRenderer;
diff --git a/client/src/components/ui/ApiKeyInput.tsx b/client/src/components/ui/ApiKeyInput.tsx
index feff9d7a..ed5cbdcf 100644
--- a/client/src/components/ui/ApiKeyInput.tsx
+++ b/client/src/components/ui/ApiKeyInput.tsx
@@ -3,8 +3,10 @@
*/
import React, { useState } from 'react';
-import { Input, Button, Space } from 'antd';
-import { SaveOutlined, DeleteOutlined, EyeOutlined, EyeInvisibleOutlined, CheckCircleOutlined } from '@ant-design/icons';
+import { Eye, EyeOff, Save, Trash2, CheckCircle, Loader2 } from 'lucide-react';
+
+import { Input } from '@/components/ui/input';
+import { Button } from '@/components/ui/button';
import { useAppTheme } from '../../hooks/useAppTheme';
interface ApiKeyInputProps {
@@ -16,9 +18,7 @@ interface ApiKeyInputProps {
loading?: boolean;
isStored?: boolean | null;
disabled?: boolean;
- /** Label for save button (default: 'Validate') */
saveLabel?: string;
- /** Label when validated/saved (default: 'Valid') */
savedLabel?: string;
}
@@ -38,45 +38,50 @@ const ApiKeyInput: React.FC<ApiKeyInputProps> = ({
const [visible, setVisible] = useState(false);
return (
- <Space.Compact style={{ width: '100%' }}>
- <Input
- type={visible ? 'text' : 'password'}
- value={value}
- onChange={e => onChange(e.target.value)}
- placeholder={placeholder}
- disabled={disabled}
- style={{
- fontFamily: 'monospace',
- backgroundColor: theme.colors.background,
- borderColor: theme.colors.border,
- color: theme.colors.text,
- }}
- suffix={
- <Button
- type="text"
- size="small"
- icon={visible ? <EyeInvisibleOutlined /> : <EyeOutlined />}
- onClick={() => setVisible(!visible)}
- style={{ color: theme.colors.textSecondary }}
- />
- }
- />
+ <div className="flex w-full items-stretch gap-1">
+ <div className="relative flex-1">
+ <Input
+ type={visible ? 'text' : 'password'}
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder={placeholder}
+ disabled={disabled}
+ className="font-mono pr-9"
+ />
+ <button
+ type="button"
+ onClick={() => setVisible((v) => !v)}
+ className="absolute top-1/2 right-2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
+ aria-label={visible ? 'Hide key' : 'Show key'}
+ >
+ {visible ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
+ </button>
+ </div>
+
<Button
- icon={isStored ? <CheckCircleOutlined /> : <SaveOutlined />}
- loading={loading}
+ variant="outline"
onClick={onSave}
- disabled={!value.trim() || disabled}
+ disabled={!value.trim() || disabled || loading}
style={{
backgroundColor: `${theme.dracula.green}25`,
borderColor: `${theme.dracula.green}60`,
color: theme.dracula.green,
}}
>
+ {loading ? (
+ <Loader2 className="h-4 w-4 animate-spin" />
+ ) : isStored ? (
+ <CheckCircle className="h-4 w-4" />
+ ) : (
+ <Save className="h-4 w-4" />
+ )}
{isStored ? savedLabel : saveLabel}
</Button>
+
{isStored && onDelete && (
<Button
- icon={<DeleteOutlined />}
+ variant="outline"
+ size="icon"
onClick={onDelete}
disabled={disabled}
style={{
@@ -84,9 +89,11 @@ const ApiKeyInput: React.FC<ApiKeyInputProps> = ({
borderColor: `${theme.dracula.pink}60`,
color: theme.dracula.pink,
}}
- />
+ >
+ <Trash2 className="h-4 w-4" />
+ </Button>
)}
- </Space.Compact>
+ </div>
);
};
diff --git a/client/src/components/ui/InputNodesPanel.tsx b/client/src/components/ui/InputNodesPanel.tsx
index 36190d47..4830ea52 100644
--- a/client/src/components/ui/InputNodesPanel.tsx
+++ b/client/src/components/ui/InputNodesPanel.tsx
@@ -1,18 +1,13 @@
import React, { useState, useEffect } from 'react';
-import { Card, Button, Space, Typography, List, Tag, Spin } from 'antd';
-import {
- LinkOutlined,
- ReloadOutlined,
- CopyOutlined,
- DatabaseOutlined
-} from '@ant-design/icons';
+import { Link2, RefreshCw, Copy, Database, Loader2 } from 'lucide-react';
+
+import { Button } from '@/components/ui/button';
+import { Badge } from '@/components/ui/badge';
import { useAppStore } from '../../store/useAppStore';
import { useWebSocket } from '../../contexts/WebSocketContext';
import DataPanel from '../shared/DataPanel';
import { copyToClipboard } from '../../utils/formatters';
-const { Text } = Typography;
-
interface InputNodesPanelProps {
nodeId: string;
}
@@ -20,7 +15,7 @@ interface InputNodesPanelProps {
interface InputDataItem {
index: number;
data: any;
- source: string; // Which node this data came from
+ source: string;
}
const InputNodesPanel: React.FC<InputNodesPanelProps> = ({ nodeId }) => {
@@ -29,7 +24,6 @@ const InputNodesPanel: React.FC<InputNodesPanelProps> = ({ nodeId }) => {
const [inputData, setInputData] = useState<InputDataItem[]>([]);
const [loading, setLoading] = useState(false);
- // Fetch actual input data from backend (async)
useEffect(() => {
const fetchInputData = async () => {
if (!currentWorkflow || !nodeId) {
@@ -40,27 +34,20 @@ const InputNodesPanel: React.FC<InputNodesPanelProps> = ({ nodeId }) => {
setLoading(true);
const nodes = currentWorkflow.nodes || [];
const edges = currentWorkflow.edges || [];
-
- // Find edges that connect TO the current node (incoming connections)
const incomingEdges = edges.filter((edge: any) => edge.target === nodeId);
-
const inputItems: InputDataItem[] = [];
- // Fetch data from backend for each connected node
for (const edge of incomingEdges) {
const sourceNode = nodes.find((node: any) => node.id === edge.source);
const sourceName = sourceNode?.data?.label || sourceNode?.type || 'Unknown';
-
- // Get the actual output data from backend via WebSocket
const outputData = await getNodeOutput(edge.source, 'output_0');
if (outputData && outputData[0] && outputData[0][0]) {
- // Real execution data exists
const actualData = outputData[0][0].json || outputData[0][0];
inputItems.push({
index: inputItems.length,
data: actualData,
- source: sourceName
+ source: sourceName,
});
}
}
@@ -77,7 +64,7 @@ const InputNodesPanel: React.FC<InputNodesPanelProps> = ({ nodeId }) => {
if (loading) {
return (
<DataPanel.Empty
- icon={<Spin size="large" />}
+ icon={<Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />}
title="Loading input data..."
description="Fetching execution data from backend"
/>
@@ -87,7 +74,7 @@ const InputNodesPanel: React.FC<InputNodesPanelProps> = ({ nodeId }) => {
if (!hasExecutionData) {
return (
<DataPanel.Empty
- icon={<DatabaseOutlined style={{ fontSize: 48, color: '#94a3b8' }} />}
+ icon={<Database className="h-12 w-12 text-muted-foreground" />}
title="No input data"
description="Execute connected nodes to see the input data received by this node"
/>
@@ -98,107 +85,73 @@ const InputNodesPanel: React.FC<InputNodesPanelProps> = ({ nodeId }) => {
<DataPanel.Root>
<DataPanel.Header
title={
- <Space>
- <LinkOutlined />
- <Text strong style={{ fontSize: 13 }}>Input Data ({inputData.length} item{inputData.length !== 1 ? 's' : ''})</Text>
- </Space>
+ <div className="flex items-center gap-2">
+ <Link2 className="h-4 w-4" />
+ <span className="text-sm font-semibold">
+ Input Data ({inputData.length} item{inputData.length !== 1 ? 's' : ''})
+ </span>
+ </div>
}
extra={
<Button
- size="small"
- icon={<ReloadOutlined />}
+ variant="ghost"
+ size="sm"
onClick={() => {
- // Trigger re-fetch by updating a dummy state
setInputData([]);
setLoading(true);
}}
- type="text"
title="Refresh input data from backend"
- loading={loading}
>
+ <RefreshCw className="h-4 w-4" />
Refresh
</Button>
}
/>
<DataPanel.Content>
- <List
- size="small"
- dataSource={inputData}
- renderItem={(inputItem) => (
- <List.Item key={inputItem.index}>
- <Card
- size="small"
- style={{
- width: '100%',
- marginBottom: 8,
- borderLeft: '4px solid #10b981'
- }}
- >
- {/* Input Item Header */}
- <div style={{
- display: 'flex',
- justifyContent: 'space-between',
- alignItems: 'center',
- marginBottom: 12
- }}>
- <Space>
- <DatabaseOutlined style={{ color: '#10b981', fontSize: 16 }} />
- <Text strong style={{ fontSize: 14 }}>
- Item {inputItem.index + 1}
- </Text>
- <Tag color="green" style={{ margin: 0 }}>
- from {inputItem.source}
- </Tag>
- </Space>
- <Button
- size="small"
- icon={<CopyOutlined />}
- onClick={() => copyToClipboard(inputItem.data, 'Input data copied to clipboard!')}
- type="text"
- title="Copy input data"
- >
- Copy
- </Button>
+ <div className="flex flex-col gap-2">
+ {inputData.map((inputItem) => (
+ <div
+ key={inputItem.index}
+ className="rounded-md border border-border border-l-4 border-l-success bg-card p-3"
+ >
+ <div className="mb-3 flex items-center justify-between">
+ <div className="flex items-center gap-2">
+ <Database className="h-4 w-4 text-success" />
+ <span className="text-sm font-semibold">Item {inputItem.index + 1}</span>
+ <Badge variant="success">from {inputItem.source}</Badge>
</div>
-
- {/* JSON Input Data */}
- <Card
- size="small"
- title={<Text strong style={{ fontSize: 12 }}>Received Data</Text>}
- headStyle={{ backgroundColor: '#f0fdf4', minHeight: 'auto', padding: '8px 12px' }}
- bodyStyle={{ padding: 12 }}
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => copyToClipboard(inputItem.data, 'Input data copied to clipboard!')}
+ title="Copy input data"
>
- <pre style={{
- margin: 0,
- fontSize: 12,
- fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
- lineHeight: 1.4,
- overflow: 'auto',
- whiteSpace: 'pre-wrap',
- wordBreak: 'break-word',
- maxHeight: 300,
- backgroundColor: '#f8fafc',
- padding: 12,
- borderRadius: 4,
- border: '1px solid #d1d5db'
- }}>
- {JSON.stringify(inputItem.data, null, 2)}
- </pre>
- </Card>
- </Card>
- </List.Item>
- )}
- />
+ <Copy className="h-4 w-4" />
+ Copy
+ </Button>
+ </div>
+
+ <div className="overflow-hidden rounded-md border border-border">
+ <div className="border-b border-border bg-muted px-3 py-1.5 text-xs font-semibold">
+ Received Data
+ </div>
+ <pre className="m-0 max-h-[300px] overflow-auto whitespace-pre-wrap break-words bg-muted/40 p-3 font-mono text-xs leading-[1.4]">
+ {JSON.stringify(inputItem.data, null, 2)}
+ </pre>
+ </div>
+ </div>
+ ))}
+ </div>
</DataPanel.Content>
<DataPanel.Footer>
- <Text type="secondary" style={{ fontSize: 11 }}>
- 💡 Shows actual data received by this node during execution
- </Text>
+ <span className="text-[11px] text-muted-foreground">
+ Shows actual data received by this node during execution
+ </span>
</DataPanel.Footer>
</DataPanel.Root>
);
};
-export default InputNodesPanel;
\ No newline at end of file
+export default InputNodesPanel;
diff --git a/client/src/components/ui/NodeOutputPanel.tsx b/client/src/components/ui/NodeOutputPanel.tsx
deleted file mode 100644
index 67bbe94a..00000000
--- a/client/src/components/ui/NodeOutputPanel.tsx
+++ /dev/null
@@ -1,319 +0,0 @@
-/**
- * NodeOutputPanel — displays execution results.
- *
- * Response text renders via Tailwind Typography (`prose`).
- * Raw JSON renders via prismjs with centralized theme tokens.
- * No node-type-specific rendering logic — the backend sends
- * standardized output, the frontend renders it uniformly.
- */
-
-import React, { useState } from 'react';
-import { Tag, Space } from 'antd';
-import ReactMarkdown from 'react-markdown';
-import remarkGfm from 'remark-gfm';
-import remarkBreaks from 'remark-breaks';
-import Prism from 'prismjs';
-import 'prismjs/components/prism-json';
-import { useAppTheme } from '../../hooks/useAppTheme';
-import { styles as themeStyles, getPrismTokenCSS } from '../../styles/theme';
-import { ExecutionResult } from '../../services/executionService';
-import { Node } from 'reactflow';
-import { copyToClipboard } from '../../utils/formatters';
-
-/** Prismjs JSON syntax highlighting (same lib as CodeEditor.tsx). */
-const highlightJSON = (json: string): React.ReactNode => (
- <code className="prism-code" dangerouslySetInnerHTML={{
- __html: Prism.highlight(json, Prism.languages.json, 'json'),
- }} />
-);
-
-// ============================================================================
-// Thinking/Reasoning block (collapsible)
-// ============================================================================
-
-interface ThinkingBlockProps {
- thinking: string;
- provider?: string;
- theme: ReturnType<typeof useAppTheme>;
-}
-
-const ThinkingBlock: React.FC<ThinkingBlockProps> = ({ thinking, provider, theme }) => {
- const [isExpanded, setIsExpanded] = useState(true);
- if (!thinking?.trim()) return null;
-
- const label = provider?.includes('anthropic') ? 'Extended Thinking'
- : provider?.includes('openai') ? 'Reasoning'
- : 'Thinking';
-
- return (
- <div style={{
- border: `1px solid ${theme.dracula.orange}40`,
- borderRadius: theme.borderRadius.md,
- borderLeft: `3px solid ${theme.dracula.orange}`,
- overflow: 'hidden',
- }}>
- <div
- onClick={() => setIsExpanded(!isExpanded)}
- style={{
- display: 'flex', alignItems: 'center', gap: theme.spacing.sm,
- padding: `${theme.spacing.sm} ${theme.spacing.md}`,
- cursor: 'pointer', backgroundColor: `${theme.dracula.orange}10`,
- fontSize: theme.fontSize.xs, fontWeight: theme.fontWeight.semibold,
- color: theme.dracula.orange, textTransform: 'uppercase', letterSpacing: '0.1em',
- }}
- >
- <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor"
- strokeWidth="2" style={{ transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)', transition: '0.2s' }}>
- <polyline points="9 18 15 12 9 6"/>
- </svg>
- {label}
- </div>
- {isExpanded && (
- <div className="prose prose-sm dark:prose-invert max-w-none" style={{
- padding: theme.spacing.md, fontSize: theme.fontSize.sm,
- maxHeight: '300px', overflow: 'auto',
- }}>
- <ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]}>
- {thinking.replace(/\\n/g, '\n')}
- </ReactMarkdown>
- </div>
- )}
- </div>
- );
-};
-
-// ============================================================================
-// Data extraction helpers (minimal, no node-type-specific formatting)
-// ============================================================================
-
-/** Extract output data object from ExecutionResult. */
-const getOutputData = (result: ExecutionResult) => {
- if (result.outputs && Object.keys(result.outputs).length > 0) return result.outputs;
- if (result.data && Object.keys(result.data).length > 0) return result.data;
- if (result.nodeData?.[0]?.[0]?.json) return result.nodeData[0][0].json;
- return { success: result.success, message: 'Execution completed' };
-};
-
-/** Extract thinking content from result. */
-const getThinkingContent = (result: ExecutionResult) => {
- const data = getOutputData(result);
- if (data?.result?.thinking) return { thinking: data.result.thinking, provider: data.result.provider };
- if (data?.thinking) return { thinking: data.thinking, provider: data?.provider };
- return { thinking: null as string | null };
-};
-
-/** Extract the main response text. Checks standard response field paths. */
-const getMainResponse = (result: ExecutionResult): string | null => {
- const data = getOutputData(result);
- // Standard response fields (covers AI agents, code executors, tools)
- const text = data?.output ?? data?.result?.response ?? data?.response
- ?? data?.result?.text ?? data?.text
- ?? data?.result?.content ?? data?.content
- ?? data?.result?.message ?? data?.result?.preview ?? data?.preview;
- if (text !== undefined && text !== null) {
- return typeof text === 'string' ? text : JSON.stringify(text, null, 2);
- }
- // Shell/command output
- if (data?.stdout !== undefined || data?.result?.stdout !== undefined) {
- const r = data?.result ?? data;
- return `$ ${r.command ?? ''}\n[${r.exit_code === 0 ? 'OK' : `Exit ${r.exit_code}`}]\n\n${r.stdout || '(no output)'}`;
- }
- return null;
-};
-
-// ============================================================================
-// Component
-// ============================================================================
-
-interface NodeOutputPanelProps {
- results: ExecutionResult[];
- onClear?: () => void;
- selectedNode?: Node | null;
-}
-
-const NodeOutputPanel: React.FC<NodeOutputPanelProps> = ({ results, onClear, selectedNode }) => {
- const theme = useAppTheme();
- const [showRawJson, setShowRawJson] = useState(false);
-
- const nodeResults = selectedNode
- ? results.filter(r => r.nodeId === selectedNode.id)
- : results;
-
- if (nodeResults.length === 0) {
- return (
- <div style={{
- width: '100%', height: '100%', display: 'flex',
- alignItems: 'center', justifyContent: 'center',
- color: theme.colors.textMuted, fontSize: theme.fontSize.sm,
- }}>
- No output yet. Run a node to see results.
- </div>
- );
- }
-
- const latestResult = nodeResults[0];
- const outputData = getOutputData(latestResult);
- const mainResponse = getMainResponse(latestResult);
- const { thinking, provider } = getThinkingContent(latestResult);
-
- return (
- <div style={{
- width: '100%', height: '100%',
- backgroundColor: theme.colors.backgroundPanel,
- display: 'flex', flexDirection: 'column', overflow: 'hidden',
- }}>
- {/* Header */}
- <div style={{
- padding: `${theme.spacing.md} ${theme.spacing.lg}`,
- borderBottom: `1px solid ${theme.colors.border}`,
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- backgroundColor: theme.colors.backgroundElevated, flexShrink: 0,
- }}>
- <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.md }}>
- <svg width="16" height="16" viewBox="0 0 24 24"
- fill={latestResult.success ? theme.dracula.green : theme.dracula.red} stroke="none">
- {latestResult.success
- ? <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"/>
- : <path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"/>}
- </svg>
- <span style={{ fontSize: theme.fontSize.base, fontWeight: theme.fontWeight.semibold, color: theme.colors.text }}>
- Output
- </span>
- <Tag color={latestResult.success ? 'green' : 'red'}>
- {latestResult.success ? 'Success' : 'Error'}
- </Tag>
- {latestResult.executionTime > 0 && (
- <Tag>{(latestResult.executionTime / 1000).toFixed(1)}s</Tag>
- )}
- </div>
- {onClear && (
- <button onClick={onClear} style={{
- padding: `${theme.spacing.xs} ${theme.spacing.md}`,
- fontSize: theme.fontSize.xs, cursor: 'pointer',
- color: theme.dracula.pink, backgroundColor: `${theme.dracula.pink}15`,
- border: `1px solid ${theme.dracula.pink}40`, borderRadius: theme.borderRadius.sm,
- }}>
- Clear
- </button>
- )}
- </div>
-
- {/* Content */}
- <div style={{
- flex: 1, overflow: 'auto', padding: theme.spacing.lg,
- display: 'flex', flexDirection: 'column', gap: theme.spacing.md,
- }}>
- {/* Error */}
- {latestResult.error && (
- <pre style={{
- margin: 0, padding: theme.spacing.md,
- backgroundColor: `${theme.dracula.red}10`,
- border: `1px solid ${theme.dracula.red}40`,
- borderRadius: theme.borderRadius.md, borderLeft: `3px solid ${theme.dracula.red}`,
- fontSize: theme.fontSize.sm, fontFamily: theme.fontFamily.mono,
- color: theme.dracula.red, whiteSpace: 'pre-wrap', wordBreak: 'break-word',
- }}>
- {latestResult.error}
- </pre>
- )}
-
- {/* Thinking/Reasoning */}
- {thinking && <ThinkingBlock thinking={thinking} provider={provider} theme={theme} />}
-
- {/* Main Response (markdown via Tailwind Typography) */}
- {mainResponse && (
- <div className="prose prose-sm dark:prose-invert max-w-none">
- <ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]}>
- {mainResponse.replace(/\\n/g, '\n').replace(/\\t/g, '\t')}
- </ReactMarkdown>
- </div>
- )}
-
- {/* Execution Metadata */}
- {(() => {
- const r = outputData?.result || outputData;
- if (!r?.provider && !r?.agent_type && !r?.model) return null;
- const tags: [string, string][] = [];
- if (r.provider) tags.push([r.provider, 'cyan']);
- if (r.model) tags.push([r.model, 'purple']);
- if (r.agent_type) tags.push([r.agent_type.replace(/_/g, ' '), 'green']);
- if (r.iterations > 1) tags.push([`${r.iterations} iterations`, 'orange']);
- if (r.messages_count) tags.push([`${r.messages_count} msgs`, 'default']);
- return (
- <Space wrap size={[4, 4]}>
- {tags.map(([val, color], i) => <Tag key={i} color={color}>{val}</Tag>)}
- </Space>
- );
- })()}
-
- {/* Raw JSON (collapsible) */}
- <div style={{
- backgroundColor: theme.colors.backgroundElevated,
- border: `1px solid ${theme.colors.border}`,
- borderRadius: theme.borderRadius.md, overflow: 'hidden',
- display: 'flex', flexDirection: 'column',
- flex: showRawJson ? 1 : undefined,
- minHeight: showRawJson ? 0 : undefined,
- }}>
- <div
- onClick={() => setShowRawJson(!showRawJson)}
- style={{
- display: 'flex', alignItems: 'center', justifyContent: 'space-between',
- padding: `${theme.spacing.sm} ${theme.spacing.md}`,
- backgroundColor: theme.colors.backgroundAlt, cursor: 'pointer',
- borderBottom: showRawJson ? `1px solid ${theme.colors.border}` : 'none',
- }}
- >
- <div style={{ display: 'flex', alignItems: 'center', gap: theme.spacing.sm }}>
- <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor"
- strokeWidth="2" style={{ transform: showRawJson ? 'rotate(90deg)' : 'rotate(0deg)', transition: '0.2s' }}>
- <polyline points="9 18 15 12 9 6"/>
- </svg>
- <span style={{ fontSize: theme.fontSize.sm, fontWeight: theme.fontWeight.medium, color: theme.colors.text }}>
- {showRawJson ? 'Hide' : 'Show'} Raw JSON
- </span>
- </div>
- <button
- onClick={(e) => { e.stopPropagation(); copyToClipboard(outputData, 'Copied!'); }}
- style={{
- padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
- fontSize: theme.fontSize.xs, cursor: 'pointer',
- color: theme.dracula.cyan, backgroundColor: `${theme.dracula.cyan}15`,
- border: `1px solid ${theme.dracula.cyan}40`, borderRadius: theme.borderRadius.sm,
- }}
- >
- Copy
- </button>
- </div>
-
- {showRawJson && (
- <div style={{
- ...themeStyles.codeBlock.container,
- padding: theme.spacing.md, flex: 1, minHeight: 0,
- backgroundColor: theme.colors.backgroundAlt,
- color: theme.dracula.foreground,
- }}>
- <style>{getPrismTokenCSS(theme)}</style>
- {highlightJSON(JSON.stringify(outputData, null, 2).replace(/\\n/g, '\n').replace(/\\t/g, '\t'))}
- </div>
- )}
- </div>
- </div>
-
- {/* Footer (multi-result indicator) */}
- {nodeResults.length > 1 && (
- <div style={{
- padding: `${theme.spacing.sm} ${theme.spacing.lg}`,
- borderTop: `1px solid ${theme.colors.border}`,
- backgroundColor: theme.colors.background,
- fontSize: theme.fontSize.xs, color: theme.colors.textMuted,
- textAlign: 'center', flexShrink: 0,
- }}>
- Showing latest of {nodeResults.length} results
- </div>
- )}
- </div>
- );
-};
-
-export default NodeOutputPanel;
diff --git a/client/src/components/ui/QRCodeDisplay.tsx b/client/src/components/ui/QRCodeDisplay.tsx
index c245f4c1..ba91d722 100644
--- a/client/src/components/ui/QRCodeDisplay.tsx
+++ b/client/src/components/ui/QRCodeDisplay.tsx
@@ -1,15 +1,11 @@
/**
* QRCodeDisplay - QR code viewer supporting both raw data and pre-encoded base64 images
- *
- * Handles two types of QR data:
- * 1. Base64 PNG images (from WhatsApp backend) - displayed directly as <img>
- * 2. Raw data strings (from Android) - encoded using qrcode.react
*/
import React, { useState, useEffect } from 'react';
import { QRCodeSVG } from 'qrcode.react';
-import { Spin, Result, Alert } from 'antd';
-import { CheckCircleOutlined, LoadingOutlined, QrcodeOutlined, WarningOutlined } from '@ant-design/icons';
+import { CheckCircle, Loader2, QrCode, AlertTriangle } from 'lucide-react';
+import { Alert, AlertTitle, AlertDescription } from '@/components/ui/alert';
interface QRCodeDisplayProps {
value?: string | null;
@@ -21,28 +17,14 @@ interface QRCodeDisplayProps {
emptyText?: string;
}
-/**
- * Check if the value is a base64-encoded image (PNG/JPEG)
- * Base64 images are typically very long strings without special QR characters
- */
const isBase64Image = (value: string): boolean => {
- // Base64 images are typically > 100 chars and contain only base64 characters
if (value.length < 100) return false;
-
- // Check if it starts with data URI prefix
if (value.startsWith('data:image/')) return true;
-
- // Check if it looks like raw base64 (no data: prefix but valid base64 chars)
- // Base64 PNG typically starts with 'iVBOR' and base64 JPEG with '/9j/'
if (value.startsWith('iVBOR') || value.startsWith('/9j/')) return true;
-
- // General check: if it's very long and contains only base64 chars, it's likely an image
- // QR code raw data is typically short (< 4000 chars) and may contain special chars
if (value.length > 5000) {
const base64Regex = /^[A-Za-z0-9+/=]+$/;
return base64Regex.test(value);
}
-
return false;
};
@@ -57,92 +39,78 @@ const QRCodeDisplay: React.FC<QRCodeDisplayProps> = ({
}) => {
if (isConnected) {
return (
- <Result
- icon={<CheckCircleOutlined style={{ color: '#52c41a' }} />}
- title={connectedTitle}
- subTitle={connectedSubtitle}
- />
+ <div className="flex flex-col items-center gap-3 p-8 text-center">
+ <CheckCircle className="h-10 w-10 text-success" />
+ <div className="text-base font-semibold">{connectedTitle}</div>
+ <div className="text-sm text-muted-foreground">{connectedSubtitle}</div>
+ </div>
);
}
if (loading) {
return (
- <div style={{ textAlign: 'center', padding: 40 }}>
- <Spin indicator={<LoadingOutlined style={{ fontSize: 32 }} />} />
- <div style={{ marginTop: 16, color: '#888' }}>Waiting for QR code...</div>
+ <div className="p-10 text-center">
+ <Loader2 className="mx-auto h-8 w-8 animate-spin text-muted-foreground" />
+ <div className="mt-4 text-sm text-muted-foreground">Waiting for QR code...</div>
</div>
);
}
if (!value) {
return (
- <div style={{ textAlign: 'center', padding: 40, color: '#888' }}>
- <QrcodeOutlined style={{ fontSize: 48, opacity: 0.3 }} />
- <div style={{ marginTop: 16 }}>{emptyText}</div>
+ <div className="p-10 text-center text-muted-foreground">
+ <QrCode className="mx-auto h-12 w-12 opacity-30" />
+ <div className="mt-4">{emptyText}</div>
</div>
);
}
- // If value is already a base64 image, display it directly
if (isBase64Image(value)) {
const imgSrc = value.startsWith('data:') ? value : `data:image/png;base64,${value}`;
return (
- <div style={{ textAlign: 'center', padding: 16 }}>
+ <div className="p-4 text-center">
<img
src={imgSrc}
alt="QR Code"
- style={{
- width: size,
- height: size,
- imageRendering: 'pixelated'
- }}
+ style={{ width: size, height: size, imageRendering: 'pixelated' }}
/>
</div>
);
}
- // Otherwise, use qrcode.react to generate the QR code
return <QRCodeRenderer value={value} size={size} />;
};
-/**
- * Inner component that handles QR code rendering with error catching
- */
const QRCodeRenderer: React.FC<{ value: string; size: number }> = ({ value, size }) => {
const [error, setError] = useState<string | null>(null);
- // Reset error state when value changes
useEffect(() => {
setError(null);
}, [value]);
if (error) {
return (
- <div style={{ textAlign: 'center', padding: 24 }}>
- <Alert
- message="QR Code Error"
- description="The QR code data is too large to display. Please try refreshing or reconnecting."
- type="warning"
- icon={<WarningOutlined />}
- showIcon
- />
+ <div className="p-6 text-center">
+ <Alert variant="warning">
+ <AlertTriangle className="h-4 w-4" />
+ <AlertTitle>QR Code Error</AlertTitle>
+ <AlertDescription>
+ The QR code data is too large to display. Please try refreshing or reconnecting.
+ </AlertDescription>
+ </Alert>
</div>
);
}
- // Wrap in error boundary using componentDidCatch equivalent
return (
<QRCodeErrorBoundary onError={(err) => setError(err)}>
- <div style={{ textAlign: 'center', padding: 16 }}>
+ <div className="p-4 text-center">
<QRCodeSVG value={value} size={size} level="L" />
</div>
</QRCodeErrorBoundary>
);
};
-/**
- * Error boundary for catching QR code rendering errors
- */
class QRCodeErrorBoundary extends React.Component<
{ children: React.ReactNode; onError: (error: string) => void },
{ hasError: boolean }
@@ -164,14 +132,14 @@ class QRCodeErrorBoundary extends React.Component<
render() {
if (this.state.hasError) {
return (
- <div style={{ textAlign: 'center', padding: 24 }}>
- <Alert
- message="QR Code Error"
- description="The QR code data is too large to display. Please try refreshing or reconnecting."
- type="warning"
- icon={<WarningOutlined />}
- showIcon
- />
+ <div className="p-6 text-center">
+ <Alert variant="warning">
+ <AlertTriangle className="h-4 w-4" />
+ <AlertTitle>QR Code Error</AlertTitle>
+ <AlertDescription>
+ The QR code data is too large to display. Please try refreshing or reconnecting.
+ </AlertDescription>
+ </Alert>
</div>
);
}
diff --git a/client/src/components/ui/alert.tsx b/client/src/components/ui/alert.tsx
index 1fe3176d..6a979d70 100644
--- a/client/src/components/ui/alert.tsx
+++ b/client/src/components/ui/alert.tsx
@@ -11,6 +11,12 @@ const alertVariants = cva(
default: "bg-card text-card-foreground",
destructive:
"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
+ success:
+ "border-success/30 bg-success/5 text-success *:data-[slot=alert-description]:text-success/90 *:[svg]:text-current",
+ warning:
+ "border-warning/30 bg-warning/5 text-warning *:data-[slot=alert-description]:text-warning/90 *:[svg]:text-current",
+ info:
+ "border-info/30 bg-info/5 text-info *:data-[slot=alert-description]:text-info/90 *:[svg]:text-current",
},
},
defaultVariants: {
diff --git a/client/src/components/ui/badge.tsx b/client/src/components/ui/badge.tsx
index cacff11d..859c9a9d 100644
--- a/client/src/components/ui/badge.tsx
+++ b/client/src/components/ui/badge.tsx
@@ -19,6 +19,9 @@ const badgeVariants = cva(
ghost:
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
link: "text-primary underline-offset-4 hover:underline",
+ success: "bg-success/15 text-success border-success/30",
+ warning: "bg-warning/15 text-warning border-warning/30",
+ info: "bg-info/15 text-info border-info/30",
},
},
defaultVariants: {