mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
Add SquareFill icon component and update TTS/stop button styling with responsive cost display
This commit is contained in:
1 parent
507860329d
commit
005861ddf9
6 files changed
+72
-10
No files matched your search
@@ -1,11 +1,13 @@
|
||||
import { memo } from 'react'
|
||||
import type { components } from '@/api/opencode-types'
|
||||
import { Volume2, Square, Loader2 } from 'lucide-react'
|
||||
import { Volume2, Loader2 } from 'lucide-react'
|
||||
import { TextPart } from './TextPart'
|
||||
import { SquareFill } from '@/components/ui/square-fill'
|
||||
import { PatchPart } from './PatchPart'
|
||||
import { ToolCallPart } from './ToolCallPart'
|
||||
import { RetryPart } from './RetryPart'
|
||||
import { useTTS } from '@/hooks/useTTS'
|
||||
import { useMobile } from '@/hooks/useMobile'
|
||||
import { CopyButton } from '@/components/ui/copy-button'
|
||||
|
||||
type RetryPartType = components['schemas']['RetryPart']
|
||||
@@ -91,7 +93,7 @@ export function TTSButton({ content, className = "" }: TTSButtonProps) {
|
||||
{isLoading && isThisPlaying ? (
|
||||
<Loader2 className="w-4 h-4 animate-spin" />
|
||||
) : isThisPlaying ? (
|
||||
<Square className="w-4 h-4" />
|
||||
<SquareFill className="w-4 h-4" />
|
||||
) : (
|
||||
<Volume2 className="w-4 h-4" />
|
||||
)}
|
||||
@@ -103,6 +105,7 @@ export function TTSButton({ content, className = "" }: TTSButtonProps) {
|
||||
|
||||
export const MessagePart = memo(function MessagePart({ part, role, allParts, partIndex, onFileClick, onChildSessionClick, messageTextContent }: MessagePartProps) {
|
||||
const copyableContent = getCopyableContent(part, allParts)
|
||||
const isMobile = useMobile()
|
||||
|
||||
switch (part.type) {
|
||||
case 'text':
|
||||
@@ -140,14 +143,17 @@ export const MessagePart = memo(function MessagePart({ part, role, allParts, par
|
||||
<div className="text-sm font-medium text-blue-600 dark:text-blue-400">Agent: {part.name}</div>
|
||||
</div>
|
||||
)
|
||||
case 'step-finish':
|
||||
case 'step-finish': {
|
||||
const isFree = part.cost === 0
|
||||
const costText = isMobile && isFree ? null : <span>${part.cost.toFixed(4)} • {part.tokens.input + part.tokens.output} tokens</span>
|
||||
return (
|
||||
<div className="text-xs text-muted-foreground my-1 flex items-center gap-2">
|
||||
<span>${part.cost.toFixed(4)} • {part.tokens.input + part.tokens.output} tokens</span>
|
||||
{costText}
|
||||
<CopyButton content={copyableContent} title="Copy step complete" />
|
||||
{messageTextContent && <TTSButton content={messageTextContent} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
case 'file':
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1 px-2 py-1 rounded bg-muted border border-border text-sm text-foreground">
|
||||
|
||||
@@ -10,9 +10,10 @@ import { useUserBash } from '@/stores/userBashStore'
|
||||
import { useMobile } from '@/hooks/useMobile'
|
||||
import { useSessionStatusForSession } from '@/stores/sessionStatusStore'
|
||||
import { usePermissionContext } from '@/contexts/PermissionContext'
|
||||
import { ChevronDown, Square, Upload, X } from 'lucide-react'
|
||||
import { ChevronDown, Upload, X } from 'lucide-react'
|
||||
|
||||
import { CommandSuggestions } from '@/components/command/CommandSuggestions'
|
||||
import { SquareFill } from '@/components/ui/square-fill'
|
||||
import { MentionSuggestions, type MentionItem } from './MentionSuggestions'
|
||||
import { SessionStatusIndicator } from '@/components/ui/session-status-indicator'
|
||||
import { detectMentionTrigger, parsePromptToParts, getFilename, filterAgentsByQuery } from '@/lib/promptParser'
|
||||
@@ -600,10 +601,10 @@ return (
|
||||
<button
|
||||
onClick={handleStop}
|
||||
disabled={disabled}
|
||||
className="fixed bottom-19 right-0 md:hidden z-50 p-3 rounded-xl transition-all duration-200 active:scale-95 hover:scale-105 bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-destructive-foreground border border-red-500/60 shadow-lg shadow-red-500/30"
|
||||
className="border border-white fixed bottom-19 right-0 md:hidden z-50 p-3 rounded-xl transition-all duration-200 active:scale-95 hover:scale-105 bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-destructive-foreground border border-red-500/60 shadow-lg shadow-red-500/30"
|
||||
title="Stop"
|
||||
>
|
||||
<Square className="w-5 h-5" />
|
||||
<SquareFill className="w-5 h-5" />
|
||||
</button>
|
||||
)}
|
||||
|
||||
@@ -693,7 +694,7 @@ return (
|
||||
className="hidden md:block p-1.5 px-5 md:p-2 md:px-6 rounded-lg transition-all duration-200 active:scale-95 hover:scale-105 bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-destructive-foreground border border-red-500/60 hover:border-red-400 shadow-md shadow-red-500/30 hover:shadow-red-500/40 ring-1 ring-red-500/20 hover:ring-red-500/30"
|
||||
title="Stop"
|
||||
>
|
||||
<Square className="w-4 h-4 md:w-5 md:h-5" />
|
||||
<SquareFill className="w-4 h-4 md:w-5 md:h-5" />
|
||||
</button>
|
||||
)}
|
||||
<input
|
||||
|
||||
@@ -297,6 +297,13 @@ export function TextPart({ part }: TextPartProps) {
|
||||
},
|
||||
li({ children }) {
|
||||
return <li className="text-foreground my-0.5 md:my-1">{children}</li>
|
||||
},
|
||||
table({ children }) {
|
||||
return (
|
||||
<div className="table-wrapper">
|
||||
<table>{children}</table>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user