Compare commits
7 Commits
88bd5fc43b
...
38ca2c3409
Author | SHA1 | Date | |
---|---|---|---|
38ca2c3409 | |||
45a0da6b27 | |||
![]() |
0588459618 | ||
7434167583 | |||
10f7af1963 | |||
7a0b03b67f | |||
638aca8301 |
@ -1,7 +1,7 @@
|
|||||||
/* Copyright (C) 2024 Manuel Bustillo*/
|
/* Copyright (C) 2024 Manuel Bustillo*/
|
||||||
|
|
||||||
import { lusitana } from '@/app/ui/fonts';
|
import { lusitana } from '@/app/ui/fonts';
|
||||||
import ExpenseSummary from '@/app/ui/expenses/summary';
|
import ExpensesTable from '@/app/ui/expenses/table';
|
||||||
|
|
||||||
export default function Page () {
|
export default function Page () {
|
||||||
return (
|
return (
|
||||||
@ -9,7 +9,7 @@ export default function Page () {
|
|||||||
<div className="w-full items-center justify-between">
|
<div className="w-full items-center justify-between">
|
||||||
<h1 className={`${lusitana.className} text-2xl`}>Expenses</h1>
|
<h1 className={`${lusitana.className} text-2xl`}>Expenses</h1>
|
||||||
<h2 className={`${lusitana.className} text-xl`}>Summary</h2>
|
<h2 className={`${lusitana.className} text-xl`}>Summary</h2>
|
||||||
<ExpenseSummary />
|
<ExpensesTable />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
/* Copyright (C) 2024 Manuel Bustillo*/
|
/* Copyright (C) 2024 Manuel Bustillo*/
|
||||||
|
|
||||||
|
import GlobalSummary from '@/app/ui/dashboard/global-summary';
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
return <p>Dashboard Page</p>;
|
return(
|
||||||
|
<GlobalSummary />
|
||||||
|
);
|
||||||
}
|
}
|
@ -26,6 +26,13 @@ export type Guest = {
|
|||||||
status?: 'Considered' | 'Invited' | 'Confirmed' | 'Declined' | 'Tentative';
|
status?: 'Considered' | 'Invited' | 'Confirmed' | 'Declined' | 'Tentative';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type Expense = {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
amount: number;
|
||||||
|
pricingType: 'fixed' | 'per person';
|
||||||
|
};
|
||||||
|
|
||||||
export type TableArrangement = {
|
export type TableArrangement = {
|
||||||
id: string;
|
id: string;
|
||||||
number: number;
|
number: number;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { MainCard, SecondaryCard } from '../components/dashboard-cards';
|
import { MainCard, SecondaryCard } from '../components/dashboard-cards';
|
||||||
|
|
||||||
export default async function ExpenseSummary() {
|
export default async function GlobalSummary() {
|
||||||
return (
|
return (
|
||||||
<div className="my-4">
|
<div className="my-4">
|
||||||
|
|
51
app/ui/expenses/table.tsx
Normal file
51
app/ui/expenses/table.tsx
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/* Copyright (C) 2024 Manuel Bustillo*/
|
||||||
|
|
||||||
|
'use client'
|
||||||
|
|
||||||
|
import React, { useState } from "react"
|
||||||
|
import { Expense } from '@/app/lib/definitions';
|
||||||
|
import TableOfContents from "../components/table-of-contents";
|
||||||
|
|
||||||
|
export default function ExpensesTable() {
|
||||||
|
const [expenses, setExpenses] = useState<Array<Expense>>([]);
|
||||||
|
|
||||||
|
function loadExpenses() {
|
||||||
|
fetch("/api/expenses")
|
||||||
|
.then((response) => response.json())
|
||||||
|
.then((data) => {
|
||||||
|
setExpenses(data.map((record: any) => {
|
||||||
|
return ({
|
||||||
|
id: record.id,
|
||||||
|
name: record.name,
|
||||||
|
amount: record.amount,
|
||||||
|
pricingType: record.pricing_type
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
}, (error) => {
|
||||||
|
return [];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
expenses.length === 0 && loadExpenses();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TableOfContents
|
||||||
|
headers={['Name', 'Amount', 'Pricing Type']}
|
||||||
|
caption='Expenses'
|
||||||
|
elements={expenses}
|
||||||
|
rowRender={(expense) => (
|
||||||
|
<tr key={expense.id} className="bg-white border-b odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800">
|
||||||
|
<th scope="row" className="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">
|
||||||
|
{expense.name}
|
||||||
|
</th>
|
||||||
|
<td className="px-6 py-4">
|
||||||
|
{expense.amount}€
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{expense.pricingType}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
@ -13,7 +13,7 @@
|
|||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"next": "15.0.3",
|
"next": "15.0.3",
|
||||||
"next-auth": "5.0.0-beta.25",
|
"next-auth": "5.0.0-beta.25",
|
||||||
"postcss": "8.4.47",
|
"postcss": "8.4.48",
|
||||||
"primeicons": "^7.0.0",
|
"primeicons": "^7.0.0",
|
||||||
"primereact": "^10.8.2",
|
"primereact": "^10.8.2",
|
||||||
"react": "19.0.0-rc-f38c22b244-20240704",
|
"react": "19.0.0-rc-f38c22b244-20240704",
|
||||||
|
51
pnpm-lock.yaml
generated
51
pnpm-lock.yaml
generated
@ -16,7 +16,7 @@ importers:
|
|||||||
version: 0.5.9(tailwindcss@3.4.14)
|
version: 0.5.9(tailwindcss@3.4.14)
|
||||||
autoprefixer:
|
autoprefixer:
|
||||||
specifier: 10.4.20
|
specifier: 10.4.20
|
||||||
version: 10.4.20(postcss@8.4.47)
|
version: 10.4.20(postcss@8.4.48)
|
||||||
bcrypt:
|
bcrypt:
|
||||||
specifier: ^5.1.1
|
specifier: ^5.1.1
|
||||||
version: 5.1.1
|
version: 5.1.1
|
||||||
@ -30,8 +30,8 @@ importers:
|
|||||||
specifier: 5.0.0-beta.25
|
specifier: 5.0.0-beta.25
|
||||||
version: 5.0.0-beta.25(next@15.0.3(@playwright/test@1.48.2)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
version: 5.0.0-beta.25(next@15.0.3(@playwright/test@1.48.2)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||||
postcss:
|
postcss:
|
||||||
specifier: 8.4.47
|
specifier: 8.4.48
|
||||||
version: 8.4.47
|
version: 8.4.48
|
||||||
primeicons:
|
primeicons:
|
||||||
specifier: ^7.0.0
|
specifier: ^7.0.0
|
||||||
version: 7.0.0
|
version: 7.0.0
|
||||||
@ -827,6 +827,9 @@ packages:
|
|||||||
picocolors@1.1.0:
|
picocolors@1.1.0:
|
||||||
resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==}
|
resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==}
|
||||||
|
|
||||||
|
picocolors@1.1.1:
|
||||||
|
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
|
||||||
|
|
||||||
picomatch@2.3.1:
|
picomatch@2.3.1:
|
||||||
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
|
resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==}
|
||||||
engines: {node: '>=8.6'}
|
engines: {node: '>=8.6'}
|
||||||
@ -890,8 +893,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==}
|
resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==}
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
|
|
||||||
postcss@8.4.47:
|
postcss@8.4.48:
|
||||||
resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==}
|
resolution: {integrity: sha512-GCRK8F6+Dl7xYniR5a4FYbpBzU8XnZVeowqsQFYdcXuSbChgiks7qybSkbvnaeqv0G0B+dd9/jJgH8kkLDQeEA==}
|
||||||
engines: {node: ^10 || ^12 || >=14}
|
engines: {node: ^10 || ^12 || >=14}
|
||||||
|
|
||||||
preact-render-to-string@5.2.3:
|
preact-render-to-string@5.2.3:
|
||||||
@ -1415,14 +1418,14 @@ snapshots:
|
|||||||
|
|
||||||
arg@5.0.2: {}
|
arg@5.0.2: {}
|
||||||
|
|
||||||
autoprefixer@10.4.20(postcss@8.4.47):
|
autoprefixer@10.4.20(postcss@8.4.48):
|
||||||
dependencies:
|
dependencies:
|
||||||
browserslist: 4.23.3
|
browserslist: 4.23.3
|
||||||
caniuse-lite: 1.0.30001651
|
caniuse-lite: 1.0.30001651
|
||||||
fraction.js: 4.3.7
|
fraction.js: 4.3.7
|
||||||
normalize-range: 0.1.2
|
normalize-range: 0.1.2
|
||||||
picocolors: 1.0.1
|
picocolors: 1.0.1
|
||||||
postcss: 8.4.47
|
postcss: 8.4.48
|
||||||
postcss-value-parser: 4.2.0
|
postcss-value-parser: 4.2.0
|
||||||
|
|
||||||
balanced-match@1.0.2: {}
|
balanced-match@1.0.2: {}
|
||||||
@ -1815,6 +1818,8 @@ snapshots:
|
|||||||
|
|
||||||
picocolors@1.1.0: {}
|
picocolors@1.1.0: {}
|
||||||
|
|
||||||
|
picocolors@1.1.1: {}
|
||||||
|
|
||||||
picomatch@2.3.1: {}
|
picomatch@2.3.1: {}
|
||||||
|
|
||||||
pify@2.3.0: {}
|
pify@2.3.0: {}
|
||||||
@ -1829,28 +1834,28 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents: 2.3.2
|
fsevents: 2.3.2
|
||||||
|
|
||||||
postcss-import@15.1.0(postcss@8.4.47):
|
postcss-import@15.1.0(postcss@8.4.48):
|
||||||
dependencies:
|
dependencies:
|
||||||
postcss: 8.4.47
|
postcss: 8.4.48
|
||||||
postcss-value-parser: 4.2.0
|
postcss-value-parser: 4.2.0
|
||||||
read-cache: 1.0.0
|
read-cache: 1.0.0
|
||||||
resolve: 1.22.8
|
resolve: 1.22.8
|
||||||
|
|
||||||
postcss-js@4.0.1(postcss@8.4.47):
|
postcss-js@4.0.1(postcss@8.4.48):
|
||||||
dependencies:
|
dependencies:
|
||||||
camelcase-css: 2.0.1
|
camelcase-css: 2.0.1
|
||||||
postcss: 8.4.47
|
postcss: 8.4.48
|
||||||
|
|
||||||
postcss-load-config@4.0.2(postcss@8.4.47):
|
postcss-load-config@4.0.2(postcss@8.4.48):
|
||||||
dependencies:
|
dependencies:
|
||||||
lilconfig: 3.1.1
|
lilconfig: 3.1.1
|
||||||
yaml: 2.4.3
|
yaml: 2.4.3
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
postcss: 8.4.47
|
postcss: 8.4.48
|
||||||
|
|
||||||
postcss-nested@6.0.1(postcss@8.4.47):
|
postcss-nested@6.0.1(postcss@8.4.48):
|
||||||
dependencies:
|
dependencies:
|
||||||
postcss: 8.4.47
|
postcss: 8.4.48
|
||||||
postcss-selector-parser: 6.1.0
|
postcss-selector-parser: 6.1.0
|
||||||
|
|
||||||
postcss-selector-parser@6.1.0:
|
postcss-selector-parser@6.1.0:
|
||||||
@ -1866,10 +1871,10 @@ snapshots:
|
|||||||
picocolors: 1.1.0
|
picocolors: 1.1.0
|
||||||
source-map-js: 1.2.1
|
source-map-js: 1.2.1
|
||||||
|
|
||||||
postcss@8.4.47:
|
postcss@8.4.48:
|
||||||
dependencies:
|
dependencies:
|
||||||
nanoid: 3.3.7
|
nanoid: 3.3.7
|
||||||
picocolors: 1.1.0
|
picocolors: 1.1.1
|
||||||
source-map-js: 1.2.1
|
source-map-js: 1.2.1
|
||||||
|
|
||||||
preact-render-to-string@5.2.3(preact@10.11.3):
|
preact-render-to-string@5.2.3(preact@10.11.3):
|
||||||
@ -2066,11 +2071,11 @@ snapshots:
|
|||||||
normalize-path: 3.0.0
|
normalize-path: 3.0.0
|
||||||
object-hash: 3.0.0
|
object-hash: 3.0.0
|
||||||
picocolors: 1.1.0
|
picocolors: 1.1.0
|
||||||
postcss: 8.4.47
|
postcss: 8.4.48
|
||||||
postcss-import: 15.1.0(postcss@8.4.47)
|
postcss-import: 15.1.0(postcss@8.4.48)
|
||||||
postcss-js: 4.0.1(postcss@8.4.47)
|
postcss-js: 4.0.1(postcss@8.4.48)
|
||||||
postcss-load-config: 4.0.2(postcss@8.4.47)
|
postcss-load-config: 4.0.2(postcss@8.4.48)
|
||||||
postcss-nested: 6.0.1(postcss@8.4.47)
|
postcss-nested: 6.0.1(postcss@8.4.48)
|
||||||
postcss-selector-parser: 6.1.0
|
postcss-selector-parser: 6.1.0
|
||||||
resolve: 1.22.8
|
resolve: 1.22.8
|
||||||
sucrase: 3.35.0
|
sucrase: 3.35.0
|
||||||
@ -2112,7 +2117,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
browserslist: 4.23.3
|
browserslist: 4.23.3
|
||||||
escalade: 3.1.2
|
escalade: 3.1.2
|
||||||
picocolors: 1.0.1
|
picocolors: 1.1.0
|
||||||
|
|
||||||
use-debounce@10.0.4(react@19.0.0-rc-f38c22b244-20240704):
|
use-debounce@10.0.4(react@19.0.0-rc-f38c22b244-20240704):
|
||||||
dependencies:
|
dependencies:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user