| ... | @@ -195,7 +195,8 @@ export function resolveThreadPullRequestBadgePresentation({ | ... | @@ -195,7 +195,8 @@ export function resolveThreadPullRequestBadgePresentation({ |
| 195 | * The linked-PR badge shared by the sidebar and composer footer. The badge owns what it shows: | 195 | * The linked-PR badge shared by the sidebar and composer footer. The badge owns what it shows: |
| 196 | * the state glyph and number at the meta size, in the state's color. The caller owns the control | 196 | * the state glyph and number at the meta size, in the state's color. The caller owns the control |
| 197 | * it sits in through `render` (an inline link in a sidebar row, a toolbar control in the | 197 | * it sits in through `render` (an inline link in a sidebar row, a toolbar control in the |
| 198 | * composer), and the badge fills in the link or stack button behavior. | 198 | * composer), and the badge fills in the behavior: a single PR is a link to it, while a stack or |
| | 199 | * several linked PRs is a button that opens the thread's pull requests tab. |
| 199 | */ | 200 | */ |
| 200 | export function ThreadPullRequestBadgeControl({ | 201 | export function ThreadPullRequestBadgeControl({ |
| 201 | render, | 202 | render, |
| ... | @@ -203,7 +204,7 @@ export function ThreadPullRequestBadgeControl({ | ... | @@ -203,7 +204,7 @@ export function ThreadPullRequestBadgeControl({ |
| 203 | number, | 204 | number, |
| 204 | url, | 205 | url, |
| 205 | status, | 206 | status, |
| 206 | onOpenStack, | 207 | onOpenList, |
| 207 | onOpenPullRequest, | 208 | onOpenPullRequest, |
| 208 | }: { | 209 | }: { |
| 209 | render: ReactElement<{ render?: useRender.RenderProp }>; | 210 | render: ReactElement<{ render?: useRender.RenderProp }>; |
| ... | @@ -211,7 +212,7 @@ export function ThreadPullRequestBadgeControl({ | ... | @@ -211,7 +212,7 @@ export function ThreadPullRequestBadgeControl({ |
| 211 | number?: number | undefined; | 212 | number?: number | undefined; |
| 212 | url?: string | undefined; | 213 | url?: string | undefined; |
| 213 | status: PrStatusIndicator | null; | 214 | status: PrStatusIndicator | null; |
| 214 | onOpenStack: () => void; | 215 | onOpenList: () => void; |
| 215 | onOpenPullRequest: (event: MouseEvent<HTMLElement>) => void; | 216 | onOpenPullRequest: (event: MouseEvent<HTMLElement>) => void; |
| 216 | }) { | 217 | }) { |
| 217 | const presentation = resolveThreadPullRequestBadgePresentation({ badge, number, url, status }); | 218 | const presentation = resolveThreadPullRequestBadgePresentation({ badge, number, url, status }); |
| ... | @@ -220,9 +221,9 @@ export function ThreadPullRequestBadgeControl({ | ... | @@ -220,9 +221,9 @@ export function ThreadPullRequestBadgeControl({ |
| 220 | <PullRequestBadge | 221 | <PullRequestBadge |
| 221 | render={render} | 222 | render={render} |
| 222 | presentation={presentation} | 223 | presentation={presentation} |
| 223 | isStack={badge?.kind === "stack"} | 224 | opensList={badge !== null && (badge.kind === "stack" || badge.others > 0)} |
| 224 | url={url} | 225 | url={url} |
| 225 | onOpenStack={onOpenStack} | 226 | onOpenList={onOpenList} |
| 226 | onOpenPullRequest={onOpenPullRequest} | 227 | onOpenPullRequest={onOpenPullRequest} |
| 227 | /> | 228 | /> |
| 228 | ); | 229 | ); |
| ... | @@ -231,26 +232,26 @@ export function ThreadPullRequestBadgeControl({ | ... | @@ -231,26 +232,26 @@ export function ThreadPullRequestBadgeControl({ |
| 231 | function PullRequestBadge({ | 232 | function PullRequestBadge({ |
| 232 | render, | 233 | render, |
| 233 | presentation, | 234 | presentation, |
| 234 | isStack, | 235 | opensList, |
| 235 | url, | 236 | url, |
| 236 | onOpenStack, | 237 | onOpenList, |
| 237 | onOpenPullRequest, | 238 | onOpenPullRequest, |
| 238 | }: { | 239 | }: { |
| 239 | render: ReactElement<{ render?: useRender.RenderProp }>; | 240 | render: ReactElement<{ render?: useRender.RenderProp }>; |
| 240 | presentation: NonNullable<ReturnType<typeof resolveThreadPullRequestBadgePresentation>>; | 241 | presentation: NonNullable<ReturnType<typeof resolveThreadPullRequestBadgePresentation>>; |
| 241 | isStack: boolean; | 242 | opensList: boolean; |
| 242 | url: string | undefined; | 243 | url: string | undefined; |
| 243 | onOpenStack: () => void; | 244 | onOpenList: () => void; |
| 244 | onOpenPullRequest: (event: MouseEvent<HTMLElement>) => void; | 245 | onOpenPullRequest: (event: MouseEvent<HTMLElement>) => void; |
| 245 | }) { | 246 | }) { |
| 246 | const onClick = isStack | 247 | const onClick = opensList |
| 247 | ? (event: MouseEvent<HTMLElement>) => { | 248 | ? (event: MouseEvent<HTMLElement>) => { |
| 248 | event.preventDefault(); | 249 | event.preventDefault(); |
| 249 | event.stopPropagation(); | 250 | event.stopPropagation(); |
| 250 | onOpenStack(); | 251 | onOpenList(); |
| 251 | } | 252 | } |
| 252 | : onOpenPullRequest; | 253 | : onOpenPullRequest; |
| 253 | const element = isStack ? ( | 254 | const element = opensList ? ( |
| 254 | <button type="button" /> | 255 | <button type="button" /> |
| 255 | ) : ( | 256 | ) : ( |
| 256 | <a href={url} target="_blank" rel="noopener noreferrer" /> | 257 | <a href={url} target="_blank" rel="noopener noreferrer" /> |