Files
DataStack/components/sections/ClientsFilters.tsx
T
Team Dark Devil fde2c86b1e refactor: improve auth defaults, update UI, and docs
- Provide fallback values for auth environment variables
- Refine global CSS styles and typography
- Update application metadata descriptions
- Add toast error handling to clients page
- Formalize phase implementation guidelines in AGENTS.md
2026-11-16 21:58:18 +06:00

60 lines
1.7 KiB
TypeScript

'use client';
import { Input } from '@/components/ui/Input';
import { Pill } from '@/components/ui/Pill';
import type { ClientStatusFilter } from './clients/types';
interface ClientsFiltersProps {
search: string;
onSearchChange: (value: string) => void;
status: ClientStatusFilter;
onStatusChange: (status: ClientStatusFilter) => void;
counts: Record<ClientStatusFilter, number>;
}
const FILTERS: { key: ClientStatusFilter; label: string }[] = [
{ key: 'all', label: 'All' },
{ key: 'online', label: 'Online' },
{ key: 'offline', label: 'Offline' },
{ key: 'pending', label: 'Pending' },
];
export function ClientsFilters({
search,
onSearchChange,
status,
onStatusChange,
counts,
}: ClientsFiltersProps) {
return (
<div className="mb-2.5 flex flex-wrap items-center gap-2">
<div className="w-full flex-1 sm:max-w-xs">
<Input
compact
icon="Search"
type="search"
aria-label="Search clients"
value={search}
onChange={(event) => onSearchChange(event.target.value)}
placeholder="Search client..."
className="bg-[var(--surface)]"
/>
</div>
<div className="ml-auto flex min-w-0 gap-1 overflow-x-auto" role="group" aria-label="Filter clients by status">
{FILTERS.map((filter) => (
<Pill
key={filter.key}
active={status === filter.key}
onClick={() => onStatusChange(filter.key)}
>
{filter.label}
<span className="font-mono text-[9.5px] tabular-nums text-[var(--text-faint)]">
{counts[filter.key].toLocaleString()}
</span>
</Pill>
))}
</div>
</div>
);
}