feat: add asset filter chips

This commit is contained in:
rajun 2026-10-27 16:28:55 +05:30
parent 57c337e0a9
commit f3f09d9c05

View File

@ -0,0 +1,22 @@
import { FilterChip } from '~/components/ui/filter-chip';
import { ASSET_FILTER } from '~/data/assets/constants';
import { ROUTES } from '~/data/routes';
import type { ProjectSummary } from '~/types/project';
export function AssetFilterChips({ filter, projects }: { filter: string; projects: ProjectSummary[] }) {
const chips = [
{ value: ASSET_FILTER.all, label: 'All', to: ROUTES.assets },
...projects.map((project) => ({ value: project.id, label: project.name, to: ROUTES.assetsFiltered(project.id) })),
{ value: ASSET_FILTER.unassigned, label: 'Unassigned', to: ROUTES.assetsFiltered(ASSET_FILTER.unassigned) },
];
return (
<nav aria-label='Filter assets' className='flex flex-wrap gap-2'>
{chips.map((chip) => (
<FilterChip key={chip.value} to={chip.to} selected={filter === chip.value}>
{chip.label}
</FilterChip>
))}
</nav>
);
}