Skip to content

Commit d4c2133

Browse files
Refine mobile thread layout for iPad responsiveness
- Improve sidebar and home list spacing on larger mobile layouts - Clean up related formatting and workspace catalog quotes
1 parent 8a0c8f8 commit d4c2133

8 files changed

Lines changed: 260 additions & 272 deletions

File tree

‎apps/mobile/src/features/home/HomeScreen.tsx‎

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,16 @@ export function HomeScreen(props: HomeScreenProps) {
153153
const insets = useSafeAreaInsets();
154154
const accentColor = useThemeColor("--color-icon-muted");
155155

156-
const updateGroupDisplay = useCallback(
157-
(key: string, action: HomeGroupDisplayAction) => {
158-
setGroupDisplayStates((previous) => {
159-
const next = new Map(previous);
160-
next.set(
161-
key,
162-
nextGroupDisplayState(previous.get(key) ?? DEFAULT_GROUP_DISPLAY_STATE, action),
163-
);
164-
return next;
165-
});
166-
},
167-
[],
168-
);
156+
const updateGroupDisplay = useCallback((key: string, action: HomeGroupDisplayAction) => {
157+
setGroupDisplayStates((previous) => {
158+
const next = new Map(previous);
159+
next.set(
160+
key,
161+
nextGroupDisplayState(previous.get(key) ?? DEFAULT_GROUP_DISPLAY_STATE, action),
162+
);
163+
return next;
164+
});
165+
}, []);
169166

170167
const handleSwipeableWillOpen = useCallback((methods: SwipeableMethods) => {
171168
if (openSwipeableRef.current !== methods) {
@@ -386,38 +383,38 @@ export function HomeScreen(props: HomeScreenProps) {
386383
collapse/expand data changes. The flattened layout still exposes
387384
`stickyHeaderIndices` if this gets revisited. */}
388385
<SwipeableScrollGateProvider enabled={swipeEnabled}>
389-
<LegendList
390-
ref={listRef}
391-
data={listLayout.items}
392-
renderItem={renderItem}
393-
keyExtractor={keyExtractor}
394-
itemsAreEqual={homeListItemsAreEqual}
395-
drawDistance={500}
396-
estimatedItemSize={ESTIMATED_THREAD_ROW_HEIGHT}
397-
extraData={extraData}
398-
ListHeaderComponent={listHeader}
399-
ListEmptyComponent={listEmpty}
400-
style={{ flex: 1 }}
401-
automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
402-
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
403-
showsVerticalScrollIndicator={false}
404-
keyboardDismissMode="on-drag"
405-
keyboardShouldPersistTaps="handled"
406-
{...scrollGateHandlers}
407-
recycleItems
408-
scrollEventThrottle={16}
409-
contentContainerStyle={{
410-
paddingBottom: Platform.OS === "ios" ? Math.max(insets.bottom, 24) + 24 : 24,
411-
}}
412-
scrollIndicatorInsets={
413-
Platform.OS === "ios"
414-
? {
415-
bottom: Math.max(insets.bottom, 16) + 24,
416-
top: 0,
417-
}
418-
: undefined
419-
}
420-
/>
386+
<LegendList
387+
ref={listRef}
388+
data={listLayout.items}
389+
renderItem={renderItem}
390+
keyExtractor={keyExtractor}
391+
itemsAreEqual={homeListItemsAreEqual}
392+
drawDistance={500}
393+
estimatedItemSize={ESTIMATED_THREAD_ROW_HEIGHT}
394+
extraData={extraData}
395+
ListHeaderComponent={listHeader}
396+
ListEmptyComponent={listEmpty}
397+
style={{ flex: 1 }}
398+
automaticallyAdjustsScrollIndicatorInsets={Platform.OS === "ios"}
399+
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
400+
showsVerticalScrollIndicator={false}
401+
keyboardDismissMode="on-drag"
402+
keyboardShouldPersistTaps="handled"
403+
{...scrollGateHandlers}
404+
recycleItems
405+
scrollEventThrottle={16}
406+
contentContainerStyle={{
407+
paddingBottom: Platform.OS === "ios" ? Math.max(insets.bottom, 24) + 24 : 24,
408+
}}
409+
scrollIndicatorInsets={
410+
Platform.OS === "ios"
411+
? {
412+
bottom: Math.max(insets.bottom, 16) + 24,
413+
top: 0,
414+
}
415+
: undefined
416+
}
417+
/>
421418
</SwipeableScrollGateProvider>
422419
{connectionStatus}
423420
</View>

‎apps/mobile/src/features/home/thread-swipe-actions.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ import {
1010
type ComponentProps,
1111
type ReactNode,
1212
} from "react";
13-
import type { ColorValue, NativeScrollEvent, NativeSyntheticEvent, StyleProp, ViewStyle } from "react-native";
13+
import type {
14+
ColorValue,
15+
NativeScrollEvent,
16+
NativeSyntheticEvent,
17+
StyleProp,
18+
ViewStyle,
19+
} from "react-native";
1420
import { Pressable, View } from "react-native";
1521
import ReanimatedSwipeable, {
1622
type SwipeableMethods,

‎apps/mobile/src/features/settings/SettingsEnvironmentsRouteScreen.tsx‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,7 @@ function ConfiguredCloudEnvironmentRows(props: {
211211
<Text className="text-base font-t3-bold text-foreground">
212212
Could not load T3 Cloud environments
213213
</Text>
214-
<Text className="text-sm text-foreground-muted">
215-
{controller.relayDiscovery.error}
216-
</Text>
214+
<Text className="text-sm text-foreground-muted">{controller.relayDiscovery.error}</Text>
217215
{controller.relayDiscovery.errorTraceId ? (
218216
<CopyTraceIdButton traceId={controller.relayDiscovery.errorTraceId} />
219217
) : null}

‎apps/mobile/src/features/threads/ThreadFeed.tsx‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,11 +1068,7 @@ const ReviewCommentCard = memo(function ReviewCommentCard(props: {
10681068
) : null}
10691069
{props.comment.text.length > 0 ? (
10701070
<View className="border-t px-3 py-3" style={{ borderColor: props.colors.border }}>
1071-
<Text
1072-
selectable
1073-
className="text-base leading-snug"
1074-
style={{ color: props.colors.text }}
1075-
>
1071+
<Text selectable className="text-base leading-snug" style={{ color: props.colors.text }}>
10761072
{props.comment.text}
10771073
</Text>
10781074
</View>

‎apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx‎

Lines changed: 66 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import { LegendList } from "@legendapp/list/react-native";
44
import type { MenuAction } from "@react-native-menu/menu";
55
import { SymbolView } from "expo-symbols";
66
import { useCallback, useMemo, useRef, useState, type ReactNode } from "react";
7-
import type {
8-
LayoutChangeEvent,
9-
NativeScrollEvent,
10-
NativeSyntheticEvent,
11-
} from "react-native";
7+
import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent } from "react-native";
128
import { Platform, StyleSheet, TextInput, View, useColorScheme } from "react-native";
139
import { Gesture, GestureDetector } from "react-native-gesture-handler";
1410
import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSwipeable";
@@ -51,11 +47,7 @@ import { SidebarHeaderActions } from "./sidebar-header-actions";
5147
import { SidebarFilterButton } from "./sidebar-filter-button";
5248
import { createSidebarHeaderItems } from "./sidebar-native-header-items";
5349
import { SidebarNavigationShell } from "./sidebar-navigation-shell";
54-
import {
55-
ThreadListGroupHeader,
56-
ThreadListRow,
57-
ThreadListShowMoreRow,
58-
} from "./thread-list-items";
50+
import { ThreadListGroupHeader, ThreadListRow, ThreadListShowMoreRow } from "./thread-list-items";
5951

6052
/**
6153
* Shared capsule behind the sidebar header buttons — a native liquid-glass
@@ -540,6 +532,67 @@ function ThreadNavigationSidebarPane(
540532
/>
541533
<View style={styles.container}>
542534
<SwipeableScrollGateProvider enabled={swipeEnabled}>
535+
<GestureDetector gesture={sidebarScrollGesture}>
536+
<LegendList
537+
data={listLayout.items}
538+
drawDistance={500}
539+
estimatedItemSize={64}
540+
extraData={listExtraData}
541+
getItemType={(item) => item.type}
542+
itemsAreEqual={homeListItemsAreEqual}
543+
keyExtractor={(item) => item.key}
544+
renderItem={renderListItem}
545+
automaticallyAdjustsScrollIndicatorInsets
546+
contentInsetAdjustmentBehavior="automatic"
547+
contentContainerStyle={[
548+
styles.threadListContent,
549+
{
550+
paddingBottom: Math.max(insets.bottom, 16) + 16,
551+
paddingTop: 6,
552+
},
553+
]}
554+
keyboardDismissMode="on-drag"
555+
keyboardShouldPersistTaps="handled"
556+
{...scrollGateHandlers}
557+
recycleItems
558+
scrollEventThrottle={16}
559+
showsVerticalScrollIndicator={false}
560+
style={styles.threadList}
561+
ListHeaderComponent={
562+
showsConnectionStatus ? (
563+
<View style={styles.connectionStatusNative}>
564+
<WorkspaceConnectionStatus
565+
onPress={props.onOpenEnvironmentSettings}
566+
state={catalogState}
567+
variant="sidebar"
568+
/>
569+
</View>
570+
) : null
571+
}
572+
ListEmptyComponent={listEmpty}
573+
/>
574+
</GestureDetector>
575+
</SwipeableScrollGateProvider>
576+
</View>
577+
</>
578+
);
579+
}
580+
581+
return (
582+
<View
583+
testID="thread-navigation-sidebar"
584+
style={[
585+
styles.container,
586+
{
587+
width: props.width,
588+
backgroundColor,
589+
borderRightColor: borderColor,
590+
borderRightWidth: StyleSheet.hairlineWidth,
591+
},
592+
]}
593+
>
594+
<View style={{ flex: 1, paddingBottom: insets.bottom }}>
595+
<SwipeableScrollGateProvider enabled={swipeEnabled}>
543596
<GestureDetector gesture={sidebarScrollGesture}>
544597
<LegendList
545598
data={listLayout.items}
@@ -550,13 +603,11 @@ function ThreadNavigationSidebarPane(
550603
itemsAreEqual={homeListItemsAreEqual}
551604
keyExtractor={(item) => item.key}
552605
renderItem={renderListItem}
553-
automaticallyAdjustsScrollIndicatorInsets
554-
contentInsetAdjustmentBehavior="automatic"
555606
contentContainerStyle={[
556607
styles.threadListContent,
557608
{
558-
paddingBottom: Math.max(insets.bottom, 16) + 16,
559-
paddingTop: 6,
609+
paddingBottom: 16 + insets.bottom,
610+
paddingTop: topListInset,
560611
},
561612
]}
562613
keyboardDismissMode="on-drag"
@@ -566,69 +617,10 @@ function ThreadNavigationSidebarPane(
566617
scrollEventThrottle={16}
567618
showsVerticalScrollIndicator={false}
568619
style={styles.threadList}
569-
ListHeaderComponent={
570-
showsConnectionStatus ? (
571-
<View style={styles.connectionStatusNative}>
572-
<WorkspaceConnectionStatus
573-
onPress={props.onOpenEnvironmentSettings}
574-
state={catalogState}
575-
variant="sidebar"
576-
/>
577-
</View>
578-
) : null
579-
}
580620
ListEmptyComponent={listEmpty}
581621
/>
582622
</GestureDetector>
583-
</SwipeableScrollGateProvider>
584-
</View>
585-
</>
586-
);
587-
}
588-
589-
return (
590-
<View
591-
testID="thread-navigation-sidebar"
592-
style={[
593-
styles.container,
594-
{
595-
width: props.width,
596-
backgroundColor,
597-
borderRightColor: borderColor,
598-
borderRightWidth: StyleSheet.hairlineWidth,
599-
},
600-
]}
601-
>
602-
<View style={{ flex: 1, paddingBottom: insets.bottom }}>
603-
<SwipeableScrollGateProvider enabled={swipeEnabled}>
604-
<GestureDetector gesture={sidebarScrollGesture}>
605-
<LegendList
606-
data={listLayout.items}
607-
drawDistance={500}
608-
estimatedItemSize={64}
609-
extraData={listExtraData}
610-
getItemType={(item) => item.type}
611-
itemsAreEqual={homeListItemsAreEqual}
612-
keyExtractor={(item) => item.key}
613-
renderItem={renderListItem}
614-
contentContainerStyle={[
615-
styles.threadListContent,
616-
{
617-
paddingBottom: 16 + insets.bottom,
618-
paddingTop: topListInset,
619-
},
620-
]}
621-
keyboardDismissMode="on-drag"
622-
keyboardShouldPersistTaps="handled"
623-
{...scrollGateHandlers}
624-
recycleItems
625-
scrollEventThrottle={16}
626-
showsVerticalScrollIndicator={false}
627-
style={styles.threadList}
628-
ListEmptyComponent={listEmpty}
629-
/>
630-
</GestureDetector>
631-
</SwipeableScrollGateProvider>
623+
</SwipeableScrollGateProvider>
632624
</View>
633625

634626
<View

0 commit comments

Comments
 (0)