Skip to content

Commit 20363c3

Browse files
authored
feat(web): add provider selector to pull request toolbar (#11524)
Co-authored-by: maria-rcks <[email protected]>
1 parent 17f8e2a commit 20363c3

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

‎apps/web/src/routes/_chat.pull-requests.tsx‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
LayersIcon,
2828
ListChecksIcon,
2929
PenLineIcon,
30+
Plug2Icon,
3031
Maximize2Icon,
3132
Minimize2Icon,
3233
SearchIcon,
@@ -1721,7 +1722,7 @@ function PullRequestsRouteView() {
17211722
// kind force the hostname to tell them apart.
17221723
const hostEntries = hosts.length > 0 ? hosts : expectedHosts;
17231724
const hostMenuOptions: ReadonlyArray<PullRequestFilterOption<string>> = [
1724-
{ value: "", label: "All hosts", Icon: LayersIcon },
1725+
{ value: "", label: "All", Icon: Plug2Icon },
17251726
...hostEntries.map((entry) => {
17261727
// `expectedHosts` stands in before the server has answered, and nothing is known to be
17271728
// unreadable yet; once the summaries arrive they carry whether each one could be read.
@@ -2044,6 +2045,7 @@ function CompactFilterMenu<Value extends string>({
20442045
triggerIcon,
20452046
triggerLabel,
20462047
outlined = false,
2048+
iconOnly = false,
20472049
value,
20482050
options,
20492051
onChange,
@@ -2053,6 +2055,7 @@ function CompactFilterMenu<Value extends string>({
20532055
triggerIcon?: ReactNode;
20542056
triggerLabel?: string;
20552057
outlined?: boolean;
2058+
iconOnly?: boolean;
20562059
value: Value;
20572060
options: ReadonlyArray<PullRequestFilterOption<Value>>;
20582061
onChange: (value: Value) => void;
@@ -2063,8 +2066,11 @@ function CompactFilterMenu<Value extends string>({
20632066
return (
20642067
<Menu>
20652068
<MenuTrigger
2066-
aria-label={triggerLabel ? `${label}: ${current.label}` : label}
2067-
render={outlined ? <Button variant="outline" /> : undefined}
2069+
aria-label={triggerLabel || iconOnly ? `${label}: ${current.label}` : label}
2070+
title={iconOnly ? `${label}: ${current.label}` : undefined}
2071+
render={
2072+
outlined ? <Button variant="outline" size={iconOnly ? "icon" : "default"} /> : undefined
2073+
}
20682074
className={
20692075
outlined
20702076
? className
@@ -2074,7 +2080,9 @@ function CompactFilterMenu<Value extends string>({
20742080
)
20752081
}
20762082
>
2077-
{triggerLabel ? (
2083+
{iconOnly ? (
2084+
<current.Icon aria-hidden className="size-4" />
2085+
) : triggerLabel ? (
20782086
<>
20792087
{triggerIcon}
20802088
<span>{triggerLabel}</span>
@@ -2377,6 +2385,16 @@ function PullRequestsColumn({
23772385
</div>
23782386
{sortMenu}
23792387
{filtersMenu}
2388+
<CompactFilterMenu
2389+
label="Filter by provider"
2390+
outlined
2391+
iconOnly={host !== undefined}
2392+
triggerIcon={<Plug2Icon aria-hidden className="size-4" />}
2393+
triggerLabel="All"
2394+
value={host ?? ""}
2395+
options={hostMenuOptions}
2396+
onChange={(next) => onHost(next === "" ? undefined : next)}
2397+
/>
23802398
{!condensed ? (
23812399
<PullRequestRefreshControl refreshing={refreshing} onRefresh={onRefresh} />
23822400
) : null}

0 commit comments

Comments
 (0)