From f9d667ed6d3e35965ab211d10f87f6bc7145f419 Mon Sep 17 00:00:00 2001 From: Matthew Meszaros Date: Sun, 7 Jun 2026 12:39:33 +0200 Subject: [PATCH] feat: add themed select menu --- web/src/app/app/admin/audit/page.tsx | 70 ++++++++----- web/src/app/app/admin/credentials/page.tsx | 40 +++++--- web/src/app/app/admin/workers/[id]/page.tsx | 89 +++++++++-------- web/src/app/app/admin/workers/new/page.tsx | 31 +++--- .../_components/ConnectionDetail.tsx | 21 ++-- web/src/app/app/settings/limits/page.tsx | 24 ++--- .../app/campaigns/NewCampaignDialog.tsx | 26 +++-- web/src/components/ui/select-menu.tsx | 99 +++++++++++++++++++ 8 files changed, 274 insertions(+), 126 deletions(-) create mode 100644 web/src/components/ui/select-menu.tsx diff --git a/web/src/app/app/admin/audit/page.tsx b/web/src/app/app/admin/audit/page.tsx index 88ad8e253..ab38a1ceb 100644 --- a/web/src/app/app/admin/audit/page.tsx +++ b/web/src/app/app/admin/audit/page.tsx @@ -2,6 +2,12 @@ import { useMemo, useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { searchAdminAuditLogs } from "@/lib/api/client/app/admin/audit"; import type { AdminAuditLog, AdminAuditLogSearch } from "@/lib/api/models/app/admin/Audit"; +import { SelectMenu, type SelectOption } from "@/components/ui/select-menu"; + +const LIMIT_OPTIONS: SelectOption[] = [25, 50, 100].map((n) => ({ + value: String(n), + label: String(n), +})); // Free-form action / target_type strings used by handlers across the app. // These are populated dynamically from the result set too — anything new the @@ -87,6 +93,22 @@ export default function AdminAuditPage() { return Array.from(set).sort(); }, [data]); + const actionOptions = useMemo( + () => [ + { value: "", label: "(any)" }, + ...allActions.map((a) => ({ value: a, label: a })), + ], + [allActions], + ); + + const entityTypeOptions = useMemo( + () => [ + { value: "", label: "(any)" }, + ...allEntityTypes.map((t) => ({ value: t, label: t })), + ], + [allEntityTypes], + ); + return (
@@ -120,28 +142,22 @@ export default function AdminAuditPage() {
- + onChange={(v) => applyFilter({ action: v || undefined })} + options={actionOptions} + className="w-full" + aria-label="Action" + /> - + onChange={(v) => applyFilter({ target_type: v || undefined })} + options={entityTypeOptions} + className="w-full" + aria-label="Target type" + />
-
- Limit:{" "} - +
+ Limit: + applyFilter({ limit: parseInt(v, 10) })} + options={LIMIT_OPTIONS} + minWidth={80} + aria-label="Result limit" + />