mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
Update mobile UI styling for TTS button and prompt input
This commit is contained in:
1 parent
18fbdaf634
commit
5e254c8c03
3 files changed
+25
-20
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import { Volume2, VolumeX, Loader2 } from 'lucide-react'
|
||||
import { useTTS } from '@/hooks/useTTS'
|
||||
import { useMobile } from '@/hooks/useMobile'
|
||||
|
||||
interface FloatingTTSButtonProps {
|
||||
content: string
|
||||
@@ -8,7 +7,6 @@ interface FloatingTTSButtonProps {
|
||||
|
||||
export function FloatingTTSButton({ content }: FloatingTTSButtonProps) {
|
||||
const { speak, stop, isEnabled, isPlaying, isLoading, originalText } = useTTS()
|
||||
const isMobile = useMobile()
|
||||
|
||||
if (!isEnabled || !content.trim()) {
|
||||
return null
|
||||
@@ -24,15 +22,13 @@ export function FloatingTTSButton({ content }: FloatingTTSButtonProps) {
|
||||
}
|
||||
}
|
||||
|
||||
const buttonPosition = isMobile ? 'bottom-24' : 'bottom-20'
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={handleClick}
|
||||
className={`fixed ${buttonPosition} right-4 z-50 flex items-center gap-2 px-4 py-3 rounded-xl transition-all duration-200 active:scale-95 hover:scale-105 shadow-lg backdrop-blur-md ${
|
||||
className={`absolute -top-5 right-0 md:right-4 z-50 flex items-center gap-1.5 px-3 py-1.5 rounded-lg transition-all duration-200 active:scale-95 hover:scale-105 shadow-md backdrop-blur-md ring-1 ${
|
||||
isThisPlaying
|
||||
? '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-red-500/30'
|
||||
: 'bg-gradient-to-br from-amber-500 to-orange-600 hover:from-amber-400 hover:to-orange-500 text-white border border-amber-400/60 shadow-amber-500/30'
|
||||
? '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-red-500/30 ring-red-500/20 hover:ring-red-500/40'
|
||||
: 'bg-gradient-to-br from-amber-500 to-orange-600 hover:from-amber-400 hover:to-orange-500 text-white border border-amber-400/60 shadow-amber-500/30 ring-amber-500/20 hover:ring-amber-500/40'
|
||||
}`}
|
||||
title={isThisPlaying ? 'Stop playback' : 'Play last response'}
|
||||
aria-label={isThisPlaying ? 'Stop playback' : 'Play last response'}
|
||||
|
||||
@@ -861,13 +861,23 @@ return (
|
||||
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5 md:gap-2 flex-shrink-0">
|
||||
<button
|
||||
onClick={onScrollToBottom}
|
||||
className={`p-2.5 md:p-2 rounded-lg bg-muted hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground transition-all duration-200 active:scale-95 hover:scale-105 shadow-md ${showScrollButton ? 'visible' : 'invisible'}`}
|
||||
title="Scroll to bottom"
|
||||
>
|
||||
<ArrowDown className="w-6 h-6" />
|
||||
</button>
|
||||
{isMobile && showScrollButton ? (
|
||||
<button
|
||||
onClick={onScrollToBottom}
|
||||
className="px-4 py-2 rounded-lg bg-muted hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground transition-all duration-200 active:scale-95 shadow-md flex items-center justify-center min-w-[52px] border border-border"
|
||||
title="Scroll to bottom"
|
||||
>
|
||||
<ArrowDown className="w-5 h-5" />
|
||||
</button>
|
||||
) : !isMobile ? (
|
||||
<button
|
||||
onClick={onScrollToBottom}
|
||||
className={`p-2 rounded-lg bg-muted hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground transition-all duration-200 active:scale-95 hover:scale-105 shadow-md ${showScrollButton ? 'visible' : 'invisible'}`}
|
||||
title="Scroll to bottom"
|
||||
>
|
||||
<ArrowDown className="w-6 h-6" />
|
||||
</button>
|
||||
) : null}
|
||||
{showStopButton && (
|
||||
<button
|
||||
onClick={handleStop}
|
||||
@@ -916,14 +926,14 @@ return (
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
{isMobile && !prompt.trim() && imageAttachments.length === 0 && sttEnabled && sttSupported && !hasPendingPermissionForSession ? (
|
||||
{isMobile && !showScrollButton && sttEnabled && sttSupported && !hasPendingPermissionForSession && (
|
||||
<button
|
||||
onClick={handleVoiceToggle}
|
||||
disabled={disabled || isProcessing}
|
||||
className={`px-4 py-2 rounded-lg transition-all duration-200 active:scale-95 flex items-center justify-center min-w-[52px] ${
|
||||
isRecording || isTogglingRecording || (isProcessing && !isRecording)
|
||||
? 'bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-destructive-foreground border-2 border-red-500/60 shadow-lg shadow-red-500/30 animate-pulse'
|
||||
: 'bg-primary hover:bg-primary/90 text-primary-foreground border border-white/30'
|
||||
: 'bg-muted hover:bg-muted-foreground/20 text-muted-foreground hover:text-foreground border border-border'
|
||||
}`}
|
||||
title={isRecording ? 'Stop recording' : 'Voice input'}
|
||||
>
|
||||
@@ -937,7 +947,7 @@ return (
|
||||
<Mic className="w-5 h-5" />
|
||||
)}
|
||||
</button>
|
||||
) : (
|
||||
)}
|
||||
<button
|
||||
data-submit-prompt
|
||||
onClick={hasPendingPermissionForSession ? () => setShowDialog(true) : handleSubmit}
|
||||
@@ -951,7 +961,6 @@ return (
|
||||
>
|
||||
<span className="whitespace-nowrap">{hasPendingPermissionForSession ? 'View' : (hasActiveStream ? 'Queue' : 'Send')}</span>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -538,10 +538,10 @@ export function SessionDetail() {
|
||||
handleClearPrompt()
|
||||
}}
|
||||
onClick={handleClearPrompt}
|
||||
className="absolute -top-12 right-0 md:right-4 z-50 flex items-center gap-2 px-4 py-2 rounded-xl bg-gradient-to-br from-red-600 to-red-700 hover:from-red-500 hover:to-red-600 text-destructive-foreground border-2 border-red-500/60 hover:border-red-400 shadow-lg shadow-red-500/30 hover:shadow-red-500/50 backdrop-blur-md transition-all duration-200 active:scale-95 hover:scale-105 ring-2 ring-red-500/20 hover:ring-red-500/40"
|
||||
className="absolute -top-5 right-0 md:right-4 z-50 flex items-center gap-1.5 px-3 py-1.5 rounded-lg 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/50 backdrop-blur-md transition-all duration-200 active:scale-95 hover:scale-105 ring-1 ring-red-500/20 hover:ring-red-500/40"
|
||||
aria-label="Clear"
|
||||
>
|
||||
<X className="w-6 h-6" />
|
||||
<X className="w-5 h-5" />
|
||||
<span className="text-sm font-medium hidden sm:inline">Clear</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user