Skip to content

Commit 1b3e56c

Browse files
committed
Style improvements
1 parent 3856fbc commit 1b3e56c

File tree

2 files changed

+46
-12
lines changed

2 files changed

+46
-12
lines changed

apps/webapp/app/components/code/AIQueryInput.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@ import { AnimatePresence, motion } from "framer-motion";
22
import { Suspense, lazy, useCallback, useEffect, useRef, useState } from "react";
33
import { AISparkleIcon } from "~/assets/icons/AISparkleIcon";
44

5-
// Lazy load streamdown to avoid SSR issues
6-
const Streamdown = lazy(() => import("streamdown").then((mod) => ({ default: mod.Streamdown })));
5+
// Lazy load streamdown components to avoid SSR issues
6+
const StreamdownRenderer = lazy(() =>
7+
import("streamdown").then((mod) => ({
8+
default: ({ children, isAnimating }: { children: string; isAnimating: boolean }) => (
9+
<mod.ShikiThemeContext.Provider value={["one-dark-pro", "one-dark-pro"]}>
10+
<mod.Streamdown isAnimating={isAnimating}>{children}</mod.Streamdown>
11+
</mod.ShikiThemeContext.Provider>
12+
),
13+
}))
14+
);
715
import { Button } from "~/components/primitives/Buttons";
816
import { Spinner } from "~/components/primitives/Spinner";
917
import { useEnvironment } from "~/hooks/useEnvironment";
@@ -137,7 +145,7 @@ export function AIQueryInput({ onQueryGenerated, autoSubmitPrompt }: AIQueryInpu
137145
setThinking((prev) => prev + event.content);
138146
break;
139147
case "tool_call":
140-
setThinking((prev) => prev + `\n[Validating query...]\n`);
148+
setThinking((prev) => prev + `\nValidating query...\n`);
141149
break;
142150
case "tool_result":
143151
// Optionally show validation result
@@ -319,9 +327,9 @@ export function AIQueryInput({ onQueryGenerated, autoSubmitPrompt }: AIQueryInpu
319327
</Button>
320328
)}
321329
</div>
322-
<div className="streamdown-container max-h-48 overflow-y-auto text-xs text-text-dimmed scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
330+
<div className="streamdown-container max-h-96 overflow-y-auto text-xs text-text-dimmed scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
323331
<Suspense fallback={<p className="whitespace-pre-wrap">{thinking}</p>}>
324-
<Streamdown isAnimating={isLoading}>{thinking}</Streamdown>
332+
<StreamdownRenderer isAnimating={isLoading}>{thinking}</StreamdownRenderer>
325333
</Suspense>
326334
</div>
327335
</div>

apps/webapp/app/tailwind.css

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@
109109

110110
/* Streamdown markdown styling */
111111
.streamdown-container {
112+
/* Streamdown uses shadcn/ui CSS variables - define them for our theme */
113+
--muted: 220 13% 20%;
114+
--muted-foreground: 215 14% 60%;
115+
--foreground: 210 20% 90%;
116+
--border: 217 19% 27%;
117+
112118
& p {
113119
@apply my-1;
114120
}
@@ -136,15 +142,10 @@
136142
& li {
137143
@apply my-0.5;
138144
}
139-
& code {
145+
/* Inline code (not in pre blocks) */
146+
& code:not(pre code) {
140147
@apply bg-charcoal-700 px-1 py-0.5 rounded text-text-bright font-mono;
141148
}
142-
& pre {
143-
@apply bg-charcoal-700 p-2 rounded my-2 overflow-x-auto;
144-
}
145-
& pre code {
146-
@apply bg-transparent p-0;
147-
}
148149
& blockquote {
149150
@apply border-l-2 border-charcoal-600 pl-3 my-2 italic;
150151
}
@@ -169,4 +170,29 @@
169170
& th {
170171
@apply bg-charcoal-700 font-semibold;
171172
}
173+
174+
/* Streamdown code block container */
175+
& [data-code-block-container] {
176+
@apply my-2 border-charcoal-700;
177+
}
178+
& [data-code-block-header] {
179+
@apply bg-charcoal-800 text-text-dimmed border-b border-charcoal-700;
180+
}
181+
/* Hide light mode code block, show dark mode */
182+
& [data-code-block].dark\:hidden {
183+
display: none !important;
184+
}
185+
& [data-code-block].hidden.dark\:block {
186+
display: block !important;
187+
}
188+
/* Override the bg-muted/40 class to let inline styles work */
189+
& [data-code-block] pre {
190+
background-color: inherit !important;
191+
}
192+
& [data-code-block] pre code {
193+
@apply bg-transparent;
194+
}
195+
& [data-code-block] .line {
196+
@apply leading-relaxed;
197+
}
172198
}

0 commit comments

Comments
 (0)