diff --git a/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx b/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx index 01440007bc6..57385d1666b 100644 --- a/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx +++ b/apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx @@ -387,6 +387,14 @@ function ProjectGroupLabel(props: { ); } +// Long-press row menu, mirroring the home/sidebar thread rows. On Android this +// is the reliable action affordance (swipe-then-tap on the narrow action button +// is fiddly), and it is the only non-swipe way to unarchive a thread. +const ARCHIVED_THREAD_ROW_MENU_ACTIONS: MenuAction[] = [ + { id: "unarchive", title: "Unarchive", image: "arrow.uturn.backward" }, + { id: "delete", title: "Delete", image: "trash", attributes: { destructive: true } }, +]; + function ArchivedThreadRow(props: { readonly environmentLabel: string | null; readonly isFirst: boolean; @@ -408,6 +416,14 @@ function ArchivedThreadRow(props: { const subtitle = [props.environmentLabel, props.thread.branch].filter((part): part is string => Boolean(part), ); + const { onDelete, onUnarchive } = props; + const handleMenuAction = useCallback( + ({ nativeEvent }: { readonly nativeEvent: { readonly event: string } }) => { + if (nativeEvent.event === "unarchive") onUnarchive(); + if (nativeEvent.event === "delete") onDelete(); + }, + [onDelete, onUnarchive], + ); return ( {() => ( - - - - - - - - - {props.thread.title} - - - {timestamp} - + + + - {subtitle.length > 0 ? ( - - + + + - {subtitle.join(" · ")} + {props.thread.title} + + + {timestamp} - ) : null} - - + {subtitle.length > 0 ? ( + + + + {subtitle.join(" · ")} + + + ) : null} + + + )} );