Spaces:
Sleeping
Sleeping
Login page
Browse files- app/(home)/reports/page.tsx +21 -18
- app/login/page.tsx +0 -70
- next.config.json +1 -0
app/(home)/reports/page.tsx
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
import { incomeStatements } from "@/app/lib/endpoints";
|
3 |
import moment from "moment";
|
4 |
import { List } from "antd";
|
5 |
-
import React, { useEffect, useState } from "react";
|
6 |
import { useRouter, useSearchParams } from "next/navigation";
|
7 |
import IncomeStatement from "@/app/components/IncomeStatement";
|
8 |
|
@@ -22,23 +22,26 @@ const Reports = () => {
|
|
22 |
}, []);
|
23 |
|
24 |
return (
|
25 |
-
<
|
26 |
-
<
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
<List.Item
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
42 |
);
|
43 |
}
|
44 |
|
|
|
2 |
import { incomeStatements } from "@/app/lib/endpoints";
|
3 |
import moment from "moment";
|
4 |
import { List } from "antd";
|
5 |
+
import React, { Suspense, useEffect, useState } from "react";
|
6 |
import { useRouter, useSearchParams } from "next/navigation";
|
7 |
import IncomeStatement from "@/app/components/IncomeStatement";
|
8 |
|
|
|
22 |
}, []);
|
23 |
|
24 |
return (
|
25 |
+
<Suspense fallback={<div>Loading...</div>}>
|
26 |
+
<div style={{ padding: 24 }}>
|
27 |
+
<h1>Statements</h1>
|
28 |
+
{statement_id ?
|
29 |
+
<IncomeStatement statementData={statements.find(({ id }) => id === Number(statement_id))} />
|
30 |
+
:
|
31 |
+
<List
|
32 |
+
itemLayout="horizontal"
|
33 |
+
dataSource={statements}
|
34 |
+
renderItem={(item: any) => (
|
35 |
+
<List.Item>
|
36 |
+
<List.Item.Meta
|
37 |
+
title={<a onClick={() => router.push(`?statement_id=${item.id}`)}>{`${moment(item.date_from).format('MM-DD-YYYY')} until ${moment(item.date_to).format('MM-DD-YYYY')}`}</a>}
|
38 |
+
/>
|
39 |
+
</List.Item>
|
40 |
+
|
41 |
+
)}
|
42 |
+
/>}
|
43 |
+
</div>
|
44 |
+
</Suspense>
|
45 |
);
|
46 |
}
|
47 |
|
app/login/page.tsx
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
'use client';
|
2 |
-
|
3 |
-
import { useState } from "react";
|
4 |
-
import { useRouter } from "next/navigation";
|
5 |
-
|
6 |
-
const Login = () => {
|
7 |
-
const [username, setUsername] = useState("");
|
8 |
-
const [password, setPassword] = useState("");
|
9 |
-
|
10 |
-
const router = useRouter();
|
11 |
-
|
12 |
-
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
13 |
-
e.preventDefault();
|
14 |
-
|
15 |
-
router.push("/dashboard");
|
16 |
-
};
|
17 |
-
|
18 |
-
return (
|
19 |
-
<div className="flex flex-col items-center justify-center h-screen">
|
20 |
-
<h1 className="text-3xl font-bold mb-4">Login to your Financial Assistant</h1>
|
21 |
-
<form
|
22 |
-
className="bg-white shadow-md rounded px-8 pt-6 pb-8 m-4"
|
23 |
-
onSubmit={handleSubmit}
|
24 |
-
>
|
25 |
-
<div className="mb-4">
|
26 |
-
<label
|
27 |
-
className="block text-gray-700 text-sm font-bold mb-2"
|
28 |
-
htmlFor="username"
|
29 |
-
>
|
30 |
-
Username
|
31 |
-
</label>
|
32 |
-
<input
|
33 |
-
className="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
|
34 |
-
id="username"
|
35 |
-
type="text"
|
36 |
-
placeholder="Username"
|
37 |
-
value={username}
|
38 |
-
onChange={(e) => setUsername(e.target.value)}
|
39 |
-
/>
|
40 |
-
</div>
|
41 |
-
<div className="mb-6">
|
42 |
-
<label
|
43 |
-
className="block text-gray-700 text-sm font-bold mb-2"
|
44 |
-
htmlFor="password"
|
45 |
-
>
|
46 |
-
Password
|
47 |
-
</label>
|
48 |
-
<input
|
49 |
-
className="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
|
50 |
-
id="password"
|
51 |
-
type="password"
|
52 |
-
placeholder="Password"
|
53 |
-
value={password}
|
54 |
-
onChange={(e) => setPassword(e.target.value)}
|
55 |
-
/>
|
56 |
-
</div>
|
57 |
-
<div className="flex items-center justify-between">
|
58 |
-
<button
|
59 |
-
className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline"
|
60 |
-
type="submit"
|
61 |
-
>
|
62 |
-
Sign In
|
63 |
-
</button>
|
64 |
-
</div>
|
65 |
-
</form>
|
66 |
-
</div>
|
67 |
-
);
|
68 |
-
};
|
69 |
-
|
70 |
-
export default Login;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
next.config.json
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
{
|
2 |
"experimental": {
|
|
|
3 |
"outputFileTracingIncludes": {
|
4 |
"/*": ["./cache/**/*"]
|
5 |
},
|
|
|
1 |
{
|
2 |
"experimental": {
|
3 |
+
"missingSuspenseWithCSRBailout": false,
|
4 |
"outputFileTracingIncludes": {
|
5 |
"/*": ["./cache/**/*"]
|
6 |
},
|