Skip to content

Commit 7cbfa63

Browse files
committed
refactor: streamline CSS styles and enhance agent panel message handling
- Removed unnecessary light-mode overrides for .prose-chat, simplifying the CSS by relying on theme variables. - Updated the AgentPanel component to build outbound messages with additional context, improving clarity in chat interactions. - Refined layout styles in ChatHome for better responsiveness and user experience.
1 parent 0001b40 commit 7cbfa63

3 files changed

Lines changed: 32 additions & 32 deletions

File tree

app/globals.css

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -946,24 +946,7 @@
946946
--color-ai-hover-bg: rgba(0, 0, 0, 0.04);
947947
}
948948

949-
/* Light-mode overrides for hardcoded dark values */
950-
[data-theme='obsidian']:not(.dark) .prose-chat code,
951-
[data-theme='bone']:not(.dark) .prose-chat code,
952-
[data-theme='neon']:not(.dark) .prose-chat code,
953-
[data-theme='catppuccin-mocha']:not(.dark) .prose-chat code,
954-
[data-theme='voodoo']:not(.dark) .prose-chat code,
955-
[data-theme='cybernord']:not(.dark) .prose-chat code,
956-
[data-theme='prettypink']:not(.dark) .prose-chat code {
957-
background: rgba(0, 0, 0, 0.04);
958-
border-color: var(--border);
959-
}
960-
[data-theme='obsidian']:not(.dark) .prose-chat th,
961-
[data-theme='bone']:not(.dark) .prose-chat th,
962-
[data-theme='neon']:not(.dark) .prose-chat th,
963-
[data-theme='catppuccin-mocha']:not(.dark) .prose-chat th,
964-
[data-theme='prettypink']:not(.dark) .prose-chat th {
965-
background: rgba(0, 0, 0, 0.03);
966-
}
949+
/* Light-mode .prose-chat overrides no longer needed — base rules use theme vars */
967950

968951
/* ──────────────────────────────────────────────────────────────────
969952
Base
@@ -2563,7 +2546,8 @@ p {
25632546
text-decoration: none;
25642547
font-weight: 500;
25652548
color: var(--text-primary);
2566-
background: var(--bg-subtle);
2549+
background: var(--bg);
2550+
border: 1px solid var(--border);
25672551
padding: 0.05em 0.35em;
25682552
border-radius: 4px;
25692553
transition:
@@ -2608,8 +2592,9 @@ p {
26082592
font-size: 0.9em;
26092593
padding: 0.15em 0.35em;
26102594
border-radius: 4px;
2611-
background: var(--bg-subtle);
2612-
color: var(--text-secondary);
2595+
background: var(--bg);
2596+
border: 1px solid var(--border);
2597+
color: var(--text-primary);
26132598
}
26142599

26152600
.md-preview pre {
@@ -2632,6 +2617,7 @@ p {
26322617
margin: 0.75em 0;
26332618
padding: 0.5em 1em;
26342619
border-left: 3px solid var(--border);
2620+
background: var(--bg);
26352621
color: var(--text-secondary);
26362622
}
26372623

@@ -2660,7 +2646,7 @@ p {
26602646
}
26612647
.md-preview th {
26622648
font-weight: 600;
2663-
background: var(--bg-subtle);
2649+
background: var(--bg);
26642650
}
26652651

26662652
/* ──────────────────────────────────────────────────────────────────
@@ -2767,14 +2753,16 @@ p {
27672753
font-size: 11px;
27682754
padding: 1px 5px;
27692755
border-radius: 4px;
2770-
background: rgba(255, 255, 255, 0.06);
2756+
color: var(--text-primary);
2757+
background: var(--bg);
27712758
border: 1px solid var(--border);
27722759
}
27732760
.prose-chat pre {
27742761
margin: 0.5em 0;
27752762
padding: 8px 10px;
27762763
border-radius: 6px;
2777-
background: var(--bg-subtle);
2764+
color: var(--text-primary);
2765+
background: var(--bg);
27782766
border: 1px solid var(--border);
27792767
overflow-x: auto;
27802768
font-size: 11px;
@@ -2838,12 +2826,14 @@ p {
28382826
}
28392827
.prose-chat th {
28402828
font-weight: 600;
2841-
background: rgba(255, 255, 255, 0.04);
2829+
color: var(--text-primary);
2830+
background: var(--bg);
28422831
}
28432832
.prose-chat blockquote {
28442833
border-left: 2px solid var(--border);
28452834
padding-left: 10px;
28462835
margin: 0.4em 0;
2836+
background: var(--bg);
28472837
color: var(--text-secondary);
28482838
}
28492839

@@ -2881,6 +2871,11 @@ p {
28812871
color: var(--text-primary);
28822872
}
28832873

2874+
/* Terminal markdown should remain readable on tinted RPC/chat cards */
2875+
.terminal-md {
2876+
color: var(--text-primary);
2877+
}
2878+
28842879
/* ─── Merge Editor: Keyframes ──────────────────────────────────────────── */
28852880

28862881
@keyframes conflict-pulse {

components/agent-panel.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ function AgentConnectPrompt() {
155155
)
156156
}
157157

158+
function buildGatewayMessage(message: string, context?: string): string {
159+
const trimmedContext = context?.trim()
160+
if (!trimmedContext) return message
161+
return `${message}\n\n[Additional Context]\n${trimmedContext}`
162+
}
163+
158164
export function AgentPanel() {
159165
const { sendRequest, onEvent, status } = useGateway()
160166
const { files, activeFile, getFile, openFile, updateFileContent } = useEditor()
@@ -1032,7 +1038,7 @@ export function AgentPanel() {
10321038
: agentMode === 'plan'
10331039
? '[Mode: Plan — outline a step-by-step plan before making changes. Present the plan to the user for approval before executing.]\n'
10341040
: '[Mode: Agent — make direct code changes and edits autonomously.]\n'
1035-
// Build silent context (not shown in chat, passed separately to gateway)
1041+
// Build silent context (not shown in chat UI, embedded in outbound gateway message)
10361042
const silentContext = [modePrefix, context || '', attachCtx].filter(Boolean).join('\n\n')
10371043
setContextAttachments([])
10381044
setImageAttachments([])
@@ -1046,10 +1052,10 @@ export function AgentPanel() {
10461052
promptChars: text.length,
10471053
contextChars: silentContext.length,
10481054
})
1055+
const outboundMessage = buildGatewayMessage(text, silentContext)
10491056
const resp = (await sendRequest('chat.send', {
10501057
sessionKey,
1051-
message: text,
1052-
context: silentContext,
1058+
message: outboundMessage,
10531059
idempotencyKey: idemKey,
10541060
})) as Record<string, unknown> | undefined
10551061

@@ -1197,8 +1203,7 @@ export function AgentPanel() {
11971203

11981204
sendRequest('chat.send', {
11991205
sessionKey,
1200-
message: prompt,
1201-
context: context || undefined,
1206+
message: buildGatewayMessage(prompt, context),
12021207
idempotencyKey: idemKey,
12031208
})
12041209
.then((resp) => {

components/chat-home.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ export const ChatHome = memo(function ChatHome({ onSend, onSelectFolder, onClone
292292
}, [hasWorkspace, openFiles, local.localTree])
293293

294294
return (
295-
<div className="flex-1 flex flex-col items-center justify-start px-4 sm:px-6 pt-8 sm:pt-10 pb-8 overflow-y-auto">
296-
<div className="w-full max-w-[700px]">
295+
<div className="flex-1 overflow-y-auto px-4 sm:px-6 py-8 sm:py-10">
296+
<div className="min-h-full w-full max-w-[700px] mx-auto flex flex-col justify-center">
297297
{/* Logo + Heading */}
298298
<div className="flex flex-col items-center mb-5">
299299
<div

0 commit comments

Comments
 (0)