@@ -27,6 +27,7 @@ import { useProjects } from "../../state/entities";
2727import { environmentServerConfigsAtom } from "../../state/server" ;
2828import { PullRequestListRow } from "./PullRequestListRow" ;
2929import { PullRequestListFilters } from "./PullRequestListFilters" ;
30+ import { PullRequestCardRow } from "./PullRequestControls" ;
3031import { usePullRequestList } from "./usePullRequestList" ;
3132import { usePullRequestListControls } from "./usePullRequestListControls" ;
3233import { usePullRequestListActions } from "./usePullRequestListActions" ;
@@ -57,6 +58,29 @@ function PullRequestScrollView(props: ScrollViewProps) {
5758 ) ;
5859}
5960
61+ function PullRequestListErrors ( props : { readonly messages : readonly string [ ] } ) {
62+ const [ expanded , setExpanded ] = useState ( false ) ;
63+ const title = `${ props . messages . length } ${ props . messages . length === 1 ? "error" : "errors" } loading pull requests` ;
64+ 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 ) }
74+ />
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 >
81+ ) ;
82+ }
83+
6084export function PullRequestsScreen (
6185 props : {
6286 readonly sidebar ?: boolean ;
@@ -307,14 +331,13 @@ export function PullRequestsScreen(
307331 projects = { projects }
308332 />
309333 { result . data ?. errors . length ? (
310- < Text className = "px-4 py-3 text-sm text-foreground-muted" >
311- { result . data . errors
312- . map (
313- ( error ) =>
314- `${ error . projectTitle || environments . find ( ( environment ) => environment . environmentId === error . environmentId ) ?. environmentLabel || "Environment" } : ${ error . message } ` ,
315- )
316- . join ( "\n" ) }
317- </ Text >
334+ < PullRequestListErrors
335+ key = { JSON . stringify ( targets ) }
336+ messages = { result . data . errors . map (
337+ ( error ) =>
338+ `${ error . projectTitle || environments . find ( ( environment ) => environment . environmentId === error . environmentId ) ?. environmentLabel || "Environment" } : ${ error . message } ` ,
339+ ) }
340+ />
318341 ) : null }
319342 </ >
320343 }
0 commit comments