/* Copyright (C) 2024 Manuel Bustillo*/ 'use client' import { loadExpenses, updateExpense } from '@/app/api/expenses'; import { Expense } from '@/app/lib/definitions'; import { useState } from "react"; import InlineTextField from "../components/form/inlineTextField"; import TableOfContents from "../components/table-of-contents"; export default function ExpensesTable() { const [expenses, setExpenses] = useState>([]); const [expensesLoaded, setExpensesLoaded] = useState(false); function refreshExpenses() { loadExpenses((expenses) => { setExpenses(expenses); setExpensesLoaded(true); }); } !expensesLoaded && refreshExpenses(); return ( ( { expense.name = value; updateExpense(expense) }} /> { expense.amount = parseFloat(value); updateExpense(expense) }} /> {expense.pricingType} )} /> ); }