Skip to content

Commit

Permalink
fix: name filter
Browse files Browse the repository at this point in the history
  • Loading branch information
salty-max committed May 12, 2024
1 parent 8ee2004 commit cd0d494
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/(platform)/library/_components/library-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export const columns: ColumnDef<LibraryCard>[] = [
<DataTableColumnHeader column={column}>Name</DataTableColumnHeader>
),
cell: (cell) => <CardTooltip card={cell.row.original} />,
filterFn: (row, id, value) => row.original.name.includes(value),
filterFn: (row, id, value) =>
row.original.name.toLowerCase().includes(value.toLowerCase()),
meta: {
filterVariant: 'text',
},
Expand Down
22 changes: 21 additions & 1 deletion app/(platform)/library/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,30 @@ export default function DashboardPage() {
const { cards, loading } = useLibrary();
const { toggleFinder } = useCards();

// Total count of each card's issue quantity
const totalCards = cards.reduce((total, card) => {
return (
total +
card.issues.reduce((subTotal, issue) => subTotal + issue.quantity, 0)
);
}, 0);

return (
<div className='px-8 py-6 flex flex-col gap-y-4' suppressHydrationWarning>
<div className='flex justify-between items-center'>
<h1 className='text-xl font-semibold'>Library</h1>
<div className='flex flex-col space-y-1'>
<h1 className='text-xl font-semibold'>Library</h1>
<div className='flex items-center space-x-2 text-sm'>
<p>
<span className='font-semibold'>{totalCards}</span> card
{totalCards !== 1 && 's'}
</p>
<p>
<span className='font-semibold'>{cards.length}</span> unique card
{cards.length !== 1 && 's'}
</p>
</div>
</div>
<div className='flex items-center space-x-4'>
<p className='text-sm'>View mode</p>
<div className='flex border rounded-md overflow-hidden'>
Expand Down

0 comments on commit cd0d494

Please sign in to comment.