Skip to content

Commit 9608d1c

Browse files
author
OpenCode Assistant
committed
Fix mobile layout button overflow in PromptInput
Hide model selector and help dropdown on mobile when processing or when scroll-to-bottom button is visible to prevent button overflow on narrow screens.
1 parent e47c9e7 commit 9608d1c

1 file changed

Lines changed: 37 additions & 30 deletions

File tree

frontend/src/components/message/PromptInput.tsx

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useFileSearch } from '@/hooks/useFileSearch'
77
import { useModelSelection } from '@/hooks/useModelSelection'
88

99
import { useUserBash } from '@/stores/userBashStore'
10+
import { useMobile } from '@/hooks/useMobile'
1011
import { ChevronDown } from 'lucide-react'
1112

1213
import { CommandSuggestions } from '@/components/command/CommandSuggestions'
@@ -449,6 +450,8 @@ export function PromptInput({
449450

450451
const { model: selectedModel, modelString } = useModelSelection(opcodeUrl, directory)
451452
const currentModel = modelString || ''
453+
const isMobile = useMobile()
454+
const hideSecondaryButtons = isMobile && (hasActiveStream || showScrollButton)
452455

453456
useEffect(() => {
454457
const loadModelName = async () => {
@@ -518,36 +521,40 @@ export function PromptInput({
518521
>
519522
{isBashMode ? 'BASH' : currentMode.toUpperCase()}
520523
</button>
521-
<button
522-
onClick={onShowModelsDialog}
523-
className="px-2 py-1 rounded-md text-xs font-medium border bg-muted border-border text-muted-foreground hover:bg-muted-foreground/10 transition-colors cursor-pointer max-w-[120px] md:max-w-[180px] truncate"
524-
>
525-
{modelName.length > 12 ? modelName.substring(0, 10) + '...' : modelName || 'Select model'}
526-
</button>
527-
<DropdownMenu>
528-
<DropdownMenuTrigger asChild>
529-
<button
530-
className="w-6 h-6 rounded-full border-2 border-foreground text-foreground hover:bg-foreground hover:text-background transition-colors flex items-center justify-center text-sm font-medium flex-shrink-0"
531-
title="Help"
532-
>
533-
?
534-
</button>
535-
</DropdownMenuTrigger>
536-
<DropdownMenuContent align="end" className="w-64">
537-
<DropdownMenuItem disabled className="text-xs text-muted-foreground font-medium">
538-
Keyboard Shortcuts
539-
</DropdownMenuItem>
540-
<DropdownMenuItem disabled className="text-xs text-muted-foreground">
541-
<span className="font-mono">Cmd/Ctrl+Enter</span> - Send message
542-
</DropdownMenuItem>
543-
<DropdownMenuItem disabled className="text-xs text-muted-foreground">
544-
<span className="font-mono">@</span> - Mention files or agents
545-
</DropdownMenuItem>
546-
<DropdownMenuItem disabled className="text-xs text-muted-foreground">
547-
<span className="font-mono">!</span> - Bash command mode
548-
</DropdownMenuItem>
549-
</DropdownMenuContent>
550-
</DropdownMenu>
524+
{!hideSecondaryButtons && (
525+
<button
526+
onClick={onShowModelsDialog}
527+
className="px-2 py-1 rounded-md text-xs font-medium border bg-muted border-border text-muted-foreground hover:bg-muted-foreground/10 transition-colors cursor-pointer max-w-[120px] md:max-w-[180px] truncate"
528+
>
529+
{modelName.length > 12 ? modelName.substring(0, 10) + '...' : modelName || 'Select model'}
530+
</button>
531+
)}
532+
{!hideSecondaryButtons && (
533+
<DropdownMenu>
534+
<DropdownMenuTrigger asChild>
535+
<button
536+
className="w-6 h-6 rounded-full border-2 border-foreground text-foreground hover:bg-foreground hover:text-background transition-colors flex items-center justify-center text-sm font-medium flex-shrink-0"
537+
title="Help"
538+
>
539+
?
540+
</button>
541+
</DropdownMenuTrigger>
542+
<DropdownMenuContent align="end" className="w-64">
543+
<DropdownMenuItem disabled className="text-xs text-muted-foreground font-medium">
544+
Keyboard Shortcuts
545+
</DropdownMenuItem>
546+
<DropdownMenuItem disabled className="text-xs text-muted-foreground">
547+
<span className="font-mono">Cmd/Ctrl+Enter</span> - Send message
548+
</DropdownMenuItem>
549+
<DropdownMenuItem disabled className="text-xs text-muted-foreground">
550+
<span className="font-mono">@</span> - Mention files or agents
551+
</DropdownMenuItem>
552+
<DropdownMenuItem disabled className="text-xs text-muted-foreground">
553+
<span className="font-mono">!</span> - Bash command mode
554+
</DropdownMenuItem>
555+
</DropdownMenuContent>
556+
</DropdownMenu>
557+
)}
551558
</div>
552559
<div className="flex items-center gap-1.5 md:gap-2 flex-shrink-0">
553560
{showScrollButton && (

0 commit comments

Comments
 (0)