Skip to content

Commit de3a49f

Browse files
committed
Use SegmentedControl for error filtering
1 parent 82a5ea0 commit de3a49f

File tree

1 file changed

+21
-27
lines changed
  • apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.errors._index

1 file changed

+21
-27
lines changed

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.errors._index/route.tsx

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import { ListPagination } from "~/components/ListPagination";
5555
import { formatNumberCompact } from "~/utils/numberFormatter";
5656
import { EnvironmentParamSchema, v3ErrorPath } from "~/utils/pathBuilder";
5757
import { ServiceValidationError } from "~/v3/services/baseService.server";
58+
import SegmentedControl from "~/components/primitives/SegmentedControl";
5859

5960
export const meta: MetaFunction = () => {
6061
return [
@@ -237,7 +238,6 @@ export default function Page() {
237238
}
238239

239240
function StatusFilterButton() {
240-
const location = useOptimisticLocation();
241241
const [searchParams, setSearchParams] = useRemixSearchParams();
242242
const currentStatus = searchParams.get("status") ?? "all";
243243

@@ -249,31 +249,26 @@ function StatusFilterButton() {
249249
];
250250

251251
return (
252-
<div className="flex items-center rounded border border-charcoal-700">
253-
{options.map((opt) => (
254-
<button
255-
key={opt.value}
256-
className={`px-2 py-0.5 text-xs transition-colors ${
257-
currentStatus === opt.value
258-
? "bg-charcoal-700 text-text-bright"
259-
: "text-text-dimmed hover:text-text-bright"
260-
}`}
261-
onClick={() => {
262-
const next = new URLSearchParams(searchParams);
263-
next.delete("cursor");
264-
next.delete("direction");
265-
if (opt.value === "all") {
266-
next.delete("status");
267-
} else {
268-
next.set("status", opt.value);
269-
}
270-
setSearchParams(next);
271-
}}
272-
>
273-
{opt.label}
274-
</button>
275-
))}
276-
</div>
252+
<SegmentedControl
253+
name="status"
254+
value={currentStatus}
255+
variant="secondary/small"
256+
options={options.map((opt) => ({
257+
label: opt.label,
258+
value: opt.value,
259+
}))}
260+
onChange={(value) => {
261+
const next = new URLSearchParams(searchParams);
262+
next.delete("cursor");
263+
next.delete("direction");
264+
if (value === "all") {
265+
next.delete("status");
266+
} else {
267+
next.set("status", value);
268+
}
269+
setSearchParams(next);
270+
}}
271+
/>
277272
);
278273
}
279274

@@ -292,7 +287,6 @@ function FiltersBar({
292287
searchParams.has("tasks") ||
293288
searchParams.has("versions") ||
294289
searchParams.has("search") ||
295-
searchParams.has("status") ||
296290
searchParams.has("period") ||
297291
searchParams.has("from") ||
298292
searchParams.has("to");

0 commit comments

Comments
 (0)