Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

simplify UI

adilson5cbf10224a58
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchModal.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchModal.tsx
index 509dc72d62..d801004586 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchModal.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/QuickSearchModal.tsx
@@ -55,12 +55,11 @@ import { QuickSearchEnvTable } from "./QuickSearchEnvTable";
import { QuickSearchFolderItem } from "./QuickSearchFolderItem";
import { QuickSearchMetadataSecretItem } from "./QuickSearchMetadataSecretItem";
import { QuickSearchSecretItem } from "./QuickSearchSecretItem";
-import { SecretMetadataFilterChips } from "./SecretMetadataFilterChips";
import {
MetadataMatchType,
MetadataSearchCondition,
- SecretMetadataSearchBuilder
-} from "./SecretMetadataSearchBuilder";
+ SecretMetadataSearchInput
+} from "./SecretMetadataSearchInput";
export type QuickSearchModalProps = {
environments: ProjectEnv[];
@@ -118,11 +117,6 @@ const Content = ({
const [isBuilderOpen, setIsBuilderOpen] = useState(false);
const conditionIdRef = useRef(0);
- const createCondition = (): MetadataSearchCondition => {
- conditionIdRef.current += 1;
- return { id: `cond-${conditionIdRef.current}`, key: "", value: "" };
- };
-
const activeConditions = useMemo(
() => metadataConditions.filter((condition) => condition.key.trim() && condition.value.trim()),
[metadataConditions]
@@ -136,7 +130,7 @@ const Content = ({
debouncedConditions.map((condition) => ({
key: condition.key.trim(),
value: condition.value.trim(),
- operator: SecretMetadataSearchOperator.Is
+ operator: condition.operator
})),
[debouncedConditions]
);
@@ -274,19 +268,38 @@ const Content = ({
const handleOpenMetadata = () => {
setIsBuilderOpen(true);
- setMetadataConditions((prev) => (prev.length ? prev : [createCondition()]));
};
- const handleAddCondition = () => {
- setMetadataConditions((prev) => [...prev, createCondition()]);
+ const handleAddCondition = (
+ key: string,
+ value: string,
+ operator: SecretMetadataSearchOperator
+ ) => {
+ setMetadataConditions((prev) => {
+ // ignore exact duplicates, but allow the same key/value with a different operator
+ if (
+ prev.some(
+ (condition) =>
+ condition.key === key && condition.value === value && condition.operator === operator
+ )
+ ) {
+ return prev;
+ }
+ conditionIdRef.current += 1;
+ return [...prev, { id: `cond-${conditionIdRef.current}`, key, value, operator }];
+ });
};
- const handleUpdateCondition = (
+ const handleEditCondition = (
id: string,
- patch: Partial<Pick<MetadataSearchCondition, "key" | "value">>
+ key: string,
+ value: string,
+ operator: SecretMetadataSearchOperator
) => {
setMetadataConditions((prev) =>
- prev.map((condition) => (condition.id === id ? { ...condition, ...patch } : condition))
+ prev.map((condition) =>
+ condition.id === id ? { ...condition, key, value, operator } : condition
+ )
);
};
@@ -464,16 +477,9 @@ const Content = ({
</InputGroup>
</div>
- <SecretMetadataFilterChips
- conditions={activeConditions}
- match={metadataMatch}
- onRemoveCondition={handleRemoveCondition}
- onClear={handleClearMetadata}
- />
-
<div className="min-h-0 thin-scrollbar flex-1 overflow-y-auto pt-4">
{isBuilderOpen && (
- <SecretMetadataSearchBuilder
+ <SecretMetadataSearchInput
conditions={metadataConditions}
match={metadataMatch}
matchingCount={metadataResultCount}
@@ -481,7 +487,7 @@ const Content = ({
hasActiveConditions={isMetadataMode}
onChangeMatch={setMetadataMatch}
onAddCondition={handleAddCondition}
- onUpdateCondition={handleUpdateCondition}
+ onEditCondition={handleEditCondition}
onRemoveCondition={handleRemoveCondition}
onClear={handleClearMetadata}
onClose={handleCloseBuilder}
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/SecretMetadataFilterChips.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/SecretMetadataFilterChips.tsx
deleted file mode 100644
index d56d05406f..0000000000
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/SecretMetadataFilterChips.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-import { BracesIcon, XIcon } from "lucide-react";
-
-import {
- HoverCard,
- HoverCardContent,
- HoverCardTrigger,
- IconButton,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-
-import { MetadataMatchType, MetadataSearchCondition } from "./SecretMetadataSearchBuilder";
-
-type Props = {
- conditions: MetadataSearchCondition[];
- match: MetadataMatchType;
- onRemoveCondition: (id: string) => void;
- onClear: () => void;
-};
-
-const MAX_VISIBLE_CONDITIONS = 3;
-
-const ConditionChip = ({
- condition,
- onRemoveCondition
-}: {
- condition: MetadataSearchCondition;
- onRemoveCondition: (id: string) => void;
-}) => (
- <span className="flex min-w-0 items-center gap-1.5 font-mono text-sm">
- <span className="shrink-0 text-muted">{condition.key}</span>
- <span className="shrink-0 text-muted">=</span>
- <span className="max-w-40 truncate text-foreground" title={condition.value}>
- {condition.value}
- </span>
- <button
- type="button"
- aria-label="Remove condition"
- className="shrink-0 text-muted transition-colors hover:text-foreground"
- onClick={() => onRemoveCondition(condition.id)}
- >
- <XIcon className="size-3" />
- </button>
- </span>
-);
-
-const Connector = ({ connector }: { connector: string }) => (
- <span className="shrink-0 rounded bg-neutral/15 px-1.5 py-0.5 text-[10px] font-semibold tracking-wide text-muted uppercase">
- {connector}
- </span>
-);
-
-export const SecretMetadataFilterChips = ({
- conditions,
- match,
- onRemoveCondition,
- onClear
-}: Props) => {
- if (!conditions.length) return null;
-
- const connector = match === "all" ? "AND" : "OR";
-
- const visibleConditions = conditions.slice(0, MAX_VISIBLE_CONDITIONS);
- const overflowConditions = conditions.slice(MAX_VISIBLE_CONDITIONS);
-
- return (
- <div className="flex items-center gap-3 pt-3.5">
- <span className="shrink-0 text-xs tracking-wide text-muted uppercase">Filters</span>
- <div className="flex min-w-0 items-center gap-2 rounded-md border border-border bg-container px-3 py-1.5">
- <BracesIcon className="size-3.5 shrink-0 text-muted" />
- <span className="shrink-0 text-sm text-foreground">Metadata</span>
- <div className="flex min-w-0 flex-nowrap items-center gap-2">
- {visibleConditions.map((condition, index) => (
- <div key={condition.id} className="flex min-w-0 items-center gap-2">
- {index > 0 && <Connector connector={connector} />}
- <ConditionChip condition={condition} onRemoveCondition={onRemoveCondition} />
- </div>
- ))}
- {overflowConditions.length > 0 && (
- <HoverCard openDelay={150} closeDelay={150}>
- <HoverCardTrigger asChild>
- <button
- type="button"
- aria-label={`Show ${overflowConditions.length} more metadata filters`}
- className="shrink-0 rounded bg-neutral/15 px-1.5 py-0.5 text-[10px] font-semibold tracking-wide text-muted transition-colors hover:bg-neutral/25 hover:text-foreground"
- >
- {`+${overflowConditions.length}`}
- </button>
- </HoverCardTrigger>
- <HoverCardContent align="end" className="flex w-auto max-w-sm flex-col gap-1.5 p-2">
- {overflowConditions.map((condition) => (
- <div key={condition.id} className="flex min-w-0 items-center gap-2">
- <Connector connector={connector} />
- <ConditionChip condition={condition} onRemoveCondition={onRemoveCondition} />
- </div>
- ))}
- </HoverCardContent>
- </HoverCard>
- )}
- </div>
- <Tooltip>
- <TooltipTrigger asChild>
- <IconButton
- variant="ghost"
- size="xs"
- className="ml-1 shrink-0"
- aria-label="Clear all metadata filters"
- onClick={onClear}
- >
- <XIcon />
- </IconButton>
- </TooltipTrigger>
- <TooltipContent>Clear all filters</TooltipContent>
- </Tooltip>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/SecretMetadataSearchBuilder.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/SecretMetadataSearchBuilder.tsx
deleted file mode 100644
index 61fcb3f21b..0000000000
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/SecretMetadataSearchBuilder.tsx
+++ /dev/null
@@ -1,171 +0,0 @@
-import { BracesIcon, InfoIcon, PlusIcon, XIcon, ZapIcon } from "lucide-react";
-
-import {
- Button,
- IconButton,
- InputGroup,
- InputGroupAddon,
- InputGroupInput,
- InputGroupText,
- Tooltip,
- TooltipContent,
- TooltipTrigger
-} from "@app/components/v3";
-import { cn } from "@app/components/v3/utils";
-
-export type MetadataSearchCondition = {
- id: string;
- key: string;
- value: string;
-};
-
-export type MetadataMatchType = "all" | "any";
-
-type Props = {
- conditions: MetadataSearchCondition[];
- match: MetadataMatchType;
- matchingCount: number;
- isPending: boolean;
- hasActiveConditions: boolean;
- onChangeMatch: (match: MetadataMatchType) => void;
- onAddCondition: () => void;
- onUpdateCondition: (
- id: string,
- patch: Partial<Pick<MetadataSearchCondition, "key" | "value">>
- ) => void;
- onRemoveCondition: (id: string) => void;
- onClear: () => void;
- onClose: () => void;
-};
-
-export const SecretMetadataSearchBuilder = ({
- conditions,
- match,
- matchingCount,
- isPending,
- hasActiveConditions,
- onChangeMatch,
- onAddCondition,
- onUpdateCondition,
- onRemoveCondition,
- onClear,
- onClose
-}: Props) => {
- return (
- <div className="mb-5 rounded-lg border border-border bg-popover">
- <div className="flex items-center gap-3 border-b border-border px-4 py-3">
- <BracesIcon className="size-4 text-muted" />
- <span className="font-medium">Filter by metadata</span>
- <IconButton
- variant="ghost"
- size="xs"
- className="ml-auto"
- aria-label="Close metadata filter"
- onClick={onClose}
- >
- <XIcon />
- </IconButton>
- </div>
-
- <div className="p-4">
- <div className="mb-4 flex flex-wrap items-center gap-3 text-sm text-muted">
- <span>Match</span>
- <div className="inline-flex rounded-md border border-border p-0.5">
- {(["all", "any"] as const).map((option) => (
- <button
- key={option}
- type="button"
- onClick={() => onChangeMatch(option)}
- className={cn(
- "h-6 rounded px-3 text-xs font-semibold tracking-wide transition-colors",
- match === option
- ? "bg-project/15 text-project"
- : "text-muted hover:text-foreground"
- )}
- >
- {option.toUpperCase()}
- </button>
- ))}
- </div>
- <span>of the conditions below</span>
- <Tooltip>
- <TooltipTrigger asChild>
- <span className="cursor-default text-muted">
- <InfoIcon className="size-3.5" />
- </span>
- </TooltipTrigger>
- <TooltipContent className="max-w-xs">
- <span className="font-semibold text-project">ALL</span> returns secrets matching every
- condition (AND). <span className="font-semibold text-project">ANY</span> returns
- secrets matching at least one condition (OR).
- </TooltipContent>
- </Tooltip>
- </div>
-
- <div className="mb-3 flex flex-col gap-2.5">
- {conditions.map((condition) => (
- <div key={condition.id} className="flex items-center gap-2.5">
- <InputGroup className="w-52 flex-none">
- <InputGroupAddon>
- <InputGroupText className="font-mono">#</InputGroupText>
- </InputGroupAddon>
- <InputGroupInput
- className="font-mono"
- placeholder="Key"
- value={condition.key}
- onChange={(e) => onUpdateCondition(condition.id, { key: e.target.value })}
- />
- </InputGroup>
- <span className="flex h-9 flex-none items-center rounded-md border border-border px-3 font-mono text-sm text-muted">
- is
- </span>
- <InputGroup className="flex-1">
- <InputGroupInput
- className="font-mono"
- placeholder="Value"
- value={condition.value}
- onChange={(e) => onUpdateCondition(condition.id, { value: e.target.value })}
- />
- </InputGroup>
- <IconButton
- variant="ghost"
- size="sm"
- className="flex-none text-muted hover:text-danger"
- aria-label="Remove condition"
- onClick={() => onRemoveCondition(condition.id)}
- >
- <XIcon />
- </IconButton>
- </div>
- ))}
- </div>
-
- <Button variant="outline" size="sm" onClick={onAddCondition}>
- <PlusIcon />
- Add condition
- </Button>
- </div>
-
- <div className="flex items-center justify-between border-t border-border px-4 py-3">
- <span className="flex items-center gap-2 text-sm text-muted">
- <ZapIcon className="size-3.5 text-project" />
- {hasActiveConditions ? (
- <span>
- <span className="font-semibold text-foreground">
- {isPending ? "…" : matchingCount}
- </span>{" "}
- matching {matchingCount === 1 && !isPending ? "secret" : "secrets"}
- </span>
- ) : (
- <span>Add a condition to search</span>
- )}
- </span>
- <div className="flex items-center gap-2">
- <Button variant="ghost" size="sm" onClick={onClear}>
- Clear
- </Button>
- </div>
- </div>
- </div>
- );
-};
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/SecretMetadataSearchInput.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/SecretMetadataSearchInput.tsx
new file mode 100644
index 0000000000..22be620090
--- /dev/null
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretSearchInput/components/SecretMetadataSearchInput.tsx
@@ -0,0 +1,332 @@
+import React, { useEffect, useRef, useState } from "react";
+import { BracesIcon, ChevronDownIcon, InfoIcon, SearchIcon, XIcon, ZapIcon } from "lucide-react";
+
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ IconButton,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
+import { cn } from "@app/components/v3/utils";
+import { SecretMetadataSearchOperator } from "@app/hooks/api/dashboard/types";
+
+export type MetadataSearchCondition = {
+ id: string;
+ key: string;
+ value: string;
+ operator: SecretMetadataSearchOperator;
+};
+
+export type MetadataMatchType = "all" | "any";
+
+// Selectable comparison operators. Only "is" exists today; adding a new operator here surfaces it
+// in the dropdown automatically.
+const METADATA_OPERATORS: { value: SecretMetadataSearchOperator; label: string }[] = [
+ { value: SecretMetadataSearchOperator.Is, label: "is" }
+];
+
+const DEFAULT_OPERATOR = METADATA_OPERATORS[0].value;
+
+const getOperatorLabel = (operator: SecretMetadataSearchOperator) =>
+ METADATA_OPERATORS.find((op) => op.value === operator)?.label ?? operator;
+
+type Props = {
+ conditions: MetadataSearchCondition[];
+ match: MetadataMatchType;
+ matchingCount: number;
+ isPending: boolean;
+ hasActiveConditions: boolean;
+ onChangeMatch: (match: MetadataMatchType) => void;
+ onAddCondition: (key: string, value: string, operator: SecretMetadataSearchOperator) => void;
+ onEditCondition: (
+ id: string,
+ key: string,
+ value: string,
+ operator: SecretMetadataSearchOperator
+ ) => void;
+ onRemoveCondition: (id: string) => void;
+ onClear: () => void;
+ onClose: () => void;
+};
+
+export const SecretMetadataSearchInput = ({
+ conditions,
+ match,
+ matchingCount,
+ isPending,
+ hasActiveConditions,
+ onChangeMatch,
+ onAddCondition,
+ onEditCondition,
+ onRemoveCondition,
+ onClear,
+ onClose
+}: Props) => {
+ // raw "key:value" text for the chip being composed; metadata keys are free-form so we just
+ // split on the first colon rather than matching against a fixed property list.
+ const [query, setQuery] = useState("");
+ const [editingId, setEditingId] = useState<string | null>(null);
+ const [composingOperator, setComposingOperator] =
+ useState<SecretMetadataSearchOperator>(DEFAULT_OPERATOR);
+ const inputRef = useRef<HTMLInputElement>(null);
+
+ const colonIndex = query.indexOf(":");
+ const isComposing = colonIndex > 0;
+ const propertyKey = isComposing ? query.slice(0, colonIndex).trim() : "";
+ const typedValue = isComposing ? query.slice(colonIndex + 1) : "";
+
+ const focusInput = () => {
+ setTimeout(() => inputRef.current?.focus(), 0);
+ };
+
+ const resetQuery = () => {
+ setQuery("");
+ setEditingId(null);
+ setComposingOperator(DEFAULT_OPERATOR);
+ };
+
+ // refocus the input when swapping between the free-text field and the composing pill
+ useEffect(() => {
+ if (isComposing) inputRef.current?.focus();
+ }, [isComposing]);
+
+ const commit = () => {
+ const key = propertyKey.trim();
+ const value = typedValue.trim();
+ if (!key || !value) return;
+
+ if (editingId !== null) {
+ onEditCondition(editingId, key, value, composingOperator);
+ } else {
+ onAddCondition(key, value, composingOperator);
+ }
+ resetQuery();
+ focusInput();
+ };
+
+ const editCondition = (condition: MetadataSearchCondition) => {
+ setEditingId(condition.id);
+ setComposingOperator(condition.operator);
+ setQuery(`${condition.key}:${condition.value}`);
+ focusInput();
+ };
+
+ const handleKeyDown = (keyEvent: React.KeyboardEvent) => {
+ switch (keyEvent.key) {
+ case "Enter":
+ keyEvent.preventDefault();
+ commit();
+ break;
+ case "Escape":
+ resetQuery();
+ break;
+ case "Backspace":
+ if (query === "" && conditions.length > 0) {
+ onRemoveCondition(conditions[conditions.length - 1].id);
+ }
+ break;
+ default:
+ break;
+ }
+ };
+
+ const operatorDropdown = (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <button
+ type="button"
+ aria-label="Select operator"
+ onClick={(clickEvent) => clickEvent.stopPropagation()}
+ className="inline-flex items-center gap-0.5 rounded bg-neutral/15 px-1.5 py-0.5 text-muted transition-colors hover:bg-neutral/25 hover:text-foreground"
+ >
+ {getOperatorLabel(composingOperator)}
+ <ChevronDownIcon className="size-2.5" />
+ </button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="start" className="min-w-[6rem]">
+ {METADATA_OPERATORS.map((op) => (
+ <DropdownMenuItem
+ key={op.value}
+ onSelect={() => {
+ setComposingOperator(op.value);
+ focusInput();
+ }}
+ >
+ {op.label}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+
+ const composingInput = (
+ <span
+ key="composing"
+ className="inline-flex shrink-0 items-center gap-1 rounded-md border border-border py-1 pr-1 pl-1.5 font-mono text-xs"
+ >
+ <span className="text-muted">{propertyKey}</span>
+ {operatorDropdown}
+ <input
+ ref={inputRef}
+ type="text"
+ className="w-auto bg-transparent font-mono text-xs text-foreground outline-none"
+ style={{ width: `${Math.max(typedValue.length, 1)}ch` }}
+ value={typedValue}
+ onChange={(inputEvent) => setQuery(`${propertyKey}:${inputEvent.target.value}`)}
+ onKeyDown={handleKeyDown}
+ />
+ <button
+ type="button"
+ aria-label="Cancel condition"
+ onClick={(clickEvent) => {
+ clickEvent.stopPropagation();
+ resetQuery();
+ }}
+ className="ml-0.5 text-muted transition-colors hover:text-foreground"
+ >
+ <XIcon className="size-2.5" />
+ </button>
+ </span>
+ );
+
+ const renderChip = (condition: MetadataSearchCondition) => (
+ <span
+ key={condition.id}
+ className="inline-flex shrink-0 items-center gap-1 rounded-md border border-border bg-container px-2.5 py-1 font-mono text-xs"
+ >
+ <button
+ type="button"
+ className="text-foreground transition-colors hover:text-foreground"
+ onClick={(clickEvent) => {
+ clickEvent.stopPropagation();
+ editCondition(condition);
+ }}
+ >
+ <span className="text-muted">{`${condition.key} ${getOperatorLabel(condition.operator)} `}</span>
+ {condition.value}
+ </button>
+ <button
+ type="button"
+ aria-label="Remove condition"
+ onClick={(clickEvent) => {
+ clickEvent.stopPropagation();
+ onRemoveCondition(condition.id);
+ }}
+ className="ml-0.5 text-muted transition-colors hover:text-foreground"
+ >
+ <XIcon className="size-2.5" />
+ </button>
+ </span>
+ );
+
+ return (
+ <div className="mb-5 rounded-lg border border-border bg-popover">
+ <div className="border-b border-border px-4 py-3">
+ <div className="flex items-center gap-3">
+ <BracesIcon className="size-4 text-muted" />
+ <span className="font-medium">Filter by metadata</span>
+ <div className="ml-auto flex items-center gap-2">
+ <div className="inline-flex rounded-md border border-border p-0.5">
+ {(["all", "any"] as const).map((option) => (
+ <button
+ key={option}
+ type="button"
+ onClick={() => onChangeMatch(option)}
+ className={cn(
+ "h-6 rounded px-3 text-xs font-semibold tracking-wide transition-colors",
+ match === option
+ ? "bg-project/15 text-project"
+ : "text-muted hover:text-foreground"
+ )}
+ >
+ {option.toUpperCase()}
+ </button>
+ ))}
+ </div>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span className="cursor-default text-muted">
+ <InfoIcon className="size-3.5" />
+ </span>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-xs">
+ <span className="font-semibold text-project">ALL</span> returns secrets matching
+ every condition (AND). <span className="font-semibold text-project">ANY</span>{" "}
+ returns secrets matching at least one condition (OR).
+ </TooltipContent>
+ </Tooltip>
+ <IconButton
+ variant="ghost"
+ size="xs"
+ aria-label="Close metadata filter"
+ onClick={onClose}
+ >
+ <XIcon />
+ </IconButton>
+ </div>
+ </div>
+ <p className="mt-1 pl-7 text-xs text-muted">
+ Type <code> key : value </code> and press Enter to add a filter, e.g. env is production.
+ </p>
+ </div>
+
+ <div className="p-4">
+ <div
+ className="flex cursor-text flex-wrap items-center gap-2 rounded-md border border-border bg-card px-3 py-2 transition-colors focus-within:border-foreground/30"
+ role="button"
+ tabIndex={-1}
+ onClick={() => inputRef.current?.focus()}
+ onKeyDown={(wrapperEvent) => {
+ if (wrapperEvent.key === "Enter" || wrapperEvent.key === " ") {
+ inputRef.current?.focus();
+ }
+ }}
+ >
+ <SearchIcon className="size-3.5 shrink-0 text-muted" />
+
+ {conditions.map((condition) =>
+ isComposing && editingId === condition.id ? composingInput : renderChip(condition)
+ )}
+
+ {isComposing && editingId === null && composingInput}
+
+ {!isComposing && (
+ <input
+ ref={inputRef}
+ type="text"
+ placeholder="Add filter..."
+ className="min-w-[160px] flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted"
+ value={query}
+ onChange={(inputEvent) => setQuery(inputEvent.target.value)}
+ onKeyDown={handleKeyDown}
+ />
+ )}
+ </div>
+ </div>
+
+ <div className="flex items-center justify-between border-t border-border px-4 py-3">
+ <span className="flex items-center gap-2 text-sm text-muted">
+ <ZapIcon className="size-3.5 text-project" />
+ {hasActiveConditions ? (
+ <span>
+ <span className="font-semibold text-foreground">
+ {isPending ? "…" : matchingCount}
+ </span>{" "}
+ matching {matchingCount === 1 && !isPending ? "secret" : "secrets"}
+ </span>
+ ) : (
+ <span>Add a condition to search</span>
+ )}
+ </span>
+ <Button variant="ghost" size="sm" onClick={onClear}>
+ Clear
+ </Button>
+ </div>
+ </div>
+ );
+};