Skip to content

Commit aa7275c

Browse files
ErikFranklingclaude
andcommitted
fix(mobile): the Needs you sheet scrolls, with Needs you and In flight as tabs
The Android sheet's list never scrolled (the bottom sheet took the drag), so with a dozen Needs you items the In flight list below was out of reach. The list now scrolls inside the sheet, and the two lists sit under tabs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 04afbab commit aa7275c

1 file changed

Lines changed: 81 additions & 38 deletions

File tree

‎apps/mobile/src/features/attention/AttentionSheet.tsx‎

Lines changed: 81 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const HEADER_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Pl
3636
const URL_PATTERN = /https?:\/\/[^\s)]+/g;
3737

3838
export type AttentionTarget = { readonly environmentId: EnvironmentId };
39+
type AttentionTab = "needs_you" | "in_flight";
3940

4041
/** Open items for the card's count. Null while the server lacks the list. */
4142
export function useOpenAttentionCount(environmentId: EnvironmentId | null): number | null {
@@ -241,7 +242,12 @@ function ProofImage(props: {
241242
onPress={() => void Linking.openURL(url)}
242243
className="w-[48%] overflow-hidden rounded-lg border border-border"
243244
>
244-
<Image source={{ uri: url }} contentFit="cover" contentPosition="top" style={{ height: 120 }} />
245+
<Image
246+
source={{ uri: url }}
247+
contentFit="cover"
248+
contentPosition="top"
249+
style={{ height: 120 }}
250+
/>
245251
</Pressable>
246252
);
247253
}
@@ -361,6 +367,7 @@ export function AttentionSheet({ route }: StaticScreenProps<AttentionTarget>) {
361367
const setDone = useAtomCommand(serverEnvironment.setAttentionItemDone, "Needs you item done");
362368
const dismiss = useAtomCommand(serverEnvironment.dismissAttentionItem, "Needs you item remove");
363369
const [busyIds, setBusyIds] = useState<ReadonlySet<string>>(new Set());
370+
const [tab, setTab] = useState<AttentionTab>("needs_you");
364371

365372
const run = async (id: string, action: () => Promise<unknown>) => {
366373
setBusyIds((current) => new Set(current).add(id));
@@ -409,47 +416,83 @@ export function AttentionSheet({ route }: StaticScreenProps<AttentionTarget>) {
409416
/>
410417
);
411418

412-
const content = (
413-
<ScrollView
414-
className="flex-1"
415-
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
416-
contentContainerClassName="px-5"
417-
contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 16) + 8 }}
419+
const needsYouLabel = open.length > 0 ? `Needs you · ${open.length}` : "Needs you";
420+
const inFlightLabel =
421+
inFlightOpen.length > 0 ? `In flight · ${inFlightOpen.length}` : "In flight";
422+
const tabButton = (value: AttentionTab, label: string) => (
423+
<Pressable
424+
key={value}
425+
accessibilityRole="tab"
426+
accessibilityState={{ selected: tab === value }}
427+
onPress={() => setTab(value)}
428+
className={cn(
429+
"flex-1 items-center rounded-full py-2",
430+
tab === value ? "bg-subtle-strong" : null,
431+
)}
418432
>
419-
{error ? <Text className="pt-6 text-sm text-danger-foreground">{error}</Text> : null}
420-
{!error && open.length === 0 ? (
421-
<Text className="pt-6 text-center text-sm text-foreground-muted">
422-
Nothing needs you right now. Your personal agent adds sign-ins, decisions and questions
423-
here when work is waiting on you.
424-
</Text>
425-
) : null}
426-
{open.map(row)}
427-
{done.length > 0 ? (
428-
<>
429-
<SectionTitle>Done this week</SectionTitle>
430-
{done.map(row)}
431-
</>
432-
) : null}
433-
<Text className="mt-8 text-lg font-t3-bold text-foreground">
434-
{inFlightOpen.length > 0 ? `In flight · ${inFlightOpen.length}` : "In flight"}
433+
<Text
434+
className={cn(
435+
"text-sm font-t3-medium",
436+
tab === value ? "text-foreground" : "text-foreground-muted",
437+
)}
438+
>
439+
{label}
435440
</Text>
436-
{inFlightOpen.length === 0 ? (
437-
<Text className="pt-2 text-sm text-foreground-muted">
438-
Nothing in flight. What you ask your personal agent for is tracked here until it is done
439-
and proven.
440-
</Text>
441-
) : null}
442-
{inFlightOpen.map(inFlightRow)}
443-
{inFlightDone.length > 0 ? (
444-
<>
445-
<SectionTitle>Delivered this week</SectionTitle>
446-
{inFlightDone.map(inFlightRow)}
447-
</>
448-
) : null}
449-
</ScrollView>
441+
</Pressable>
442+
);
443+
444+
const content = (
445+
<View className="flex-1">
446+
<View accessibilityRole="tablist" className="mx-5 mt-2 flex-row rounded-full bg-subtle p-1">
447+
{tabButton("needs_you", needsYouLabel)}
448+
{tabButton("in_flight", inFlightLabel)}
449+
</View>
450+
<ScrollView
451+
nestedScrollEnabled
452+
className="flex-1"
453+
contentInsetAdjustmentBehavior={Platform.OS === "ios" ? "automatic" : "never"}
454+
contentContainerClassName="px-5"
455+
contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 16) + 8 }}
456+
>
457+
{error ? <Text className="pt-6 text-sm text-danger-foreground">{error}</Text> : null}
458+
{tab === "needs_you" ? (
459+
<>
460+
{!error && open.length === 0 ? (
461+
<Text className="pt-6 text-center text-sm text-foreground-muted">
462+
Nothing needs you right now. Your personal agent adds sign-ins, decisions and
463+
questions here when work is waiting on you.
464+
</Text>
465+
) : null}
466+
{open.map(row)}
467+
{done.length > 0 ? (
468+
<>
469+
<SectionTitle>Done this week</SectionTitle>
470+
{done.map(row)}
471+
</>
472+
) : null}
473+
</>
474+
) : (
475+
<>
476+
{!error && inFlightOpen.length === 0 ? (
477+
<Text className="pt-6 text-center text-sm text-foreground-muted">
478+
Nothing in flight. What you ask your personal agent for is tracked here until it is
479+
done and proven.
480+
</Text>
481+
) : null}
482+
{inFlightOpen.map(inFlightRow)}
483+
{inFlightDone.length > 0 ? (
484+
<>
485+
<SectionTitle>Delivered this week</SectionTitle>
486+
{inFlightDone.map(inFlightRow)}
487+
</>
488+
) : null}
489+
</>
490+
)}
491+
</ScrollView>
492+
</View>
450493
);
451494

452-
const title = open.length > 0 ? `Needs you · ${open.length}` : "Needs you";
495+
const title = tab === "needs_you" ? needsYouLabel : inFlightLabel;
453496

454497
if (Platform.OS === "ios") {
455498
// A formSheet screen never renders a stack header, so it comes from a

0 commit comments

Comments
 (0)