Skip to content

Commit 805d449

Browse files
fix(web): align dashboard page with current component contracts
1 parent d72e255 commit 805d449

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

apps/web/app/dashboard/page.tsx

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ActivityDto, AuthUserDto } from '@fairshare/shared-types';
1+
import { ActivityDto } from '@fairshare/shared-types';
22

33
import { ActivityList, QuickActions, SummaryCard } from '../../src/components/dashboard';
44
import { DashboardLayout } from '../../src/components/layout';
@@ -16,52 +16,48 @@ function formatMoney(cents: string | null, currency: string | null): string {
1616
}
1717

1818
export default async function DashboardPage() {
19-
const [me, groups] = await Promise.all([
20-
backendFetch<AuthUserDto>('/users/me'),
19+
const [groups, recentActivityData, summary] = await Promise.all([
2120
backendFetch<Group[]>('/groups'),
22-
]);
23-
24-
const [recentActivityData, summary] = await Promise.all([
2521
backendFetch<{ items: ActivityDto[] }>('/activity'),
2622
backendFetch<{ totalBalanceCents: string }>('/groups/summary'),
2723
]);
2824

2925
const recentActivity = recentActivityData.items || [];
3026
const totalBalanceCents = summary.totalBalanceCents;
27+
const isPositive = Number(totalBalanceCents) >= 0;
3128

3229
return (
33-
<DashboardLayout user={me}>
30+
<DashboardLayout>
3431
<div className="space-y-6">
35-
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
32+
<div className="grid grid-cols-1 gap-6 md:grid-cols-3">
3633
<SummaryCard
3734
title="Total Balance"
38-
amount={formatMoney(totalBalanceCents, 'USD')}
39-
trend={Number(totalBalanceCents) >= 0 ? 'up' : 'down'}
40-
description={Number(totalBalanceCents) >= 0 ? 'You are owed' : 'You owe'}
35+
value={formatMoney(totalBalanceCents, 'USD')}
36+
hint={isPositive ? 'You are owed overall' : 'You owe overall'}
4137
/>
4238
<SummaryCard
4339
title="Active Groups"
44-
amount={groups.length.toString()}
45-
description="Across all categories"
40+
value={groups.length.toString()}
41+
hint="Across all categories"
4642
/>
4743
<QuickActions />
4844
</div>
4945

50-
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
46+
<div className="grid grid-cols-1 gap-6 lg:grid-cols-3">
5147
<div className="lg:col-span-2">
5248
<ActivityList items={recentActivity} groupId="" />
5349
</div>
5450
<div>
55-
<h2 className="text-xl font-semibold mb-4">Group Balances</h2>
56-
<div className="bg-white rounded-xl shadow-sm p-6">
51+
<h2 className="mb-4 text-xl font-semibold">Group Balances</h2>
52+
<div className="rounded-xl bg-white p-6 shadow-sm">
5753
{groups.map((group) => (
58-
<div key={group.id} className="flex justify-between items-center py-3 border-b last:border-0">
54+
<div key={group.id} className="flex items-center justify-between border-b py-3 last:border-0">
5955
<span className="font-medium">{group.name}</span>
6056
<span className="text-sm text-gray-500">{group.currency}</span>
6157
</div>
6258
))}
6359
{groups.length === 0 && (
64-
<p className="text-sm text-gray-500 text-center py-4">No active groups yet.</p>
60+
<p className="py-4 text-center text-sm text-gray-500">No active groups yet.</p>
6561
)}
6662
</div>
6763
</div>

0 commit comments

Comments
 (0)