Skip to content

Commit 2abf87c

Browse files
committed
create proper home page
1 parent a5fd5d6 commit 2abf87c

6 files changed

Lines changed: 281 additions & 148 deletions

File tree

src/app/clients/page.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Button } from '@/components/ui/button';
55
import { Input } from '@/components/ui/input';
66
import { ClientForm } from '@/components/clients/client-form';
77
import { ClientList } from '@/components/clients/client-list';
8+
import { Navbar } from '@/components/layout/navbar';
89
import { trpc } from '@/trpc/client';
910

1011
// Temporary user ID for demo - will be replaced with auth
@@ -94,9 +95,11 @@ export default function ClientsPage() {
9495
};
9596

9697
return (
97-
<div className="container mx-auto px-4 py-8">
98-
<div className="flex justify-between items-center mb-6">
99-
<h1 className="text-2xl font-bold text-gray-900">Clients</h1>
98+
<div className="min-h-screen bg-gray-50">
99+
<Navbar />
100+
<div className="container mx-auto px-4 py-8">
101+
<div className="flex justify-between items-center mb-6">
102+
<h1 className="text-2xl font-bold text-gray-900">客户管理</h1>
100103
<Button onClick={() => { setShowForm(true); setEditingClient(null); }}>
101104
Add Client
102105
</Button>
@@ -146,14 +149,15 @@ export default function ClientsPage() {
146149
</div>
147150
)}
148151

149-
{/* Client List */}
150-
<div className="bg-white rounded-lg shadow">
151-
<ClientList
152-
clients={clientsQuery.data || []}
153-
onEdit={handleEdit}
154-
onDelete={handleDelete}
155-
isLoading={clientsQuery.isLoading}
156-
/>
152+
{/* Client List */}
153+
<div className="bg-white rounded-lg shadow">
154+
<ClientList
155+
clients={clientsQuery.data || []}
156+
onEdit={handleEdit}
157+
onDelete={handleDelete}
158+
isLoading={clientsQuery.isLoading}
159+
/>
160+
</div>
157161
</div>
158162
</div>
159163
);

src/app/invoices/new/page.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { useRouter } from 'next/navigation';
44
import { InvoiceForm } from '@/components/invoices/invoice-form';
5+
import { Navbar } from '@/components/layout/navbar';
56
import { trpc } from '@/trpc/client';
67

78
const DEMO_USER_ID = 'demo-user-id';
@@ -57,17 +58,20 @@ export default function NewInvoicePage() {
5758
};
5859

5960
return (
60-
<div className="container mx-auto px-4 py-8">
61-
<h1 className="text-2xl font-bold text-gray-900 mb-6">Create Invoice</h1>
61+
<div className="min-h-screen bg-gray-50">
62+
<Navbar />
63+
<div className="container mx-auto px-4 py-8">
64+
<h1 className="text-2xl font-bold text-gray-900 mb-6">创建发票</h1>
6265

63-
<div className="bg-white rounded-lg shadow p-6">
64-
<InvoiceForm
65-
clients={(clientsQuery.data || []).map((c) => ({ id: c.id, name: c.name }))}
66-
projects={(projectsQuery.data || []).map((p) => ({ id: p.id, name: p.name }))}
67-
onSubmit={handleSubmit}
68-
onCancel={() => router.push('/invoices')}
69-
isLoading={createMutation.isPending}
70-
/>
66+
<div className="bg-white rounded-lg shadow p-6">
67+
<InvoiceForm
68+
clients={(clientsQuery.data || []).map((c) => ({ id: c.id, name: c.name }))}
69+
projects={(projectsQuery.data || []).map((p) => ({ id: p.id, name: p.name }))}
70+
onSubmit={handleSubmit}
71+
onCancel={() => router.push('/invoices')}
72+
isLoading={createMutation.isPending}
73+
/>
74+
</div>
7175
</div>
7276
</div>
7377
);

src/app/invoices/page.tsx

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useState } from 'react';
44
import Link from 'next/link';
55
import { Button } from '@/components/ui/button';
66
import { InvoiceList } from '@/components/invoices/invoice-list';
7+
import { Navbar } from '@/components/layout/navbar';
78
import { trpc } from '@/trpc/client';
89

910
const DEMO_USER_ID = 'demo-user-id';
@@ -49,13 +50,15 @@ export default function InvoicesPage() {
4950
};
5051

5152
return (
52-
<div className="container mx-auto px-4 py-8">
53-
<div className="flex justify-between items-center mb-6">
54-
<h1 className="text-2xl font-bold text-gray-900">Invoices</h1>
55-
<Link href="/invoices/new">
56-
<Button>Create Invoice</Button>
57-
</Link>
58-
</div>
53+
<div className="min-h-screen bg-gray-50">
54+
<Navbar />
55+
<div className="container mx-auto px-4 py-8">
56+
<div className="flex justify-between items-center mb-6">
57+
<h1 className="text-2xl font-bold text-gray-900">发票管理</h1>
58+
<Link href="/invoices/new">
59+
<Button>创建发票</Button>
60+
</Link>
61+
</div>
5962

6063
{/* Filters */}
6164
<div className="mb-6 flex gap-4">
@@ -73,21 +76,22 @@ export default function InvoicesPage() {
7376
</select>
7477
</div>
7578

76-
{/* Invoice List */}
77-
<div className="bg-white rounded-lg shadow">
78-
<InvoiceList
79-
invoices={(invoicesQuery.data || []).map((inv) => ({
80-
...inv,
81-
total: String(inv.total),
82-
}))}
83-
onView={(invoice) => {
84-
window.location.href = `/invoices/${invoice.id}`;
85-
}}
86-
onSend={handleSend}
87-
onMarkPaid={handleMarkPaid}
88-
onCancel={handleCancel}
89-
isLoading={invoicesQuery.isLoading}
90-
/>
79+
{/* Invoice List */}
80+
<div className="bg-white rounded-lg shadow">
81+
<InvoiceList
82+
invoices={(invoicesQuery.data || []).map((inv) => ({
83+
...inv,
84+
total: String(inv.total),
85+
}))}
86+
onView={(invoice) => {
87+
window.location.href = `/invoices/${invoice.id}`;
88+
}}
89+
onSend={handleSend}
90+
onMarkPaid={handleMarkPaid}
91+
onCancel={handleCancel}
92+
isLoading={invoicesQuery.isLoading}
93+
/>
94+
</div>
9195
</div>
9296
</div>
9397
);

0 commit comments

Comments
 (0)