@@ -6,6 +6,11 @@ import { ControlPillMenu } from "../../components/ControlPillMenu";
66import type { ControlPillMenuProps } from "../../components/ControlPillMenu.types" ;
77import { cn } from "../../lib/cn" ;
88import { relativeTime } from "../../lib/time" ;
9+ import {
10+ selectedThreadRowColors ,
11+ THREAD_LIST_V2_SIDEBAR_ROW_STYLE ,
12+ THREAD_LIST_V2_SIDEBAR_ROW_CONTAINER_STYLE ,
13+ } from "../threads/thread-list-v2-row-appearance" ;
914import { PullRequestAvatar , PullRequestDiffStats } from "./PullRequestPresentation" ;
1015import {
1116 pullRequestLabelColor ,
@@ -20,11 +25,27 @@ export const PullRequestListRow = memo(
2025 readonly item : EnvironmentPullRequestListEntry ;
2126 readonly onSelect : ( item : EnvironmentPullRequestListEntry ) => void ;
2227 readonly selected : boolean ;
28+ readonly sidebar : boolean ;
2329 readonly busy : boolean ;
2430 readonly getActions : ( item : EnvironmentPullRequestListEntry ) => ControlPillMenuProps [ "actions" ] ;
2531 readonly onAction : ( item : EnvironmentPullRequestListEntry , action : string ) => void ;
2632 } ) {
2733 const { item } = props ;
34+ const foreground = props . selected
35+ ? selectedThreadRowColors . foregroundClassName
36+ : props . sidebar
37+ ? "text-drawer-foreground"
38+ : "text-foreground" ;
39+ const mutedForeground = props . selected
40+ ? selectedThreadRowColors . mutedForegroundClassName
41+ : props . sidebar
42+ ? "text-drawer-foreground-muted"
43+ : "text-foreground-muted" ;
44+ const tertiaryForeground = props . selected
45+ ? selectedThreadRowColors . mutedForegroundClassName
46+ : props . sidebar
47+ ? "text-drawer-foreground-muted"
48+ : "text-foreground-tertiary" ;
2849 const status = pullRequestStatus ( item ) ;
2950 const review = pullRequestListReviewStatus ( item ) ;
3051 const checkTint =
@@ -34,123 +55,144 @@ export const PullRequestListRow = memo(
3455 ? "accent-danger-foreground"
3556 : "accent-warning-foreground" ;
3657 return (
37- < ControlPillMenu
38- shouldOpenOnLongPress
39- title = { `#${ item . number } · ${ item . repository } ` }
40- actions = { props . getActions ( item ) }
41- onPressAction = { ( { nativeEvent } ) => props . onAction ( item , nativeEvent . event ) }
42- >
43- < Pressable
44- accessibilityRole = "button"
45- accessibilityState = { { selected : props . selected , busy : props . busy } }
46- accessibilityLabel = { `Pull request ${ item . number } , ${ item . title } , ${ status . label } , by ${ item . author ?. login ?? "unknown author" } ${ review ? `, ${ review . accessibleLabel } ` : "" } ${ item . checksState ? `, checks ${ item . checksState } ` : "" } ${ item . stack ? `, stack ${ item . stack . position } of ${ item . stack . size } ` : "" } ${ item . labels . length ? `, ${ item . labels . map ( ( label ) => label . name ) . join ( ", " ) } ` : "" } , ${ item . additions } additions, ${ item . deletions } deletions` }
47- accessibilityHint = "Double tap to open. Touch and hold for quick actions."
48- onPress = { ( ) => props . onSelect ( item ) }
49- disabled = { props . busy }
50- className = { cn (
51- "flex-row gap-3 px-4 active:bg-row-hover" ,
52- props . selected && "bg-thread-selected" ,
53- props . busy && "opacity-50" ,
54- ) }
58+ < View style = { props . sidebar ? THREAD_LIST_V2_SIDEBAR_ROW_CONTAINER_STYLE : undefined } >
59+ < ControlPillMenu
60+ shouldOpenOnLongPress
61+ title = { `#${ item . number } · ${ item . repository } ` }
62+ actions = { props . getActions ( item ) }
63+ onPressAction = { ( { nativeEvent } ) => props . onAction ( item , nativeEvent . event ) }
5564 >
56- < View className = "pt-2.5" >
57- < SymbolView name = { status . icon } size = { 20 } tintColorClassName = { status . tint } />
58- </ View >
59- < View className = "min-w-0 flex-1 gap-1 border-b border-border-subtle py-2.5" >
60- < View className = "flex-row items-center gap-1.5" >
61- < PullRequestAvatar actor = { item . author } size = { 16 } />
62- < Text className = "min-w-0 flex-1 text-xs text-foreground-muted" numberOfLines = { 1 } >
63- { item . repository } < Text className = "text-foreground-tertiary" > #{ item . number } </ Text >
64- </ Text >
65- { item . stack ? (
66- < View className = "flex-row items-center gap-1" >
67- < SymbolView
68- name = "square.3.layers.3d"
69- size = { 12 }
70- tintColorClassName = "accent-icon-muted"
71- />
72- < Text className = "text-2xs tabular-nums text-foreground-muted" >
73- { item . stack . position } /{ item . stack . size }
74- </ Text >
75- </ View >
76- ) : null }
77- < Text className = "text-2xs tabular-nums text-foreground-tertiary" >
78- { relativeTime ( item . updatedAt ) }
79- </ Text >
65+ < Pressable
66+ accessibilityRole = "button"
67+ accessibilityState = { { selected : props . selected , busy : props . busy } }
68+ accessibilityLabel = { `Pull request ${ item . number } , ${ item . title } , ${ status . label } , by ${ item . author ?. login ?? "unknown author" } ${ review ? `, ${ review . accessibleLabel } ` : "" } ${ item . checksState ? `, checks ${ item . checksState } ` : "" } ${ item . stack ? `, stack ${ item . stack . position } of ${ item . stack . size } ` : "" } ${ item . labels . length ? `, ${ item . labels . map ( ( label ) => label . name ) . join ( ", " ) } ` : "" } , ${ item . additions } additions, ${ item . deletions } deletions` }
69+ accessibilityHint = "Double tap to open. Touch and hold for quick actions."
70+ onPress = { ( ) => props . onSelect ( item ) }
71+ disabled = { props . busy }
72+ style = { props . sidebar ? THREAD_LIST_V2_SIDEBAR_ROW_STYLE : undefined }
73+ className = { cn (
74+ "flex-row gap-3 overflow-hidden" ,
75+ ! props . sidebar && "px-4 active:bg-row-hover" ,
76+ props . sidebar && "bg-drawer" ,
77+ props . sidebar && ! props . selected && "active:bg-thread-hover" ,
78+ props . selected && "bg-thread-selected" ,
79+ props . busy && "opacity-50" ,
80+ ) }
81+ >
82+ < View className = { props . sidebar ? "pt-0.5" : "pt-2.5" } >
83+ < SymbolView name = { status . icon } size = { 20 } tintColorClassName = { status . tint } />
8084 </ View >
81- < Text
82- className = "text-base leading-5 font-t3-medium text-foreground"
83- numberOfLines = { 2 }
84- ellipsizeMode = "tail"
85+ < View
86+ className = { cn (
87+ "min-w-0 flex-1 gap-1" ,
88+ ! props . sidebar && "border-b border-border-subtle py-2.5" ,
89+ ) }
8590 >
86- { item . title }
87- </ Text >
88- < View className = "flex-row items-center gap-1.5" >
89- < View className = "min-w-0 flex-1 flex-row items-center gap-1" >
90- { item . labels . slice ( 0 , 2 ) . map ( ( label ) => {
91- const color = pullRequestLabelColor ( label . color ) ;
92- return (
93- < View
94- key = { label . name }
95- className = "min-w-0 shrink flex-row items-center gap-1 rounded-md bg-subtle px-1.5 py-0.5"
96- style = { { maxWidth : 160 , ...( color ? { backgroundColor : `${ color } 20` } : { } ) } }
97- >
98- { color ? (
99- < View
100- style = { { width : 5 , height : 5 , borderRadius : 3 , backgroundColor : color } }
101- />
102- ) : null }
103- < Text
104- className = "shrink text-2xs font-t3-medium text-foreground-muted"
105- numberOfLines = { 1 }
106- >
107- { label . name }
108- </ Text >
109- </ View >
110- ) ;
111- } ) }
112- { item . labels . length > 2 ? (
113- < Text className = "shrink-0 text-2xs text-foreground-tertiary" >
114- +{ item . labels . length - 2 }
115- </ Text >
91+ < View className = "flex-row items-center gap-1.5" >
92+ < PullRequestAvatar actor = { item . author } size = { 16 } />
93+ < Text className = { cn ( "min-w-0 flex-1 text-xs" , mutedForeground ) } numberOfLines = { 1 } >
94+ { item . repository } < Text className = { tertiaryForeground } > #{ item . number } </ Text >
95+ </ Text >
96+ { item . stack ? (
97+ < View className = "flex-row items-center gap-1" >
98+ < SymbolView
99+ name = "square.3.layers.3d"
100+ size = { 12 }
101+ tintColorClassName = {
102+ props . selected
103+ ? selectedThreadRowColors . mutedIconTintClassName
104+ : props . sidebar
105+ ? "accent-drawer-foreground-muted"
106+ : "accent-foreground-muted"
107+ }
108+ />
109+ < Text className = { cn ( "text-2xs tabular-nums" , mutedForeground ) } >
110+ { item . stack . position } /{ item . stack . size }
111+ </ Text >
112+ </ View >
116113 ) : null }
114+ < Text className = { cn ( "text-2xs tabular-nums" , tertiaryForeground ) } >
115+ { relativeTime ( item . updatedAt ) }
116+ </ Text >
117117 </ View >
118- { item . checksState ? (
119- < View className = "shrink-0" accessibilityLabel = { `Checks ${ item . checksState } ` } >
120- < SymbolView
121- name = {
122- item . checksState === "passing"
123- ? "checkmark.circle"
124- : item . checksState === "failing"
125- ? "xmark.circle.fill"
126- : "clock"
127- }
128- size = { 13 }
129- tintColorClassName = { checkTint }
130- />
131- </ View >
132- ) : null }
133- { review ? (
134- < View className = "shrink-0" accessibilityLabel = { review . accessibleLabel } >
135- < SymbolView name = { review . icon } size = { 13 } tintColorClassName = { review . tint } />
118+ < Text
119+ className = { cn ( "text-base leading-5 font-t3-medium" , foreground ) }
120+ numberOfLines = { 2 }
121+ ellipsizeMode = "tail"
122+ >
123+ { item . title }
124+ </ Text >
125+ < View className = "flex-row items-center gap-1.5" >
126+ < View className = "min-w-0 flex-1 flex-row items-center gap-1" >
127+ { item . labels . slice ( 0 , 2 ) . map ( ( label ) => {
128+ const color = pullRequestLabelColor ( label . color ) ;
129+ return (
130+ < View
131+ key = { label . name }
132+ className = "min-w-0 shrink flex-row items-center gap-1 rounded-md bg-subtle px-1.5 py-0.5"
133+ style = { {
134+ maxWidth : 160 ,
135+ ...( color ? { backgroundColor : `${ color } 20` } : { } ) ,
136+ } }
137+ >
138+ { color ? (
139+ < View
140+ style = { { width : 5 , height : 5 , borderRadius : 3 , backgroundColor : color } }
141+ />
142+ ) : null }
143+ < Text
144+ className = { cn ( "shrink text-2xs font-t3-medium" , mutedForeground ) }
145+ numberOfLines = { 1 }
146+ >
147+ { label . name }
148+ </ Text >
149+ </ View >
150+ ) ;
151+ } ) }
152+ { item . labels . length > 2 ? (
153+ < Text className = { cn ( "shrink-0 text-2xs" , tertiaryForeground ) } >
154+ +{ item . labels . length - 2 }
155+ </ Text >
156+ ) : null }
136157 </ View >
137- ) : null }
138- { item . additions || item . deletions ? (
139- < PullRequestDiffStats
140- additions = { item . additions }
141- deletions = { item . deletions }
142- compact
143- />
144- ) : null }
158+ { item . checksState ? (
159+ < View className = "shrink-0" accessibilityLabel = { `Checks ${ item . checksState } ` } >
160+ < SymbolView
161+ name = {
162+ item . checksState === "passing"
163+ ? "checkmark.circle"
164+ : item . checksState === "failing"
165+ ? "xmark.circle.fill"
166+ : "clock"
167+ }
168+ size = { 13 }
169+ tintColorClassName = { checkTint }
170+ />
171+ </ View >
172+ ) : null }
173+ { review ? (
174+ < View className = "shrink-0" accessibilityLabel = { review . accessibleLabel } >
175+ < SymbolView name = { review . icon } size = { 13 } tintColorClassName = { review . tint } />
176+ </ View >
177+ ) : null }
178+ { item . additions || item . deletions ? (
179+ < PullRequestDiffStats
180+ additions = { item . additions }
181+ deletions = { item . deletions }
182+ compact
183+ />
184+ ) : null }
185+ </ View >
145186 </ View >
146- </ View >
147- </ Pressable >
148- </ ControlPillMenu >
187+ </ Pressable >
188+ </ ControlPillMenu >
189+ </ View >
149190 ) ;
150191 } ,
151192 ( previous , next ) =>
152193 pullRequestListRowsAreEqual ( previous . item , next . item ) &&
153194 previous . selected === next . selected &&
195+ previous . sidebar === next . sidebar &&
154196 previous . busy === next . busy &&
155197 previous . onSelect === next . onSelect &&
156198 previous . onAction === next . onAction &&
0 commit comments