diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsx index 8110cca26793d..7bef53458855b 100644 --- a/apps/mobile/src/features/home/HomeScreen.tsx +++ b/apps/mobile/src/features/home/HomeScreen.tsx @@ -78,8 +78,6 @@ import { ThreadListV2WorkingShelfHeader, } from "../threads/thread-list-v2-items"; import { useThreadRowProviderInstanceResolver } from "../threads/thread-provider-instance"; -import { useOpenThreadPullRequests } from "../threads/use-open-thread-pull-requests"; -import type { ThreadPrPresentation } from "../../state/thread-pr-presentation"; import { threadListV2ListItemsAreEqual, THREAD_LIST_V2_SETTLED_INITIAL_COUNT, @@ -259,14 +257,6 @@ export function HomeScreen(props: HomeScreenProps) { const handleScrollBeginDrag = () => { openSwipeableRef.current?.close(); }; - const openThreadPullRequests = useOpenThreadPullRequests(); - const handleOpenThreadPullRequests = ( - thread: EnvironmentThreadShell, - pr: ThreadPrPresentation, - ) => { - openSwipeableRef.current?.close(); - openThreadPullRequests(thread, pr); - }; const onFabScroll = useFabScroll(); const listRef = useRef(null); const searchMode = workspace?.state.tabs.threads.searchMode; @@ -557,7 +547,6 @@ export function HomeScreen(props: HomeScreenProps) { } searchQuery={threadSearch.query} onSelectThread={selectThread} - onOpenThreadPullRequests={handleOpenThreadPullRequests} onDeleteThread={handleDeleteThread} onArchiveThread={props.onArchiveThread} onRenameThread={handleRenameThread} diff --git a/apps/mobile/src/features/layout/workspace/WorkspaceThreadSidebar.tsx b/apps/mobile/src/features/layout/workspace/WorkspaceThreadSidebar.tsx index da1fb44a46046..850d6b565cd14 100644 --- a/apps/mobile/src/features/layout/workspace/WorkspaceThreadSidebar.tsx +++ b/apps/mobile/src/features/layout/workspace/WorkspaceThreadSidebar.tsx @@ -11,7 +11,6 @@ import { usePendingTaskListActions } from "../../home/usePendingTaskListActions" import { useAdaptiveWorkspaceLayout, useWorkspacePaneState } from "../adaptive-workspace-context"; import { openSettings } from "../../settings/settings-navigation"; import { ThreadNavigationSidebar } from "../../threads/ThreadNavigationSidebar"; -import { useOpenThreadPullRequests } from "../../threads/use-open-thread-pull-requests"; import { useSelectWorkspaceDetail } from "./useSelectWorkspaceDetail"; type Route = { readonly name: string; readonly params?: object }; @@ -46,7 +45,6 @@ export function WorkspaceThreadSidebar() { useAdaptiveWorkspaceLayout(); const { panes, primarySidebarSearchQuery } = useWorkspacePaneState(); const selectDetail = useSelectWorkspaceDetail(); - const openThreadPullRequests = useOpenThreadPullRequests(); const selectedThread = useNavigationState(selectedThreadKey); const selectThreadRoute = (params: ReactNavigation.RootParamList["Thread"]) => selectDetail({ name: "Thread", params }); @@ -87,7 +85,6 @@ export function WorkspaceThreadSidebar() { threadId: String(thread.id), }) } - onOpenThreadPullRequests={openThreadPullRequests} onSearchQueryChange={setPrimarySidebarSearchQuery} searchQuery={primarySidebarSearchQuery} /> diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx index 6aa576f984fce..c05ab82da9da8 100644 --- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx +++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx @@ -65,7 +65,6 @@ import { ThreadListV2WorkingShelfHeader, } from "./thread-list-v2-items"; import { useThreadRowProviderInstanceResolver } from "./thread-provider-instance"; -import type { ThreadPrPresentation } from "../../state/thread-pr-presentation"; import { ThreadPrDemandProvider } from "../../state/thread-pr-demand"; import { isThreadListV2ListItem, @@ -97,10 +96,6 @@ interface ThreadNavigationSidebarProps { readonly onOpenPendingTask: (pendingTask: PendingNewTask) => void; readonly onSearchQueryChange: (query: string) => void; readonly onSelectThread: (thread: EnvironmentThreadShell) => void; - readonly onOpenThreadPullRequests: ( - thread: EnvironmentThreadShell, - pr: ThreadPrPresentation, - ) => void; readonly onRequestVisibility: () => void; readonly searchQuery: string; } @@ -321,7 +316,7 @@ function ThreadNavigationSidebarPane(props: ThreadNavigationSidebarProps) { } }; // Destructure callback props; capturing all props would invalidate these row-closing handlers on unrelated changes. - const { onSelectThread, onOpenThreadPullRequests } = props; + const { onSelectThread } = props; // A row listed for a message match opens the thread at that message, by // tap or by shortcut. const handleSelectThread = (thread: EnvironmentThreadShell) => { @@ -335,13 +330,6 @@ function ThreadNavigationSidebarPane(props: ThreadNavigationSidebarProps) { onSelectThread(thread); openSwipeableRef.current?.close(); }; - const handleOpenThreadPullRequests = ( - thread: EnvironmentThreadShell, - pr: ThreadPrPresentation, - ) => { - onOpenThreadPullRequests(thread, pr); - openSwipeableRef.current?.close(); - }; const handleScrollBeginDrag = () => { openSwipeableRef.current?.close(); }; @@ -453,7 +441,6 @@ function ThreadNavigationSidebarPane(props: ThreadNavigationSidebarProps) { } fullSwipeWidth={props.width - 20} onSelectThread={handleSelectThread} - onOpenThreadPullRequests={handleOpenThreadPullRequests} onDeleteThread={confirmDeleteThread} onArchiveThread={archiveThread} onRenameThread={renameThread} 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 69d0c84ecaa8d..6de7a75cd67aa 100644 --- a/apps/mobile/src/features/threads/thread-list-v2-items.tsx +++ b/apps/mobile/src/features/threads/thread-list-v2-items.tsx @@ -63,10 +63,6 @@ import { } from "../../state/pending-new-tasks-model"; import { useBranches } from "../../state/queries"; import { useNewTaskProjectDefaults } from "./use-new-task-project-defaults"; -import { - resolveThreadPrBadgeAction, - type ThreadPrPresentation, -} from "../../state/thread-pr-presentation"; import { useThreadPr } from "../../state/use-thread-pr"; import { useSwipeRowDormant } from "../home/swipe-row-activation"; import { ThreadSwipeable } from "../home/thread-swipe-actions"; @@ -670,10 +666,6 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { readonly selected?: boolean; readonly fullSwipeWidth?: number; readonly onSelectThread: (thread: EnvironmentThreadShell) => void; - readonly onOpenThreadPullRequests: ( - thread: EnvironmentThreadShell, - pr: ThreadPrPresentation, - ) => void; readonly onDeleteThread: (thread: EnvironmentThreadShell) => void; readonly onNewThreadOnBranch: (thread: EnvironmentThreadShell) => void; readonly onRenameThread: (thread: EnvironmentThreadShell) => void; @@ -721,7 +713,6 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { thread, variant, onSelectThread, - onOpenThreadPullRequests, onDeleteThread, onRenameThread, onRegenerateThreadTitle, @@ -763,10 +754,6 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { }) : null; const pr = useThreadPr(thread); - const prBadgeLabel = pr ? resolveThreadPrBadgeAction(pr).accessibilityLabel : null; - const handleOpenPullRequests = useCallback(() => { - if (pr) onOpenThreadPullRequests(thread, pr); - }, [onOpenThreadPullRequests, pr, thread]); const theme = useUniwindTheme(); const sidebarPane = props.pane === "sidebar"; @@ -784,7 +771,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { : workingLabel) ?? (isUnread ? DONE_STATUS_LABEL : undefined); const recede = shouldRecedeThreadRow({ status, selected }); const isRegeneratingTitle = thread.titleRegeneration != null; - const rowAccessibilityLabel = `${thread.title}${providerNameLabel ? `, ${providerNameLabel}` : ""}${props.hasQueuedMessages ? ", messages queued to send" : ""}${isRegeneratingTitle ? ", regenerating title" : ""}`; + const rowAccessibilityLabel = `${thread.title}${providerNameLabel ? `, ${providerNameLabel}` : ""}${props.hasQueuedMessages ? ", messages queued to send" : ""}${isRegeneratingTitle ? ", regenerating title" : ""}${pr ? `, ${pr.accessibilityLabel}` : ""}`; const timeLabel = props.timeLabel; const visitThread = useAtomCommand(threadEnvironment.visit, { reportFailure: false }); @@ -797,11 +784,8 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { }, [props.wokeAt, thread.environmentId, thread.id, visitThread]); // VoiceOver cannot focus buttons inside the accessible row. const rowAccessibilityActions = useMemo( - () => [ - ...(prBadgeLabel ? [{ name: "openPullRequests", label: prBadgeLabel }] : []), - ...(showsWoke ? [{ name: "dismissWoke", label: "Dismiss Woke notification" }] : []), - ], - [prBadgeLabel, showsWoke], + () => (showsWoke ? [{ name: "dismissWoke", label: "Dismiss Woke notification" }] : []), + [showsWoke], ); const handleDelete = useCallback(() => onDeleteThread(thread), [onDeleteThread, thread]); @@ -1343,17 +1327,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { )} {pr ? ( - undefined} - style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })} - > + {pr.label} - + ) : null} {providerInstance ? ( @@ -1443,7 +1417,6 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: { accessibilityState={{ selected }} accessibilityActions={rowAccessibilityActions} onAccessibilityAction={(event) => { - if (event.nativeEvent.actionName === "openPullRequests") handleOpenPullRequests(); if (event.nativeEvent.actionName === "dismissWoke") handleAcknowledgeWoke(); }} onPress={() => { diff --git a/apps/mobile/src/features/threads/use-open-thread-pull-requests.ts b/apps/mobile/src/features/threads/use-open-thread-pull-requests.ts deleted file mode 100644 index 034719d5dd19e..0000000000000 --- a/apps/mobile/src/features/threads/use-open-thread-pull-requests.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell"; -import { useNavigation } from "@react-navigation/native"; - -import * as Dialog from "../../components/ui/Dialog"; -import { useNavigateToPullRequest } from "../../native/useOpenPullRequest"; -import { - resolveThreadPrBadgeAction, - type ThreadPrPresentation, -} from "../../state/thread-pr-presentation"; - -/** Called once per thread list so virtualized rows share one stable handler. */ -export function useOpenThreadPullRequests() { - const navigation = useNavigation(); - const navigateToPullRequest = useNavigateToPullRequest(); - return (thread: EnvironmentThreadShell, pr: ThreadPrPresentation) => { - if (resolveThreadPrBadgeAction(pr).kind === "list") { - navigation.navigate("ThreadPullRequests", { - environmentId: String(thread.environmentId), - threadId: String(thread.id), - }); - return; - } - void navigateToPullRequest(pr.url, { - environmentId: String(thread.environmentId), - projectId: String(thread.projectId), - }).then((opened) => { - if (!opened) - Dialog.alert( - `Unable to open ${pr.changeRequest.shortLabel}`, - `The ${pr.changeRequest.singular} could not be opened.`, - ); - }); - }; -} diff --git a/apps/mobile/src/state/thread-pr-presentation.ts b/apps/mobile/src/state/thread-pr-presentation.ts index a57d04fb24918..ee48e998b9dfd 100644 --- a/apps/mobile/src/state/thread-pr-presentation.ts +++ b/apps/mobile/src/state/thread-pr-presentation.ts @@ -122,12 +122,6 @@ export function resolveThreadPrSource( return { linkedPresentation, pullRequestRef }; } -export function resolveThreadPrBadgeAction(pr: ThreadPrPresentation) { - return pr.kind === "stack" || pr.others > 0 - ? { kind: "list" as const, accessibilityLabel: `Show ${pr.accessibilityLabel}` } - : { kind: "open" as const, accessibilityLabel: `Open ${pr.accessibilityLabel}` }; -} - /** Records `value` as the newest entry, evicting the least recently answered beyond `limit`. */ export function rememberBounded( current: ReadonlyMap,