Skip to content

Commit 9baea53

Browse files
authored
feat: update shield sync indicator layout (#1601)
1 parent 426dbd3 commit 9baea53

File tree

8 files changed

+40
-25
lines changed

8 files changed

+40
-25
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { Panel } from "@namada/components";
22
import { ConnectPanel } from "App/Common/ConnectPanel";
33
import { PageWithSidebar } from "App/Common/PageWithSidebar";
4-
import { ShieldedSyncProgress } from "App/Masp/ShieldedSyncProgress";
5-
import { EpochInformation } from "App/Sidebars/EpochInformation";
4+
import { Sidebar } from "App/Layout/Sidebar";
65
import MainnetRoadmap from "App/Sidebars/MainnetRoadmap";
76
import { ShieldAllBanner } from "App/Sidebars/ShieldAllBanner";
87
import { StakingRewardsPanel } from "App/Staking/StakingRewardsPanel";
@@ -54,12 +53,10 @@ export const AccountOverview = (): JSX.Element => {
5453
</Panel>
5554
</section>
5655
</div>
57-
<aside className="flex flex-col gap-2">
58-
<EpochInformation />
59-
<ShieldedSyncProgress />
56+
<Sidebar>
6057
<ShieldAllBanner />
6158
<MainnetRoadmap />
62-
</aside>
59+
</Sidebar>
6360
</PageWithSidebar>
6461
);
6562
};

apps/namadillo/src/App/Governance/GovernanceOverview.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Panel, SkeletonLoading } from "@namada/components";
22
import { ConnectBanner } from "App/Common/ConnectBanner";
33
import { PageWithSidebar } from "App/Common/PageWithSidebar";
4-
import { EpochInformation } from "App/Sidebars/EpochInformation";
4+
import { Sidebar } from "App/Layout/Sidebar";
55
import { allProposalsAtom, votedProposalsAtom } from "atoms/proposals";
66
import {
77
atomsAreFetching,
@@ -76,8 +76,7 @@ export const GovernanceOverview: React.FC = () => {
7676
/>
7777
</ProposalListPanel>
7878
</div>
79-
<aside className="flex flex-col gap-2 mt-1.5 lg:mt-0">
80-
<EpochInformation />
79+
<Sidebar>
8180
<Panel>
8281
{atomsAreFetching(allProposals) && (
8382
<SkeletonLoading height="150px" width="100%" />
@@ -86,7 +85,7 @@ export const GovernanceOverview: React.FC = () => {
8685
<ProposalsSummary allProposals={allProposals.data!} />
8786
)}
8887
</Panel>
89-
</aside>
88+
</Sidebar>
9089
</PageWithSidebar>
9190
);
9291
};

apps/namadillo/src/App/Ibc/IbcTransfersLayout.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Panel, TabContainer } from "@namada/components";
22
import { ConnectPanel } from "App/Common/ConnectPanel";
33
import { PageWithSidebar } from "App/Common/PageWithSidebar";
4+
import { Sidebar } from "App/Layout/Sidebar";
45
import { routes } from "App/routes";
5-
import { EpochInformation } from "App/Sidebars/EpochInformation";
66
import { ShieldAllBanner } from "App/Sidebars/ShieldAllBanner";
77
import { useUserHasAccount } from "hooks/useIsAuthenticated";
88
import { Outlet, useLocation, useNavigate } from "react-router-dom";
@@ -44,10 +44,9 @@ export const IbcTransfersLayout = (): JSX.Element => {
4444
]}
4545
/>
4646
</div>
47-
<aside className="w-full mt-2 flex flex-col sm:flex-row lg:mt-0 lg:flex-col gap-2">
48-
<EpochInformation />
47+
<Sidebar>
4948
<ShieldAllBanner />
50-
</aside>
49+
</Sidebar>
5150
</PageWithSidebar>
5251
);
5352
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { ShieldedSyncProgress } from "App/Masp/ShieldedSyncProgress";
2+
import { EpochInformation } from "App/Sidebars/EpochInformation";
3+
import { ReactNode } from "react";
4+
5+
export const Sidebar = ({ children }: { children: ReactNode }): JSX.Element => {
6+
return (
7+
<aside className="flex flex-col gap-2 mt-1.5 lg:mt-0">
8+
<EpochInformation />
9+
<ShieldedSyncProgress />
10+
{children}
11+
</aside>
12+
);
13+
};

apps/namadillo/src/App/Masp/MaspLayout.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { ConnectPanel } from "App/Common/ConnectPanel";
22
import { MaspContainer } from "App/Common/MaspContainer";
33
import { PageWithSidebar } from "App/Common/PageWithSidebar";
4+
import { Sidebar } from "App/Layout/Sidebar";
45
import { routes } from "App/routes";
56
import { ShieldAllBanner } from "App/Sidebars/ShieldAllBanner";
67
import { shieldedBalanceAtom } from "atoms/balance";
78
import { useUserHasAccount } from "hooks/useIsAuthenticated";
89
import { useAtomValue } from "jotai";
910
import { useEffect } from "react";
1011
import { Outlet, useLocation } from "react-router-dom";
11-
import { ShieldedSyncProgress } from "./ShieldedSyncProgress";
1212

1313
export const MaspLayout: React.FC = () => {
1414
const userHasAccount = useUserHasAccount();
@@ -29,10 +29,9 @@ export const MaspLayout: React.FC = () => {
2929
<MaspContainer>
3030
<Outlet />
3131
</MaspContainer>
32-
<aside className="w-full mt-2 flex flex-col sm:flex-row lg:mt-0 lg:flex-col gap-2">
33-
<ShieldedSyncProgress />
32+
<Sidebar>
3433
<ShieldAllBanner />
35-
</aside>
34+
</Sidebar>
3635
</PageWithSidebar>
3736
);
3837
};

apps/namadillo/src/App/Masp/ShieldedSyncProgress.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { shieldedBalanceAtom, shieldedSyncProgress } from "atoms/balance/atoms";
22
import { useAtomValue } from "jotai";
3+
import { twMerge } from "tailwind-merge";
34

45
export const ShieldedSyncProgress = (): JSX.Element => {
56
const syncProgress = useAtomValue(shieldedSyncProgress);
@@ -10,11 +11,18 @@ export const ShieldedSyncProgress = (): JSX.Element => {
1011
}
1112

1213
return (
13-
<div className={"bg-yellow rounded-sm text-xs font-medium py-2 px-3"}>
14+
<div className="relative bg-black text-yellow rounded-sm overflow-hidden text-xs font-medium py-2 px-3">
1415
Shielded sync{" "}
1516
{syncProgress === 1 ?
1617
"converting..."
1718
: `progress: ${Math.min(Math.floor(syncProgress * 100), 100)}%`}
19+
<div
20+
className={twMerge(
21+
"absolute bg-yellow top-0 left-0 w-full h-full mix-blend-difference origin-left",
22+
syncProgress > 0 && "transition-all"
23+
)}
24+
style={{ transform: `scaleX(${syncProgress * 100}%)` }}
25+
/>
1826
</div>
1927
);
2028
};

apps/namadillo/src/App/Staking/StakingOverview.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Panel } from "@namada/components";
22
import { ConnectBanner } from "App/Common/ConnectBanner";
33
import { PageWithSidebar } from "App/Common/PageWithSidebar";
4-
import { EpochInformation } from "App/Sidebars/EpochInformation";
4+
import { Sidebar } from "App/Layout/Sidebar";
55
import { ValidatorDiversification } from "App/Sidebars/ValidatorDiversification";
66
import { YourStakingDistribution } from "App/Sidebars/YourStakingDistribution";
77
import { myValidatorsAtom } from "atoms/validators";
@@ -40,8 +40,7 @@ export const StakingOverview = (): JSX.Element => {
4040
<AllValidatorsTable />
4141
</Panel>
4242
</div>
43-
<aside className="w-full mt-2 flex flex-col sm:flex-row lg:mt-0 lg:flex-col gap-2">
44-
<EpochInformation />
43+
<Sidebar>
4544
{hasStaking && myValidators.isSuccess && (
4645
<Panel className="w-full @container">
4746
<YourStakingDistribution myValidators={myValidators.data!} />
@@ -50,7 +49,7 @@ export const StakingOverview = (): JSX.Element => {
5049
<Panel>
5150
<ValidatorDiversification />
5251
</Panel>
53-
</aside>
52+
</Sidebar>
5453
</PageWithSidebar>
5554
);
5655
};

apps/namadillo/src/App/Transfer/TransferLayout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ConnectPanel } from "App/Common/ConnectPanel";
22
import { PageWithSidebar } from "App/Common/PageWithSidebar";
3+
import { Sidebar } from "App/Layout/Sidebar";
34
import { ShieldAllBanner } from "App/Sidebars/ShieldAllBanner";
45
import { useUserHasAccount } from "hooks/useIsAuthenticated";
56
import { Outlet } from "react-router-dom";
@@ -14,9 +15,9 @@ export const TransferLayout: React.FC = () => {
1415
return (
1516
<PageWithSidebar>
1617
<Outlet />
17-
<aside className="w-full mt-2 flex flex-col sm:flex-row lg:mt-0 lg:flex-col gap-2">
18+
<Sidebar>
1819
<ShieldAllBanner />
19-
</aside>
20+
</Sidebar>
2021
</PageWithSidebar>
2122
);
2223
};

0 commit comments

Comments
 (0)