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

refactor(tangle-dapp): Cleanup legacy code & re-organize project #2686

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion apps/tangle-dapp/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type React from 'react';
import { cookieToInitialState } from 'wagmi';

import { DEFAULT_OPENGRAPH_METADATA } from '../constants/openGraph';
import { Layout } from '../containers';
import Layout from '../containers/Layout';
import Providers from './providers';

export const dynamic = 'force-static';
Expand Down
6 changes: 3 additions & 3 deletions apps/tangle-dapp/app/liquid-staking/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { FC, useEffect, useState } from 'react';
import LsUnbondingTable from '../../components/LiquidStaking/LsUnbondingTable';
import LsStakeCard from '../../components/LiquidStaking/stakeAndUnstake/LsStakeCard';
import LsUnstakeCard from '../../components/LiquidStaking/stakeAndUnstake/LsUnstakeCard';
import LsCreatePoolModal from '../../containers/LsCreatePoolModal';
import LsMyProtocolsTable from '../../containers/LsMyProtocolsTable';
import { LsAllProtocolsTable } from '../../containers/LsPoolsTable';
import LsCreatePoolModal from '../../containers/liquidStaking/LsCreatePoolModal';
import LsMyProtocolsTable from '../../containers/liquidStaking/LsMyProtocolsTable';
import { LsAllProtocolsTable } from '../../containers/liquidStaking/poolTables';
import { useLsStore } from '../../data/liquidStaking/useLsStore';
import useIsAccountConnected from '../../hooks/useIsAccountConnected';
import getLsTangleNetwork from '../../utils/liquidStaking/getLsTangleNetwork';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { TableVariant } from '@webb-tools/webb-ui-components/components/Table/ty
import cx from 'classnames';
import { FC } from 'react';

import { TableStatus } from '../../../components';
import ContainerSkeleton from '../../../components/skeleton/ContainerSkeleton';
import { HeaderCell } from '../../../components/tableCells';
import TableStatus from '../../../components/TableStatus';
import useNodeSpecifications from '../../../data/validatorDetails/useNodeSpecifications';
import { NodeSpecification } from '../../../types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isAddress } from '@polkadot/util-crypto';
import { notFound } from 'next/navigation';

import { IS_PRODUCTION_ENV } from '../../../constants/env';
import { IS_PRODUCTION_ENV } from '../../../constants';
import InfoCard from './InfoCard';
import NodeSpecificationsTable from './NodeSpecificationsTable';

Expand Down
14 changes: 6 additions & 8 deletions apps/tangle-dapp/app/nomination/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import { Typography } from '@webb-tools/webb-ui-components';
import { Metadata } from 'next';

import { OpenGraphPageImageUrl } from '../../constants/openGraph';
import {
HeaderChipsContainer,
KeyStatsContainer,
NominationsPayoutsContainer,
NominatorStatsContainer,
ValidatorTablesContainer,
} from '../../containers';
import { KeyStatsContainer } from '../../containers';
import HeaderChipsContainer from '../../containers/HeaderChipsContainer';
import ActiveAndWaitingValidatorTables from '../../containers/nomination/ActiveAndWaitingValidatorTables';
import NominationsPayoutsContainer from '../../containers/nomination/NominationsPayoutsContainer';
import NominatorStatsContainer from '../../containers/nomination/NominatorStatsContainer';
import createPageMetadata from '../../utils/createPageMetadata';

export const dynamic = 'force-static';
Expand Down Expand Up @@ -37,7 +35,7 @@ export default function NominationPage() {

<NominationsPayoutsContainer />

<ValidatorTablesContainer />
<ActiveAndWaitingValidatorTables />
</div>
);
}
2 changes: 1 addition & 1 deletion apps/tangle-dapp/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Metadata } from 'next';
import { FC } from 'react';

import AccountSummaryCard from '../components/account/AccountSummaryCard';
import BalancesTableContainer from '../containers/BalancesTableContainer/BalancesTableContainer';
import BalancesTableContainer from '../containers/account/balances/BalancesTableContainer';
import createPageMetadata from '../utils/createPageMetadata';

export const dynamic = 'force-static';
Expand Down
68 changes: 0 additions & 68 deletions apps/tangle-dapp/components/BnChartTooltip.tsx

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions apps/tangle-dapp/components/HeaderChip/dataHooks.ts

This file was deleted.

11 changes: 0 additions & 11 deletions apps/tangle-dapp/components/HeaderChip/types.ts

This file was deleted.

100 changes: 0 additions & 100 deletions apps/tangle-dapp/components/HowItWorks/index.tsx

This file was deleted.

23 changes: 2 additions & 21 deletions apps/tangle-dapp/components/InputWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,11 @@ import {
InfoIconWithTooltip,
Label,
} from '@webb-tools/webb-ui-components';
import {
Dispatch,
FC,
ReactNode,
SetStateAction,
useCallback,
useEffect,
} from 'react';
import { Dispatch, FC, ReactNode, SetStateAction, useCallback } from 'react';
import { twMerge } from 'tailwind-merge';

import InputAction from '../containers/ManageProfileModalContainer/InputAction';
import { useErrorCountContext } from '../context/ErrorsContext';
import ErrorMessage from './ErrorMessage';
import InputAction from './InputAction';

export type InputWrapperProps = {
title: string;
Expand Down Expand Up @@ -58,23 +50,12 @@ const InputWrapper: FC<InputWrapperProps> = ({
isDisabled = false,
tooltip,
}) => {
const { addError, removeError } = useErrorCountContext();

const toggleDropdown = useCallback(() => {
if (dropdownBody !== undefined && setIsDropdownVisible !== undefined) {
setIsDropdownVisible((isVisible) => !isVisible);
}
}, [dropdownBody, setIsDropdownVisible]);

// TODO: Do not set error (or remove it if already set) if the input is disabled.
useEffect(() => {
if (errorMessage !== undefined) {
addError(id);
} else {
removeError(id);
}
}, [addError, errorMessage, id, removeError]);

// Do not consider the input as having an error if it's disabled.
const hasError = errorMessage !== undefined && !isDisabled;

Expand Down
2 changes: 0 additions & 2 deletions apps/tangle-dapp/components/KeyStatsItem/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ import { AmountFormatStyle } from '../../utils/formatDisplayAmount';
import getLsProtocolDef from '../../utils/liquidStaking/getLsProtocolDef';
import tryEncodeAddressWithPrefix from '../../utils/liquidStaking/tryEncodeAddressWithPrefix';
import pluralize from '../../utils/pluralize';
import { TableStatus } from '..';
import BlueIconButton from '../BlueIconButton';
import PercentageCell from '../tableCells/PercentageCell';
import TokenAmountCell from '../tableCells/TokenAmountCell';
import TableStatus from '../TableStatus';
import LstIcon from './LstIcon';
import UpdateCommissionModal from './UpdateCommissionModal';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import getLsNetwork from '../../utils/liquidStaking/getLsNetwork';
import getLsProtocolDef from '../../utils/liquidStaking/getLsProtocolDef';
import DropdownChevronIcon from '../DropdownChevronIcon';
import InputWrapper from '../InputWrapper';
import LsTokenIcon from '../LsTokenIcon';
import LsTokenIcon from './LsTokenIcon';

type LsProtocolDropdownInputProps = {
id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ import useLsUnbonding from '../../data/liquidStaking/useLsUnbonding';
import useIsAccountConnected from '../../hooks/useIsAccountConnected';
import addCommasToNumber from '../../utils/addCommasToNumber';
import pluralize from '../../utils/pluralize';
import { ContainerSkeleton, TableStatus } from '..';
import { ContainerSkeleton } from '..';
import TokenAmountCell from '../tableCells/TokenAmountCell';
import TableStatus from '../TableStatus';
import LstIcon from './LstIcon';
import WithdrawUnstakeRequestButton from './WithdrawUnstakeRequestButton';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { twMerge } from 'tailwind-merge';

import { LS_DERIVATIVE_TOKEN_PREFIX } from '../../../constants/liquidStaking/constants';
import { LsNetworkId, LsToken } from '../../../constants/liquidStaking/types';
import { ERROR_NOT_ENOUGH_BALANCE } from '../../../containers/ManageProfileModalContainer/Independent/IndependentAllocationInput';
import { ERROR_NOT_ENOUGH_BALANCE } from '../../../containers/liquidStaking/LsCreatePoolModal';
import { useLsStore } from '../../../data/liquidStaking/useLsStore';
import useInputAmount from '../../../hooks/useInputAmount';
import formatBn from '../../../utils/formatBn';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { FC, useCallback, useMemo } from 'react';
import { twMerge } from 'tailwind-merge';

import { IS_PRODUCTION_ENV } from '../../../constants/env';
import { IS_PRODUCTION_ENV } from '../../../constants';
import { LS_NETWORKS } from '../../../constants/liquidStaking/constants';
import { LsNetworkId } from '../../../constants/liquidStaking/types';
import { NETWORK_FEATURE_MAP } from '../../../constants/networks';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import formatBn from '../../../utils/formatBn';
import formatFractional from '../../../utils/formatFractional';
import getLsProtocolDef from '../../../utils/liquidStaking/getLsProtocolDef';
import { ListCardWrapper } from '../../Lists/ListCardWrapper';
import ListStatus from '../../ListStatus';
import SkeletonRows from '../../SkeletonRows';
import ListStatus from '../../Lists/ListStatus';
import SkeletonRows from '../../skeleton/SkeletonRows';
import LstIcon, { LstIconSize } from '../LstIcon';

export type LsSelectLstModalProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { twMerge } from 'tailwind-merge';
import { LS_DERIVATIVE_TOKEN_PREFIX } from '../../../constants/liquidStaking/constants';
import { LsToken } from '../../../constants/liquidStaking/types';
import DropdownChevronIcon from '../../DropdownChevronIcon';
import LsTokenIcon from '../../LsTokenIcon';
import LsTokenIcon from '../LsTokenIcon';

type LsTokenChipProps = {
token?: LsToken;
Expand Down
Loading
Loading