Skip to content
TypeScript

feat(mobile): add copy thread ID to thread list actions (#12228)

Jake Leventhal7a2cce826852
diff --git a/apps/mobile/src/features/threads/thread-list-items.tsx b/apps/mobile/src/features/threads/thread-list-items.tsx
index b9d4dd50d29..5ab2251875c 100644
--- a/apps/mobile/src/features/threads/thread-list-items.tsx
+++ b/apps/mobile/src/features/threads/thread-list-items.tsx
@@ -18,6 +18,7 @@ import { ControlPillMenu } from "../../components/ControlPill";
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
import { ProjectFavicon } from "../../components/ProjectFavicon";
import { cn } from "../../lib/cn";
+import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic";
import { HOME_HORIZONTAL_INSET } from "../../lib/layoutMetrics";
import { relativeTime } from "../../lib/time";
import { useUniwindTheme } from "../../lib/useUniwindTheme";
@@ -547,6 +548,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
: []),
THREAD_ROW_MENU_ACTIONS[0]!,
THREAD_ROW_MENU_ACTIONS[1]!,
+ { id: "copy-thread-id", title: "Copy thread ID", image: "doc.on.doc" },
...buildThreadTitleRegenerationMenuItems({
supported: props.titleRegenerationSupported,
isRegenerating: thread.titleRegeneration != null,
@@ -569,6 +571,9 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
if (nativeEvent.event === "new-thread-on-branch") onNewThreadOnBranch(thread);
if (nativeEvent.event === "archive") handleArchive();
if (nativeEvent.event === "rename") handleRename();
+ if (nativeEvent.event === "copy-thread-id") {
+ copyTextWithHaptic(thread.id, { target: "thread-id" });
+ }
if (nativeEvent.event === "regenerate-title") handleRegenerateTitle();
if (nativeEvent.event === "delete") handleDelete();
},
diff --git a/apps/mobile/src/features/threads/thread-list-v2-items.tsx b/apps/mobile/src/features/threads/thread-list-v2-items.tsx
index fa406271198..a1b16ee21ff 100644
--- a/apps/mobile/src/features/threads/thread-list-v2-items.tsx
+++ b/apps/mobile/src/features/threads/thread-list-v2-items.tsx
@@ -24,6 +24,7 @@ import { ProjectFavicon } from "../../components/ProjectFavicon";
import { ProviderInstanceIcon } from "../../components/ProviderIcon";
import type { ThreadRowProviderInstance } from "./thread-provider-instance";
import { cn } from "../../lib/cn";
+import { copyTextWithHaptic } from "../../lib/copyTextWithHaptic";
import { relativeTime } from "../../lib/time";
import { useUniwindTheme } from "../../lib/useUniwindTheme";
import type { PendingNewTask } from "../../state/use-pending-new-tasks";
@@ -670,6 +671,9 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
if (nativeEvent.event === "archive") handleArchive();
if (nativeEvent.event === "rename") handleRename();
if (nativeEvent.event === "regenerate-title") handleRegenerateTitle();
+ if (nativeEvent.event === "copy-thread-id") {
+ copyTextWithHaptic(thread.id, { target: "thread-id" });
+ }
if (nativeEvent.event === "delete") handleDelete();
if (nativeEvent.event === "snooze:custom") {
setCustomSnoozeOpen(true);
@@ -1165,6 +1169,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
},
]
: []),
+ { id: "copy-thread-id", title: "Copy thread ID", image: "doc.on.doc" },
...(snoozedRow
? snoozedMenuActions
: !props.settlementSupported