Skip to content

Commit

Permalink
refactor(tangle-dapp): Update restaking page organization (#2711)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurixander authored Jan 6, 2025
1 parent b1e678a commit f671e21
Show file tree
Hide file tree
Showing 95 changed files with 1,439 additions and 1,794 deletions.
13 changes: 10 additions & 3 deletions apps/tangle-cloud/app/blueprints/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import TopBanner from '@webb-tools/tangle-shared-ui/components/blueprints/TopBanner';
import RestakeBanner from '@webb-tools/tangle-shared-ui/components/blueprints/RestakeBanner';
import BlueprintListing from './BlueprintListing';
import { BLUEPRINT_DOCS_LINK } from '@webb-tools/webb-ui-components/constants/tangleDocs';
import { FC } from 'react';

export const dynamic = 'force-static';

const Page = () => {
const Page: FC = () => {
return (
<div className="px-4 space-y-5">
<TopBanner />
<RestakeBanner
title="Create Your First Blueprint"
description="Learn how to set up a minimal Tangle Blueprint in minutes accompanied by a step-by-step guide."
buttonHref={BLUEPRINT_DOCS_LINK}
buttonText="Get Started"
/>

<BlueprintListing />
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/tangle-cloud/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Providers = ({
}: PropsWithChildren<Props>): ReactNode => {
return (
<NextThemeProvider>
<WebbUIProvider hasErrorBoudary isNextApp>
<WebbUIProvider hasErrorBoundary isNextApp>
<WebbProvider
appEvent={appEvent}
applicationName="Tangle dApp"
Expand Down
54 changes: 10 additions & 44 deletions apps/tangle-dapp/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '@webb-tools/webb-ui-components/tailwind.css';
import '../styles.css';

import { Navigate, Route, Routes } from 'react-router';
import { Route, Routes } from 'react-router';
import { Layout } from '../containers';
import AccountPage from '../pages/account';
import ClaimPage from '../pages/claim';
Expand All @@ -18,13 +18,8 @@ import BlueprintLayout from '../pages/blueprints/layout';
import BlueprintsPage from '../pages/blueprints';
import BlueprintDetailsPage from '../pages/blueprints/[id]';
import LiquidStakingPage from '../pages/liquid-staking';
import RestakeLayout from '../pages/restake/layout';
import RestakeOverviewPage from '../pages/restake/overview';
import RestakeOperatorPage from '../pages/restake/operators/[address]';
import RestakeDepositPage from '../pages/restake/deposit';
import RestakeStakePage from '../pages/restake/stake';
import RestakeUnstakePage from '../pages/restake/unstake';
import RestakeWithdrawPage from '../pages/restake/withdraw';
import RestakePage from '../pages/restake/overview';
import NotFoundPage from '../pages/notFound';

// TODO: Add metadata tags for SEO

Expand All @@ -33,7 +28,6 @@ function App() {
<div>
<Providers>
<Layout>
{/* START: routes */}
<Routes>
<Route index path={PagePath.DASHBOARD} element={<AccountPage />} />

Expand Down Expand Up @@ -61,6 +55,7 @@ function App() {

<Route path={PagePath.BLUEPRINTS} element={<BlueprintLayout />}>
<Route index element={<BlueprintsPage />} />

<Route
path={PagePath.BLUEPRINTS_DETAILS}
element={<BlueprintDetailsPage />}
Expand All @@ -72,44 +67,15 @@ function App() {
element={<LiquidStakingPage />}
/>

<Route path={PagePath.RESTAKE} element={<RestakeLayout />}>
<Route
index
element={<Navigate to={PagePath.RESTAKE_OVERVIEW} />}
/>

<Route
path={PagePath.RESTAKE_OVERVIEW}
element={<RestakeOverviewPage />}
/>

<Route
path={`${PagePath.RESTAKE_OPERATOR}/:address`}
element={<RestakeOperatorPage />}
/>

<Route
path={PagePath.RESTAKE_DEPOSIT}
element={<RestakeDepositPage />}
/>

<Route
path={PagePath.RESTAKE_STAKE}
element={<RestakeStakePage />}
/>
<Route path={`${PagePath.RESTAKE}`} element={<RestakePage />} />

<Route
path={PagePath.RESTAKE_UNSTAKE}
element={<RestakeUnstakePage />}
/>
<Route
path={`${PagePath.RESTAKE}/:action`}
element={<RestakePage />}
/>

<Route
path={PagePath.RESTAKE_WITHDRAW}
element={<RestakeWithdrawPage />}
/>
</Route>
<Route path="*" element={<NotFoundPage />} />
</Routes>
{/* END: routes */}
</Layout>
</Providers>
</div>
Expand Down
7 changes: 5 additions & 2 deletions apps/tangle-dapp/src/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { z } from 'zod';
import HyperlaneWarpContext from '../pages/bridge/context/HyperlaneWarpContext';
import BridgeTxQueueProvider from '../pages/bridge/context/BridgeTxQueueContext/BridgeTxQueueProvider';
import PolkadotApiProvider from '@webb-tools/tangle-shared-ui/context/PolkadotApiProvider';
import { RestakeContextProvider } from '@webb-tools/tangle-shared-ui/context/RestakeContext';

const appEvent = new AppEvent();

Expand All @@ -37,7 +38,7 @@ const Providers = ({
} = envSchema.parse(process.env);

return (
<WebbUIProvider hasErrorBoudary>
<WebbUIProvider hasErrorBoundary>
<WebbProvider
appEvent={appEvent}
applicationName="Tangle dApp"
Expand All @@ -51,7 +52,9 @@ const Providers = ({
>
<HyperlaneWarpContext>
<BridgeTxQueueProvider>
<PolkadotApiProvider>{children}</PolkadotApiProvider>
<PolkadotApiProvider>
<RestakeContextProvider>{children}</RestakeContextProvider>
</PolkadotApiProvider>
</BridgeTxQueueProvider>
</HyperlaneWarpContext>
</OFACFilterProvider>
Expand Down
62 changes: 62 additions & 0 deletions apps/tangle-dapp/src/components/LiquidStaking/LstListItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { FC } from 'react';
import LstIcon from './LstIcon';
import {
AmountFormatStyle,
EMPTY_VALUE_PLACEHOLDER,
formatDisplayAmount,
Typography,
} from '@webb-tools/webb-ui-components';
import { LsPool } from '../../constants/liquidStaking/types';
import { LstIconSize } from './types';
import formatFractional from '@webb-tools/webb-ui-components/utils/formatFractional';
import getLsProtocolDef from '../../utils/liquidStaking/getLsProtocolDef';
import LogoListItem from '../Lists/LogoListItem';

type Props = {
pool: LsPool;
isSelfStaked: boolean;
};

const LstListItem: FC<Props> = ({ pool, isSelfStaked }) => {
const lsProtocol = getLsProtocolDef(pool.protocolId);

const fmtStakeAmount = formatDisplayAmount(
pool.totalStaked,
lsProtocol.decimals,
AmountFormatStyle.SI,
);

const fmtCommission =
pool.commissionFractional === undefined
? undefined
: `${formatFractional(pool.commissionFractional)} commission`;

const stakeText = `${fmtStakeAmount} ${lsProtocol.token}`;

return (
<LogoListItem
leftUpperContent={
<Typography
variant="body1"
fw="bold"
className="block text-mono-200 dark:text-mono-0"
>
{pool.name?.toUpperCase()}
<span className="text-mono-180 dark:text-mono-120">#{pool.id}</span>
</Typography>
}
leftBottomContent={`${stakeText} ${isSelfStaked ? 'self ' : ''}staked`}
rightUpperText={`${pool.apyPercentage ?? EMPTY_VALUE_PLACEHOLDER}% APY`}
rightBottomText={fmtCommission}
logo={
<LstIcon
lsProtocolId={pool.protocolId}
iconUrl={pool.iconUrl}
size={LstIconSize.LG}
/>
}
/>
);
};

export default LstListItem;
Loading

0 comments on commit f671e21

Please sign in to comment.