Skip to content

Commit 7d6430d

Browse files
authored
New filtered dropdown and run filters (#1089)
* Extract out useFilterTasks * WIP on Combobox * Revert "WIP on Combobox" This reverts commit f0a9b2e. * Added ariakit * Started adding a Listbox component * Listbox WIP * More WIP on the list box * More work on the Listbox * WIP on filterable Listbox using headless… but it’s going to be a nightmare to make it good. Wrong approach * WIP using Ariakit * Multiple selection working * WIP in reworking it so search is built in and it’s easier to use * Nicer API for listbox * Allow sections to be rendered with filtering * More progress on the styling of the menu * The empty state * Removed focus outline * Allow filtering based on the section title * Render the shortcut correctly * Allow passing static children to Select and render a separator if a section has no title * Static example and added subtle focus * Allow static data with no items array passed in * Allow shortcuts on select items * Only how heading if true * Tooltip for keyboard shortcut * useShortcutKeys fixes - Can be passed an undefined definition (so we render the same number of hooks always). - Fix for enabledOnInputElements not being used… * Shortcut keys working with lists * Don’t render shortcut numbers higher than 0 * More improvements * WIP on a Link row * Nicer API for the children function * Much nicer shortcut key support * Separated SelectTrigger out * Heading separated out * More styled elements created * Removed unused element * Reordered statuses * Added search context * Fixes for default values * Removed tab elements * Combo box * Simplified it more * Started work on Filter menu * Experiments with filter menu * Filter menu proof of concept working * Nice hook for using a search param * The escape key goes back to the previous menu * Added filter page to storybook * Added other variants * Renamed Select file to OldSelect, implemented Feedback form * Added placeholder support * Added an optional dropdown icon (defaults to a chevron down) * Feedback new Select * Feedback just use static items * New project page * Renamed storybook pages * Lots of progress on the new run filters * Added new tasks filters * Show the applied filters * Added period filtering * Fix for escape resetting the period value to the previous value when escape is pressed * Show the Clear button sooner * Removed unused code * Reworked useSearchParams so multiple values can be set at once… * Renamed file: OldSelect -> SImpleSelect * Fix for new Select not working in forms because props weren’t being passed through * New Select on the schedules page * Better layout when there are lots of run filters * Many style improvements to run filters * Status filter allows you to select as well * Rolled out the menus for the other files * Minor improvements to schedule page and page padding * Latest lockfile
1 parent b289aa3 commit 7d6430d

File tree

26 files changed

+2305
-557
lines changed

26 files changed

+2305
-557
lines changed

apps/webapp/app/components/Feedback.tsx

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { conform, useForm } from "@conform-to/react";
22
import { parse } from "@conform-to/zod";
3+
import { BookOpenIcon } from "@heroicons/react/20/solid";
34
import { ChevronRightIcon } from "@heroicons/react/24/solid";
45
import { Form, useActionData, useLocation, useNavigation } from "@remix-run/react";
56
import { DiscordIcon, GitHubLightIcon } from "@trigger.dev/companyicons";
7+
import { ActivityIcon } from "lucide-react";
68
import { ReactNode, useState } from "react";
79
import { FeedbackType, feedbackTypeLabel, schema } from "~/routes/resources.feedback";
10+
import { cn } from "~/utils/cn";
11+
import { docsPath } from "~/utils/pathBuilder";
812
import { Button, LinkButton } from "./primitives/Buttons";
913
import { Fieldset } from "./primitives/Fieldset";
1014
import { FormButtons } from "./primitives/FormButtons";
@@ -13,20 +17,9 @@ import { Header1, Header2 } from "./primitives/Headers";
1317
import { InputGroup } from "./primitives/InputGroup";
1418
import { Label } from "./primitives/Label";
1519
import { Paragraph } from "./primitives/Paragraph";
16-
import {
17-
Select,
18-
SelectContent,
19-
SelectGroup,
20-
SelectItem,
21-
SelectTrigger,
22-
SelectValue,
23-
} from "./primitives/Select";
20+
import { Select, SelectItem } from "./primitives/Select";
2421
import { Sheet, SheetBody, SheetContent, SheetTrigger } from "./primitives/Sheet";
2522
import { TextArea } from "./primitives/TextArea";
26-
import { cn } from "~/utils/cn";
27-
import { BookOpenIcon } from "@heroicons/react/20/solid";
28-
import { ActivityIcon, HeartPulseIcon } from "lucide-react";
29-
import { docsPath } from "~/utils/pathBuilder";
3023

3124
type FeedbackProps = {
3225
button: ReactNode;
@@ -78,20 +71,20 @@ export function Feedback({ button, defaultValue = "bug" }: FeedbackProps) {
7871
<Fieldset className="max-w-full gap-y-3">
7972
<input value={location.pathname} {...conform.input(path, { type: "hidden" })} />
8073
<InputGroup className="max-w-full">
81-
<SelectGroup>
82-
<Select {...conform.input(feedbackType)} defaultValue={defaultValue}>
83-
<SelectTrigger size="medium" width="full">
84-
<SelectValue placeholder="Type" />
85-
</SelectTrigger>
86-
<SelectContent>
87-
{Object.entries(feedbackTypeLabel).map(([key, value]) => (
88-
<SelectItem key={key} value={key}>
89-
{value}
90-
</SelectItem>
91-
))}
92-
</SelectContent>
93-
</Select>
94-
</SelectGroup>
74+
<Select
75+
{...conform.select(feedbackType)}
76+
variant="tertiary/medium"
77+
defaultValue={defaultValue}
78+
placeholder="Select type"
79+
text={(value) => feedbackTypeLabel[value]}
80+
dropdownIcon
81+
>
82+
{Object.entries(feedbackTypeLabel).map(([name, title]) => (
83+
<SelectItem key={name} value={name}>
84+
{title}
85+
</SelectItem>
86+
))}
87+
</Select>
9588
<FormError id={feedbackType.errorId}>{feedbackType.error}</FormError>
9689
</InputGroup>
9790
<InputGroup className="max-w-full">

apps/webapp/app/components/events/EventsFilters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
SelectItem,
1010
SelectTrigger,
1111
SelectValue,
12-
} from "../primitives/Select";
12+
} from "../primitives/SimpleSelect";
1313
import { EventListSearchSchema } from "./EventStatuses";
1414
import { environmentKeys, FilterableEnvironment } from "~/components/runs/RunStatuses";
1515
import { TimeFrameFilter } from "../runs/TimeFrameFilter";

apps/webapp/app/components/layout/AppLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function PageBody({
4141
<div
4242
className={cn(
4343
scrollable
44-
? "overflow-y-auto p-4 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600"
44+
? "overflow-y-auto p-3 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600"
4545
: "overflow-hidden",
4646
className
4747
)}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { XMarkIcon } from "@heroicons/react/20/solid";
2+
import { ReactNode } from "react";
3+
import { cn } from "~/utils/cn";
4+
5+
const variants = {
6+
"tertiary/small": {
7+
box: "h-6 bg-tertiary rounded pl-1.5 gap-1.5 text-xs divide-x divide-black/15 group-hover:bg-charcoal-600",
8+
clear: "size-6 text-text-dimmed hover:text-text-bright transition-colors",
9+
},
10+
"minimal/small": {
11+
box: "h-6 hover:bg-tertiary rounded pl-1.5 gap-1.5 text-xs",
12+
clear: "size-6 text-text-dimmed hover:text-text-bright transition-colors",
13+
},
14+
};
15+
16+
type Variant = keyof typeof variants;
17+
18+
type AppliedFilterProps = {
19+
label: ReactNode;
20+
value: ReactNode;
21+
removable?: boolean;
22+
onRemove?: () => void;
23+
variant?: Variant;
24+
className?: string;
25+
};
26+
27+
export function AppliedFilter({
28+
label,
29+
value,
30+
removable = true,
31+
onRemove,
32+
variant = "tertiary/small",
33+
className,
34+
}: AppliedFilterProps) {
35+
const variantClassName = variants[variant];
36+
return (
37+
<div className={cn("flex items-center transition", variantClassName.box, className)}>
38+
<div className="flex items-center gap-0.5">
39+
<div className="text-text-dimmed">
40+
<span>{label}</span>:
41+
</div>
42+
<div className="text-text-bright">
43+
<div>{value}</div>
44+
</div>
45+
</div>
46+
{removable && (
47+
<button
48+
className={cn("group flex size-6 items-center justify-center", variantClassName.clear)}
49+
onClick={onRemove}
50+
>
51+
<XMarkIcon className="size-3.5" />
52+
</button>
53+
)}
54+
</div>
55+
);
56+
}

0 commit comments

Comments
 (0)