Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Move mobile working timer into the thread timeline (#4285)

Julius Marminge7e2bb475042c
diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsx
index e712664d3..c1a6f2c23 100644
--- a/apps/mobile/src/features/threads/ThreadComposer.tsx
+++ b/apps/mobile/src/features/threads/ThreadComposer.tsx
@@ -26,7 +26,13 @@ import {
type ViewStyle,
} from "react-native";
import ImageViewing from "react-native-image-viewing";
-import Animated, { FadeIn, FadeOut, LinearTransition } from "react-native-reanimated";
+import Animated, {
+ FadeIn,
+ FadeInDown,
+ FadeOut,
+ FadeOutDown,
+ LinearTransition,
+} from "react-native-reanimated";
import { useThemeColor } from "../../lib/useThemeColor";
import { armAgentAwarenessLiveActivityForLocalWork } from "../agent-awareness/remoteRegistration";
import { scopedThreadKey } from "../../lib/scopedEntities";
@@ -232,7 +238,12 @@ const ComposerConnectionStatusPill = memo(function ComposerConnectionStatusPill(
const isReconnecting = props.status.kind !== "unavailable";
return (
- <View className="items-center pb-2">
+ <Animated.View
+ className="absolute inset-x-0 bottom-full items-center pb-2"
+ entering={FadeInDown.duration(180)}
+ exiting={FadeOutDown.duration(140)}
+ pointerEvents="box-none"
+ >
<Pressable
accessibilityRole="button"
onPress={props.onPress}
@@ -250,7 +261,7 @@ const ComposerConnectionStatusPill = memo(function ComposerConnectionStatusPill(
{props.status.label}
</Text>
</Pressable>
- </View>
+ </Animated.View>
);
});
diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
index 32527b0b7..5cb04290f 100644
--- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
@@ -14,21 +14,18 @@ import type {
ServerConfig as T3ServerConfig,
ThreadId,
} from "@t3tools/contracts";
-import { formatElapsed } from "@t3tools/shared/orchestrationTiming";
import * as Haptics from "expo-haptics";
import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { Platform, View, type GestureResponderEvent } from "react-native";
import { KeyboardController, KeyboardStickyView } from "react-native-keyboard-controller";
-import Animated, { FadeInDown, FadeOut, LinearTransition } from "react-native-reanimated";
+import Animated, { FadeInDown, FadeOut } from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";
-import { AppText as Text } from "../../components/AppText";
import type { ComposerEditorHandle } from "../../components/ComposerEditor";
import type { StatusTone } from "../../components/StatusPill";
import type { DraftComposerImageAttachment } from "../../lib/composerImages";
import { CHAT_CONTENT_MAX_WIDTH, type LayoutVariant } from "../../lib/layout";
import { scopedThreadKey } from "../../lib/scopedEntities";
-import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
import type {
PendingApproval,
PendingUserInput,
@@ -172,54 +169,6 @@ function useStreamingHaptics(threadId: ThreadId, feed: ReadonlyArray<ThreadFeedE
}, [threadId, feed]);
}
-// Pre-measurement estimate for the working pill's slot (the real height is
-// measured via onComposerLayout since the pill lives inside the composer
-// overlay). Matches the rendered pill: pt-2 + pb-2 (16) wrapping a bordered
-// px-3/py-2 row (~36), so ~52 — keep it in sync with WorkingDurationPill.
-const WORKING_INDICATOR_HEIGHT = 52;
-
-const WorkingDurationPill = memo(function WorkingDurationPill(props: {
- readonly startedAt: string;
-}) {
- const [nowMs, setNowMs] = useState(() => Date.now());
-
- useEffect(() => {
- const intervalId = setInterval(() => {
- setNowMs(Date.now());
- }, 1_000);
- return () => clearInterval(intervalId);
- }, [props.startedAt]);
-
- const durationLabel = formatElapsed(props.startedAt, new Date(nowMs).toISOString()) ?? "0s";
-
- return (
- <Animated.View
- className="shrink-0 px-4 pb-2 pt-2"
- entering={FadeInDown.duration(200)}
- exiting={FadeOut.duration(140)}
- >
- <View
- className={
- Platform.OS === "ios" && !NATIVE_LIQUID_GLASS_SUPPORTED
- ? "self-start rounded-full border border-border bg-card px-3 py-2"
- : "self-start rounded-full border border-neutral-200/80 bg-neutral-50/90 px-3 py-2 dark:border-white/[0.08] dark:bg-white/[0.04]"
- }
- >
- <View className="flex-row items-center gap-2">
- <View className="flex-row items-center gap-1">
- <View className="h-1.5 w-1.5 rounded-full bg-neutral-400 dark:bg-neutral-500" />
- <View className="h-1.5 w-1.5 rounded-full bg-neutral-400/80 dark:bg-neutral-500/80" />
- <View className="h-1.5 w-1.5 rounded-full bg-neutral-400/60 dark:bg-neutral-500/60" />
- </View>
- <Text className="font-t3-medium text-xs text-neutral-600 dark:text-neutral-400">
- Working for {durationLabel}
- </Text>
- </View>
- </View>
- </Animated.View>
- );
-});
-
export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: ThreadDetailScreenProps) {
const insets = useSafeAreaInsets();
const agentLabel = `${props.selectedThread.modelSelection.instanceId} agent`;
@@ -253,8 +202,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
const selectedThreadFeed = props.selectedThreadFeed;
const composerChrome = composerExpanded ? COMPOSER_EXPANDED_CHROME : COMPOSER_COLLAPSED_CHROME;
const composerOverlapHeight = composerChrome + composerBottomInset;
- const activeWorkIndicatorHeight = props.activeWorkStartedAt ? WORKING_INDICATOR_HEIGHT : 0;
- const estimatedOverlayHeight = composerOverlapHeight + activeWorkIndicatorHeight;
+ const estimatedOverlayHeight = composerOverlapHeight;
// The overlay's measured height includes the home-indicator inset (the
// composer pads it), but contentInsetAdjustmentBehavior="automatic" makes
// UIKit add the safe-area bottom to the content inset AGAIN — leaving a
@@ -411,6 +359,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
contentPresentation={props.contentPresentation}
agentLabel={agentLabel}
latestTurn={props.selectedThread.latestTurn}
+ activeWorkStartedAt={props.activeWorkStartedAt}
listRef={listRef}
freeze={freeze}
anchorMessageId={anchorMessageId}
@@ -438,15 +387,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
list's bottom inset, so any padding above the pill/composer
pushes the resting content floor up by the same amount. */}
<View ref={composerOverlayRef} onLayout={onComposerLayout} className="w-full">
- <Animated.View
- className="w-full self-center"
- layout={LinearTransition.duration(220)}
- style={{ maxWidth: contentMaxWidth }}
- >
- {props.activeWorkStartedAt ? (
- <WorkingDurationPill startedAt={props.activeWorkStartedAt} />
- ) : null}
-
+ <View className="w-full self-center" style={{ maxWidth: contentMaxWidth }}>
{props.activePendingApproval || props.activePendingUserInput ? (
<Animated.View
className="shrink-0 gap-3 px-4 pb-3"
@@ -473,7 +414,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
) : null}
</Animated.View>
) : null}
- </Animated.View>
+ </View>
<ThreadComposer
editorRef={composerEditorRef}
diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsx
index 38ec26c43..37a8639fd 100644
--- a/apps/mobile/src/features/threads/ThreadFeed.tsx
+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx
@@ -3,6 +3,7 @@ import { KeyboardAwareLegendList } from "@legendapp/list/keyboard";
import { type LegendListRef } from "@legendapp/list/react-native";
import type { EnvironmentId, MessageId, ThreadId, TurnId } from "@t3tools/contracts";
import { CHAT_LIST_ANCHOR_OFFSET, resolveChatListAnchoredEndSpace } from "@t3tools/shared/chatList";
+import { formatElapsed } from "@t3tools/shared/orchestrationTiming";
import { SymbolView } from "../../components/AppSymbol";
import { HeaderHeightContext } from "@react-navigation/elements";
import { useNavigation } from "@react-navigation/native";
@@ -128,6 +129,7 @@ export interface ThreadFeedProps {
readonly contentPresentation: ThreadContentPresentation;
readonly agentLabel: string;
readonly latestTurn: ThreadFeedLatestTurn | null;
+ readonly activeWorkStartedAt: string | null;
readonly listRef: RefObject<LegendListRef | null>;
readonly freeze: SharedValue<boolean>;
readonly anchorMessageId: MessageId | null;
@@ -816,6 +818,10 @@ function renderFeedEntry(
const entry = info.item;
const { markdownStyles, iconSubtleColor, userBubbleColor } = props;
+ if (entry.type === "working") {
+ return <WorkingTimelineRow startedAt={entry.createdAt} />;
+ }
+
if (entry.type === "turn-fold") {
return (
<Pressable
@@ -993,6 +999,32 @@ function renderFeedEntry(
);
}
+const WorkingTimelineRow = memo(function WorkingTimelineRow(props: { readonly startedAt: string }) {
+ const [nowMs, setNowMs] = useState(() => Date.now());
+
+ useEffect(() => {
+ const intervalId = setInterval(() => {
+ setNowMs(Date.now());
+ }, 1_000);
+ return () => clearInterval(intervalId);
+ }, [props.startedAt]);
+
+ const durationLabel = formatElapsed(props.startedAt, new Date(nowMs).toISOString()) ?? "0s";
+
+ return (
+ <View className="mb-4 flex-row items-center gap-2 px-1.5 py-1">
+ <View className="flex-row items-center gap-1">
+ <View className="h-1 w-1 rounded-full bg-neutral-400 dark:bg-neutral-500" />
+ <View className="h-1 w-1 rounded-full bg-neutral-400/80 dark:bg-neutral-500/80" />
+ <View className="h-1 w-1 rounded-full bg-neutral-400/60 dark:bg-neutral-500/60" />
+ </View>
+ <Text className="font-t3-medium text-xs tabular-nums text-neutral-600 dark:text-neutral-400">
+ Working for {durationLabel}
+ </Text>
+ </View>
+ );
+});
+
function UserMessageContent(props: {
readonly text: string;
readonly markdownStyles: MarkdownStyleSet;
@@ -1415,8 +1447,15 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
props.latestTurn,
expandedTurnIds,
expandedWorkGroupIds,
+ props.activeWorkStartedAt,
),
- [expandedTurnIds, expandedWorkGroupIds, props.feed, props.latestTurn],
+ [
+ expandedTurnIds,
+ expandedWorkGroupIds,
+ props.activeWorkStartedAt,
+ props.feed,
+ props.latestTurn,
+ ],
);
// The empty↔filled key below remounts the list, which resets its imperative
@@ -1761,7 +1800,9 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
}}
/>
</View>
- {props.feed.length === 0 && props.contentPresentation.kind === "ready" ? (
+ {props.feed.length === 0 &&
+ props.activeWorkStartedAt === null &&
+ props.contentPresentation.kind === "ready" ? (
<View pointerEvents="none" style={StyleSheet.absoluteFill}>
<ThreadFeedPlaceholder
title="No conversation yet"
diff --git a/apps/mobile/src/lib/threadActivity.test.ts b/apps/mobile/src/lib/threadActivity.test.ts
index 5f9f099a4..b1bdb61b9 100644
--- a/apps/mobile/src/lib/threadActivity.test.ts
+++ b/apps/mobile/src/lib/threadActivity.test.ts
@@ -414,6 +414,20 @@ describe("buildThreadFeed", () => {
});
});
+ it("appends active work as a normal timeline row", () => {
+ const startedAt = "2026-04-01T00:00:01.000Z";
+ const presented = deriveThreadFeedPresentation([], null, new Set(), new Set(), startedAt);
+
+ expect(presented).toEqual([
+ {
+ type: "working",
+ id: "working-indicator-row",
+ createdAt: startedAt,
+ },
+ ]);
+ expect(deriveThreadFeedPresentation(presented, null, new Set())).toEqual([]);
+ });
+
it("models work-log overflow as list rows", () => {
const activity = (
id: string,
diff --git a/apps/mobile/src/lib/threadActivity.ts b/apps/mobile/src/lib/threadActivity.ts
index 9f79a9055..6278247dc 100644
--- a/apps/mobile/src/lib/threadActivity.ts
+++ b/apps/mobile/src/lib/threadActivity.ts
@@ -98,6 +98,11 @@ type RawThreadFeedEntry =
export type ThreadFeedEntry =
| Extract<RawThreadFeedEntry, { type: "message" }>
+ | {
+ readonly type: "working";
+ readonly id: string;
+ readonly createdAt: string;
+ }
| {
readonly type: "activity-group";
readonly id: string;
@@ -1105,9 +1110,11 @@ export function deriveThreadFeedPresentation(
latestTurn: ThreadFeedLatestTurn | null,
expandedTurnIds: ReadonlySet<TurnId>,
expandedWorkGroupIds: ReadonlySet<string> = new Set(),
+ activeWorkStartedAt: string | null = null,
): ThreadFeedEntry[] {
const sourceFeed = feed.filter(
- (entry) => entry.type !== "turn-fold" && entry.type !== "work-toggle",
+ (entry) =>
+ entry.type !== "turn-fold" && entry.type !== "work-toggle" && entry.type !== "working",
);
const foldsByAnchorId = deriveThreadFeedTurnFolds(sourceFeed, latestTurn);
const collapsedEntryIds = new Set<string>();
@@ -1136,12 +1143,19 @@ export function deriveThreadFeedPresentation(
appendPresentedFeedEntry(result, entry, expandedWorkGroupIds);
}
}
+ if (activeWorkStartedAt !== null) {
+ result.push({
+ type: "working",
+ id: "working-indicator-row",
+ createdAt: activeWorkStartedAt,
+ });
+ }
return result;
}
function appendPresentedFeedEntry(
result: ThreadFeedEntry[],
- entry: Exclude<ThreadFeedEntry, { readonly type: "turn-fold" | "work-toggle" }>,
+ entry: Exclude<ThreadFeedEntry, { readonly type: "turn-fold" | "work-toggle" | "working" }>,
expandedWorkGroupIds: ReadonlySet<string>,
): void {
if (entry.type !== "activity-group") {