Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New filtered dropdown and run filters #1089

Merged
merged 75 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
ae93d97
Extract out useFilterTasks
matt-aitken Apr 28, 2024
f0a9b2e
WIP on Combobox
matt-aitken Apr 28, 2024
afc2050
Revert "WIP on Combobox"
matt-aitken Apr 28, 2024
2954fea
Added ariakit
matt-aitken Apr 28, 2024
11a4ea2
Started adding a Listbox component
matt-aitken Apr 29, 2024
9f4fb0c
Listbox WIP
matt-aitken Apr 30, 2024
cf7de6e
Merge remote-tracking branch 'origin/main' into multi-filterable-comb…
matt-aitken Apr 30, 2024
979d6d5
More WIP on the list box
matt-aitken Apr 30, 2024
cf217b8
More work on the Listbox
matt-aitken Apr 30, 2024
17c4a7a
WIP on filterable Listbox using headless… but it’s going to be a nigh…
matt-aitken May 1, 2024
4a991a5
WIP using Ariakit
matt-aitken May 1, 2024
bce012c
Multiple selection working
matt-aitken May 1, 2024
49fea37
WIP in reworking it so search is built in and it’s easier to use
matt-aitken May 1, 2024
161243e
Nicer API for listbox
matt-aitken May 1, 2024
847244f
Allow sections to be rendered with filtering
matt-aitken May 1, 2024
c0c1655
More progress on the styling of the menu
matt-aitken May 1, 2024
1ae060c
The empty state
matt-aitken May 1, 2024
f9933d4
Removed focus outline
matt-aitken May 1, 2024
a85385b
Allow filtering based on the section title
matt-aitken May 2, 2024
a8a2bc6
Render the shortcut correctly
matt-aitken May 2, 2024
a338950
Allow passing static children to Select and render a separator if a s…
matt-aitken May 2, 2024
62050e7
Static example and added subtle focus
matt-aitken May 2, 2024
39125bf
Allow static data with no items array passed in
matt-aitken May 2, 2024
9a7cf08
Allow shortcuts on select items
matt-aitken May 2, 2024
68f8356
Only how heading if true
matt-aitken May 2, 2024
63a1580
Tooltip for keyboard shortcut
matt-aitken May 2, 2024
a123433
useShortcutKeys fixes
matt-aitken May 2, 2024
567f10c
Shortcut keys working with lists
matt-aitken May 2, 2024
2c7da19
Don’t render shortcut numbers higher than 0
matt-aitken May 2, 2024
3ab7140
More improvements
matt-aitken May 2, 2024
1bc28b2
WIP on a Link row
matt-aitken May 2, 2024
8524bdf
Nicer API for the children function
matt-aitken May 2, 2024
ae3ce40
Much nicer shortcut key support
matt-aitken May 2, 2024
538842e
Separated SelectTrigger out
matt-aitken May 3, 2024
a1ec69b
Heading separated out
matt-aitken May 3, 2024
bdf7dff
More styled elements created
matt-aitken May 3, 2024
5defb50
Removed unused element
matt-aitken May 3, 2024
a70d152
Reordered statuses
matt-aitken May 3, 2024
6e4e102
Added search context
matt-aitken May 3, 2024
ab76dcd
Fixes for default values
matt-aitken May 3, 2024
f367d71
Removed tab elements
matt-aitken May 3, 2024
2b6c76a
Combo box
matt-aitken May 3, 2024
a8f7516
Simplified it more
matt-aitken May 3, 2024
2041b2b
Started work on Filter menu
matt-aitken May 3, 2024
a9bf577
Experiments with filter menu
matt-aitken May 3, 2024
d09fe3d
Filter menu proof of concept working
matt-aitken May 3, 2024
1eb0460
Nice hook for using a search param
matt-aitken May 3, 2024
65a18d0
The escape key goes back to the previous menu
matt-aitken May 3, 2024
214475b
Added filter page to storybook
matt-aitken May 4, 2024
98c544a
Added other variants
matt-aitken May 4, 2024
d6007d7
Renamed Select file to OldSelect, implemented Feedback form
matt-aitken May 4, 2024
2208168
Added placeholder support
matt-aitken May 4, 2024
a4657d0
Added an optional dropdown icon (defaults to a chevron down)
matt-aitken May 4, 2024
85ec09b
Feedback new Select
matt-aitken May 5, 2024
99d9eac
Feedback just use static items
matt-aitken May 5, 2024
e224f32
New project page
matt-aitken May 5, 2024
ce6d752
Renamed storybook pages
matt-aitken May 5, 2024
0d98988
Lots of progress on the new run filters
matt-aitken May 5, 2024
5e7d659
Added new tasks filters
matt-aitken May 6, 2024
a7d9e8d
Show the applied filters
matt-aitken May 6, 2024
b4e4449
Added period filtering
matt-aitken May 6, 2024
a00cb5e
Fix for escape resetting the period value to the previous value when …
matt-aitken May 6, 2024
49f87a2
Show the Clear button sooner
matt-aitken May 6, 2024
fd0d6b2
Removed unused code
matt-aitken May 6, 2024
5b50bde
Reworked useSearchParams so multiple values can be set at once…
matt-aitken May 6, 2024
d5effd9
Renamed file: OldSelect -> SImpleSelect
matt-aitken May 7, 2024
8eed330
Fix for new Select not working in forms because props weren’t being p…
matt-aitken May 7, 2024
38b2f72
New Select on the schedules page
matt-aitken May 7, 2024
52c4bf8
Better layout when there are lots of run filters
matt-aitken May 7, 2024
ed74688
Many style improvements to run filters
matt-aitken May 7, 2024
4bb8388
Status filter allows you to select as well
matt-aitken May 7, 2024
b2f2b99
Rolled out the menus for the other files
matt-aitken May 7, 2024
55ab0ef
Minor improvements to schedule page and page padding
matt-aitken May 7, 2024
4faa4a7
Merge remote-tracking branch 'origin/main' into multi-filterable-comb…
matt-aitken May 7, 2024
e637882
Latest lockfile
matt-aitken May 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 19 additions & 26 deletions apps/webapp/app/components/Feedback.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { conform, useForm } from "@conform-to/react";
import { parse } from "@conform-to/zod";
import { BookOpenIcon } from "@heroicons/react/20/solid";
import { ChevronRightIcon } from "@heroicons/react/24/solid";
import { Form, useActionData, useLocation, useNavigation } from "@remix-run/react";
import { DiscordIcon, GitHubLightIcon } from "@trigger.dev/companyicons";
import { ActivityIcon } from "lucide-react";
import { ReactNode, useState } from "react";
import { FeedbackType, feedbackTypeLabel, schema } from "~/routes/resources.feedback";
import { cn } from "~/utils/cn";
import { docsPath } from "~/utils/pathBuilder";
import { Button, LinkButton } from "./primitives/Buttons";
import { Fieldset } from "./primitives/Fieldset";
import { FormButtons } from "./primitives/FormButtons";
Expand All @@ -13,20 +17,9 @@ import { Header1, Header2 } from "./primitives/Headers";
import { InputGroup } from "./primitives/InputGroup";
import { Label } from "./primitives/Label";
import { Paragraph } from "./primitives/Paragraph";
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectTrigger,
SelectValue,
} from "./primitives/Select";
import { Select, SelectItem } from "./primitives/Select";
import { Sheet, SheetBody, SheetContent, SheetTrigger } from "./primitives/Sheet";
import { TextArea } from "./primitives/TextArea";
import { cn } from "~/utils/cn";
import { BookOpenIcon } from "@heroicons/react/20/solid";
import { ActivityIcon, HeartPulseIcon } from "lucide-react";
import { docsPath } from "~/utils/pathBuilder";

type FeedbackProps = {
button: ReactNode;
Expand Down Expand Up @@ -78,20 +71,20 @@ export function Feedback({ button, defaultValue = "bug" }: FeedbackProps) {
<Fieldset className="max-w-full gap-y-3">
<input value={location.pathname} {...conform.input(path, { type: "hidden" })} />
<InputGroup className="max-w-full">
<SelectGroup>
<Select {...conform.input(feedbackType)} defaultValue={defaultValue}>
<SelectTrigger size="medium" width="full">
<SelectValue placeholder="Type" />
</SelectTrigger>
<SelectContent>
{Object.entries(feedbackTypeLabel).map(([key, value]) => (
<SelectItem key={key} value={key}>
{value}
</SelectItem>
))}
</SelectContent>
</Select>
</SelectGroup>
<Select
{...conform.select(feedbackType)}
variant="tertiary/medium"
defaultValue={defaultValue}
placeholder="Select type"
text={(value) => feedbackTypeLabel[value]}
dropdownIcon
>
{Object.entries(feedbackTypeLabel).map(([name, title]) => (
<SelectItem key={name} value={name}>
{title}
</SelectItem>
))}
</Select>
<FormError id={feedbackType.errorId}>{feedbackType.error}</FormError>
</InputGroup>
<InputGroup className="max-w-full">
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/app/components/events/EventsFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
SelectItem,
SelectTrigger,
SelectValue,
} from "../primitives/Select";
} from "../primitives/SimpleSelect";
import { EventListSearchSchema } from "./EventStatuses";
import { environmentKeys, FilterableEnvironment } from "~/components/runs/RunStatuses";
import { TimeFrameFilter } from "../runs/TimeFrameFilter";
Expand Down
2 changes: 1 addition & 1 deletion apps/webapp/app/components/layout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function PageBody({
<div
className={cn(
scrollable
? "overflow-y-auto p-4 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600"
? "overflow-y-auto p-3 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600"
: "overflow-hidden",
className
)}
Expand Down
56 changes: 56 additions & 0 deletions apps/webapp/app/components/primitives/AppliedFilter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { XMarkIcon } from "@heroicons/react/20/solid";
import { ReactNode } from "react";
import { cn } from "~/utils/cn";

const variants = {
"tertiary/small": {
box: "h-6 bg-tertiary rounded pl-1.5 gap-1.5 text-xs divide-x divide-black/15 group-hover:bg-charcoal-600",
clear: "size-6 text-text-dimmed hover:text-text-bright transition-colors",
},
"minimal/small": {
box: "h-6 hover:bg-tertiary rounded pl-1.5 gap-1.5 text-xs",
clear: "size-6 text-text-dimmed hover:text-text-bright transition-colors",
},
};

type Variant = keyof typeof variants;

type AppliedFilterProps = {
label: ReactNode;
value: ReactNode;
removable?: boolean;
onRemove?: () => void;
variant?: Variant;
className?: string;
};

export function AppliedFilter({
label,
value,
removable = true,
onRemove,
variant = "tertiary/small",
className,
}: AppliedFilterProps) {
const variantClassName = variants[variant];
return (
<div className={cn("flex items-center transition", variantClassName.box, className)}>
<div className="flex items-center gap-0.5">
<div className="text-text-dimmed">
<span>{label}</span>:
</div>
<div className="text-text-bright">
<div>{value}</div>
</div>
</div>
{removable && (
<button
className={cn("group flex size-6 items-center justify-center", variantClassName.clear)}
onClick={onRemove}
>
<XMarkIcon className="size-3.5" />
</button>
)}
</div>
);
}