* fix(app): refine compact composer controls and native scrolling Consolidate responsive agent controls and model browsing inside the compact sheet. Preserve manual native scrolling by suspending sticky bottom maintenance while the user owns the viewport. * fix(app): suppress recoverable resume refresh errors Resume revalidation can race host reconnection and reject while the host is offline. Treat the refresh as deferred so development LogBox does not surface a recoverable disconnect. * fix(app): stabilize compact model sheet loading Let the model list consume the sheet space above persistent controls as the sheet expands. Keep unresolved defaults in a loading state so Select model only represents a genuinely empty selection. * fix(app): preserve route anchors during native scroll * fix(app): preserve native scroll intent and sheet dismissal * fix(app): keep compact sheet styles composable
38 lines
937 B
TypeScript
38 lines
937 B
TypeScript
import { createContext, useContext, type ReactNode } from "react";
|
|
import type { ComposerControlPresentation } from "@/composer/agent-controls/layout";
|
|
|
|
interface ComposerControlLayoutValue {
|
|
glyphSize: number;
|
|
presentation: ComposerControlPresentation;
|
|
}
|
|
|
|
const DEFAULT_LAYOUT: ComposerControlLayoutValue = {
|
|
glyphSize: 16,
|
|
presentation: {
|
|
showCarets: true,
|
|
showThinkingLabel: true,
|
|
showModeLabel: true,
|
|
aggregateFeatures: false,
|
|
},
|
|
};
|
|
|
|
const ComposerControlLayoutContext = createContext(DEFAULT_LAYOUT);
|
|
|
|
export function ComposerControlLayoutProvider({
|
|
value,
|
|
children,
|
|
}: {
|
|
value: ComposerControlLayoutValue;
|
|
children: ReactNode;
|
|
}) {
|
|
return (
|
|
<ComposerControlLayoutContext.Provider value={value}>
|
|
{children}
|
|
</ComposerControlLayoutContext.Provider>
|
|
);
|
|
}
|
|
|
|
export function useComposerControlLayout(): ComposerControlLayoutValue {
|
|
return useContext(ComposerControlLayoutContext);
|
|
}
|