Skip to content
TypeScript

feat(web): add provider selector to pull request toolbar (#11524)

maria20363c32c9bf
diff --git a/apps/web/src/routes/_chat.pull-requests.tsx b/apps/web/src/routes/_chat.pull-requests.tsx
index 2b5586a6e8e..973c406f690 100644
--- a/apps/web/src/routes/_chat.pull-requests.tsx
+++ b/apps/web/src/routes/_chat.pull-requests.tsx
@@ -27,6 +27,7 @@ import {
LayersIcon,
ListChecksIcon,
PenLineIcon,
+ Plug2Icon,
Maximize2Icon,
Minimize2Icon,
SearchIcon,
@@ -1721,7 +1722,7 @@ function PullRequestsRouteView() {
// kind force the hostname to tell them apart.
const hostEntries = hosts.length > 0 ? hosts : expectedHosts;
const hostMenuOptions: ReadonlyArray<PullRequestFilterOption<string>> = [
- { value: "", label: "All hosts", Icon: LayersIcon },
+ { value: "", label: "All", Icon: Plug2Icon },
...hostEntries.map((entry) => {
// `expectedHosts` stands in before the server has answered, and nothing is known to be
// unreadable yet; once the summaries arrive they carry whether each one could be read.
@@ -2044,6 +2045,7 @@ function CompactFilterMenu<Value extends string>({
triggerIcon,
triggerLabel,
outlined = false,
+ iconOnly = false,
value,
options,
onChange,
@@ -2053,6 +2055,7 @@ function CompactFilterMenu<Value extends string>({
triggerIcon?: ReactNode;
triggerLabel?: string;
outlined?: boolean;
+ iconOnly?: boolean;
value: Value;
options: ReadonlyArray<PullRequestFilterOption<Value>>;
onChange: (value: Value) => void;
@@ -2063,8 +2066,11 @@ function CompactFilterMenu<Value extends string>({
return (
<Menu>
<MenuTrigger
- aria-label={triggerLabel ? `${label}: ${current.label}` : label}
- render={outlined ? <Button variant="outline" /> : undefined}
+ aria-label={triggerLabel || iconOnly ? `${label}: ${current.label}` : label}
+ title={iconOnly ? `${label}: ${current.label}` : undefined}
+ render={
+ outlined ? <Button variant="outline" size={iconOnly ? "icon" : "default"} /> : undefined
+ }
className={
outlined
? className
@@ -2074,7 +2080,9 @@ function CompactFilterMenu<Value extends string>({
)
}
>
- {triggerLabel ? (
+ {iconOnly ? (
+ <current.Icon aria-hidden className="size-4" />
+ ) : triggerLabel ? (
<>
{triggerIcon}
<span>{triggerLabel}</span>
@@ -2377,6 +2385,16 @@ function PullRequestsColumn({
</div>
{sortMenu}
{filtersMenu}
+ <CompactFilterMenu
+ label="Filter by provider"
+ outlined
+ iconOnly={host !== undefined}
+ triggerIcon={<Plug2Icon aria-hidden className="size-4" />}
+ triggerLabel="All"
+ value={host ?? ""}
+ options={hostMenuOptions}
+ onChange={(next) => onHost(next === "" ? undefined : next)}
+ />
{!condensed ? (
<PullRequestRefreshControl refreshing={refreshing} onRefresh={onRefresh} />
) : null}