Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions apps/mobile/src/features/home/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,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,
Expand Down Expand Up @@ -313,14 +311,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<LegendListRef>(null);
const searchMode = workspace?.state.tabs.threads.searchMode;
Expand Down Expand Up @@ -611,7 +601,6 @@ export function HomeScreen(props: HomeScreenProps) {
}
searchQuery={threadSearch.query}
onSelectThread={selectThread}
onOpenThreadPullRequests={handleOpenThreadPullRequests}
onDeleteThread={handleDeleteThread}
onArchiveThread={props.onArchiveThread}
onRenameThread={handleRenameThread}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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 });
Expand Down Expand Up @@ -87,7 +85,6 @@ export function WorkspaceThreadSidebar() {
threadId: String(thread.id),
})
}
onOpenThreadPullRequests={openThreadPullRequests}
onSearchQueryChange={setPrimarySidebarSearchQuery}
searchQuery={primarySidebarSearchQuery}
/>
Expand Down
15 changes: 1 addition & 14 deletions apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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,
Expand Down Expand Up @@ -91,10 +90,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;
}
Expand Down Expand Up @@ -315,7 +310,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) => {
Expand All @@ -329,13 +324,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();
};
Expand Down Expand Up @@ -447,7 +435,6 @@ function ThreadNavigationSidebarPane(props: ThreadNavigationSidebarProps) {
}
fullSwipeWidth={props.width - 20}
onSelectThread={handleSelectThread}
onOpenThreadPullRequests={handleOpenThreadPullRequests}
onDeleteThread={confirmDeleteThread}
onArchiveThread={archiveThread}
onRenameThread={renameThread}
Expand Down
37 changes: 5 additions & 32 deletions apps/mobile/src/features/threads/thread-list-v2-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,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";
Expand Down Expand Up @@ -663,10 +659,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;
Expand Down Expand Up @@ -714,7 +706,6 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
thread,
variant,
onSelectThread,
onOpenThreadPullRequests,
onDeleteThread,
onRenameThread,
onRegenerateThreadTitle,
Expand Down Expand Up @@ -756,10 +747,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";
Expand All @@ -776,7 +763,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 });
Expand All @@ -789,11 +776,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" }] : []),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
[showsWoke],
);

const handleDelete = useCallback(() => onDeleteThread(thread), [onDeleteThread, thread]);
Expand Down Expand Up @@ -1333,17 +1317,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<View className="flex-1" />
)}
{pr ? (
<Pressable
// Padding cancelled by negative margin grows the touch target into
// the row padding without moving the badge.
className="-m-2.5 flex-row items-center gap-1 p-2.5"
accessibilityRole="button"
accessibilityLabel={prBadgeLabel ?? undefined}
onPress={handleOpenPullRequests}
// Handle long-press so opening the iOS row menu cannot also open the PR on release.
onLongPress={() => undefined}
style={({ pressed }) => ({ opacity: pressed ? 0.6 : 1 })}
>
<View className="flex-row items-center gap-1" pointerEvents="none">
<SymbolView
name={
pr.kind === "stack"
Expand All @@ -1370,7 +1344,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
>
{pr.label}
</Text>
</Pressable>
</View>
) : null}
{providerInstance ? (
<View className="flex-row items-center">
Expand Down Expand Up @@ -1433,7 +1407,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={() => {
Expand Down
34 changes: 0 additions & 34 deletions apps/mobile/src/features/threads/use-open-thread-pull-requests.ts

This file was deleted.

6 changes: 0 additions & 6 deletions apps/mobile/src/state/thread-pr-presentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,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<V>(
current: ReadonlyMap<string, V>,
Expand Down
Loading