'use client'; import * as React from 'react'; import { Landmark, CalendarDays, CircleDollarSign, Tag, UserRound, } from 'lucide-react'; import * as Checkbox from '@/components/ui/checkbox'; import * as Divider from '@/components/ui/divider'; import * as Input from '@/components/ui/input'; import * as Label from '@/components/ui/label'; import { Actions, FilterSidebar, } from '@/components/blocks/filter/filter-popover-parts'; const FILTER_TYPES = [ { icon: , label: 'Date' }, { icon: , label: 'Customers' }, { icon: , label: 'Amount' }, { icon: , label: 'Categories' }, { icon: , label: 'Accounts' }, ]; const useAmountFilter = () => { const [directions, setDirections] = React.useState(['any']); const [specificAmount, setSpecificAmount] = React.useState(''); const [minAmount, setMinAmount] = React.useState(''); const [maxAmount, setMaxAmount] = React.useState(''); const clearSelection = () => { setSpecificAmount(''); setMinAmount(''); setMaxAmount(''); setDirections(['any']); }; const toggleDirection = (value: string) => { setDirections((prev) => { if (prev.includes(value)) { return prev.filter((dir) => dir !== value); } else { return [...prev, value]; } }); }; return { directions, setDirections, toggleDirection, specificAmount, setSpecificAmount, minAmount, setMinAmount, maxAmount, setMaxAmount, clearSelection, }; }; export default function AmountFilterPopover() { const [activeFilter, setActiveFilter] = React.useState('Amount'); const { directions, toggleDirection, specificAmount, setSpecificAmount, minAmount, setMinAmount, maxAmount, setMaxAmount, clearSelection, } = useAmountFilter(); return (
{/* Content */}
{/* Header */}

Amount

{/* Main content area */}
DIRECTION {/* Direction */}
toggleDirection('any')} /> Any
(Recipient)
toggleDirection('in')} /> In (e.g. deposits, refunds)
(Recipient)
toggleDirection('out')} /> Out (e.g. purchases, charges)
(Recipient)
{/* Specific Amount */}
Specific Amount
$ setSpecificAmount(e.target.value)} />
{/* At least... */}
At least...
$ setMinAmount(e.target.value)} />
{/* No more than... */}
No more than...
$ setMaxAmount(e.target.value)} />
); }