Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(ui): Phase 3 (partial) - Modal shell + Collapse to shadcn
trohitgaf88ec5e6e82
diff --git a/client/src/components/credentials/panels/EmailPanel.tsx b/client/src/components/credentials/panels/EmailPanel.tsxindex c8c992c9..8408bda1 100644--- a/client/src/components/credentials/panels/EmailPanel.tsx+++ b/client/src/components/credentials/panels/EmailPanel.tsx@@ -11,7 +11,6 @@import React, { useState, useEffect, useCallback } from 'react';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';@@ -232,7 +231,6 @@ const EmailPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co<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>diff --git a/client/src/components/credentials/sections/ApiUsageSection.tsx b/client/src/components/credentials/sections/ApiUsageSection.tsxindex 088f8a36..0ee06c2c 100644--- a/client/src/components/credentials/sections/ApiUsageSection.tsx+++ b/client/src/components/credentials/sections/ApiUsageSection.tsx@@ -4,11 +4,17 @@*/import React, { useState, useEffect, useCallback } from 'react';-import { Collapse, Button } from 'antd';+import { Button } from 'antd';import { DollarSign, RefreshCw, Loader2 } from 'lucide-react';import { Badge } from '@/components/ui/badge';import { Alert, AlertDescription } from '@/components/ui/alert';+import {+ Accordion,+ AccordionItem,+ AccordionTrigger,+ AccordionContent,+} from '@/components/ui/accordion';import { useApiKeys, type APIUsageSummary } from '../../../hooks/useApiKeys';interface Props {@@ -39,17 +45,16 @@ const ApiUsageSection: React.FC<Props> = ({ service, serviceName }) => {) : null;return (- <Collapse- items={[- {- key: 'usage',- label: (- <span className="flex items-center gap-2">- <DollarSign className="h-4 w-4 text-dracula-yellow" />- API Usage & Costs {costBadge}- </span>- ),- children: loading ? (+ <Accordion type="single" collapsible>+ <AccordionItem value="usage">+ <AccordionTrigger>+ <span className="flex items-center gap-2">+ <DollarSign className="h-4 w-4 text-dracula-yellow" />+ API Usage & Costs {costBadge}+ </span>+ </AccordionTrigger>+ <AccordionContent>+ {loading ? (<div className="flex justify-center p-4"><Loader2 className="h-4 w-4 animate-spin text-muted-foreground" /></div>@@ -93,10 +98,10 @@ const ApiUsageSection: React.FC<Props> = ({ service, serviceName }) => {Refresh</Button></div>- ),- },- ]}- />+ )}+ </AccordionContent>+ </AccordionItem>+ </Accordion>);};diff --git a/client/src/components/credentials/sections/LlmUsageSection.tsx b/client/src/components/credentials/sections/LlmUsageSection.tsxindex 746ec016..72c907d6 100644--- a/client/src/components/credentials/sections/LlmUsageSection.tsx+++ b/client/src/components/credentials/sections/LlmUsageSection.tsx@@ -3,10 +3,16 @@*/import React, { useState, useEffect, useCallback } from 'react';-import { Collapse, Button } from 'antd';+import { Button } from 'antd';import { DollarSign, RefreshCw, Loader2 } from 'lucide-react';import { Alert, AlertDescription } from '@/components/ui/alert';+import {+ Accordion,+ AccordionItem,+ AccordionTrigger,+ AccordionContent,+} from '@/components/ui/accordion';import { useApiKeys, type ProviderUsageSummary } from '../../../hooks/useApiKeys';interface Props {@@ -47,20 +53,19 @@ const LlmUsageSection: React.FC<Props> = ({ providerId, providerName }) => {}, [expanded, load]);return (- <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 & Costs- </span>- ),- children: loading ? (+ <Accordion+ type="single"+ collapsible+ onValueChange={(value) => setExpanded(value === 'usage')}+ >+ <AccordionItem value="usage">+ <AccordionTrigger>+ <span className="flex items-center gap-2">+ <DollarSign className="h-4 w-4" /> Usage & Costs+ </span>+ </AccordionTrigger>+ <AccordionContent>+ {loading ? (<div className="flex justify-center p-4"><Loader2 className="h-4 w-4 animate-spin text-muted-foreground" /></div>@@ -130,10 +135,10 @@ const LlmUsageSection: React.FC<Props> = ({ providerId, providerName }) => {Refresh</Button></div>- ),- },- ]}- />+ )}+ </AccordionContent>+ </AccordionItem>+ </Accordion>);};diff --git a/client/src/components/credentials/sections/ProviderDefaultsSection.tsx b/client/src/components/credentials/sections/ProviderDefaultsSection.tsxindex 6ff1fed6..2cc46e17 100644--- a/client/src/components/credentials/sections/ProviderDefaultsSection.tsx+++ b/client/src/components/credentials/sections/ProviderDefaultsSection.tsx@@ -10,10 +10,16 @@*/import React, { useState, useEffect, useCallback } from 'react';-import { Form, Collapse, Select, InputNumber, Switch, Button } from 'antd';+import { Form, Select, InputNumber, Switch, Button } from 'antd';import { Settings } from 'lucide-react';import { Badge } from '@/components/ui/badge';+import {+ Accordion,+ AccordionItem,+ AccordionTrigger,+ AccordionContent,+} from '@/components/ui/accordion';import { useAppTheme } from '../../../hooks/useAppTheme';import { useApiKeys, type ProviderDefaults, type ModelConstraints } from '../../../hooks/useApiKeys';@@ -92,16 +98,16 @@ const ProviderDefaultsSection: React.FC<Props> = ({ providerId }) => {});return (- <Collapse ghost defaultActiveKey={['defaults']} items={[{- key: 'defaults',- label: (- <span className="flex items-center gap-2">- <Settings className="h-4 w-4" /> Default Parameters- </span>- ),- children: (- <div className={loading ? 'pointer-events-none opacity-60' : ''}>- <Form form={form} layout="vertical" size="small" onValuesChange={() => setDirty(true)} preserve>+ <Accordion type="single" collapsible defaultValue="defaults">+ <AccordionItem value="defaults">+ <AccordionTrigger>+ <span className="flex items-center gap-2">+ <Settings className="h-4 w-4" /> Default Parameters+ </span>+ </AccordionTrigger>+ <AccordionContent>+ <div className={loading ? 'pointer-events-none opacity-60' : ''}>+ <Form form={form} layout="vertical" size="small" onValuesChange={() => setDirty(true)} preserve><Form.Itemlabel="Default Model"name="default_model"@@ -176,9 +182,10 @@ const ProviderDefaultsSection: React.FC<Props> = ({ providerId }) => {Save Defaults</Button></Form>- </div>- ),- }]} />+ </div>+ </AccordionContent>+ </AccordionItem>+ </Accordion>);};diff --git a/client/src/components/credentials/sections/RateLimitSection.tsx b/client/src/components/credentials/sections/RateLimitSection.tsxindex 15b25833..034267a0 100644--- a/client/src/components/credentials/sections/RateLimitSection.tsx+++ b/client/src/components/credentials/sections/RateLimitSection.tsx@@ -4,9 +4,15 @@*/import React, { useState, useEffect, useCallback } from 'react';-import { Form, Collapse, InputNumber, Switch, Button } from 'antd';+import { Form, InputNumber, Switch, Button } from 'antd';import { Alert, AlertDescription } from '@/components/ui/alert';+import {+ Accordion,+ AccordionItem,+ AccordionTrigger,+ AccordionContent,+} from '@/components/ui/accordion';import { useAppTheme } from '../../../hooks/useAppTheme';import { useWebSocket, type RateLimitConfig, type RateLimitStats } from '../../../contexts/WebSocketContext';@@ -67,19 +73,22 @@ const RateLimitSection: React.FC = () => {}, [unpauseWhatsAppRateLimit]);return (- <Collapse items={[{- key: 'ratelimits',- label: 'Rate Limits',- extra: (- <span onClick={e => e.stopPropagation()}>- <Form form={form} component={false}>- <Form.Item name="enabled" valuePropName="checked" noStyle>- <Switch size="small" onChange={() => setDirty(true)} />- </Form.Item>- </Form>- </span>- ),- children: !loaded ? (+ <Accordion type="single" collapsible>+ <AccordionItem value="ratelimits">+ <AccordionTrigger>+ <div className="flex w-full items-center justify-between gap-2">+ <span>Rate Limits</span>+ <span onClick={(e) => e.stopPropagation()}>+ <Form form={form} component={false}>+ <Form.Item name="enabled" valuePropName="checked" noStyle>+ <Switch size="small" onChange={() => setDirty(true)} />+ </Form.Item>+ </Form>+ </span>+ </div>+ </AccordionTrigger>+ <AccordionContent>+ {!loaded ? (<div className="flex justify-center p-4 text-sm text-muted-foreground">Loading...</div>) : (<Form form={form} layout="vertical" size="small" onValuesChange={() => setDirty(true)}>@@ -156,8 +165,10 @@ const RateLimitSection: React.FC = () => {Save Changes</Button></Form>- ),- }]} />+ )}+ </AccordionContent>+ </AccordionItem>+ </Accordion>);};diff --git a/client/src/components/parameterPanel/MiddleSection.tsx b/client/src/components/parameterPanel/MiddleSection.tsxindex 995f774a..a3207173 100644--- a/client/src/components/parameterPanel/MiddleSection.tsx+++ b/client/src/components/parameterPanel/MiddleSection.tsx@@ -1,7 +1,13 @@import React, { useState, useEffect } from 'react';-import { Collapse, Progress, Statistic, Row, Col, InputNumber, Button } from 'antd';+import { Progress, Statistic, Row, Col, InputNumber, Button } from 'antd';import { Loader2 } from 'lucide-react';import { toast } from 'sonner';+import {+ Accordion,+ AccordionItem,+ AccordionTrigger,+ AccordionContent,+} from '@/components/ui/accordion';import { ThunderboltOutlined, EditOutlined, SaveOutlined } from '@ant-design/icons';import ParameterRenderer from '../ParameterRenderer';import ToolSchemaEditor from './ToolSchemaEditor';@@ -777,27 +783,27 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({{/* Token Usage Section - Only for agent nodes with memory connected */}{isAgentWithSkills && connectedMemorySessionId && (- <Collapse- defaultActiveKey={['tokens']}- style={{ marginTop: 16 }}- items={[{- key: 'tokens',- label: (() => {- const ctxLen = compactionStats?.context_length || 0;- const displayMax = ctxLen > 0 ? ctxLen : compactionStats?.threshold || 0;- return (- <span style={{ display: 'flex', alignItems: 'center', gap: 8 }}>- <ThunderboltOutlined />- Token Usage- {compactionStats && displayMax > 0 && (- <span className="ml-auto text-xs text-muted-foreground">- {Math.round(compactionStats.total / 1000)}K / {Math.round(displayMax / 1000)}K{ctxLen > 0 ? ' context' : ''}- </span>- )}- </span>- );- })(),- children: compactionLoading ? (+ <Accordion type="single" collapsible defaultValue="tokens" style={{ marginTop: 16 }}>+ <AccordionItem value="tokens">+ <AccordionTrigger>+ {(() => {+ const ctxLen = compactionStats?.context_length || 0;+ const displayMax = ctxLen > 0 ? ctxLen : compactionStats?.threshold || 0;+ return (+ <span className="flex flex-1 items-center gap-2">+ <ThunderboltOutlined />+ Token Usage+ {compactionStats && displayMax > 0 && (+ <span className="ml-auto text-xs text-muted-foreground">+ {Math.round(compactionStats.total / 1000)}K / {Math.round(displayMax / 1000)}K{ctxLen > 0 ? ' context' : ''}+ </span>+ )}+ </span>+ );+ })()}+ </AccordionTrigger>+ <AccordionContent>+ {compactionLoading ? (<Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />) : compactionStats ? (() => {const ctxLen = compactionStats.context_length || 0;@@ -878,9 +884,10 @@ const MiddleSection: React.FC<MiddleSectionProps> = ({);})() : (<span className="text-xs text-muted-foreground">No data yet. Run the agent to start tracking.</span>- )- }]}- />+ )}+ </AccordionContent>+ </AccordionItem>+ </Accordion>)}{/* Connected Skills Section - Only for Zeenie nodes */}diff --git a/client/src/components/ui/Modal.tsx b/client/src/components/ui/Modal.tsxindex 05e5660d..1632e388 100644--- a/client/src/components/ui/Modal.tsx+++ b/client/src/components/ui/Modal.tsx@@ -1,6 +1,22 @@+/**+ * Modal — thin wrapper around shadcn Dialog.+ *+ * Preserves the existing API (`isOpen`, `onClose`, `title`, `maxWidth`,+ * `maxHeight`, `headerActions`, `autoHeight`) so call sites don't churn.+ */+import React from 'react';-import * as Dialog from '@radix-ui/react-dialog';-import { useAppTheme } from '../../hooks/useAppTheme';+import { X, Settings } from 'lucide-react';+import {+ Dialog,+ DialogPortal,+ DialogOverlay,+ DialogTitle,+ DialogDescription,+ DialogClose,+} from '@/components/ui/dialog';+import { Dialog as DialogPrimitive } from 'radix-ui';+import { cn } from '@/lib/utils';interface ModalProps {isOpen: boolean;@@ -10,8 +26,10 @@ interface ModalProps {maxWidth?: string;maxHeight?: string;headerActions?: React.ReactNode;- /** When true, modal height fits content up to maxHeight instead of fixed at maxHeight */+ /** When true, modal height fits content up to maxHeight instead of fixed at maxHeight. */autoHeight?: boolean;+ /** Optional extra classes for the content panel. */+ className?: string;}const Modal: React.FC<ModalProps> = ({@@ -23,133 +41,52 @@ const Modal: React.FC<ModalProps> = ({maxHeight = '80vh',headerActions,autoHeight = false,+ className,}) => {- const theme = useAppTheme();+ const showHeader = Boolean(title || headerActions);+return (- <Dialog.Root open={isOpen}>- <Dialog.Portal>- <Dialog.Overlay- style={{- position: 'fixed',- inset: 0,- backgroundColor: 'rgba(0, 0, 0, 0.5)',- backdropFilter: 'blur(2px)',- zIndex: 1000,- }}- />- <Dialog.Content+ <Dialog open={isOpen} onOpenChange={(next) => { if (!next) onClose(); }}>+ <DialogPortal>+ <DialogOverlay className="bg-black/50 supports-backdrop-filter:backdrop-blur-xs" />+ <DialogPrimitive.Content+ data-slot="dialog-content"+ className={cn(+ 'fixed top-1/2 left-1/2 z-50 flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg border border-border bg-background shadow-2xl outline-none',+ 'data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 duration-100',+ className+ )}style={{- position: 'fixed',- top: '50%',- left: '50%',- transform: 'translate(-50%, -50%)',- backgroundColor: theme.colors.background,- borderRadius: theme.borderRadius.lg,- boxShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.25)',width: maxWidth,minWidth: maxWidth,height: autoHeight ? 'auto' : maxHeight,- maxHeight: maxHeight,- display: 'flex',- flexDirection: 'column',- overflow: 'hidden',- zIndex: 1001,+ maxHeight,}}>- {(title || headerActions) && (- <div- style={{- padding: `${theme.spacing.lg} ${theme.spacing.xl}`,- borderBottom: `1px solid ${theme.colors.border}`,- backgroundColor: theme.colors.backgroundPanel,- display: 'flex',- alignItems: 'center',- position: 'relative',- width: '100%'- }}- >- <Dialog.Title- style={{- margin: 0,- fontSize: theme.fontSize.lg,- fontWeight: theme.fontWeight.semibold,- color: theme.colors.textSecondary,- position: 'absolute',- left: theme.spacing.xl,- display: 'flex',- alignItems: 'center',- gap: '8px',- }}- >- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" style={{ opacity: 0.7 }}>- <circle cx="12" cy="12" r="3"/>- <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>- </svg>+ {showHeader ? (+ <div className="relative flex w-full items-center border-b border-border bg-card px-5 py-3">+ <DialogTitle className="absolute left-5 flex items-center gap-2 text-base font-semibold text-foreground/80">+ <Settings className="h-4 w-4 opacity-70" />{title}- </Dialog.Title>-- {/* Centered header actions */}- <div style={{- flex: 1,- display: 'flex',- justifyContent: 'center',- alignItems: 'center'- }}>- {headerActions}- </div>-- <Dialog.Close+ </DialogTitle>+ <div className="flex flex-1 items-center justify-center">{headerActions}</div>+ <DialogCloseonClick={onClose}- style={{- background: 'transparent',- border: 'none',- fontSize: '20px',- cursor: 'pointer',- color: theme.colors.textSecondary,- padding: theme.spacing.xs,- borderRadius: theme.borderRadius.sm,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- width: '32px',- height: '32px',- position: 'absolute',- right: theme.spacing.xl,- transition: `all ${theme.transitions.fast}`,- }}- onMouseEnter={(e) => {- e.currentTarget.style.backgroundColor = theme.colors.backgroundHover;- e.currentTarget.style.color = theme.colors.text;- }}- onMouseLeave={(e) => {- e.currentTarget.style.backgroundColor = 'transparent';- e.currentTarget.style.color = theme.colors.textSecondary;- }}+ className="absolute right-5 inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"+ aria-label="Close">- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">- <line x1="18" y1="6" x2="6" y2="18"/>- <line x1="6" y1="6" x2="18" y2="18"/>- </svg>- </Dialog.Close>+ <X className="h-[18px] w-[18px]" />+ </DialogClose></div>+ ) : (+ <DialogTitle className="sr-only">{title || 'Dialog'}</DialogTitle>)}- <Dialog.Description style={{ display: 'none' }}>- {title || 'Modal dialog'}- </Dialog.Description>- <div- style={{- flex: 1,- height: '100%',- overflowY: 'auto',- padding: 0,- }}- >- {children}- </div>- </Dialog.Content>- </Dialog.Portal>- </Dialog.Root>+ <DialogDescription className="sr-only">{title || 'Modal dialog'}</DialogDescription>+ <div className="h-full flex-1 overflow-y-auto">{children}</div>+ </DialogPrimitive.Content>+ </DialogPortal>+ </Dialog>);};-export default Modal;\ No newline at end of file+export default Modal;diff --git a/client/src/components/ui/accordion.tsx b/client/src/components/ui/accordion.tsxnew file mode 100644index 00000000..fcfee5ca--- /dev/null+++ b/client/src/components/ui/accordion.tsx@@ -0,0 +1,79 @@+import * as React from "react"+import { Accordion as AccordionPrimitive } from "radix-ui"++import { cn } from "@/lib/utils"+import { ChevronDownIcon, ChevronUpIcon } from "lucide-react"++function Accordion({+ className,+ ...props+}: React.ComponentProps<typeof AccordionPrimitive.Root>) {+ return (+ <AccordionPrimitive.Root+ data-slot="accordion"+ className={cn("flex w-full flex-col", className)}+ {...props}+ />+ )+}++function AccordionItem({+ className,+ ...props+}: React.ComponentProps<typeof AccordionPrimitive.Item>) {+ return (+ <AccordionPrimitive.Item+ data-slot="accordion-item"+ className={cn("not-last:border-b", className)}+ {...props}+ />+ )+}++function AccordionTrigger({+ className,+ children,+ ...props+}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {+ return (+ <AccordionPrimitive.Header className="flex">+ <AccordionPrimitive.Trigger+ data-slot="accordion-trigger"+ className={cn(+ "group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring disabled:pointer-events-none disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",+ className+ )}+ {...props}+ >+ {children}+ <ChevronDownIcon data-slot="accordion-trigger-icon" className="pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden" />+ <ChevronUpIcon data-slot="accordion-trigger-icon" className="pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline" />+ </AccordionPrimitive.Trigger>+ </AccordionPrimitive.Header>+ )+}++function AccordionContent({+ className,+ children,+ ...props+}: React.ComponentProps<typeof AccordionPrimitive.Content>) {+ return (+ <AccordionPrimitive.Content+ data-slot="accordion-content"+ className="overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up"+ {...props}+ >+ <div+ className={cn(+ "h-(--radix-accordion-content-height) pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",+ className+ )}+ >+ {children}+ </div>+ </AccordionPrimitive.Content>+ )+}++export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }