collapse composer pills to icons on narrow screens (#7269)

* Studio: wrap composer toolbar chips instead of clipping on narrow screens

* Studio: collapse composer pills to icons on narrow screens

* Studio: wrap compare composer pills instead of clipping

---------

Co-authored-by: Lee Jackson <130007945+Imagineer99@users.noreply.github.com>
This commit is contained in:
Nilay 2026-07-22 01:32:56 +05:30 committed by GitHub
commit d437bc56d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 17 deletions

View file

@ -176,6 +176,7 @@ import {
} from "react";
import { create } from "zustand";
import { extractTaggedText, updateThreadMessage } from "@/features/chat/utils/update-thread-message";
import { useIsMobile } from "@/hooks/use-mobile";
// True while a file is dragged anywhere over the chat page, so the composer
// can show its "Drop files here" affordance.
@ -1436,14 +1437,16 @@ const Composer: FC<{
const mcpEnabledForChat = useChatRuntimeStore((s) => s.mcpEnabledForChat);
const ragEnabled = useChatRuntimeStore((s) => s.ragEnabled);
// More than 4 pills: collapse to icons only. Search, Code, and permissions
// always show; Images, RAG, Canvas and MCP are conditional.
const pillsCompact =
// always show; Images, RAG, Canvas and MCP are conditional. Narrow viewports
// collapse too: the labelled row is wider than a phone-width composer.
const isMobile = useIsMobile();
const pillCount =
3 +
(ragEnabled ? 1 : 0) +
(supportsBuiltinImageGeneration ? 1 : 0) +
(artifactsEnabled ? 1 : 0) +
(mcpEnabledForChat ? 1 : 0) >
4;
(ragEnabled ? 1 : 0) +
(supportsBuiltinImageGeneration ? 1 : 0) +
(artifactsEnabled ? 1 : 0) +
(mcpEnabledForChat ? 1 : 0);
const pillsCompact = isMobile || pillCount > 4;
const activeThreadId = useChatRuntimeStore((s) => s.activeThreadId);
const setPendingImageEditReference = useChatRuntimeStore(
(s) => s.setPendingImageEditReference,

View file

@ -98,6 +98,7 @@ import {
providerTypeSupportsVision,
} from "./external-providers";
import { useExternalProvidersStore } from "./stores/external-providers-store";
import { useIsMobile } from "@/hooks/use-mobile";
import {
PLUS_MENU_ORDER,
type PlusMenuItemId,
@ -813,15 +814,17 @@ export function SharedComposer({
const ragDisabled = modelLoaded && (isExternalModel || !supportsTools);
const showRagPill = !isExternalModel;
// Above 4 pills, collapse to icons only. Compare, Search, Code, and
// permissions always show; the rest are conditional.
const pillsCompact =
// permissions always show; the rest are conditional. Narrow viewports
// collapse too: the labelled row is wider than a phone-width composer.
const isMobile = useIsMobile();
const pillCount =
4 +
(showImagePill ? 1 : 0) +
(showRagPill && ragEnabled ? 1 : 0) +
(showWebFetchPill ? 1 : 0) +
(artifactsEnabled ? 1 : 0) +
(mcpEnabledForChat ? 1 : 0) >
4;
(showImagePill ? 1 : 0) +
(showRagPill && ragEnabled ? 1 : 0) +
(showWebFetchPill ? 1 : 0) +
(artifactsEnabled ? 1 : 0) +
(mcpEnabledForChat ? 1 : 0);
const pillsCompact = isMobile || pillCount > 4;
// Backwards-compatible alias for call sites still referencing
// `toolsDisabled` (rare; both pills used it before).
const toolsDisabled = codeDisabled;
@ -1781,7 +1784,7 @@ export function SharedComposer({
/>
<div className="composer-action-wrapper">
<div
className="flex items-center gap-0.5"
className="flex min-w-0 flex-wrap items-center gap-0.5"
data-pill-compact={pillsCompact ? "true" : undefined}
>
<input

View file

@ -1606,7 +1606,7 @@ html[data-chat-font] .aui-root {
}
.unsloth-composer-left {
@apply flex shrink-0 items-center gap-0.5;
@apply flex min-w-0 flex-wrap items-center gap-0.5;
order: 1;
/* Pull the plus button closer to the composer edge. */
margin-left: -0.25rem;