Add padding around user messages, fix "Stop" button position

This commit is contained in:
Alex Gleason committed 2025-08-24 22:06:17 -05:00
1 parent da62b69145
commit 570c7eaead
3 files changed
+26 -22

No files matched your search

+17 -15
View File
@@ -153,7 +153,7 @@ export const AIMessageItem = memo(({
if (message.role === 'user') {
// User messages: right-aligned bubble without avatar/name
return (
<div className="flex justify-end">
<div className="flex justify-end py-6">
<div className="max-w-[80%] bg-primary text-primary-foreground rounded-2xl rounded-br-md px-4 py-3">
<div className="text-sm whitespace-pre-wrap break-words">
<Streamdown
@@ -171,20 +171,7 @@ export const AIMessageItem = memo(({
// Assistant messages: left-aligned without avatar/name
return (
<div className="flex">
<div className="flex-1 min-w-0">
{isCurrentlyLoading && onStopGeneration && (
<div className="flex justify-end mb-2">
<Button
variant="outline"
size="sm"
onClick={onStopGeneration}
className="gap-1 h-6 px-2 text-xs"
>
<Square className="h-3 w-3" />
Stop
</Button>
</div>
)}
<div className="flex-1 min-w-0 relative">
<div className="text-sm">
<div className="whitespace-pre-wrap break-words">
<Streamdown
@@ -197,6 +184,21 @@ export const AIMessageItem = memo(({
{/* Tool calls are now hidden from assistant messages */}
</div>
{/* Stop button positioned absolutely to avoid affecting text layout */}
{isCurrentlyLoading && onStopGeneration && (
<div className="absolute -top-8 right-0">
<Button
variant="outline"
size="sm"
onClick={onStopGeneration}
className="gap-1 h-6 px-2 text-xs"
>
<Square className="h-3 w-3" />
Stop
</Button>
</div>
)}
</div>
</div>
);
+8 -6
View File
@@ -392,8 +392,14 @@ BASE_DOMAIN=nostrdeploy.com`);
/>
) : (
<div key="streaming-loading" className="flex">
<div className="flex-1 min-w-0">
<div className="flex justify-end mb-2">
<div className="flex-1 min-w-0 relative">
<div className="text-sm space-y-2">
<Skeleton className="h-4 w-full" />
<Skeleton className="h-4 w-3/4" />
</div>
{/* Stop button positioned absolutely to match AIMessageItem */}
<div className="absolute -top-8 right-0">
<Button
variant="outline"
size="sm"
@@ -404,10 +410,6 @@ BASE_DOMAIN=nostrdeploy.com`);
Stop
</Button>
</div>
<div className="text-sm space-y-2">
<Skeleton className="h-4 w-full" />
<Skeleton className="h-4 w-3/4" />
</div>
</div>
</div>
)
+1 -1
View File
@@ -10,7 +10,7 @@ vi.mock('*.sass', () => ({}));
vi.mock('katex/dist/katex.min.css', () => ({}));
// Mock Streamdown component that might be importing KaTeX
vi.mock('@soapbox.pub/streamdown', () => ({
vi.mock('streamdown', () => ({
Streamdown: ({ children }: { children: React.ReactNode }) => children
}));