47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
import Head from "next/head";
|
|
import Image from "next/image";
|
|
import styles from "../styles/Home.module.css";
|
|
import { parseBeanCount } from "./api/hello";
|
|
import Transaction from "../components/Transaction/Transaction";
|
|
import Graph from "../components/Graph/Graph";
|
|
import Overview from "../components/Overview/Overview";
|
|
|
|
export default function Home({statements, stats}) {
|
|
return (
|
|
<div className={styles.container}>
|
|
<Head>
|
|
<title></title>
|
|
<meta name="description" content="" />
|
|
<link rel="icon" href="/favicon.ico" />
|
|
</Head>
|
|
|
|
<main className={styles.main}>
|
|
<div className={styles.grid}>
|
|
<Graph transactions={statements}/>
|
|
<Overview transactions={statements} stats={stats} />
|
|
{statements && statements.map((item, index) => {
|
|
return <Transaction {...item} key={index}/>
|
|
})}
|
|
</div>
|
|
|
|
</main>
|
|
|
|
</div>
|
|
);
|
|
}
|
|
|
|
|
|
export async function getStaticProps() {
|
|
const { statements, stats } = parseBeanCount(`
|
|
2014-05-05 txn 'Cafe Mogador' 'Lamb tagine with wine'
|
|
Liabilities:CreditCard:CapitalOne -37.5 USD
|
|
Expenses:Restaurant
|
|
|
|
2013-06-04 * 'Cafe A' 'hi'
|
|
Liabilities:CapitalOne -37.45 USD
|
|
Expenses:Restaurant
|
|
`)
|
|
return {
|
|
props: { statements, stats }
|
|
}
|
|
} |