@@ -11,6 +11,7 @@ import { useAtomValue } from "@effect/atom-react";
1111import {
1212 Keyboard ,
1313 Platform ,
14+ Pressable ,
1415 RefreshControl ,
1516 ScrollView ,
1617 View ,
@@ -20,6 +21,7 @@ import { NativeScrollViewMarker as ScrollViewMarker } from "../../native/NativeS
2021import { useSafeAreaInsets } from "react-native-safe-area-context" ;
2122
2223import { AppText as Text } from "../../components/ui/AppText" ;
24+ import { SymbolView } from "../../components/ui/AppSymbol" ;
2325import { EmptyState } from "../../components/ui/EmptyState" ;
2426import { NativePrimaryColumnContext } from "../../native/v5-workspace-context" ;
2527import { useNativeColumnLayoutMetrics } from "../../native/native-layout-metrics" ;
@@ -32,7 +34,6 @@ import {
3234 usePullRequestListFilters ,
3335 type PullRequestFilterMenu ,
3436} from "./PullRequestListFilters" ;
35- import { PullRequestCardRow } from "./PullRequestControls" ;
3637import { usePullRequestList } from "./usePullRequestList" ;
3738import { usePullRequestListControls } from "./usePullRequestListControls" ;
3839import { usePullRequestListActions } from "./usePullRequestListActions" ;
@@ -58,26 +59,38 @@ function PullRequestScrollView(props: ScrollViewProps) {
5859 ) ;
5960}
6061
61- function PullRequestListErrors ( props : { readonly messages : readonly string [ ] } ) {
62+ function PullRequestListError ( props : { readonly message : string } ) {
6263 const [ expanded , setExpanded ] = useState ( false ) ;
63- const title = `${ props . messages . length } ${ props . messages . length === 1 ? "error" : "errors" } loading pull requests` ;
6464 return (
65- < View >
66- < PullRequestCardRow
67- title = { title }
68- icon = "exclamationmark.triangle"
69- compact
70- last
71- expanded = { expanded }
72- accessibilityLabel = { `${ title } . ${ expanded ? "Hide" : "Show" } details` }
73- onPress = { ( ) => setExpanded ( ( value ) => ! value ) }
65+ < Pressable
66+ accessibilityRole = "button"
67+ accessibilityLabel = { props . message }
68+ accessibilityState = { { expanded } }
69+ onPress = { ( ) => setExpanded ( ( value ) => ! value ) }
70+ // A long press selects the text; collapsing under that selection crashes Android's
71+ // smart-select animation, so it must not also count as a press.
72+ onLongPress = { ( ) => undefined }
73+ className = "min-h-11 flex-row items-center gap-3 px-4 py-2.5 active:opacity-70"
74+ >
75+ < SymbolView
76+ name = "exclamationmark.triangle"
77+ size = { 18 }
78+ tintColorClassName = "accent-icon-muted"
7479 />
75- { expanded ? (
76- < Text selectable className = "px-4 pb-3 text-sm text-foreground-muted" >
77- { props . messages . join ( "\n" ) }
78- </ Text >
79- ) : null }
80- </ View >
80+ < Text
81+ selectable = { expanded }
82+ numberOfLines = { expanded ? undefined : 1 }
83+ ellipsizeMode = "tail"
84+ className = "min-w-0 flex-1 text-sm text-foreground-muted"
85+ >
86+ { props . message }
87+ </ Text >
88+ < SymbolView
89+ name = { expanded ? "chevron.up" : "chevron.down" }
90+ size = { 11 }
91+ tintColorClassName = "accent-icon-muted"
92+ />
93+ </ Pressable >
8194 ) ;
8295}
8396
@@ -334,13 +347,14 @@ export function PullRequestsScreen(
334347 < >
335348 < PullRequestListFilters sidebar = { sidebar } filters = { filters } />
336349 { result . data ?. errors . length ? (
337- < PullRequestListErrors
338- key = { JSON . stringify ( targets ) }
339- messages = { result . data . errors . map (
340- ( error ) =>
341- `${ error . projectTitle || environments . find ( ( environment ) => environment . environmentId === error . environmentId ) ?. environmentLabel || "Environment" } : ${ error . message } ` ,
342- ) }
343- />
350+ < View key = { JSON . stringify ( targets ) } >
351+ { result . data . errors . map ( ( error ) => (
352+ < PullRequestListError
353+ key = { `${ error . environmentId } ${ error . projectTitle } ${ error . message } ` }
354+ message = { `${ error . projectTitle || environments . find ( ( environment ) => environment . environmentId === error . environmentId ) ?. environmentLabel || "Environment" } : ${ error . message } ` }
355+ />
356+ ) ) }
357+ </ View >
344358 ) : null }
345359 </ >
346360 }
0 commit comments