Compare commits

..

7 Commits

Author SHA1 Message Date
38ca2c3409 Allow inline editing of guest name
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 3m6s
Add copyright notice / copyright_notice (pull_request) Successful in 5m9s
Playwright Tests / test (pull_request) Successful in 8m52s
2024-11-11 08:01:45 +01:00
45a0da6b27 Merge pull request 'Implement expenses table and other changes' (#92) from expenses-table into main
Some checks failed
Check usage of free licenses / build-static-assets (push) Successful in 1m18s
Playwright Tests / test (push) Successful in 7m10s
Build Nginx-based docker image / build-static-assets (push) Has been cancelled
Reviewed-on: #92
2024-11-11 06:59:52 +00:00
Renovate Bot
0588459618 Update dependency postcss to v8.4.48
Some checks failed
Check usage of free licenses / build-static-assets (pull_request) Successful in 2m20s
Add copyright notice / copyright_notice (pull_request) Successful in 3m37s
Playwright Tests / test (pull_request) Successful in 6m48s
Check usage of free licenses / build-static-assets (push) Successful in 2m1s
Playwright Tests / test (push) Successful in 19m32s
Build Nginx-based docker image / build-static-assets (push) Failing after 19m45s
2024-11-11 01:07:31 +00:00
7434167583 Merge branch 'main' into expenses-table
All checks were successful
Add copyright notice / copyright_notice (pull_request) Successful in 1m42s
Playwright Tests / test (pull_request) Successful in 5m40s
Check usage of free licenses / build-static-assets (pull_request) Successful in 20s
2024-11-10 20:31:33 +00:00
10f7af1963 Merge pull request 'Extract a common TableOfContents component' (#91) from extract-table-component into main
Some checks failed
Check usage of free licenses / build-static-assets (push) Successful in 2m34s
Playwright Tests / test (push) Failing after 3m9s
Build Nginx-based docker image / build-static-assets (push) Successful in 6m37s
Reviewed-on: #91
2024-11-10 20:31:25 +00:00
7a0b03b67f Rename summary component and move it to the dashboard
Some checks failed
Check usage of free licenses / build-static-assets (pull_request) Failing after 17s
Add copyright notice / copyright_notice (pull_request) Failing after 18s
Playwright Tests / test (pull_request) Failing after 27s
2024-11-10 21:13:17 +01:00
638aca8301 Display a list of expenses
Some checks failed
Add copyright notice / copyright_notice (pull_request) Failing after 33s
Playwright Tests / test (pull_request) Failing after 55s
Check usage of free licenses / build-static-assets (pull_request) Failing after 1m3s
2024-11-10 21:08:03 +01:00
7 changed files with 95 additions and 28 deletions

View File

@ -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>
); );

View File

@ -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 />
);
} }

View File

@ -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;

View File

@ -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
View 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>
)}
/>
);
}

View File

@ -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
View File

@ -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: