feat(web): add provider selector to pull request toolbar (#11524)
Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
1 parent
17f8e2a8ac
commit
20363c32c9
1 file changed
+22
-4
@@ -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}
|
||||
|
||||
Reference in new issue
Block a user