Skip to content

Commit c7fe563

Browse files
author
Test
committed
🤖 fix: simplify mobile run settings layout
- Remove collapsible sections and present model/mode/reasoning/context inline - Add extra header inset so the Run settings title clears safe areas - Keep model list scrollable via nested ScrollView without virtualized nesting Generated with Change-Id: If60679bf6bff95af019a232d2c02c4721e0131d2 Signed-off-by: Test <test@example.com>
1 parent 659fb79 commit c7fe563

File tree

1 file changed

+52
-104
lines changed

1 file changed

+52
-104
lines changed

apps/mobile/src/components/RunSettingsSheet.tsx

Lines changed: 52 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import {
2323
const ALL_MODELS = listKnownModels();
2424
const THINKING_LEVELS: ThinkingLevel[] = ["off", "low", "medium", "high"];
2525

26-
type CollapsibleKey = "model" | "mode" | "reasoning" | "context";
27-
2826
interface RunSettingsSheetProps {
2927
visible: boolean;
3028
onClose: () => void;
@@ -40,55 +38,9 @@ interface RunSettingsSheetProps {
4038
supportsExtendedContext: boolean;
4139
}
4240

43-
interface SectionProps {
44-
title: string;
45-
subtitle?: string;
46-
collapsed: boolean;
47-
onToggle: () => void;
48-
children: JSX.Element | JSX.Element[];
49-
}
50-
51-
function SectionCard(props: SectionProps): JSX.Element {
52-
const theme = useTheme();
53-
return (
54-
<View style={[styles.sectionCard, { borderColor: theme.colors.border }]}>
55-
<Pressable
56-
onPress={props.onToggle}
57-
style={({ pressed }) => [
58-
styles.sectionHeader,
59-
pressed ? { backgroundColor: theme.colors.surfaceSecondary } : null,
60-
]}
61-
>
62-
<View style={{ flex: 1 }}>
63-
<ThemedText variant="label" weight="semibold">
64-
{props.title}
65-
</ThemedText>
66-
{props.subtitle && (
67-
<ThemedText variant="caption" style={{ color: theme.colors.foregroundMuted }}>
68-
{props.subtitle}
69-
</ThemedText>
70-
)}
71-
</View>
72-
<Ionicons
73-
name={props.collapsed ? "chevron-forward" : "chevron-down"}
74-
size={18}
75-
color={theme.colors.foregroundPrimary}
76-
/>
77-
</Pressable>
78-
{!props.collapsed && <View style={styles.sectionBody}>{props.children}</View>}
79-
</View>
80-
);
81-
}
82-
8341
export function RunSettingsSheet(props: RunSettingsSheetProps): JSX.Element {
8442
const theme = useTheme();
8543
const [query, setQuery] = useState("");
86-
const [collapsed, setCollapsed] = useState<Record<CollapsibleKey, boolean>>({
87-
model: false,
88-
mode: false,
89-
reasoning: false,
90-
context: false,
91-
});
9244

9345
useEffect(() => {
9446
if (!props.visible) {
@@ -112,10 +64,6 @@ export function RunSettingsSheet(props: RunSettingsSheetProps): JSX.Element {
11264
return props.recentModels.filter(isKnownModelId);
11365
}, [props.recentModels]);
11466

115-
const toggleSection = (key: CollapsibleKey) => {
116-
setCollapsed((prev) => ({ ...prev, [key]: !prev[key] }));
117-
};
118-
11967
const handleSelectModel = (modelId: string) => {
12068
props.onSelectModel(modelId);
12169
};
@@ -127,23 +75,27 @@ export function RunSettingsSheet(props: RunSettingsSheetProps): JSX.Element {
12775
presentationStyle="pageSheet"
12876
onRequestClose={props.onClose}
12977
>
130-
<View style={[styles.container, { backgroundColor: theme.colors.background }]}>
78+
<View style={[styles.container, { backgroundColor: theme.colors.background }]}>
13179
<View style={styles.header}>
132-
<ThemedText variant="titleMedium" weight="semibold">
80+
<ThemedText variant="titleMedium" weight="semibold" style={styles.headerTitle}>
13381
Run settings
13482
</ThemedText>
13583
<Pressable onPress={props.onClose} style={styles.closeButton}>
13684
<Ionicons name="close" size={20} color={theme.colors.foregroundPrimary} />
13785
</Pressable>
13886
</View>
13987

140-
<ScrollView contentContainerStyle={{ paddingBottom: 32 }}>
141-
<SectionCard
142-
title="Model"
143-
subtitle={formatModelSummary(props.selectedModel)}
144-
collapsed={collapsed.model}
145-
onToggle={() => toggleSection("model")}
146-
>
88+
<ScrollView contentContainerStyle={styles.content}>
89+
<View style={[styles.sectionBlock, { borderColor: theme.colors.border }]}>
90+
<View style={styles.sectionHeading}>
91+
<ThemedText variant="label" weight="semibold">
92+
Model
93+
</ThemedText>
94+
<ThemedText variant="caption" style={{ color: theme.colors.foregroundMuted }}>
95+
{formatModelSummary(props.selectedModel)}
96+
</ThemedText>
97+
</View>
98+
14799
<View
148100
style={[
149101
styles.searchWrapper,
@@ -254,14 +206,12 @@ export function RunSettingsSheet(props: RunSettingsSheetProps): JSX.Element {
254206
))
255207
)}
256208
</ScrollView>
257-
</SectionCard>
209+
</View>
258210

259-
<SectionCard
260-
title="Mode"
261-
subtitle={props.mode === "plan" ? "Plan" : "Exec"}
262-
collapsed={collapsed.mode}
263-
onToggle={() => toggleSection("mode")}
264-
>
211+
<View style={[styles.sectionBlock, { borderColor: theme.colors.border }]}>
212+
<ThemedText variant="label" weight="semibold" style={styles.sectionTitle}>
213+
Mode
214+
</ThemedText>
265215
<View style={styles.modeRow}>
266216
{(["plan", "exec"] as WorkspaceMode[]).map((modeOption) => (
267217
<Pressable
@@ -289,14 +239,12 @@ export function RunSettingsSheet(props: RunSettingsSheetProps): JSX.Element {
289239
</Pressable>
290240
))}
291241
</View>
292-
</SectionCard>
242+
</View>
293243

294-
<SectionCard
295-
title="Reasoning"
296-
subtitle={props.thinkingLevel.toUpperCase()}
297-
collapsed={collapsed.reasoning}
298-
onToggle={() => toggleSection("reasoning")}
299-
>
244+
<View style={[styles.sectionBlock, { borderColor: theme.colors.border }]}>
245+
<ThemedText variant="label" weight="semibold" style={styles.sectionTitle}>
246+
Reasoning
247+
</ThemedText>
300248
<View style={styles.levelRow}>
301249
{THINKING_LEVELS.map((level) => {
302250
const active = props.thinkingLevel === level;
@@ -330,15 +278,13 @@ export function RunSettingsSheet(props: RunSettingsSheetProps): JSX.Element {
330278
);
331279
})}
332280
</View>
333-
</SectionCard>
281+
</View>
334282

335283
{props.supportsExtendedContext && (
336-
<SectionCard
337-
title="Context window"
338-
subtitle={props.use1MContext ? "1M tokens" : "128K tokens"}
339-
collapsed={collapsed.context}
340-
onToggle={() => toggleSection("context")}
341-
>
284+
<View style={[styles.sectionBlock, { borderColor: theme.colors.border }]}>
285+
<ThemedText variant="label" weight="semibold" style={styles.sectionTitle}>
286+
Context window
287+
</ThemedText>
342288
<View style={styles.contextRow}>
343289
<ThemedText style={{ flex: 1 }}>
344290
Enable 1M token context (Anthropic only)
@@ -350,7 +296,7 @@ export function RunSettingsSheet(props: RunSettingsSheetProps): JSX.Element {
350296
thumbColor={theme.colors.surface}
351297
/>
352298
</View>
353-
</SectionCard>
299+
</View>
354300
)}
355301
</ScrollView>
356302
</View>
@@ -361,34 +307,53 @@ export function RunSettingsSheet(props: RunSettingsSheetProps): JSX.Element {
361307
const styles = StyleSheet.create({
362308
container: {
363309
flex: 1,
364-
paddingHorizontal: 16,
365310
paddingTop: 12,
366311
},
367312
header: {
368313
flexDirection: "row",
369314
alignItems: "center",
370315
justifyContent: "space-between",
316+
paddingHorizontal: 24,
371317
marginBottom: 12,
372318
},
319+
headerTitle: {
320+
paddingRight: 16,
321+
},
322+
content: {
323+
paddingBottom: 32,
324+
paddingHorizontal: 16,
325+
},
373326
closeButton: {
374327
padding: 8,
375328
},
329+
sectionBlock: {
330+
borderWidth: StyleSheet.hairlineWidth,
331+
borderRadius: 12,
332+
padding: 16,
333+
marginBottom: 16,
334+
gap: 12,
335+
},
336+
sectionHeading: {
337+
gap: 4,
338+
},
339+
sectionTitle: {
340+
marginBottom: 4,
341+
},
376342
searchWrapper: {
377343
flexDirection: "row",
378344
alignItems: "center",
379345
borderWidth: 1,
380-
borderRadius: 8,
346+
borderRadius: 10,
381347
paddingHorizontal: 12,
382348
paddingVertical: 8,
383349
gap: 8,
384-
marginBottom: 16,
385350
},
386351
searchInput: {
387352
flex: 1,
388353
fontSize: 16,
389354
},
390355
section: {
391-
marginBottom: 12,
356+
marginTop: 8,
392357
},
393358
recentChips: {
394359
flexDirection: "row",
@@ -410,23 +375,6 @@ const styles = StyleSheet.create({
410375
paddingVertical: 14,
411376
paddingHorizontal: 4,
412377
},
413-
sectionCard: {
414-
borderWidth: StyleSheet.hairlineWidth,
415-
borderRadius: 12,
416-
marginBottom: 16,
417-
overflow: "hidden",
418-
},
419-
sectionHeader: {
420-
flexDirection: "row",
421-
alignItems: "center",
422-
paddingHorizontal: 16,
423-
paddingVertical: 14,
424-
},
425-
sectionBody: {
426-
paddingHorizontal: 16,
427-
paddingBottom: 16,
428-
gap: 12,
429-
},
430378
modeRow: {
431379
flexDirection: "row",
432380
gap: 12,

0 commit comments

Comments
 (0)