Compare commits
4 Commits
cbf08ba5be
...
3366b4146c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3366b4146c | ||
266f0970a4 | |||
510b3140fd | |||
d45ba871d8 |
@ -1,12 +1,15 @@
|
||||
/* Copyright (C) 2024 Manuel Bustillo*/
|
||||
|
||||
import { lusitana } from '@/app/ui/fonts';
|
||||
import ExpenseSummary from '@/app/ui/expenses/summary';
|
||||
|
||||
export default function Page () {
|
||||
return (
|
||||
<div className="w-full">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="w-full items-center justify-between">
|
||||
<h1 className={`${lusitana.className} text-2xl`}>Expenses</h1>
|
||||
<h2 className={`${lusitana.className} text-xl`}>Summary</h2>
|
||||
<ExpenseSummary />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
13
app/types.tsx
Normal file
13
app/types.tsx
Normal file
@ -0,0 +1,13 @@
|
||||
/* Copyright (C) 2024 Manuel Bustillo*/
|
||||
|
||||
import * as HeroIcon from '@heroicons/react/24/outline'
|
||||
import { ComponentProps } from 'react'
|
||||
|
||||
type Props = {
|
||||
name: keyof typeof HeroIcon
|
||||
} & ComponentProps<typeof HeroIcon.AcademicCapIcon>
|
||||
|
||||
export const Icon = ({ name, ...props }: Props) => {
|
||||
const IconComponent = HeroIcon[name]
|
||||
return <IconComponent {...props} />
|
||||
}
|
53
app/ui/components/dashboard-cards.tsx
Normal file
53
app/ui/components/dashboard-cards.tsx
Normal file
@ -0,0 +1,53 @@
|
||||
/* Copyright (C) 2024 Manuel Bustillo*/
|
||||
|
||||
import clsx from "clsx"
|
||||
import { Icon } from "../../types";
|
||||
import * as HeroIcon from '@heroicons/react/24/outline'
|
||||
|
||||
type Style = "green" | "blue" | "red" | "orange" | "gray"
|
||||
|
||||
const colorClasses = (style: Style) => {
|
||||
switch (style) {
|
||||
case "green":
|
||||
return "bg-green-700 hover:bg-green-800"
|
||||
case "blue":
|
||||
return "bg-blue-500 hover:bg-blue-700"
|
||||
case "red":
|
||||
return "bg-red-600 hover:bg-red-700"
|
||||
case "orange":
|
||||
return "bg-orange-600 hover:bg-orange-700"
|
||||
case "gray":
|
||||
return "bg-gray-600 hover:bg-gray-700"
|
||||
}
|
||||
}
|
||||
|
||||
export async function MainCard({ amount, title, subtitle, style, iconName }:
|
||||
{
|
||||
amount: string,
|
||||
title: string,
|
||||
subtitle?: string,
|
||||
style: Style,
|
||||
iconName: keyof typeof HeroIcon
|
||||
}) {
|
||||
|
||||
return (
|
||||
<div className={`w-80 m-1 py-2 px-6 text-white flex flex-row items-center ${colorClasses(style)}`}>
|
||||
<Icon className="m-3 h-14 w-14" name={iconName} />
|
||||
<div className="flex flex-col justify-evenly">
|
||||
<div className="text-4xl font-medium">{amount}</div>
|
||||
<div className="text-xl">{title}</div>
|
||||
<div className="text-sm">{subtitle || 'ㅤ'}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export async function SecondaryCard({ amount, title, iconName, style }: { amount: string, title: string, iconName: keyof typeof HeroIcon, style: Style }) {
|
||||
return (
|
||||
<div className={`h-12 w-80 m-1 p-2 text-white flex flex-row items-center ${colorClasses(style)}`}>
|
||||
<Icon className="m-3 h-7 w-7" name={iconName} />
|
||||
<span className="text-2xl font-medium mx-1">{amount}</span>
|
||||
<span className="text-l mx-1">{title}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
45
app/ui/expenses/summary.tsx
Normal file
45
app/ui/expenses/summary.tsx
Normal file
@ -0,0 +1,45 @@
|
||||
/* Copyright (C) 2024 Manuel Bustillo*/
|
||||
|
||||
import { MainCard, SecondaryCard } from '../components/dashboard-cards';
|
||||
|
||||
export default async function ExpenseSummary() {
|
||||
return (
|
||||
<div className="my-4">
|
||||
|
||||
<div className="flex flex-row w-full my-2">
|
||||
<MainCard style="green" amount="65000€" title="Projected" subtitle="150 guests" iconName="ArrowTrendingUpIcon" />
|
||||
|
||||
<div className="flex flex-col">
|
||||
<MainCard amount="10000€" title="Paid already" iconName="Square3Stack3DIcon" style='blue' />
|
||||
<MainCard amount="198€" title="/ guest" iconName="UserIcon" style='blue' />
|
||||
</div>
|
||||
<div className="flex flex-col">
|
||||
<MainCard amount="78000€" title="Max." subtitle='200 guests' iconName="ChevronDoubleUpIcon" style="orange" />
|
||||
<MainCard amount="45000€" title="Min." subtitle="125 guests" iconName="ChevronDoubleDownIcon" style="green" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row w-full my-2">
|
||||
<MainCard style="blue" amount="150" title="Invites sent" iconName="UsersIcon" />
|
||||
|
||||
<div className="flex flex-col">
|
||||
<SecondaryCard amount="31%" title="confirmed (27 guests)" iconName="CheckIcon" style='green' />
|
||||
<SecondaryCard amount="5%" title="declined (8 guests)" iconName="XMarkIcon" style='red' />
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col">
|
||||
<SecondaryCard amount="17%" title="tentative (14 guests)" iconName="QuestionMarkCircleIcon" style='orange' />
|
||||
<SecondaryCard amount="65%" title="awaiting (72 guests)" iconName="EllipsisHorizontalIcon" style='gray' />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row w-full my-2">
|
||||
<MainCard style="blue" amount="5" title="Table simulations" iconName="ServerStackIcon" />
|
||||
<MainCard style="blue" amount="9" title="Bus simulations" iconName="TruckIcon" />
|
||||
<MainCard style="blue" amount="98" title="QR codes" iconName="QrCodeIcon" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -18,7 +18,7 @@
|
||||
"primeicons": "^7.0.0",
|
||||
"primereact": "^10.8.2",
|
||||
"react": "19.0.0-rc-f38c22b244-20240704",
|
||||
"react-dom": "19.0.0-rc-f38c22b244-20240704",
|
||||
"react-dom": "19.0.0-rc-fb9a90fa48-20240614",
|
||||
"tailwindcss": "3.4.14",
|
||||
"typescript": "5.6.3",
|
||||
"use-debounce": "^10.0.1",
|
||||
|
44
pnpm-lock.yaml
generated
44
pnpm-lock.yaml
generated
@ -28,10 +28,10 @@ importers:
|
||||
version: 2.1.1
|
||||
next:
|
||||
specifier: 15.0.2
|
||||
version: 15.0.2(@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)
|
||||
version: 15.0.2(@playwright/test@1.48.2)(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
next-auth:
|
||||
specifier: 5.0.0-beta.25
|
||||
version: 5.0.0-beta.25(next@15.0.2(@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.2(@playwright/test@1.48.2)(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
postcss:
|
||||
specifier: 8.4.47
|
||||
version: 8.4.47
|
||||
@ -40,13 +40,13 @@ importers:
|
||||
version: 7.0.0
|
||||
primereact:
|
||||
specifier: ^10.8.2
|
||||
version: 10.8.4(@types/react@18.3.5)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
version: 10.8.4(@types/react@18.3.5)(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react:
|
||||
specifier: 19.0.0-rc-f38c22b244-20240704
|
||||
version: 19.0.0-rc-f38c22b244-20240704
|
||||
react-dom:
|
||||
specifier: 19.0.0-rc-f38c22b244-20240704
|
||||
version: 19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704)
|
||||
specifier: 19.0.0-rc-fb9a90fa48-20240614
|
||||
version: 19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704)
|
||||
tailwindcss:
|
||||
specifier: 3.4.14
|
||||
version: 3.4.14
|
||||
@ -983,10 +983,10 @@ packages:
|
||||
queue-microtask@1.2.3:
|
||||
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
|
||||
|
||||
react-dom@19.0.0-rc-f38c22b244-20240704:
|
||||
resolution: {integrity: sha512-g89q2pf3irdpKFUMgCQgtxgqo3TSV1k1J6Sc8God4FwfxuNmAOOthkijENe5XZe6VeV1tor9DPzpjdTD9EyvNw==}
|
||||
react-dom@19.0.0-rc-fb9a90fa48-20240614:
|
||||
resolution: {integrity: sha512-PoEsPe32F7KPLYOBvZfjylEI1B67N44PwY3lyvpmBkhlluLnLz0jH8q2Wg9YidAi6z0k3iUnNRm5x10wurzt9Q==}
|
||||
peerDependencies:
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
react: 19.0.0-rc-fb9a90fa48-20240614
|
||||
|
||||
react-is@16.13.1:
|
||||
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
|
||||
@ -1034,8 +1034,8 @@ packages:
|
||||
safe-buffer@5.2.1:
|
||||
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
|
||||
|
||||
scheduler@0.25.0-rc-f38c22b244-20240704:
|
||||
resolution: {integrity: sha512-uAELK9fHhvg7kDQhk29+uO8FUMWUpkg9WpzkNXFP+BJy5HEtqnajde3CxuSgh202WH9TqoaiWT1mdA3DvUu6cQ==}
|
||||
scheduler@0.25.0-rc-fb9a90fa48-20240614:
|
||||
resolution: {integrity: sha512-HHqQ/SqbeiDfXXVKgNxTpbQTD4n7IUb4hZATvHjp03jr3TF7igehCyHdOjeYTrzIseLO93cTTfSb5f4qWcirMQ==}
|
||||
|
||||
semver@6.3.1:
|
||||
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
|
||||
@ -1830,13 +1830,13 @@ snapshots:
|
||||
|
||||
nanoid@3.3.7: {}
|
||||
|
||||
next-auth@5.0.0-beta.25(next@15.0.2(@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):
|
||||
next-auth@5.0.0-beta.25(next@15.0.2(@playwright/test@1.48.2)(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
dependencies:
|
||||
'@auth/core': 0.37.2
|
||||
next: 15.0.2(@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)
|
||||
next: 15.0.2(@playwright/test@1.48.2)(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
|
||||
next@15.0.2(@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):
|
||||
next@15.0.2(@playwright/test@1.48.2)(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
dependencies:
|
||||
'@next/env': 15.0.2
|
||||
'@swc/counter': 0.1.3
|
||||
@ -1845,7 +1845,7 @@ snapshots:
|
||||
caniuse-lite: 1.0.30001651
|
||||
postcss: 8.4.31
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
react-dom: 19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react-dom: 19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704)
|
||||
styled-jsx: 5.1.6(react@19.0.0-rc-f38c22b244-20240704)
|
||||
optionalDependencies:
|
||||
'@next/swc-darwin-arm64': 15.0.2
|
||||
@ -2010,12 +2010,12 @@ snapshots:
|
||||
|
||||
primeicons@7.0.0: {}
|
||||
|
||||
primereact@10.8.4(@types/react@18.3.5)(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
primereact@10.8.4(@types/react@18.3.5)(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
dependencies:
|
||||
'@types/react-transition-group': 4.4.11
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
react-dom: 19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react-transition-group: 4.4.5(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react-dom: 19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react-transition-group: 4.4.5(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704)
|
||||
optionalDependencies:
|
||||
'@types/react': 18.3.5
|
||||
|
||||
@ -2027,21 +2027,21 @@ snapshots:
|
||||
|
||||
queue-microtask@1.2.3: {}
|
||||
|
||||
react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704):
|
||||
react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704):
|
||||
dependencies:
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
scheduler: 0.25.0-rc-f38c22b244-20240704
|
||||
scheduler: 0.25.0-rc-fb9a90fa48-20240614
|
||||
|
||||
react-is@16.13.1: {}
|
||||
|
||||
react-transition-group@4.4.5(react-dom@19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
react-transition-group@4.4.5(react-dom@19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704))(react@19.0.0-rc-f38c22b244-20240704):
|
||||
dependencies:
|
||||
'@babel/runtime': 7.25.7
|
||||
dom-helpers: 5.2.1
|
||||
loose-envify: 1.4.0
|
||||
prop-types: 15.8.1
|
||||
react: 19.0.0-rc-f38c22b244-20240704
|
||||
react-dom: 19.0.0-rc-f38c22b244-20240704(react@19.0.0-rc-f38c22b244-20240704)
|
||||
react-dom: 19.0.0-rc-fb9a90fa48-20240614(react@19.0.0-rc-f38c22b244-20240704)
|
||||
|
||||
react@19.0.0-rc-f38c22b244-20240704: {}
|
||||
|
||||
@ -2079,7 +2079,7 @@ snapshots:
|
||||
|
||||
safe-buffer@5.2.1: {}
|
||||
|
||||
scheduler@0.25.0-rc-f38c22b244-20240704: {}
|
||||
scheduler@0.25.0-rc-fb9a90fa48-20240614: {}
|
||||
|
||||
semver@6.3.1: {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user