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(tangle-dapp): Update account page to prioritize restaking #2694

Merged
merged 88 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
793c9f4
refactor(repo): Remove legacy note manager
AtelyPham Nov 30, 2024
f473d77
refactor(repo): Remove legacy tx queue
AtelyPham Nov 30, 2024
90e0a8d
refactor(repo): Remove webb state
AtelyPham Nov 30, 2024
35d2ba2
refactor(repo): Remove relay chain methods
AtelyPham Nov 30, 2024
bcb5e31
refactor(repo): Remove relayer manager
AtelyPham Dec 2, 2024
524cf75
refactor(repo): Remove ecdsa claim
AtelyPham Dec 2, 2024
d2da7a2
refactor(repo): Remove wrap/unwrap
AtelyPham Dec 2, 2024
66aee06
refactor(repo): Remove bridge api
AtelyPham Dec 2, 2024
1ac7b93
refactor(repo): Remove chain query
AtelyPham Dec 2, 2024
dd638fa
refactor(repo): Remove vanchor things
AtelyPham Dec 2, 2024
1a5bd90
refactor(repo): Remove react-hooks lib and more unused functions
AtelyPham Dec 2, 2024
f8af80c
refactor(repo): Remove currency class
AtelyPham Dec 2, 2024
95d7f5c
refactor(repo): Remove anchors bridge currencies from api-config
AtelyPham Dec 2, 2024
254d989
refactor(repo): Remove unused context
AtelyPham Dec 2, 2024
6db1531
refactor(repo): Remove interactive feedback and notification handler
AtelyPham Dec 2, 2024
fc178e1
refactor(repo): Remove capabilities and ensureApiInterface
AtelyPham Dec 2, 2024
6653661
refactor(repo): Remove all legacy @webb-tools packages
AtelyPham Dec 2, 2024
41d9366
Merge branch 'develop' into trung-tin/vite-migration
AtelyPham Dec 4, 2024
3063ba1
ci(repo): Remove deps
AtelyPham Dec 4, 2024
8c7c992
ci(repo): Upgrade to Nx v20
AtelyPham Dec 4, 2024
6c89e46
ci(repo): Migrate to eslint 9 with flat config
AtelyPham Dec 4, 2024
e66175a
ci(repo): Upgrade deps
AtelyPham Dec 4, 2024
7513275
ci(repo): Upgrade deps with breaking changes
AtelyPham Dec 4, 2024
f537380
ci(repo): Migrate to nx inferred tasks
AtelyPham Dec 4, 2024
f346a18
ci(repo): Migrate Storybook inferred task
AtelyPham Dec 4, 2024
293c807
feat(tangle-dapp): Migrate account page to Vite
AtelyPham Dec 5, 2024
1930cbb
feat(tangle-dapp): Setup tailwind for Tangle dApp Vite
AtelyPham Dec 5, 2024
f66f50e
Revert "feat(tangle-dapp): Setup tailwind for Tangle dApp Vite"
AtelyPham Dec 5, 2024
9210c39
fix(tangle-dapp): Fix lint and build
AtelyPham Dec 5, 2024
6a01d12
feat(tangle-dapp): Setup Tailwind manually
AtelyPham Dec 5, 2024
f55b7b0
feat(tangle-dapp): Setup claim pages
AtelyPham Dec 5, 2024
b75faa5
feat(tangle-dapp): Update app title and favicon
AtelyPham Dec 5, 2024
1e0ea16
feat(tangle-dapp): Add nomination pages
AtelyPham Dec 5, 2024
af6f378
fix(tangle-dapp): Fix not found svg icon error
AtelyPham Dec 5, 2024
ebd1bbb
feat(tangle-dapp): Add bridge page
AtelyPham Dec 5, 2024
557e5a2
feat(tangle-dapp): add blueprint pages
AtelyPham Dec 5, 2024
73cd736
feat(tangle-dapp): add liquid staking page
AtelyPham Dec 5, 2024
c636261
feat(tangle-dapp): Add restake pages
AtelyPham Dec 5, 2024
8d62d4a
feat(tangle-dapp): Add ci files
AtelyPham Dec 5, 2024
ece9abb
fix(tangle-dapp): Move next features to react-router
AtelyPham Dec 5, 2024
795d10f
fix(tangle-dapp): Move to esm
AtelyPham Dec 5, 2024
b0bec41
chore(tangle-dapp): Remove Tangle Nextjs dApp
AtelyPham Dec 5, 2024
678498f
ci(repo): Migrate Tangle dApp to Vite
AtelyPham Dec 5, 2024
69c3d2b
Merge branch 'develop' into trung-tin/vite-migration
yurixander Dec 6, 2024
6c951fa
fix(tangle-dapp): Fix build errors
yurixander Dec 6, 2024
542bb5d
fix(tangle-dapp): Fix wallet connection error
yurixander Dec 7, 2024
2b68400
refactor: Avoid using `Buffer`
yurixander Dec 7, 2024
74509ad
ci: Match config with overrides on Netlify
yurixander Dec 7, 2024
b5ad769
ci: Update build folder for Tangle Cloud
yurixander Dec 7, 2024
745a601
fix(tangle-dapp): Don't use `process.env`
yurixander Dec 7, 2024
0a80f6c
fix(tangle-dapp): Need `process.env` polyfill
yurixander Dec 7, 2024
3578d1e
feat(tangle-dapp): Progress on updated account page
yurixander Dec 7, 2024
b10fc14
feat(tangle-dapp): Fetch balance locks & show in table
yurixander Dec 8, 2024
ec0d14e
refactor(tangle-dapp): Improve Update Nominations table
yurixander Dec 8, 2024
5bce529
refactor(tangle-dapp): Better naming
yurixander Dec 8, 2024
9a02823
refactor(tangle-dapp): Improve modals
yurixander Dec 8, 2024
622cfe5
feat(tangle-dapp): Add APY column
yurixander Dec 8, 2024
be19d2c
style(tangle-dapp): Update table design from feedback
yurixander Dec 8, 2024
7c744fc
fix(tangle-dapp): Fix font loading issue
AtelyPham Dec 9, 2024
2094db4
fix(tangle-dapp): Resolve test issue
AtelyPham Dec 6, 2024
47f011a
fix(tangle-dapp): Add Nodejs polyfills
AtelyPham Dec 9, 2024
664a21b
fix(tangle-dapp): Update TangleTokenIcon
AtelyPham Dec 10, 2024
c5afb81
fix(tangle-dapp): Update useQueryState hook to work with react-router
AtelyPham Dec 10, 2024
e2a4338
chore(repo): Add test script
AtelyPham Dec 10, 2024
ba45722
fix(repo): Fix tests not exit
AtelyPham Dec 10, 2024
329a1ca
chore(repo): Remove logs
AtelyPham Dec 11, 2024
9dbc97e
chore(repo): Update test script on ci
AtelyPham Dec 11, 2024
16b05a9
feat(repo): Throw error when detecting unhandled rejection
AtelyPham Dec 11, 2024
5033bb7
chore(repo): Add tag to ignore error on testing
AtelyPham Dec 11, 2024
dd4d092
style(tangle-dapp): Improve table styling consistency
yurixander Dec 11, 2024
8ff49a2
Merge branch 'trung-tin/vite-migration' into yuri/prioritize-restakin…
yurixander Dec 11, 2024
8adfe6d
Merge branch 'develop' into yuri/prioritize-restaking-in-landing-page
yurixander Dec 13, 2024
89c5afe
feat(tangle-dapp): List restaking assets in table
yurixander Dec 14, 2024
8c11644
feat(tangle-dapp): Include LSTs in table
yurixander Dec 14, 2024
4aabf31
Merge branch 'develop' into yuri/prioritize-restaking-in-landing-page
yurixander Dec 18, 2024
a990956
fix(tangle-dapp): Fix build errors
yurixander Dec 18, 2024
c0ab254
fix(tangle-dapp): Fix column not showing up
yurixander Dec 18, 2024
3859712
feat(tangle-dapp): Missing column values
yurixander Dec 19, 2024
b560008
style(tangle-dapp): Improve styling
yurixander Dec 19, 2024
c25a693
feat(tangle-dapp): My stake for pools
yurixander Dec 19, 2024
3c31154
fix(tangle-dapp): Capitalize
yurixander Dec 19, 2024
5f19fb4
feat(tangle-dapp): TVL for assets
yurixander Dec 19, 2024
5f1bc06
fix(tangle-dapp): Show all assets
yurixander Dec 20, 2024
f0d094f
feat(tangle-dapp): Show table without account
yurixander Dec 20, 2024
6f8c310
ci(tangle-dapp): Fix import
yurixander Dec 20, 2024
7c82b32
ci(tangle-dapp): Fix lint errors
yurixander Dec 20, 2024
96e77e2
ci(tangle-dapp): Fix CI error
yurixander Dec 20, 2024
6a3b961
docs(tangle-dapp): Not market cap
yurixander Dec 20, 2024
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
3 changes: 2 additions & 1 deletion apps/tangle-dapp/src/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ function App() {
<Layout>
{/* START: routes */}
<Routes>
<Route path={PagePath.ACCOUNT} element={<AccountPage />} />
<Route index path={PagePath.DASHBOARD} element={<AccountPage />} />

<Route path={PagePath.CLAIM_AIRDROP} element={<ClaimLayout />}>
<Route index element={<ClaimPage />} />

<Route
path={PagePath.CLAIM_AIRDROP_SUCCESS}
element={<ClaimSuccessPage />}
Expand Down
5 changes: 4 additions & 1 deletion apps/tangle-dapp/src/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,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';

const appEvent = new AppEvent();

Expand Down Expand Up @@ -49,7 +50,9 @@ const Providers = ({
blockedCountryCodes={blockedCountryCodes}
>
<HyperlaneWarpContext>
<BridgeTxQueueProvider>{children}</BridgeTxQueueProvider>
<BridgeTxQueueProvider>
<PolkadotApiProvider>{children}</PolkadotApiProvider>
</BridgeTxQueueProvider>
</HyperlaneWarpContext>
</OFACFilterProvider>
</WebbProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { twMerge } from 'tailwind-merge';

import TangleBigLogo from './TangleBigLogo';

const GlassCardWithLogo: FC<PropsWithChildren<{ className?: string }>> = ({
const CardWithTangleLogo: FC<PropsWithChildren<{ className?: string }>> = ({
children,
className,
}) => {
Expand All @@ -23,4 +23,4 @@ const GlassCardWithLogo: FC<PropsWithChildren<{ className?: string }>> = ({
);
};

export default GlassCardWithLogo;
export default CardWithTangleLogo;
2 changes: 1 addition & 1 deletion apps/tangle-dapp/src/components/HowItWorks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const HowItWorks = forwardRef<HTMLDivElement, HowItWorksProps>(
ref={ref}
>
<Typography variant="body1" fw="bold">
How it works
How It Works
</Typography>

<div>{children}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,13 @@ const LsMyPoolsTable: FC<LsMyPoolsTableProps> = ({ pools, isShown }) => {
<TableStatus
title="Wallet Not Connected"
description="Once you've connected an account, you'll be able to increase stake, unstake, and manage your liquid staking pools here."
icon="🔍"
/>
);
} else if (pools.length === 0) {
return (
<TableStatus
title="No Active Pools"
description="You haven't staked in any pools yet. Select a pool and start liquid staking to earn rewards! Once you've staked or created a pool, you'll be able to manage your stake and configure the pool here."
icon="🔍"
buttonText="Learn More"
buttonProps={{
href: TANGLE_DOCS_LIQUID_STAKING_URL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ const LsUnbondingTable: FC = () => {
<TableStatus
title="Connect a wallet to continue"
description="Once you've connected an account, you'll be able to see and manage your liquid staking pools' unstaking requests here."
icon="🔍"
/>
);
} else if (unstakeRequests === null) {
Expand All @@ -167,7 +166,6 @@ const LsUnbondingTable: FC = () => {
<TableStatus
title="No Unstake Requests"
description="Once you've scheduled an unstake request, you'll see information about it here."
icon="🔍"
buttonText="Learn More"
buttonProps={{
href: TANGLE_DOCS_LIQUID_STAKING_URL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const getTailwindSize = (size: LstIconSize) => {
case LstIconSize.MD:
return 'w-[30px] h-[30px]';
case LstIconSize.LG:
return 'w-[38px] h-[38px]';
return 'w-[40px] h-[40px]';
}
};

Expand Down
8 changes: 4 additions & 4 deletions apps/tangle-dapp/src/components/Lists/AssetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import { ScrollArea } from '@webb-tools/webb-ui-components/components/ScrollArea';
import { EMPTY_VALUE_PLACEHOLDER } from '@webb-tools/webb-ui-components/constants';
import { ComponentProps, useMemo, useState } from 'react';
import { Link } from 'react-router';
import { twMerge } from 'tailwind-merge';
import { Address } from 'viem';

Expand Down Expand Up @@ -96,9 +95,10 @@ export const AssetList = ({
</Typography>

{asset.explorerUrl !== undefined && (
<Link
to={asset.explorerUrl}
<a
href={asset.explorerUrl}
target="_blank"
rel="noreferrer"
className="z-20 flex items-center gap-1 text-mono-120 dark:text-mono-100 dark:hover:text-mono-80"
>
<Typography
Expand All @@ -111,7 +111,7 @@ export const AssetList = ({
</Typography>

<ArrowRightUp className="fill-current dark:fill-current" />
</Link>
</a>
)}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import calculateCommission from '../../utils/calculateCommission';
import { HeaderCell, StringCell } from '../tableCells';
import PercentageCell from '../tableCells/PercentageCell';
import TokenAmountCell from '../tableCells/TokenAmountCell';
import pluralize from '@webb-tools/webb-ui-components/utils/pluralize';

const columnHelper = createColumnHelper<Nominee>();

Expand All @@ -51,7 +52,11 @@ const columns = [
: identityName}
</Typography>

<CopyWithTooltip textToCopy={address} isButton={false} />
<CopyWithTooltip
copyLabel="Copy Address"
textToCopy={address}
isButton={false}
/>
</div>
);
},
Expand Down Expand Up @@ -150,6 +155,7 @@ const NominationsTable: FC<NominationsTableProps> = ({
tableProps={table}
isPaginated
totalRecords={nominees.length}
title={pluralize('nomination', nominees.length !== 1)}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ const PayoutTable: FC<PayoutTableProps> = ({
{identity === address ? shortenString(address, 6) : identity}
</Typography>

<CopyWithTooltip textToCopy={address} isButton={false} />
<CopyWithTooltip
copyLabel="Copy Address"
textToCopy={address}
isButton={false}
/>
</div>
);
},
Expand Down
4 changes: 2 additions & 2 deletions apps/tangle-dapp/src/components/Sidebar/sidebarProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import { PagePath } from '../../types';
// Only show the services dropdown if on development mode.
const SIDEBAR_STATIC_ITEMS: SideBarItemProps[] = [
{
name: 'Account',
href: PagePath.ACCOUNT,
name: 'Dashboard',
href: PagePath.DASHBOARD,
isInternal: true,
isNext: false,
Icon: HomeFillIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
AmountFormatStyle,
Avatar,
CheckBox,
Chip,
CopyWithTooltip,
fuzzyFilter,
Input,
Expand All @@ -31,7 +30,6 @@ import {
} from '@webb-tools/webb-ui-components';
import { TableVariant } from '@webb-tools/webb-ui-components/components/Table/types';
import formatFractional from '@webb-tools/webb-ui-components/utils/formatFractional';
import pluralize from '@webb-tools/webb-ui-components/utils/pluralize';
import assertSubstrateAddress from '@webb-tools/webb-ui-components/utils/assertSubstrateAddress';
import cx from 'classnames';
import {
Expand All @@ -46,10 +44,11 @@ import {

import { Validator } from '../../types';
import calculateCommission from '../../utils/calculateCommission';
import { ContainerSkeleton } from '..';
import { HeaderCell } from '../tableCells';
import TokenAmountCell from '../tableCells/TokenAmountCell';
import { ValidatorSelectionTableProps } from './types';
import SkeletonRows from '../SkeletonRows';
import addCommasToNumber from '@webb-tools/webb-ui-components/utils/addCommasToNumber';

const columnHelper = createColumnHelper<Validator>();

Expand Down Expand Up @@ -123,6 +122,7 @@ const ValidatorSelectionTable: FC<ValidatorSelectionTableProps> = ({
</Typography>

<CopyWithTooltip
copyLabel="Copy Address"
textToCopy={address}
isButton={false}
iconClassName="!fill-mono-160 dark:!fill-mono-80"
Expand All @@ -141,6 +141,7 @@ const ValidatorSelectionTable: FC<ValidatorSelectionTableProps> = ({
),
filterFn: (row, _, filterValue) => {
const { address, identityName } = row.original;

return (
address.toLowerCase().includes(filterValue.toLowerCase()) ||
identityName.toLowerCase().includes(filterValue.toLowerCase())
Expand All @@ -152,15 +153,11 @@ const ValidatorSelectionTable: FC<ValidatorSelectionTableProps> = ({
<HeaderCell title="Total Staked" className="justify-start" />
),
cell: (props) => (
<div className="flex items-center justify-start">
<Chip color="dark-grey" className="normal-case">
<TokenAmountCell
amount={props.getValue()}
className="text-mono-0"
formatStyle={AmountFormatStyle.SHORT}
/>
</Chip>
</div>
<TokenAmountCell
amount={props.getValue()}
className="text-mono-0"
formatStyle={AmountFormatStyle.SHORT}
/>
),
sortingFn: (rowA, rowB, columnId) =>
sortValidatorsBy(
Expand All @@ -176,9 +173,9 @@ const ValidatorSelectionTable: FC<ValidatorSelectionTableProps> = ({
<HeaderCell title="Nominations" className="justify-start" />
),
cell: (props) => (
<div className="flex items-center justify-start">
<Chip color="dark-grey">{props.getValue()}</Chip>
</div>
<Typography variant="body1">
{addCommasToNumber(props.getValue())}
</Typography>
),
sortingFn: (rowA, rowB, columnId) =>
sortValidatorsBy(
Expand All @@ -195,11 +192,9 @@ const ValidatorSelectionTable: FC<ValidatorSelectionTableProps> = ({
<HeaderCell title="Commission" className="justify-start" />
),
cell: (props) => (
<div className="flex items-center justify-start">
<Chip color="dark-grey">
{formatFractional(calculateCommission(props.getValue()))}
</Chip>
</div>
<Typography variant="body1">
{formatFractional(calculateCommission(props.getValue()))}
</Typography>
),
sortingFn: (rowA, rowB, columnId) =>
sortValidatorsBy(
Expand All @@ -210,10 +205,6 @@ const ValidatorSelectionTable: FC<ValidatorSelectionTableProps> = ({
isDesc,
),
}),
columnHelper.accessor('identityName', {
header: () => <HeaderCell title="Identity" />,
cell: (props) => props.getValue(),
}),
],
[isDesc],
);
Expand Down Expand Up @@ -265,48 +256,39 @@ const ValidatorSelectionTable: FC<ValidatorSelectionTableProps> = ({

const table = useReactTable(tableProps);

if (isLoading) {
return <SkeletonRows />;
}

const paginationLabel = `Selected validators: ${Object.keys(rowSelection).length}/${table.getPreFilteredRowModel().rows.length}`;

return (
<div className="flex flex-col gap-2">
<Input
id="search-validators-selection"
rightIcon={<Search className="mr-2" />}
placeholder="Search validators..."
placeholder="Search validators by identity or address..."
value={searchQuery}
onChange={setSearchQuery}
className="mb-1"
isControlled
/>

{isLoading && <ContainerSkeleton className="h-[340px] w-full" />}

{!isLoading &&
(allValidators.length === 0 ? (
<div className="h-[340px] flex items-center justify-center">
<Typography variant="body1" fw="normal">
No results found
</Typography>
</div>
) : (
<Table
variant={TableVariant.NESTED_IN_MODAL}
tableClassName={cx('[&_tr]:[overflow-anchor:_none]')}
paginationClassName="bg-mono-0 dark:bg-mono-180 p-2"
tableWrapperClassName="max-h-[340px] overflow-y-scroll"
tableProps={table}
isPaginated
title={pluralize('validator', allValidators.length !== 1)}
/>
))}

{!isLoading && allValidators.length > 0 && (
<Typography
variant="body1"
fw="normal"
className="text-mono-200 dark:text-mono-0"
>
Selected: {Object.keys(rowSelection).length}/
{table.getPreFilteredRowModel().rows.length}
</Typography>
{allValidators.length === 0 ? (
<div className="h-[340px] flex items-center justify-center">
<Typography variant="body1" fw="normal">
No results found
</Typography>
</div>
) : (
<Table
variant={TableVariant.EMBEDDED_IN_MODAL}
tableClassName={cx('[&_tr]:[overflow-anchor:_none]')}
tableWrapperClassName="max-h-[340px] overflow-y-scroll"
tableProps={table}
isPaginated
paginationLabelOverride={paginationLabel}
/>
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ const ValidatorTable: FC<ValidatorTableProps> = ({
</Typography>

<CopyWithTooltip
copyLabel="Copy Address"
textToCopy={address}
isButton={false}
iconClassName="!fill-mono-160 dark:!fill-mono-80"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { FC } from 'react';

import GlassCardWithLogo from '../GlassCardWithLogo';
import CardWithTangleLogo from '../CardWithTangleLogo';
import AccountAddress from './AccountAddress';
import Actions from './Actions';
import Balance from './Balance';

const AccountSummaryCard: FC<{ className?: string }> = ({ className }) => {
return (
<GlassCardWithLogo className={className}>
<CardWithTangleLogo className={className}>
<div className="w-full space-y-5">
<header>
<AccountAddress />
Expand All @@ -17,7 +17,7 @@ const AccountSummaryCard: FC<{ className?: string }> = ({ className }) => {

<Actions />
</div>
</GlassCardWithLogo>
</CardWithTangleLogo>
);
};

Expand Down
2 changes: 1 addition & 1 deletion apps/tangle-dapp/src/components/account/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const Actions: FC = () => {
label="Payouts"
Icon={CoinsLineIcon}
internalHref={StaticSearchQueryPath.PayoutsTable}
tooltip="You have payouts available. Click here to visit the Payouts page."
tooltip="There are nomination payouts available to claim. Click here to visit the Payouts page."
/>
)}

Expand Down
Loading
Loading