Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .server-changes/admin-tabs-preserve-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
area: webapp
type: improvement
---

Preserve search string when switching between the Users and Organizations tabs in the admin dashboard.
10 changes: 7 additions & 3 deletions apps/webapp/app/routes/admin.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet } from "@remix-run/react";
import { Outlet, useSearchParams } from "@remix-run/react";
import { typedjson } from "remix-typedjson";
import { LinkButton } from "~/components/primitives/Buttons";
import { Tabs } from "~/components/primitives/Tabs";
Expand All @@ -10,18 +10,22 @@ export const loader = dashboardLoader(
);

export default function Page() {
const [searchParams] = useSearchParams();
const search = searchParams.get("search");
const searchSuffix = search ? `?search=${encodeURIComponent(search)}` : "";

return (
<div className="h-full w-full">
<div className="flex items-center justify-between p-4">
<Tabs
tabs={[
{
label: "Users",
to: "/admin",
to: `/admin${searchSuffix}`,
},
{
label: "Organizations",
to: "/admin/orgs",
to: `/admin/orgs${searchSuffix}`,
},
{
label: "Concurrency",
Expand Down
Loading