Skip to content

Commit 8deb9a4

Browse files
feat: Overview Dashboard v2 (#1951)
Co-authored-by: neocybereth <sean@arrowburn.co.nz>
1 parent 02b5348 commit 8deb9a4

30 files changed

+833
-512
lines changed

apps/namadillo/src/App/AccountOverview/AccountBalanceContainer.tsx

Lines changed: 0 additions & 57 deletions
This file was deleted.

apps/namadillo/src/App/AccountOverview/AccountOverview.tsx

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
1-
import { Panel } from "@namada/components";
21
import { ConnectPanel } from "App/Common/ConnectPanel";
32
import { PageWithSidebar } from "App/Common/PageWithSidebar";
43
import { Sidebar } from "App/Layout/Sidebar";
54
import MainnetRoadmap from "App/Sidebars/MainnetRoadmap";
65
import { ShieldAllBanner } from "App/Sidebars/ShieldAllBanner";
7-
import { StakingRewardsPanel } from "App/Staking/StakingRewardsPanel";
8-
import { applicationFeaturesAtom } from "atoms/settings";
96
import { useUserHasAccount } from "hooks/useIsAuthenticated";
10-
import { useAtomValue } from "jotai";
117
import { twMerge } from "tailwind-merge";
12-
import { BalanceOverviewChart } from "./BalanceOverviewChart";
13-
import { MaspBanner } from "./MaspBanner";
14-
import { NamBalanceContainer } from "./NamBalanceContainer";
8+
import { AssetsOverviewPanel } from "./AssetsOverviewPanel";
159
import { NavigationFooter } from "./NavigationFooter";
16-
import { TransparentOverviewPanel } from "./TransparentOverviewPanel";
10+
import { StakeSidebar } from "./StakeSidebar";
11+
import { TotalBalanceBanner } from "./TotalBalanceBanner";
1712

1813
export const AccountOverview = (): JSX.Element => {
1914
const userHasAccount = useUserHasAccount();
20-
const { maspEnabled } = useAtomValue(applicationFeaturesAtom);
21-
2215
if (!userHasAccount) {
2316
return (
2417
<ConnectPanel>
@@ -31,27 +24,15 @@ export const AccountOverview = (): JSX.Element => {
3124
<PageWithSidebar>
3225
<div className={twMerge("flex w-full")}>
3326
<section className="flex flex-col w-full rounded-sm min-h-full gap-2">
34-
<div className="grid sm:grid-cols-[0.8fr_1.25fr_0.66fr] gap-2">
35-
<Panel>
36-
<BalanceOverviewChart />
37-
</Panel>
38-
<Panel>
39-
<NamBalanceContainer />
40-
</Panel>
41-
<Panel>
42-
<StakingRewardsPanel />
43-
</Panel>
27+
<TotalBalanceBanner />
28+
<AssetsOverviewPanel />
29+
<div>
30+
<NavigationFooter />
4431
</div>
45-
{maspEnabled && (
46-
<>
47-
<MaspBanner />
48-
<TransparentOverviewPanel />
49-
</>
50-
)}
51-
<NavigationFooter />
5232
</section>
5333
</div>
5434
<Sidebar>
35+
<StakeSidebar />
5536
<ShieldAllBanner />
5637
<MainnetRoadmap />
5738
</Sidebar>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { TabContainer } from "@namada/components";
2+
import clsx from "clsx";
3+
import { useRequiresNewShieldedSync } from "hooks/useRequiresNewShieldedSync";
4+
import { useState } from "react";
5+
import { ShieldedAssetsOverview } from "./ShieldedAssetsOverview";
6+
import { UnshieldedAssetsOverview } from "./UnshieldedAssetsOverview";
7+
8+
export const AssetsOverviewPanel = (): JSX.Element => {
9+
const requiresNewShieldedSync = useRequiresNewShieldedSync();
10+
11+
// Always select the unshielded tab as default if shielded sync is required
12+
const [currentTab, setCurrentTab] = useState(requiresNewShieldedSync ? 1 : 0);
13+
const shieldedPanelSelected = currentTab === 0;
14+
15+
return (
16+
<TabContainer
17+
id="ibc-transfer"
18+
title="IBC Transfer"
19+
activeTabIndex={currentTab}
20+
onChangeActiveTab={setCurrentTab}
21+
className={clsx(
22+
"transition-colors border-solid border border-transparent",
23+
"duration-0",
24+
"[&[aria-selected='true']]:z-20 [&[aria-selected='true']]:!border-b-neutral-950",
25+
shieldedPanelSelected &&
26+
"[&[aria-selected='true']]:text-yellow [&[aria-selected='true']]:border-yellow"
27+
)}
28+
tabs={[
29+
{
30+
title: "Shielded Assets (MASP)",
31+
children: <ShieldedAssetsOverview />,
32+
},
33+
{ title: "Unshielded Assets", children: <UnshieldedAssetsOverview /> },
34+
]}
35+
/>
36+
);
37+
};

apps/namadillo/src/App/AccountOverview/BalanceOverviewChart.tsx

Lines changed: 0 additions & 158 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { NamCurrency } from "App/Common/NamCurrency";
2+
import { cachedShieldedRewardsAtom } from "atoms/balance";
3+
import clsx from "clsx";
4+
import { useAtomValue } from "jotai";
5+
6+
export const EstimateShieldingRewardsCard = (): JSX.Element => {
7+
const shieldedRewards = useAtomValue(cachedShieldedRewardsAtom);
8+
9+
return (
10+
<div
11+
className={clsx(
12+
"flex items-center justify-between gap-12 text-sm text-yellow bg-neutral-900 rounded-sm px-6",
13+
"py-4"
14+
)}
15+
>
16+
<span className="max-w-[15ch] text-center leading-tight">
17+
Your Est. Shielding rewards per 24hrs
18+
</span>
19+
<span className="text-3xl text-center leading-7 relative top-1">
20+
{shieldedRewards.amount === undefined ?
21+
<span>
22+
--<i className="block text-sm not-italic">NAM</i>
23+
</span>
24+
: <div className="flex flex-col items-center">
25+
<NamCurrency
26+
amount={shieldedRewards.amount}
27+
currencySymbolClassName="text-xs block"
28+
decimalPlaces={2}
29+
/>
30+
</div>
31+
}
32+
</span>
33+
</div>
34+
);
35+
};

0 commit comments

Comments
 (0)