mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(frontend): add scroll-to-bottom button, improve scroll disengagement, and tall content detection
This commit is contained in:
1 parent
c3802aa021
commit
f492faa84b
10 files changed
+512
-29
No files matched your search
@@ -92,7 +92,7 @@ export function FloatingTTSButton({ messageId, content }: FloatingTTSButtonProps
|
||||
onPointerDown={handlePointerDown}
|
||||
onPointerUp={handlePointerUp}
|
||||
onPointerLeave={handlePointerLeave}
|
||||
className={`absolute -top-5 right-0 md:right-4 z-50 flex items-center transition-all duration-200 shadow-md backdrop-blur-md ring-1 ${buttonToneClasses} ${isLongPressVisual ? 'scale-95 opacity-80' : 'active:scale-95 hover:scale-105'} ${!hasContent && !autoPlay ? 'opacity-50 cursor-not-allowed' : ''}`}
|
||||
className={`flex items-center transition-all duration-200 shadow-md backdrop-blur-md ring-1 ${buttonToneClasses} ${isLongPressVisual ? 'scale-95 opacity-80' : 'active:scale-95 hover:scale-105'} ${!hasContent && !autoPlay ? 'opacity-50 cursor-not-allowed' : ''}`}
|
||||
title={pillTitle}
|
||||
aria-label={pillAriaLabel}
|
||||
disabled={!hasContent && !autoPlay}
|
||||
|
||||
@@ -380,5 +380,35 @@ describe('PromptInput STT Gesture Tests', () => {
|
||||
expect(mockStartRecording).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
})
|
||||
|
||||
it('renders mobile mic even when showScrollButton is true and no voice feedback is active', async () => {
|
||||
mocks.useMobile.mockReturnValue(true)
|
||||
|
||||
render(
|
||||
<QueryClientProvider client={createTestQueryClient()}>
|
||||
<PromptInput {...defaultProps} showScrollButton={true} />
|
||||
</QueryClientProvider>
|
||||
)
|
||||
|
||||
const allButtons = screen.getAllByRole('button')
|
||||
const voiceButtons = allButtons.filter((btn) => {
|
||||
const title = (btn.getAttribute('title') || '').toLowerCase()
|
||||
return title.includes('tap to speak') || title.includes('tap to transcribe') || title.includes('hold to speak')
|
||||
})
|
||||
|
||||
expect(voiceButtons.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('does NOT render mobile in-row ArrowDown button', async () => {
|
||||
mocks.useMobile.mockReturnValue(true)
|
||||
|
||||
render(
|
||||
<QueryClientProvider client={createTestQueryClient()}>
|
||||
<PromptInput {...defaultProps} showScrollButton={true} />
|
||||
</QueryClientProvider>
|
||||
)
|
||||
|
||||
expect(screen.queryByTitle('Scroll to bottom')).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1244,23 +1244,15 @@ return (
|
||||
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5 md:gap-2 flex-shrink-0">
|
||||
{isMobile && showScrollButton && !showVoiceFeedback ? (
|
||||
{!isMobile && (
|
||||
<button
|
||||
onClick={onScrollToBottom}
|
||||
className="px-4 py-2 rounded-lg bg-black hover:bg-zinc-900 text-white transition-all duration-200 active:scale-95 shadow-md flex items-center justify-center min-w-[52px] border border-zinc-700"
|
||||
title="Scroll to bottom"
|
||||
>
|
||||
<ArrowDown className="w-5 h-5" />
|
||||
</button>
|
||||
) : !isMobile ? (
|
||||
<button
|
||||
onClick={onScrollToBottom}
|
||||
className={`p-2 rounded-lg bg-black hover:bg-zinc-900 text-white transition-all duration-200 active:scale-95 hover:scale-105 shadow-md border border-zinc-700 ${showScrollButton ? 'visible' : 'invisible'}`}
|
||||
className={`p-2 rounded-lg bg-zinc-950/80 hover:bg-zinc-900/90 text-blue-300 hover:text-blue-200 transition-all duration-200 active:scale-95 hover:scale-105 shadow-md border border-blue-400/20 backdrop-blur-md ring-1 ring-blue-400/15 ${showScrollButton ? 'visible' : 'invisible'}`}
|
||||
title="Scroll to bottom"
|
||||
>
|
||||
<ArrowDown className="w-6 h-6" />
|
||||
</button>
|
||||
) : null}
|
||||
)}
|
||||
{showStopButton && (
|
||||
<button
|
||||
onClick={handleStop}
|
||||
@@ -1289,7 +1281,7 @@ return (
|
||||
{sttEnabled && sttSupported && (
|
||||
renderVoiceButton('desktop')
|
||||
)}
|
||||
{isMobile && sttEnabled && sttSupported && !hasPendingPermissionForSession && (!showScrollButton || showVoiceFeedback) && (
|
||||
{isMobile && sttEnabled && sttSupported && !hasPendingPermissionForSession && (
|
||||
renderVoiceButton('mobile')
|
||||
)}
|
||||
<button
|
||||
|
||||
Reference in new issue
Block a user