feat: enhance mobile view for model controls

This commit is contained in:
Bohdan Triapitsyn
2025-12-15 03:04:46 +02:00
parent bd25787b92
commit 05deb79107
4 changed files with 48 additions and 13 deletions
+5
View File
@@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file.
## [Unreleased] ## [Unreleased]
## [1.1.4] - 2025-12-15
- Flexoki themes for Shiki syntax highlighting for consistency with the app color schema. - Flexoki themes for Shiki syntax highlighting for consistency with the app color schema.
- Enchanced VSCode extension theming with editor themes
- Fixed mobile view model/agent selection
## [1.1.3] - 2025-12-14 ## [1.1.3] - 2025-12-14
@@ -870,9 +870,10 @@ export const ChatInput: React.FC<ChatInputProps> = ({ onOpenSettings, scrollToBo
<div className="flex items-center flex-shrink-0 gap-x-1"> <div className="flex items-center flex-shrink-0 gap-x-1">
{attachmentsControls} {attachmentsControls}
</div> </div>
<div className="flex-1" /> <div className="flex flex-1 items-center justify-end gap-x-1 min-w-0">
<div className="flex items-center gap-x-1 min-w-0"> <div className="flex flex-1 min-w-0 justify-end overflow-hidden">
<ModelControls className={cn('flex items-center justify-end min-w-0')} /> <ModelControls className={cn('w-full flex items-center justify-end min-w-0')} />
</div>
{actionButton} {actionButton}
</div> </div>
</div> </div>
@@ -1473,7 +1473,6 @@ export const ModelControls: React.FC<ModelControlsProps> = ({ className }) => {
<div <div
className={cn( className={cn(
'model-controls__model-trigger flex items-center gap-1.5 cursor-pointer hover:opacity-70 min-w-0', 'model-controls__model-trigger flex items-center gap-1.5 cursor-pointer hover:opacity-70 min-w-0',
!isDesktopRuntime && 'flex-1',
buttonHeight buttonHeight
)} )}
> >
@@ -1494,7 +1493,7 @@ export const ModelControls: React.FC<ModelControlsProps> = ({ className }) => {
'model-controls__model-label', 'model-controls__model-label',
controlTextSize, controlTextSize,
'font-medium whitespace-nowrap text-foreground truncate min-w-0', 'font-medium whitespace-nowrap text-foreground truncate min-w-0',
isDesktopRuntime ? 'max-w-[260px]' : 'flex-1' 'max-w-[260px]'
)} )}
> >
{getCurrentModelDisplayName()} {getCurrentModelDisplayName()}
@@ -1610,7 +1609,8 @@ export const ModelControls: React.FC<ModelControlsProps> = ({ className }) => {
onTouchEnd={handleLongPressEnd} onTouchEnd={handleLongPressEnd}
onTouchCancel={handleLongPressEnd} onTouchCancel={handleLongPressEnd}
className={cn( className={cn(
'model-controls__model-trigger flex items-center gap-1.5 min-w-0 focus:outline-none flex-1', 'model-controls__model-trigger flex items-center gap-1.5 min-w-0 focus:outline-none',
isMobile && 'flex-1',
'cursor-pointer hover:opacity-70', 'cursor-pointer hover:opacity-70',
buttonHeight buttonHeight
)} )}
@@ -1623,7 +1623,12 @@ export const ModelControls: React.FC<ModelControlsProps> = ({ className }) => {
) : ( ) : (
<RiPencilAiLine className={cn(controlIconSize, 'text-muted-foreground')} /> <RiPencilAiLine className={cn(controlIconSize, 'text-muted-foreground')} />
)} )}
<span className="model-controls__model-label typography-micro font-medium truncate min-w-0 flex-1"> <span
className={cn(
'model-controls__model-label typography-micro font-medium truncate min-w-0',
isMobile ? 'flex-1' : 'max-w-[220px]',
)}
>
{getCurrentModelDisplayName()} {getCurrentModelDisplayName()}
</span> </span>
</button> </button>
@@ -1961,7 +1966,14 @@ export const ModelControls: React.FC<ModelControlsProps> = ({ className }) => {
); );
}; };
const inlineClassName = cn('@container/model-controls flex items-center min-w-0', inlineGapClass, className); const inlineClassName = cn(
'@container/model-controls flex items-center min-w-0',
inlineGapClass,
// Only force full-width + truncation behaviors on true mobile layouts.
// VS Code also uses "compact" mode, but should keep its right-aligned inline sizing.
isMobile && 'w-full',
className,
);
return ( return (
<> <>
@@ -1969,12 +1981,16 @@ export const ModelControls: React.FC<ModelControlsProps> = ({ className }) => {
<div <div
className={cn( className={cn(
'flex items-center min-w-0', 'flex items-center min-w-0',
!isCompact ? (isDesktopRuntime ? 'flex-1 min-w-0 justify-end' : 'flex-1 min-w-0') : undefined isMobile
? 'flex-1 min-w-0 overflow-hidden'
: (isCompact
? 'flex-1 min-w-0 justify-end'
: 'flex-1 min-w-0 justify-end')
)} )}
> >
{renderModelSelector()} {renderModelSelector()}
</div> </div>
<div className={cn('flex items-center min-w-0', inlineGapClass)}> <div className={cn('flex items-center min-w-0', inlineGapClass, isMobile && 'flex-shrink-0')}>
{renderAgentSelector()} {renderAgentSelector()}
</div> </div>
</div> </div>
+16 -3
View File
@@ -1266,19 +1266,32 @@ html:not(.dark) .chat-scroll {
font-size: inherit !important; font-size: inherit !important;
} }
/* Model/agent controls: collapse labels in narrow containers (mobile + VSCode side panel). */ /* Model/agent controls: agent label hides before model label. */
@container model-controls (max-width: 15rem) { @container model-controls (max-width: 11rem) {
.model-controls__agent-label { .model-controls__agent-label {
display: none; display: none;
} }
} }
@container model-controls (max-width: 12rem) { @container model-controls (max-width: 9rem) {
.model-controls__model-label { .model-controls__model-label {
display: none; display: none;
} }
} }
/* VS Code side panel: collapse earlier to save horizontal space. */
@container model-controls (max-width: 9rem) {
:root.vscode-runtime .model-controls__agent-label {
display: none;
}
}
@container model-controls (max-width: 10rem) {
:root.vscode-runtime .model-controls__model-label {
display: none;
}
}
/* Text font: IBM Plex Sans */ /* Text font: IBM Plex Sans */
.streamdown-content { .streamdown-content {
font-family: var(--font-sans); font-family: var(--font-sans);