import {
Table, TableHeader, TableBody, TableHead, TableRow, TableCell,
} from '@/components/ui/table';
import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils';
import { History } from 'lucide-react';
function hasHistoricalVisibility(bill) {
const visibility = bill.history_visibility;
return !!bill.has_history_ranges || (visibility && visibility !== 'default');
}
// Accepts row action handlers from BillsPage
export default function BillsTableInner({ bills, onEdit, onToggle, onDelete, onHistory }) {
return (
Bill
Category
Due
Expected
Cycle
Flags
{bills.map((bill) => (
{/* Bill name */}
{hasHistoricalVisibility(bill) && (
)}
{/* Category */}
{bill.category_name ? (
{bill.category_name}
) : (
—
)}
{/* Due day */}
Day {bill.due_day}
{/* Expected amount */}
${Number(bill.expected_amount).toFixed(2)}
{/* Billing cycle — field is billing_cycle, not cycle */}
{bill.billing_cycle || 'monthly'}
{/* Flags */}
{(!!bill.autopay_enabled || !!bill.has_2fa) ? (
{!!bill.autopay_enabled && (
AP
)}
{!!bill.has_2fa && (
2FA
)}
) : (
—
)}
{/* Actions — visible on row hover */}
{!bill.active && (
)}
))}
);
}