mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
Update UI components and refactor message display
This commit is contained in:
1 parent
21bc210e62
commit
8c0689eac8
15 files changed
+78
-78
No files matched your search
@@ -136,25 +136,25 @@ export const MessagePart = memo(function MessagePart({ part, role, allParts, par
|
||||
return <ToolCallPart part={part} onFileClick={onFileClick} />
|
||||
case 'reasoning':
|
||||
return (
|
||||
<details className="border border-zinc-800 rounded-lg my-2">
|
||||
<summary className="px-4 py-2 bg-zinc-900 hover:bg-zinc-800 cursor-pointer text-sm font-medium">
|
||||
<details className="border border-border rounded-lg my-2">
|
||||
<summary className="px-4 py-2 bg-muted hover:bg-accent cursor-pointer text-sm font-medium">
|
||||
Reasoning
|
||||
</summary>
|
||||
<div className="p-4 bg-zinc-950 text-sm text-zinc-300 whitespace-pre-wrap">
|
||||
<div className="p-4 bg-card text-sm text-muted-foreground whitespace-pre-wrap">
|
||||
{part.text}
|
||||
</div>
|
||||
</details>
|
||||
)
|
||||
case 'snapshot':
|
||||
return (
|
||||
<div className="border border-zinc-800 rounded-lg p-4 my-2 bg-zinc-950">
|
||||
<div className="text-xs text-zinc-500 font-mono">Snapshot: {part.snapshot}</div>
|
||||
<div className="border border-border rounded-lg p-4 my-2 bg-card">
|
||||
<div className="text-xs text-muted-foreground font-mono">Snapshot: {part.snapshot}</div>
|
||||
</div>
|
||||
)
|
||||
case 'agent':
|
||||
return (
|
||||
<div className="border border-zinc-800 rounded-lg p-4 my-2 bg-zinc-950">
|
||||
<div className="text-sm font-medium text-blue-400">Agent: {part.name}</div>
|
||||
<div className="border border-border rounded-lg p-4 my-2 bg-card">
|
||||
<div className="text-sm font-medium text-blue-600 dark:text-blue-400">Agent: {part.name}</div>
|
||||
</div>
|
||||
)
|
||||
case 'step-finish':
|
||||
@@ -167,8 +167,8 @@ export const MessagePart = memo(function MessagePart({ part, role, allParts, par
|
||||
)
|
||||
case 'file':
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1 px-2 py-1 rounded bg-zinc-800 border border-zinc-700 text-sm text-zinc-300">
|
||||
<span className="text-blue-400">@</span>
|
||||
<span className="inline-flex items-center gap-1 px-2 py-1 rounded bg-muted border border-border text-sm text-foreground">
|
||||
<span className="text-blue-600 dark:text-blue-400">@</span>
|
||||
<span className="font-medium">{part.filename || 'File'}</span>
|
||||
</span>
|
||||
)
|
||||
|
||||
@@ -31,7 +31,7 @@ const isMessageThinking = (msg: MessageWithParts): boolean => {
|
||||
export const MessageThread = memo(function MessageThread({ messages, onFileClick }: MessageThreadProps) {
|
||||
if (!messages || messages.length === 0) {
|
||||
return (
|
||||
<div className="flex items-center justify-center h-full text-zinc-600">
|
||||
<div className="flex items-center justify-center h-full text-muted-foreground">
|
||||
No messages yet. Start a conversation below.
|
||||
</div>
|
||||
)
|
||||
@@ -56,7 +56,7 @@ export const MessageThread = memo(function MessageThread({ messages, onFileClick
|
||||
} ${streaming ? 'animate-pulse-subtle' : ''}`}
|
||||
>
|
||||
<div className="flex items-center gap-2 mb-1">
|
||||
<span className="text-xs font-medium text-zinc-400">
|
||||
<span className="text-xs font-medium text-muted-foreground">
|
||||
{msg.info.role === 'user' ? 'You' : (msg.info.role === 'assistant' && 'modelID' in msg.info ? msg.info.modelID : 'Assistant')}
|
||||
</span>
|
||||
{msg.info.time && (
|
||||
@@ -65,14 +65,14 @@ export const MessageThread = memo(function MessageThread({ messages, onFileClick
|
||||
</span>
|
||||
)}
|
||||
{streaming && (
|
||||
<span className="text-xs text-blue-400 flex items-center gap-1">
|
||||
<span className="text-xs text-blue-600 dark:text-blue-400 flex items-center gap-1">
|
||||
<span className="animate-pulse">●</span> <span className="shine-loading">Generating...</span>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{thinking ? (
|
||||
<div className="flex items-center gap-2 text-zinc-500">
|
||||
<div className="flex items-center gap-2 text-muted-foreground">
|
||||
<span className="animate-pulse">▋</span>
|
||||
<span className="text-sm shine-loading">Thinking...</span>
|
||||
</div>
|
||||
|
||||
@@ -440,9 +440,9 @@ export function PromptInput({
|
||||
: "Send a message..."
|
||||
}
|
||||
disabled={disabled || hasActiveStream}
|
||||
className={`w-full bg-background/90 px-2 md:px-3 py-2 text-[16px] text-foreground placeholder-muted-foreground focus:outline-none focus:bg-black resize-none min-h-[40px] max-h-[120px] disabled:opacity-50 disabled:cursor-not-allowed md:text-sm rounded-lg ${
|
||||
className={`w-full bg-background/90 px-2 md:px-3 py-2 text-[16px] text-foreground placeholder-muted-foreground focus:outline-none focus:bg-background resize-none min-h-[40px] max-h-[120px] disabled:opacity-50 disabled:cursor-not-allowed md:text-sm rounded-lg ${
|
||||
isBashMode
|
||||
? 'border-purple-500/50 bg-purple-500/5 focus:bg-black'
|
||||
? 'border-purple-500/50 bg-purple-500/5 focus:bg-background'
|
||||
: ''
|
||||
}`}
|
||||
rows={1}
|
||||
|
||||
@@ -59,7 +59,7 @@ function ClickableJson({ json, onFileClick }: { json: unknown; onFileClick?: (fi
|
||||
e.stopPropagation()
|
||||
onFileClick?.(ref.filePath)
|
||||
}}
|
||||
className="text-blue-300 hover:text-blue-200 cursor-pointer underline decoration-dotted"
|
||||
className="text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 cursor-pointer underline decoration-dotted"
|
||||
title={`Click to open ${ref.filePath}`}
|
||||
>
|
||||
{ref.fullMatch}
|
||||
@@ -96,13 +96,13 @@ export function ToolCallPart({ part, onFileClick }: ToolCallPartProps) {
|
||||
const getStatusColor = () => {
|
||||
switch (part.state.status) {
|
||||
case 'completed':
|
||||
return 'text-green-400'
|
||||
return 'text-green-600 dark:text-green-400'
|
||||
case 'error':
|
||||
return 'text-red-400'
|
||||
return 'text-red-600 dark:text-red-400'
|
||||
case 'running':
|
||||
return 'text-yellow-400'
|
||||
return 'text-yellow-600 dark:text-yellow-400'
|
||||
default:
|
||||
return 'text-zinc-400'
|
||||
return 'text-muted-foreground'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,9 +154,9 @@ export function ToolCallPart({ part, onFileClick }: ToolCallPartProps) {
|
||||
return (
|
||||
<div ref={outputRef} className="my-2">
|
||||
<div className="flex items-center gap-2 text-sm mb-2">
|
||||
<span className="text-green-400">✓</span>
|
||||
<span className="text-green-600 dark:text-green-400">✓</span>
|
||||
<span className="font-medium">$</span>
|
||||
<span className="text-zinc-300">{command}</span>
|
||||
<span className="text-foreground">{command}</span>
|
||||
{part.state.status === 'completed' && part.state.time && (
|
||||
<span className="text-muted-foreground text-xs ml-auto">
|
||||
{((part.state.time.end - part.state.time.start) / 1000).toFixed(2)}s
|
||||
@@ -188,13 +188,13 @@ export function ToolCallPart({ part, onFileClick }: ToolCallPartProps) {
|
||||
onFileClick(previewText)
|
||||
}
|
||||
}}
|
||||
className="text-blue-300 text-xs truncate hover:text-blue-200 cursor-pointer underline decoration-dotted"
|
||||
className="text-blue-600 dark:text-blue-400 text-xs truncate hover:text-blue-700 dark:hover:text-blue-300 cursor-pointer underline decoration-dotted"
|
||||
title={`Click to open ${previewText}`}
|
||||
>
|
||||
{previewText}
|
||||
</span>
|
||||
) : previewText ? (
|
||||
<span className="text-zinc-400 text-xs truncate">{previewText}</span>
|
||||
<span className="text-muted-foreground text-xs truncate">{previewText}</span>
|
||||
) : null}
|
||||
<span className="text-muted-foreground text-xs ml-auto">({part.state.status})</span>
|
||||
</button>
|
||||
@@ -213,24 +213,24 @@ export function ToolCallPart({ part, onFileClick }: ToolCallPartProps) {
|
||||
{part.tool === 'bash' ? (
|
||||
<div className="text-sm">
|
||||
<div className="flex items-center gap-2 mb-1">
|
||||
<div className="text-zinc-400">Command:</div>
|
||||
<div className="text-muted-foreground">Command:</div>
|
||||
<CopyButton
|
||||
content={typeof part.state.input?.command === 'string' ? part.state.input.command : ''}
|
||||
title="Copy command"
|
||||
/>
|
||||
</div>
|
||||
<div className="bg-accent p-2 rounded text-xs overflow-x-auto">
|
||||
<span className="text-green-400">$</span> {typeof part.state.input?.command === 'string' ? part.state.input.command : ''}
|
||||
<span className="text-green-600 dark:text-green-400">$</span> {typeof part.state.input?.command === 'string' ? part.state.input.command : ''}
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-sm">
|
||||
<div className="text-zinc-400 mb-1">Input:</div>
|
||||
<div className="text-muted-foreground mb-1">Input:</div>
|
||||
<ClickableJson json={part.state.input} onFileClick={onFileClick} />
|
||||
</div>
|
||||
)}
|
||||
<div className="text-sm" ref={outputRef}>
|
||||
<div className="text-zinc-400 mb-1">Output:</div>
|
||||
<div className="text-muted-foreground mb-1">Output:</div>
|
||||
<pre className="bg-accent p-2 rounded text-xs overflow-x-auto whitespace-pre-wrap cursor-pointer hover:bg-accent/80 transition-colors"
|
||||
onClick={() => part.state.status === 'completed' && navigator.clipboard.writeText(part.state.output)}
|
||||
title="Click to copy output">
|
||||
@@ -238,7 +238,7 @@ export function ToolCallPart({ part, onFileClick }: ToolCallPartProps) {
|
||||
</pre>
|
||||
</div>
|
||||
{part.state.time && (
|
||||
<div className="text-xs text-zinc-500">
|
||||
<div className="text-xs text-muted-foreground">
|
||||
Duration: {((part.state.time.end - part.state.time.start) / 1000).toFixed(2)}s
|
||||
</div>
|
||||
)}
|
||||
@@ -247,8 +247,8 @@ export function ToolCallPart({ part, onFileClick }: ToolCallPartProps) {
|
||||
|
||||
{part.state.status === 'error' && (
|
||||
<div className="text-sm">
|
||||
<div className="text-red-400 mb-1">Error:</div>
|
||||
<pre className="bg-accent p-2 rounded text-xs overflow-x-auto text-red-300">
|
||||
<div className="text-red-600 dark:text-red-400 mb-1">Error:</div>
|
||||
<pre className="bg-accent p-2 rounded text-xs overflow-x-auto text-red-600 dark:text-red-300">
|
||||
{part.state.error}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user