Skip to content

Self-improving AI Employees for everyone

refactor(ui): migrate small panels + CodeEditor off useAppTheme

trohitg085e6b3fee3f
diff --git a/client/src/components/LocationParameterPanel.tsx b/client/src/components/LocationParameterPanel.tsx
index b682e6d8..8a1a51b0 100644
--- a/client/src/components/LocationParameterPanel.tsx
+++ b/client/src/components/LocationParameterPanel.tsx
@@ -3,11 +3,9 @@ import Modal from './ui/Modal';
import LocationPanelLayout from './parameterPanel/LocationPanelLayout';
import { useParameterPanel } from '../hooks/useParameterPanel';
import { ExecutionService } from '../services/executionService';
-import { useAppTheme } from '../hooks/useAppTheme';
import { ActionButton } from './ui/action-button';
const LocationParameterPanel: React.FC = () => {
- const theme = useAppTheme();
const {
selectedNode,
nodeDefinition,
@@ -67,7 +65,7 @@ const LocationParameterPanel: React.FC = () => {
<div className="flex items-center gap-2 text-[15px] font-semibold text-foreground">
<span>{nodeDefinition.icon}</span>
<span>{nodeDefinition.displayName}</span>
- {hasUnsavedChanges && <span style={{ color: theme.accent.orange }}>*</span>}
+ {hasUnsavedChanges && <span className="text-warning">*</span>}
</div>
<div className="flex items-center gap-2">
{canExecute && (
diff --git a/client/src/components/output/OutputPanel.tsx b/client/src/components/output/OutputPanel.tsx
index b2bdc6c0..9dca1afc 100644
--- a/client/src/components/output/OutputPanel.tsx
+++ b/client/src/components/output/OutputPanel.tsx
@@ -130,10 +130,7 @@ export default function OutputPanel({ results, onClear, selectedNode }: Props) {
<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' }}
- >
+ <div className="prose prose-sm max-w-none whitespace-pre-wrap dark:prose-invert">
<ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]}>
{fmt(typeof response === 'string' ? response : JSON.stringify(response, null, 2))}
</ReactMarkdown>
@@ -143,10 +140,7 @@ export default function OutputPanel({ results, onClear, selectedNode }: Props) {
{thinking && (
<Section label="Thinking">
- <div
- className="prose prose-sm dark:prose-invert max-w-none max-h-[300px] overflow-auto"
- style={{ whiteSpace: 'pre-wrap' }}
- >
+ <div className="prose prose-sm max-h-[300px] max-w-none overflow-auto whitespace-pre-wrap dark:prose-invert">
<ReactMarkdown remarkPlugins={[remarkGfm, remarkBreaks]}>
{fmt(thinking)}
</ReactMarkdown>
diff --git a/client/src/components/parameterPanel/LocationPanelLayout.tsx b/client/src/components/parameterPanel/LocationPanelLayout.tsx
index 72b34b79..f6e117eb 100644
--- a/client/src/components/parameterPanel/LocationPanelLayout.tsx
+++ b/client/src/components/parameterPanel/LocationPanelLayout.tsx
@@ -28,10 +28,10 @@ const LocationPanelLayout: React.FC<LocationPanelLayoutProps> = ({
showInputSection = true
}) => {
return (
- <div style={{ display: 'flex', height: '100%', minHeight: 0 }}>
+ <div className="flex h-full min-h-0">
{/* Left: Input Nodes JSON Data */}
{showInputSection && (
- <div style={{ flex: 1, height: '100%', overflow: 'hidden' }}>
+ <div className="h-full flex-1 overflow-hidden">
<InputSection
nodeId={selectedNode.id}
visible={showInputSection}
@@ -40,7 +40,7 @@ const LocationPanelLayout: React.FC<LocationPanelLayoutProps> = ({
)}
{/* Middle: Parameter Content */}
- <div style={{ flex: 1, height: '100%', overflow: 'hidden' }}>
+ <div className="h-full flex-1 overflow-hidden">
<MiddleSection
nodeId={selectedNode.id}
nodeDefinition={nodeDefinition}
@@ -50,7 +50,7 @@ const LocationPanelLayout: React.FC<LocationPanelLayoutProps> = ({
</div>
{/* Right: Maps Section */}
- <div style={{ flex: 1, height: '100%', overflow: 'hidden' }}>
+ <div className="h-full flex-1 overflow-hidden">
<MapsSection
selectedNode={selectedNode}
nodeDefinition={nodeDefinition}
diff --git a/client/src/components/parameterPanel/MapsSection.tsx b/client/src/components/parameterPanel/MapsSection.tsx
index ca907968..ec636e6b 100644
--- a/client/src/components/parameterPanel/MapsSection.tsx
+++ b/client/src/components/parameterPanel/MapsSection.tsx
@@ -1,6 +1,5 @@
import React, { useState, useEffect, useRef } from 'react';
import MapsPreviewPanel from '../maps/MapsPreviewPanel';
-import { useAppTheme } from '../../hooks/useAppTheme';
import { Node } from 'reactflow';
import { INodeTypeDescription } from '../../types/INodeProperties';
import {
@@ -26,7 +25,6 @@ const MapsSection: React.FC<MapsSectionProps> = ({
onParameterChange,
visible = true
}) => {
- const theme = useAppTheme();
const { getStoredApiKey, isConnected } = useApiKeys();
const [apiKey, setApiKey] = useState<string | undefined>(() => {
// Initialize with env variable if available
@@ -68,13 +66,7 @@ const MapsSection: React.FC<MapsSectionProps> = ({
const handleLocationUpdate = createLocationUpdateHandler(locationParams, onParameterChange);
return (
- <div style={{
- backgroundColor: theme.colors.backgroundPanel,
- display: 'flex',
- flexDirection: 'column',
- width: '100%',
- height: '100%'
- }}>
+ <div className="flex h-full w-full flex-col bg-card">
<MapsPreviewPanel
lat={lat}
lng={lng}
diff --git a/client/src/components/parameterPanel/OutputSection.tsx b/client/src/components/parameterPanel/OutputSection.tsx
index 7e87d4d1..1e748009 100644
--- a/client/src/components/parameterPanel/OutputSection.tsx
+++ b/client/src/components/parameterPanel/OutputSection.tsx
@@ -1,6 +1,5 @@
import React from 'react';
import OutputPanel from '../output/OutputPanel';
-import { useAppTheme } from '../../hooks/useAppTheme';
import { ExecutionResult } from '../../services/executionService';
import { Node } from 'reactflow';
import { useWebSocket } from '../../contexts/WebSocketContext';
@@ -18,7 +17,6 @@ const OutputSection: React.FC<OutputSectionProps> = ({
onClearResults,
visible = true
}) => {
- const theme = useAppTheme();
const { nodeStatuses } = useWebSocket();
if (!visible) {
@@ -62,15 +60,7 @@ const OutputSection: React.FC<OutputSectionProps> = ({
}, [executionResults, nodeStatuses, selectedNode.id, selectedNode.type]);
return (
- <div style={{
- backgroundColor: theme.colors.backgroundPanel,
- display: 'flex',
- flexDirection: 'column',
- width: '100%',
- height: '100%',
- overflow: 'hidden',
- position: 'relative'
- }}>
+ <div className="relative flex h-full w-full flex-col overflow-hidden bg-card">
<OutputPanel
results={combinedResults}
onClear={onClearResults}
diff --git a/client/src/components/parameterPanel/ParameterPanelLayout.tsx b/client/src/components/parameterPanel/ParameterPanelLayout.tsx
index a32bd2c3..4f50183b 100644
--- a/client/src/components/parameterPanel/ParameterPanelLayout.tsx
+++ b/client/src/components/parameterPanel/ParameterPanelLayout.tsx
@@ -41,10 +41,10 @@ const ParameterPanelLayout: React.FC<ParameterPanelLayoutProps> = ({
isLoadingParameters = false
}) => {
return (
- <div style={{ display: 'flex', height: '100%', minHeight: 0 }}>
+ <div className="flex h-full min-h-0">
{/* Left: Input Nodes JSON Data */}
{showInputSection && (
- <div style={{ flex: 0.7, height: '100%', overflow: 'hidden' }}>
+ <div className="h-full flex-[0.7] overflow-hidden">
<InputSection
nodeId={selectedNode.id}
visible={showInputSection}
@@ -53,7 +53,7 @@ const ParameterPanelLayout: React.FC<ParameterPanelLayoutProps> = ({
)}
{/* Middle: Parameter Content */}
- <div style={{ flex: 1.6, height: '100%', overflow: 'hidden', minWidth: 0 }}>
+ <div className="h-full min-w-0 flex-[1.6] overflow-hidden">
<MiddleSection
nodeId={selectedNode.id}
nodeDefinition={nodeDefinition}
@@ -66,7 +66,7 @@ const ParameterPanelLayout: React.FC<ParameterPanelLayoutProps> = ({
{/* Right: Current Node Output */}
{showOutputSection && (
- <div style={{ flex: 0.7, height: '100%', overflow: 'hidden' }}>
+ <div className="h-full flex-[0.7] overflow-hidden">
<OutputSection
selectedNode={selectedNode}
executionResults={executionResults}
diff --git a/client/src/components/ui/ApiKeyInput.tsx b/client/src/components/ui/ApiKeyInput.tsx
index ed5cbdcf..c773dc49 100644
--- a/client/src/components/ui/ApiKeyInput.tsx
+++ b/client/src/components/ui/ApiKeyInput.tsx
@@ -7,7 +7,6 @@ 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 {
value: string;
@@ -34,7 +33,6 @@ const ApiKeyInput: React.FC<ApiKeyInputProps> = ({
saveLabel = 'Validate',
savedLabel = 'Valid',
}) => {
- const theme = useAppTheme();
const [visible, setVisible] = useState(false);
return (
@@ -59,14 +57,9 @@ const ApiKeyInput: React.FC<ApiKeyInputProps> = ({
</div>
<Button
- variant="outline"
+ variant="default"
onClick={onSave}
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" />
@@ -80,15 +73,10 @@ const ApiKeyInput: React.FC<ApiKeyInputProps> = ({
{isStored && onDelete && (
<Button
- variant="outline"
+ variant="destructive"
size="icon"
onClick={onDelete}
disabled={disabled}
- style={{
- backgroundColor: `${theme.dracula.pink}25`,
- borderColor: `${theme.dracula.pink}60`,
- color: theme.dracula.pink,
- }}
>
<Trash2 className="h-4 w-4" />
</Button>
diff --git a/client/src/components/ui/CodeEditor.tsx b/client/src/components/ui/CodeEditor.tsx
index cb024abd..a1c8ec53 100644
--- a/client/src/components/ui/CodeEditor.tsx
+++ b/client/src/components/ui/CodeEditor.tsx
@@ -5,7 +5,6 @@ import 'prismjs/components/prism-python';
import 'prismjs/components/prism-javascript';
import 'prismjs/components/prism-typescript';
import 'prismjs/components/prism-markdown';
-import { useAppTheme } from '../../hooks/useAppTheme';
interface CodeEditorProps {
value: string;
@@ -20,10 +19,7 @@ const CodeEditor: React.FC<CodeEditorProps> = ({
language = 'python',
placeholder
}) => {
- const theme = useAppTheme();
-
const handleChange = (newValue: string) => {
- console.log('[CodeEditor] Value changed, length:', newValue.length);
onChange(newValue);
};
@@ -33,27 +29,8 @@ const CodeEditor: React.FC<CodeEditorProps> = ({
};
return (
- <div style={{
- height: '100%',
- borderRadius: theme.borderRadius.md,
- overflow: 'auto',
- border: `1px solid ${theme.colors.border}`
- }}>
- <style>{`
- .code-editor-container .token.comment { color: ${theme.dracula.comment}; }
- .code-editor-container .token.string { color: ${theme.dracula.yellow}; }
- .code-editor-container .token.keyword { color: ${theme.dracula.pink}; }
- .code-editor-container .token.function { color: ${theme.dracula.green}; }
- .code-editor-container .token.number { color: ${theme.dracula.purple}; }
- .code-editor-container .token.operator { color: ${theme.dracula.pink}; }
- .code-editor-container .token.class-name { color: ${theme.dracula.cyan}; }
- .code-editor-container .token.builtin { color: ${theme.dracula.cyan}; }
- .code-editor-container .token.boolean { color: ${theme.dracula.purple}; }
- .code-editor-container .token.punctuation { color: ${theme.colors.text}; }
- .code-editor-container textarea { outline: none !important; caret-color: ${theme.colors.text}; }
- .code-editor-container textarea::placeholder { color: ${theme.colors.textMuted}; }
- `}</style>
- <div className="code-editor-container" style={{ height: '100%' }}>
+ <div className="h-full overflow-auto rounded-md border border-border">
+ <div className="code-editor-container h-full bg-muted text-foreground">
<Editor
value={value || ''}
onValueChange={handleChange}
@@ -62,15 +39,16 @@ const CodeEditor: React.FC<CodeEditorProps> = ({
padding={12}
tabSize={4}
insertSpaces={true}
+ // Underlying textarea cannot use Tailwind classes for these
+ // properties; font + sizing must live on the editor's style
+ // prop. Colors come from .code-editor-container in index.css.
style={{
fontFamily: "'Consolas', 'Monaco', 'Fira Code', monospace",
fontSize: 13,
lineHeight: 1.5,
- backgroundColor: theme.colors.backgroundAlt,
- color: theme.colors.text,
minHeight: '100%',
height: 'auto',
- overflow: 'visible'
+ overflow: 'visible',
}}
/>
</div>
diff --git a/client/src/index.css b/client/src/index.css
index f077c0da..00156672 100644
--- a/client/src/index.css
+++ b/client/src/index.css
@@ -437,3 +437,35 @@ html {
.dark .chat-markdown hr {
border-top-color: hsl(var(--dracula-selection));
}
+
+/* ============================================================================
+ * Prism syntax-highlighting palette — used by react-simple-code-editor.
+ * Token roles map to existing dracula tokens; future themes can override
+ * each --prism-* var in their own scope.
+ * ============================================================================ */
+
+:root {
+ --prism-comment: var(--dracula-comment);
+ --prism-string: var(--dracula-yellow);
+ --prism-keyword: var(--dracula-pink);
+ --prism-function: var(--dracula-green);
+ --prism-number: var(--dracula-purple);
+ --prism-operator: var(--dracula-pink);
+ --prism-class-name: var(--dracula-cyan);
+ --prism-builtin: var(--dracula-cyan);
+ --prism-boolean: var(--dracula-purple);
+ --prism-punctuation: var(--foreground);
+}
+
+.code-editor-container .token.comment { color: hsl(var(--prism-comment)); }
+.code-editor-container .token.string { color: hsl(var(--prism-string)); }
+.code-editor-container .token.keyword { color: hsl(var(--prism-keyword)); }
+.code-editor-container .token.function { color: hsl(var(--prism-function)); }
+.code-editor-container .token.number { color: hsl(var(--prism-number)); }
+.code-editor-container .token.operator { color: hsl(var(--prism-operator)); }
+.code-editor-container .token.class-name { color: hsl(var(--prism-class-name)); }
+.code-editor-container .token.builtin { color: hsl(var(--prism-builtin)); }
+.code-editor-container .token.boolean { color: hsl(var(--prism-boolean)); }
+.code-editor-container .token.punctuation { color: hsl(var(--prism-punctuation)); }
+.code-editor-container textarea { outline: none !important; caret-color: hsl(var(--foreground)); }
+.code-editor-container textarea::placeholder { color: hsl(var(--muted-foreground)); }