|
1 | 1 | 'use client'; |
2 | 2 |
|
3 | 3 | import { Suspense, useState } from 'react'; |
| 4 | +import { useTranslation } from 'react-i18next'; |
4 | 5 | import { DashboardLayout } from '@/components/layouts/DashboardLayout'; |
5 | 6 | import { TransactionHistorySection } from '@/components/TransactionHistorySection'; |
6 | 7 | import { TransactionSimulator } from '@/components/TransactionSimulator'; |
7 | 8 | import { CachedActivity } from '@/components/CachedActivity'; |
8 | 9 | import { SendModal } from '@/components/SendModal'; |
9 | 10 | import { PortfolioAssets } from '@/components/PortfolioAssets'; |
| 11 | +import { VaultTable } from '@/components/vaults/VaultTable'; |
| 12 | +import { PluginGrid } from '@/components/dashboard/PluginGrid'; |
| 13 | + |
| 14 | +import { SwapCard } from '@/components/swap/SwapCard'; |
| 15 | + |
| 16 | +import { ErrorBoundary } from '@/components/ErrorBoundary'; |
| 17 | +import { ProtocolStatsBar } from '@/components/dashboard/ProtocolStatsBar'; |
| 18 | +import { RecentSwaps } from '@/components/dashboard/RecentSwaps'; |
10 | 19 |
|
11 | 20 | export default function DashboardPage() { |
| 21 | + const { t } = useTranslation(); |
12 | 22 | const [sendOpen, setSendOpen] = useState(false); |
13 | 23 |
|
14 | 24 | return ( |
15 | 25 | <DashboardLayout> |
16 | 26 | <div className="grid grid-cols-1 gap-4 lg:grid-cols-2"> |
| 27 | + <section id="swap" className="lg:col-span-2"> |
| 28 | + <ErrorBoundary> |
| 29 | + <SwapCard /> |
| 30 | + </ErrorBoundary> |
| 31 | + </section> |
| 32 | + |
| 33 | + <section id="protocol-stats" className="lg:col-span-2"> |
| 34 | + <ErrorBoundary> |
| 35 | + <ProtocolStatsBar /> |
| 36 | + </ErrorBoundary> |
| 37 | + </section> |
| 38 | + |
17 | 39 | <section id="staking" className="card"> |
18 | 40 | <h2 className="text-sm font-semibold text-gray-900">Staking</h2> |
19 | | - <p className="mt-2 text-sm text-gray-600">No active stakes yet.</p> |
| 41 | + <ErrorBoundary> |
| 42 | + <p className="mt-2 text-sm text-gray-600">No active stakes yet.</p> |
| 43 | + <h2 className="text-sm font-semibold text-gray-900">{t('dashboard.staking')}</h2> |
| 44 | + <ErrorBoundary> |
| 45 | + <p className="mt-2 text-sm text-gray-600">{t('dashboard.noStakes')}</p> |
| 46 | + </ErrorBoundary> |
20 | 47 | </section> |
21 | 48 |
|
22 | 49 | <section id="governance" className="card"> |
23 | | - <h2 className="text-sm font-semibold text-gray-900">Governance</h2> |
24 | | - <p className="mt-2 text-sm text-gray-600">No open proposals.</p> |
| 50 | + <h2 className="text-sm font-semibold text-gray-900">{t('dashboard.governance')}</h2> |
| 51 | + <p className="mt-2 text-sm text-gray-600">{t('dashboard.noProposals')}</p> |
| 52 | + </section> |
| 53 | + |
| 54 | + <section id="recent-swaps" className="lg:col-span-2"> |
| 55 | + <ErrorBoundary> |
| 56 | + <RecentSwaps /> |
| 57 | + </ErrorBoundary> |
25 | 58 | </section> |
26 | 59 |
|
27 | 60 | <section id="portfolio" className="card lg:col-span-2"> |
28 | | - <PortfolioAssets /> |
| 61 | + <ErrorBoundary> |
| 62 | + <PortfolioAssets /> |
| 63 | + </ErrorBoundary> |
29 | 64 | <button type="button" className="btn mt-3" onClick={() => setSendOpen(true)}> |
30 | | - Send asset |
| 65 | + {t('dashboard.sendAsset')} |
31 | 66 | </button> |
32 | 67 | </section> |
33 | 68 |
|
34 | | - <TransactionSimulator /> |
| 69 | + <ErrorBoundary> |
| 70 | + <TransactionSimulator /> |
| 71 | + </ErrorBoundary> |
35 | 72 |
|
36 | | - <CachedActivity /> |
| 73 | + <ErrorBoundary> |
| 74 | + <CachedActivity /> |
| 75 | + </ErrorBoundary> |
37 | 76 |
|
38 | 77 | {/* useSearchParams (page state, #15) requires a Suspense boundary. */} |
39 | 78 | <Suspense fallback={null}> |
40 | | - <TransactionHistorySection /> |
| 79 | + <ErrorBoundary> |
| 80 | + <TransactionHistorySection /> |
| 81 | + </ErrorBoundary> |
41 | 82 | </Suspense> |
| 83 | + |
| 84 | + {/* |
| 85 | + * Community plugin widgets — renders nothing when no plugins are |
| 86 | + * registered, so existing layout is unaffected by default. |
| 87 | + * Plugins register themselves via usePluginSDK().registerPlugin(). |
| 88 | + */} |
| 89 | + <ErrorBoundary> |
| 90 | + <PluginGrid /> |
| 91 | + </ErrorBoundary> |
42 | 92 | </div> |
43 | 93 |
|
44 | 94 | <SendModal isOpen={sendOpen} onClose={() => setSendOpen(false)} /> |
|
0 commit comments