Skip to content

Self-improving AI Employees for everyone

refactor(client): ConsolePanel - Tailwind utilities + CSS-var token aliases

trohitg9802a48df4be
diff --git a/client/src/components/ui/ConsolePanel.tsx b/client/src/components/ui/ConsolePanel.tsx
index 9d569296..dbe2911e 100644
--- a/client/src/components/ui/ConsolePanel.tsx
+++ b/client/src/components/ui/ConsolePanel.tsx
@@ -377,87 +377,6 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({
return Prism.highlight(code, Prism.languages.json, 'json');
}, []);
- // Prism token styles following CodeEditor.tsx convention
- const prismStyles = `
- .console-json-output .token.string { color: ${theme.dracula.yellow}; }
- .console-json-output .token.number { color: ${theme.dracula.purple}; }
- .console-json-output .token.boolean { color: ${theme.dracula.purple}; }
- .console-json-output .token.null { color: ${theme.dracula.purple}; }
- .console-json-output .token.property { color: ${theme.dracula.cyan}; }
- .console-json-output .token.punctuation { color: ${theme.colors.text}; }
- .console-json-output .token.operator { color: ${theme.dracula.pink}; }
-
- /* Chat markdown styles */
- .chat-markdown p { margin: 0 0 8px 0; }
- .chat-markdown p:last-child { margin-bottom: 0; }
- .chat-markdown h1, .chat-markdown h2, .chat-markdown h3 {
- margin: 12px 0 8px 0;
- font-weight: 600;
- color: ${theme.colors.text};
- }
- .chat-markdown h1:first-child, .chat-markdown h2:first-child, .chat-markdown h3:first-child {
- margin-top: 0;
- }
- .chat-markdown h1 { font-size: 1.25em; }
- .chat-markdown h2 { font-size: 1.1em; }
- .chat-markdown h3 { font-size: 1em; }
- .chat-markdown strong { font-weight: 600; color: ${theme.colors.text}; }
- .chat-markdown em { font-style: italic; }
- .chat-markdown ul, .chat-markdown ol {
- margin: 8px 0;
- padding-left: 20px;
- }
- .chat-markdown li { margin: 4px 0; }
- .chat-markdown code {
- background-color: ${isDarkMode ? theme.dracula.currentLine : `${theme.colors.border}50`};
- padding: 2px 6px;
- border-radius: 4px;
- font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
- font-size: 0.9em;
- }
- .chat-markdown pre {
- background-color: ${isDarkMode ? theme.dracula.currentLine : theme.colors.backgroundPanel};
- padding: 12px;
- border-radius: 6px;
- overflow-x: auto;
- margin: 8px 0;
- }
- .chat-markdown pre code {
- background: none;
- padding: 0;
- }
- .chat-markdown table {
- border-collapse: collapse;
- margin: 8px 0;
- width: 100%;
- font-size: 0.9em;
- }
- .chat-markdown th, .chat-markdown td {
- border: 1px solid ${isDarkMode ? theme.dracula.selection : theme.colors.border};
- padding: 6px 10px;
- text-align: left;
- }
- .chat-markdown th {
- background-color: ${isDarkMode ? theme.dracula.currentLine : theme.colors.backgroundPanel};
- font-weight: 600;
- }
- .chat-markdown blockquote {
- border-left: 3px solid ${isDarkMode ? theme.dracula.purple : theme.colors.primary};
- margin: 8px 0;
- padding: 4px 12px;
- color: ${theme.colors.textSecondary};
- }
- .chat-markdown a {
- color: ${isDarkMode ? theme.dracula.cyan : theme.colors.primary};
- text-decoration: none;
- }
- .chat-markdown a:hover { text-decoration: underline; }
- .chat-markdown hr {
- border: none;
- border-top: 1px solid ${isDarkMode ? theme.dracula.selection : theme.colors.border};
- margin: 12px 0;
- }
- `;
// Resize handle style
const resizeHandleStyle: React.CSSProperties = {
@@ -734,7 +653,7 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({
return (
<div
- style={{ position: 'relative' }}
+ className="relative"
onWheel={e => {
// Prevent scroll from propagating to the canvas/page when the cursor
// is over the panel header, resize handle, or non-scrollable areas.
@@ -745,7 +664,6 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({
}}
>
{/* Prism syntax highlighting styles for JSON */}
- <style>{prismStyles}</style>
{/* Resize Handle - Only visible when open */}
{isOpen && (
@@ -794,7 +712,7 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({
{/* Chat Section - Left */}
<div style={chatSectionStyle}>
<div style={sectionHeaderStyle}>
- <div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
+ <div className="flex items-center gap-2">
<span style={sectionTitleStyle}>
Chat
{chatMessages && chatMessages.length > 0 && (
@@ -846,7 +764,7 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({
Send a message to trigger chatTrigger nodes
</div>
) : (
- <div style={{ display: 'flex', flexDirection: 'column', gap: '4px' }}>
+ <div className="flex flex-col gap-1">
{chatMessages.map((msg, index) => (
<div key={`${msg.timestamp}-${index}`} style={chatMessageStyle(msg.role === 'user')}>
{msg.role === 'user' ? (
@@ -922,7 +840,7 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({
<div style={consoleSectionStyle}>
<div style={sectionHeaderStyle}>
{/* Tab Buttons */}
- <div style={{ display: 'flex', alignItems: 'center', gap: '4px' }}>
+ <div className="flex items-center gap-1">
<button
onClick={() => setPref('consoleTab', 'console')}
style={{
@@ -970,7 +888,7 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({
)}
</button>
</div>
- <div style={{ display: 'flex', alignItems: 'center', gap: '6px' }}>
+ <div className="flex items-center gap-1.5">
{consoleTab === 'terminal' && (
<select
value={terminalLogLevel}
@@ -1023,7 +941,7 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({
type="checkbox"
checked={autoScroll}
onChange={e => setPref('autoScroll', e.target.checked)}
- style={{ cursor: 'pointer', width: '12px', height: '12px' }}
+ className="h-3 w-3 cursor-pointer"
/>
Auto
</label>
@@ -1045,7 +963,7 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({
type="checkbox"
checked={prettyPrint}
onChange={e => setPref('prettyPrint', e.target.checked)}
- style={{ cursor: 'pointer', width: '12px', height: '12px' }}
+ className="h-3 w-3 cursor-pointer"
/>
Pretty
</label>
@@ -1103,14 +1021,7 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({
if (isJson && prettyPrint) {
return (
<pre
- className="console-json-output"
- style={{
- margin: 0,
- flex: 1,
- overflow: 'auto',
- whiteSpace: 'pre-wrap',
- wordBreak: 'break-word'
- }}
+ className="console-json-output m-0 flex-1 overflow-auto whitespace-pre-wrap break-words"
dangerouslySetInnerHTML={{ __html: highlightJson(formatted) }}
/>
);
@@ -1161,7 +1072,7 @@ const ConsolePanel: React.FC<ConsolePanelProps> = ({
: 'No logs match the filter'}
</div>
) : (
- <div style={{ minWidth: 'max-content' }}>
+ <div className="min-w-max">
{filteredTerminalLogs.slice().reverse().map((log, index) => (
<div key={`${log.timestamp}-${index}`} style={{
padding: '3px 12px',
diff --git a/client/src/index.css b/client/src/index.css
index fc30fcf1..732c6a7c 100644
--- a/client/src/index.css
+++ b/client/src/index.css
@@ -62,6 +62,9 @@
--dracula-red: 0 100% 67%; /* #ff5555 */
--dracula-orange: 27 100% 71%; /* #ffb86c */
--dracula-yellow: 65 92% 76%; /* #f1fa8c */
+ --dracula-selection: 232 14% 31%; /* #44475a */
+ --dracula-current-line: 232 14% 25%; /* #383a4a */
+ --dracula-comment: 225 27% 51%; /* #6272a4 */
}
.dark {
@@ -159,6 +162,9 @@
--color-dracula-red: hsl(var(--dracula-red));
--color-dracula-orange: hsl(var(--dracula-orange));
--color-dracula-yellow: hsl(var(--dracula-yellow));
+ --color-dracula-selection: hsl(var(--dracula-selection));
+ --color-dracula-current-line: hsl(var(--dracula-current-line));
+ --color-dracula-comment: hsl(var(--dracula-comment));
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
@@ -274,3 +280,106 @@ html {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
+
+/* ============================================================================
+ * ConsolePanel — Prism token colors + chat markdown theming.
+ * Static CSS vars; dark-mode overrides via `.dark` cascade.
+ * ============================================================================ */
+
+.console-json-output .token.string { color: hsl(var(--dracula-yellow)); }
+.console-json-output .token.number,
+.console-json-output .token.boolean,
+.console-json-output .token.null { color: hsl(var(--dracula-purple)); }
+.console-json-output .token.property { color: hsl(var(--dracula-cyan)); }
+.console-json-output .token.punctuation { color: hsl(var(--foreground)); }
+.console-json-output .token.operator { color: hsl(var(--dracula-pink)); }
+
+.chat-markdown p { margin: 0 0 8px 0; }
+.chat-markdown p:last-child { margin-bottom: 0; }
+.chat-markdown h1,
+.chat-markdown h2,
+.chat-markdown h3 {
+ margin: 12px 0 8px 0;
+ font-weight: 600;
+ color: hsl(var(--foreground));
+}
+.chat-markdown h1:first-child,
+.chat-markdown h2:first-child,
+.chat-markdown h3:first-child { margin-top: 0; }
+.chat-markdown h1 { font-size: 1.25em; }
+.chat-markdown h2 { font-size: 1.1em; }
+.chat-markdown h3 { font-size: 1em; }
+.chat-markdown strong { font-weight: 600; color: hsl(var(--foreground)); }
+.chat-markdown em { font-style: italic; }
+.chat-markdown ul,
+.chat-markdown ol { margin: 8px 0; padding-left: 20px; }
+.chat-markdown li { margin: 4px 0; }
+.chat-markdown code {
+ background-color: hsl(var(--border) / 0.3);
+ padding: 2px 6px;
+ border-radius: 4px;
+ font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
+ font-size: 0.9em;
+}
+.dark .chat-markdown code {
+ background-color: hsl(var(--dracula-current-line));
+}
+.chat-markdown pre {
+ background-color: hsl(var(--card));
+ padding: 12px;
+ border-radius: 6px;
+ overflow-x: auto;
+ margin: 8px 0;
+}
+.dark .chat-markdown pre {
+ background-color: hsl(var(--dracula-current-line));
+}
+.chat-markdown pre code { background: none; padding: 0; }
+.chat-markdown table {
+ border-collapse: collapse;
+ margin: 8px 0;
+ width: 100%;
+ font-size: 0.9em;
+}
+.chat-markdown th,
+.chat-markdown td {
+ border: 1px solid hsl(var(--border));
+ padding: 6px 10px;
+ text-align: left;
+}
+.dark .chat-markdown th,
+.dark .chat-markdown td {
+ border-color: hsl(var(--dracula-selection));
+}
+.chat-markdown th {
+ background-color: hsl(var(--card));
+ font-weight: 600;
+}
+.dark .chat-markdown th {
+ background-color: hsl(var(--dracula-current-line));
+}
+.chat-markdown blockquote {
+ border-left: 3px solid hsl(var(--primary));
+ margin: 8px 0;
+ padding: 4px 12px;
+ color: hsl(var(--muted-foreground));
+}
+.dark .chat-markdown blockquote {
+ border-left-color: hsl(var(--dracula-purple));
+}
+.chat-markdown a {
+ color: hsl(var(--primary));
+ text-decoration: none;
+}
+.dark .chat-markdown a {
+ color: hsl(var(--dracula-cyan));
+}
+.chat-markdown a:hover { text-decoration: underline; }
+.chat-markdown hr {
+ border: none;
+ border-top: 1px solid hsl(var(--border));
+ margin: 12px 0;
+}
+.dark .chat-markdown hr {
+ border-top-color: hsl(var(--dracula-selection));
+}
diff --git a/client/tailwind.config.js b/client/tailwind.config.js
index 867c5ee7..a4b07de2 100644
--- a/client/tailwind.config.js
+++ b/client/tailwind.config.js
@@ -59,6 +59,9 @@ export default {
red: "hsl(var(--dracula-red))",
orange: "hsl(var(--dracula-orange))",
yellow: "hsl(var(--dracula-yellow))",
+ selection: "hsl(var(--dracula-selection))",
+ "current-line": "hsl(var(--dracula-current-line))",
+ comment: "hsl(var(--dracula-comment))",
},
},
borderRadius: {