Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update shield sync indicator layout #1601

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions apps/namadillo/src/App/AccountOverview/AccountOverview.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Panel } from "@namada/components";
import { ConnectPanel } from "App/Common/ConnectPanel";
import { PageWithSidebar } from "App/Common/PageWithSidebar";
import { ShieldedSyncProgress } from "App/Masp/ShieldedSyncProgress";
import { EpochInformation } from "App/Sidebars/EpochInformation";
import { Sidebar } from "App/Layout/Sidebar";
import MainnetRoadmap from "App/Sidebars/MainnetRoadmap";
import { ShieldAllBanner } from "App/Sidebars/ShieldAllBanner";
import { StakingRewardsPanel } from "App/Staking/StakingRewardsPanel";
Expand Down Expand Up @@ -54,12 +53,10 @@ export const AccountOverview = (): JSX.Element => {
</Panel>
</section>
</div>
<aside className="flex flex-col gap-2">
<EpochInformation />
<ShieldedSyncProgress />
<Sidebar>
<ShieldAllBanner />
<MainnetRoadmap />
</aside>
</Sidebar>
</PageWithSidebar>
);
};
7 changes: 3 additions & 4 deletions apps/namadillo/src/App/Governance/GovernanceOverview.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Panel, SkeletonLoading } from "@namada/components";
import { ConnectBanner } from "App/Common/ConnectBanner";
import { PageWithSidebar } from "App/Common/PageWithSidebar";
import { EpochInformation } from "App/Sidebars/EpochInformation";
import { Sidebar } from "App/Layout/Sidebar";
import { allProposalsAtom, votedProposalsAtom } from "atoms/proposals";
import {
atomsAreFetching,
Expand Down Expand Up @@ -76,8 +76,7 @@ export const GovernanceOverview: React.FC = () => {
/>
</ProposalListPanel>
</div>
<aside className="flex flex-col gap-2 mt-1.5 lg:mt-0">
<EpochInformation />
<Sidebar>
<Panel>
{atomsAreFetching(allProposals) && (
<SkeletonLoading height="150px" width="100%" />
Expand All @@ -86,7 +85,7 @@ export const GovernanceOverview: React.FC = () => {
<ProposalsSummary allProposals={allProposals.data!} />
)}
</Panel>
</aside>
</Sidebar>
</PageWithSidebar>
);
};
7 changes: 3 additions & 4 deletions apps/namadillo/src/App/Ibc/IbcTransfersLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Panel, TabContainer } from "@namada/components";
import { ConnectPanel } from "App/Common/ConnectPanel";
import { PageWithSidebar } from "App/Common/PageWithSidebar";
import { Sidebar } from "App/Layout/Sidebar";
import { routes } from "App/routes";
import { EpochInformation } from "App/Sidebars/EpochInformation";
import { ShieldAllBanner } from "App/Sidebars/ShieldAllBanner";
import { useUserHasAccount } from "hooks/useIsAuthenticated";
import { Outlet, useLocation, useNavigate } from "react-router-dom";
Expand Down Expand Up @@ -44,10 +44,9 @@ export const IbcTransfersLayout = (): JSX.Element => {
]}
/>
</div>
<aside className="w-full mt-2 flex flex-col sm:flex-row lg:mt-0 lg:flex-col gap-2">
<EpochInformation />
<Sidebar>
<ShieldAllBanner />
</aside>
</Sidebar>
</PageWithSidebar>
);
};
13 changes: 13 additions & 0 deletions apps/namadillo/src/App/Layout/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ShieldedSyncProgress } from "App/Masp/ShieldedSyncProgress";
import { EpochInformation } from "App/Sidebars/EpochInformation";
import { ReactNode } from "react";

export const Sidebar = ({ children }: { children: ReactNode }): JSX.Element => {
return (
<aside className="flex flex-col gap-2 mt-1.5 lg:mt-0">
<EpochInformation />
<ShieldedSyncProgress />
{children}
</aside>
);
};
7 changes: 3 additions & 4 deletions apps/namadillo/src/App/Masp/MaspLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ConnectPanel } from "App/Common/ConnectPanel";
import { MaspContainer } from "App/Common/MaspContainer";
import { PageWithSidebar } from "App/Common/PageWithSidebar";
import { Sidebar } from "App/Layout/Sidebar";
import { routes } from "App/routes";
import { ShieldAllBanner } from "App/Sidebars/ShieldAllBanner";
import { shieldedBalanceAtom } from "atoms/balance";
import { useUserHasAccount } from "hooks/useIsAuthenticated";
import { useAtomValue } from "jotai";
import { useEffect } from "react";
import { Outlet, useLocation } from "react-router-dom";
import { ShieldedSyncProgress } from "./ShieldedSyncProgress";

export const MaspLayout: React.FC = () => {
const userHasAccount = useUserHasAccount();
Expand All @@ -29,10 +29,9 @@ export const MaspLayout: React.FC = () => {
<MaspContainer>
<Outlet />
</MaspContainer>
<aside className="w-full mt-2 flex flex-col sm:flex-row lg:mt-0 lg:flex-col gap-2">
<ShieldedSyncProgress />
<Sidebar>
<ShieldAllBanner />
</aside>
</Sidebar>
</PageWithSidebar>
);
};
6 changes: 5 additions & 1 deletion apps/namadillo/src/App/Masp/ShieldedSyncProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ export const ShieldedSyncProgress = (): JSX.Element => {
}

return (
<div className={"bg-yellow rounded-sm text-xs font-medium py-2 px-3"}>
<div className="relative bg-black text-yellow rounded-sm overflow-hidden text-xs font-medium py-2 px-3">
Shielded sync{" "}
{syncProgress === 1 ?
"converting..."
: `progress: ${Math.min(Math.floor(syncProgress * 100), 100)}%`}
<div
className="absolute bg-yellow top-0 left-0 w-full h-full mix-blend-difference origin-left transition-all"
style={{ transform: `scaleX(${syncProgress * 100}%)` }}
/>
</div>
);
};
7 changes: 3 additions & 4 deletions apps/namadillo/src/App/Staking/StakingOverview.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Panel } from "@namada/components";
import { ConnectBanner } from "App/Common/ConnectBanner";
import { PageWithSidebar } from "App/Common/PageWithSidebar";
import { EpochInformation } from "App/Sidebars/EpochInformation";
import { Sidebar } from "App/Layout/Sidebar";
import { ValidatorDiversification } from "App/Sidebars/ValidatorDiversification";
import { YourStakingDistribution } from "App/Sidebars/YourStakingDistribution";
import { myValidatorsAtom } from "atoms/validators";
Expand Down Expand Up @@ -40,8 +40,7 @@ export const StakingOverview = (): JSX.Element => {
<AllValidatorsTable />
</Panel>
</div>
<aside className="w-full mt-2 flex flex-col sm:flex-row lg:mt-0 lg:flex-col gap-2">
<EpochInformation />
<Sidebar>
{hasStaking && myValidators.isSuccess && (
<Panel className="w-full @container">
<YourStakingDistribution myValidators={myValidators.data!} />
Expand All @@ -50,7 +49,7 @@ export const StakingOverview = (): JSX.Element => {
<Panel>
<ValidatorDiversification />
</Panel>
</aside>
</Sidebar>
</PageWithSidebar>
);
};
5 changes: 3 additions & 2 deletions apps/namadillo/src/App/Transfer/TransferLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ConnectPanel } from "App/Common/ConnectPanel";
import { PageWithSidebar } from "App/Common/PageWithSidebar";
import { Sidebar } from "App/Layout/Sidebar";
import { ShieldAllBanner } from "App/Sidebars/ShieldAllBanner";
import { useUserHasAccount } from "hooks/useIsAuthenticated";
import { Outlet } from "react-router-dom";
Expand All @@ -14,9 +15,9 @@ export const TransferLayout: React.FC = () => {
return (
<PageWithSidebar>
<Outlet />
<aside className="w-full mt-2 flex flex-col sm:flex-row lg:mt-0 lg:flex-col gap-2">
<Sidebar>
<ShieldAllBanner />
</aside>
</Sidebar>
</PageWithSidebar>
);
};