mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +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>
|
||||
)
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -6,8 +6,9 @@ import { useSettings } from '@/hooks/useSettings'
|
||||
import { useTTS } from '@/hooks/useTTS'
|
||||
import { useTTSModels, useTTSVoices, useTTSDiscovery } from '@/hooks/useTTSDiscovery'
|
||||
import { getAvailableVoiceNames, isWebSpeechSupported } from '@/lib/webSpeechSynthesizer'
|
||||
import { Loader2, Volume2, Square, XCircle, RefreshCw, MonitorSpeaker, Globe, CheckCircle2 } from 'lucide-react'
|
||||
import { Loader2, Volume2, XCircle, RefreshCw, MonitorSpeaker, Globe, CheckCircle2 } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { SquareFill } from '@/components/ui/square-fill'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Switch } from '@/components/ui/switch'
|
||||
import { Slider } from '@/components/ui/slider'
|
||||
@@ -642,7 +643,7 @@ export function TTSSettings() {
|
||||
</>
|
||||
) : isPlaying ? (
|
||||
<>
|
||||
<Square className="h-4 w-4 mr-2" />
|
||||
<SquareFill className="h-4 w-4 mr-2" />
|
||||
Stop
|
||||
</>
|
||||
) : (
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
export function SquareFill({ className = "" }: { className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
className={className}
|
||||
>
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
@@ -225,6 +225,35 @@ body {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.prose-enhanced .table-wrapper {
|
||||
overflow-x: auto;
|
||||
margin: 1em 0;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.prose-enhanced table {
|
||||
border-collapse: collapse;
|
||||
min-width: 100%;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.prose-enhanced th,
|
||||
.prose-enhanced td {
|
||||
padding: 0.5rem 0.75rem;
|
||||
border: 1px solid var(--color-border);
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.prose-enhanced th {
|
||||
background-color: var(--color-accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.prose-enhanced tr:nth-child(even) {
|
||||
background-color: var(--color-accent);
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.prose-enhanced pre {
|
||||
padding: 0.5rem;
|
||||
@@ -234,6 +263,12 @@ body {
|
||||
.prose-enhanced code {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.prose-enhanced th,
|
||||
.prose-enhanced td {
|
||||
padding: 0.375rem 0.5rem;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
.prose-enhanced :first-child {
|
||||
|
||||
Reference in new issue
Block a user