* feat(mobile): add quick actions button and improve mobile UX Add mobile-optimized quick action buttons and improve autocomplete UX. - Add quick command button (/) in mobile chat footer - Add tabbed autocomplete interface for Commands/Agents/Files - Fix agent selector conflict with model selector - Improve TerminalViewport Android IME support - Add reusable Slider component for settings - Update StatusChip styling for mobile layout Files changed: - ChatInput.tsx: Mobile quick actions, command menu, autocomplete tabs - AgentMentionAutocomplete.tsx: Tab support for mobile - CommandAutocomplete.tsx: Tab support and touch handling - FileMentionAutocomplete.tsx: Tab support for mobile - ModelControls.tsx: Agent selector fix - StatusChip.tsx: Mobile layout improvements - TerminalViewport.tsx: Android IME improvements - ui/slider.tsx: New reusable slider component * feat(chat): remove unused BrowserVoiceButton component from ChatInput * fix: Resolve linter errors
68 lines
2.5 KiB
TypeScript
68 lines
2.5 KiB
TypeScript
import React from 'react';
|
|
import { cn } from '@/lib/utils';
|
|
import { useConfigStore } from '@/stores/useConfigStore';
|
|
import { useSessionStore } from '@/stores/useSessionStore';
|
|
import { useContextStore } from '@/stores/contextStore';
|
|
import { formatEffortLabel, getAgentDisplayName, getModelDisplayName } from './mobileControlsUtils';
|
|
|
|
interface StatusChipProps {
|
|
onClick: () => void;
|
|
className?: string;
|
|
}
|
|
|
|
export const StatusChip: React.FC<StatusChipProps> = ({ onClick, className }) => {
|
|
const {
|
|
currentModelId,
|
|
currentVariant,
|
|
currentAgentName,
|
|
getCurrentProvider,
|
|
getCurrentModelVariants,
|
|
getVisibleAgents,
|
|
} = useConfigStore();
|
|
const currentSessionId = useSessionStore((state) => state.currentSessionId);
|
|
const sessionAgentName = useContextStore((state) =>
|
|
currentSessionId ? state.getSessionAgentSelection(currentSessionId) : null
|
|
);
|
|
|
|
const agents = getVisibleAgents();
|
|
const uiAgentName = currentSessionId ? (sessionAgentName || currentAgentName) : currentAgentName;
|
|
const agentLabel = getAgentDisplayName(agents, uiAgentName);
|
|
const currentProvider = getCurrentProvider();
|
|
const modelLabel = getModelDisplayName(currentProvider, currentModelId);
|
|
const hasEffort = getCurrentModelVariants().length > 0;
|
|
const effortLabel = hasEffort ? formatEffortLabel(currentVariant) : null;
|
|
const fullLabel = [agentLabel, modelLabel, effortLabel].filter(Boolean).join(' · ');
|
|
|
|
return (
|
|
<button
|
|
type="button"
|
|
onClick={onClick}
|
|
className={cn(
|
|
'inline-flex min-w-0 items-center justify-center',
|
|
'rounded-md border border-border/50 px-1.5',
|
|
'text-[11px] font-medium text-foreground/80',
|
|
'focus:outline-none hover:bg-[var(--interactive-hover)]',
|
|
className
|
|
)}
|
|
style={{
|
|
height: '28px',
|
|
maxHeight: '28px',
|
|
minHeight: '28px',
|
|
}}
|
|
title={fullLabel}
|
|
>
|
|
<span className="shrink-0">{agentLabel}</span>
|
|
<span className="shrink-0 text-muted-foreground mx-0.5">·</span>
|
|
<span className="min-w-0 truncate">{modelLabel}</span>
|
|
{effortLabel && (
|
|
<>
|
|
<span className="shrink-0 text-muted-foreground mx-0.5">·</span>
|
|
<span className="shrink-0">{effortLabel}</span>
|
|
</>
|
|
)}
|
|
</button>
|
|
);
|
|
};
|
|
|
|
export default StatusChip;
|