Skip to content

Commit

Permalink
fix eslint errors and old modals crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
nistadev committed Nov 17, 2023
1 parent 5d3e104 commit 893cd5b
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 65 deletions.
25 changes: 12 additions & 13 deletions packages/yoroi-extension/app/components/topbar/WalletListDialog.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
// @flow
import { BigNumber } from 'bignumber.js';
import type { Node } from 'react';
import type { $npm$ReactIntl$IntlFormat } from 'react-intl';
import type { TokenLookupKey } from '../../api/common/lib/MultiToken';
import type { TokenRow } from '../../api/ada/lib/storage/database/primitives/tables';
import type { UnitOfAccountSettingType } from '../../types/unitOfAccountType';
import type { WalletsNavigation } from '../../api/localStorage';
import { BigNumber } from 'bignumber.js';
import { Component } from 'react';
import { observer } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
import Dialog from '../widgets/Dialog';
import DialogCloseButton from '../widgets/DialogCloseButton';
import styles from './WalletListDialog.scss';
import type { $npm$ReactIntl$IntlFormat } from 'react-intl';
import { ReactComponent as IconEyeOpen } from '../../assets/images/my-wallets/icon_eye_open.inline.svg';
import { ReactComponent as IconEyeClosed } from '../../assets/images/my-wallets/icon_eye_closed.inline.svg';
import type { TokenLookupKey } from '../../api/common/lib/MultiToken';
import type { TokenRow } from '../../api/ada/lib/storage/database/primitives/tables';
import { MultiToken } from '../../api/common/lib/MultiToken';
import WalletCard from './WalletCard';
import { DragDropContext, Droppable } from 'react-beautiful-dnd';
import globalMessages from '../../i18n/global-messages';
import type { UnitOfAccountSettingType } from '../../types/unitOfAccountType';
import AmountDisplay, { FiatDisplay } from '../common/AmountDisplay';
import type { WalletsNavigation } from '../../api/localStorage';
import { Button, Stack } from '@mui/material';
import { Box } from '@mui/system';
import { PublicDeriver } from '../../api/ada/lib/storage/models/PublicDeriver';
import Dialog from '../widgets/Dialog';
import DialogCloseButton from '../widgets/DialogCloseButton';
import styles from './WalletListDialog.scss';
import WalletCard from './WalletCard';
import globalMessages from '../../i18n/global-messages';
import AmountDisplay, { FiatDisplay } from '../common/AmountDisplay';

const messages = defineMessages({
addWallet: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
import type { Node } from 'react';
import type { Notification } from '../../types/notificationType';
import type { $npm$ReactIntl$IntlFormat } from 'react-intl';
import classnames from 'classnames';
import { Component } from 'react';
import { observer } from 'mobx-react';
import { intlShape, defineMessages } from 'react-intl';
import { buildURI } from '../../utils/URIHandling';
import { ReactComponent as InfoIcon } from '../../assets/images/revamp/icons/info.inline.svg';
import { Box, Typography } from '@mui/material';
import classnames from 'classnames';
import Dialog from '../widgets/Dialog';
import DialogBackButton from '../widgets/DialogBackButton';
import DialogCloseButton from '../widgets/DialogCloseButton';
import QrCodeWrapper from '../widgets/QrCodeWrapper';
import WarningBox from '../widgets/WarningBox';
import CopyableAddress from '../widgets/CopyableAddress';
import BigNumber from 'bignumber.js';

import styles from './URIDisplayDialog.scss';
import { Box, Typography } from '@mui/material';
import globalMessages from '../../i18n/global-messages';

const messages = defineMessages({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,38 @@
/* eslint react/jsx-one-expression-per-line: 0 */ // the   in the html breaks this

import type { Node, ComponentType } from 'react';
import type { $npm$ReactIntl$IntlFormat } from 'react-intl';
import type { Notification } from '../../../types/notificationType';
import type { StandardAddress } from '../../../types/AddressFilterTypes';
import type { Addressing } from '../../../api/ada/lib/storage/models/PublicDeriver/interfaces';
import type { ComplexityLevelType } from '../../../types/complexityLevelType';
import type { InjectedLayoutProps } from '../../../styles/context/layout';
import { Component } from 'react';
import { observer } from 'mobx-react';
import classnames from 'classnames';
import { defineMessages, intlShape } from 'react-intl';
import { toDerivationPathString } from '../../../api/common/lib/crypto/keys/path';

import QrCodeWrapper from '../../widgets/QrCodeWrapper';
import DialogClassic from '../../widgets/Dialog';
import DialogRevamp from '../../widgets/DialogRevamp';
import DialogCloseButton from '../../widgets/DialogCloseButton';
import ErrorBlock from '../../widgets/ErrorBlock';
import RawHash from '../../widgets/hashWrappers/RawHash';
import ExplorableHashContainer from '../../../containers/widgets/ExplorableHashContainer';
import { SelectedExplorer } from '../../../domain/SelectedExplorer';

import LocalizableError from '../../../i18n/LocalizableError';
import globalMessages from '../../../i18n/global-messages';
import styles from './VerifyAddressDialog.scss';
import type { $npm$ReactIntl$IntlFormat } from 'react-intl';
import { truncateAddress } from '../../../utils/formatters';
import CopyableAddress from '../../widgets/CopyableAddress';
import type { Notification } from '../../../types/notificationType';
import type { StandardAddress } from '../../../types/AddressFilterTypes';
import type { Addressing } from '../../../api/ada/lib/storage/models/PublicDeriver/interfaces';
import { CoreAddressTypes } from '../../../api/ada/lib/storage/database/primitives/enums';
import { RustModule } from '../../../api/ada/lib/cardanoCrypto/rustLoader';
import {
isCardanoHaskellAddress,
getCardanoSpendingKeyHash,
normalizeToAddress,
} from '../../../api/ada/lib/storage/bridge/utils';
import type { ComplexityLevelType } from '../../../types/complexityLevelType';
import { ComplexityLevels } from '../../../types/complexityLevelType';
import { withLayout } from '../../../styles/context/layout';
import type { InjectedLayoutProps } from '../../../styles/context/layout';
import classnames from 'classnames';
import QrCodeWrapper from '../../widgets/QrCodeWrapper';
import Dialog from '../../widgets/Dialog';
import DialogCloseButton from '../../widgets/DialogCloseButton';
import ErrorBlock from '../../widgets/ErrorBlock';
import RawHash from '../../widgets/hashWrappers/RawHash';
import ExplorableHashContainer from '../../../containers/widgets/ExplorableHashContainer';
import LocalizableError from '../../../i18n/LocalizableError';
import globalMessages from '../../../i18n/global-messages';
import styles from './VerifyAddressDialog.scss';
import CopyableAddress from '../../widgets/CopyableAddress';

const messages = defineMessages({
addressDetailsTitleLabel: {
Expand Down Expand Up @@ -78,7 +75,6 @@ class VerifyAddressDialog extends Component<Props & InjectedLayoutProps> {

render(): Node {
const { intl } = this.context;
const { isRevampLayout } = this.props;

const dialogActions = !this.props.isHardware
? []
Expand All @@ -91,8 +87,6 @@ class VerifyAddressDialog extends Component<Props & InjectedLayoutProps> {
},
];

const Dialog = isRevampLayout ? DialogClassic : DialogRevamp;

return (
<Dialog
className={classnames([styles.component, 'VerifyAddressDialog'])}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
// @flow
/* eslint react/jsx-one-expression-per-line: 0 */ // the &nbsp; in the html breaks this
import { Component } from 'react';
import type { Node } from 'react';
import { observer } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
import Dialog from '../../../widgets/Dialog';
import styles from './AddNFTDialog.scss';
import type { $npm$ReactIntl$IntlFormat } from 'react-intl';
import { MultiToken } from '../../../../api/common/lib/MultiToken';
import { ReactComponent as SearchIcon } from '../../../../assets/images/assets-page/search.inline.svg';
import { ReactComponent as NoItemsFoundImg } from '../../../../assets/images/assets-page/no-nfts.inline.svg';
import { getNFTs } from '../../../../utils/wallet';
import type { FormattedNFTDisplay } from '../../../../utils/wallet';
import BigNumber from 'bignumber.js';
import type { TokenLookupKey } from '../../../../api/common/lib/MultiToken';
import type {
TokenRow,
NetworkRow,
} from '../../../../api/ada/lib/storage/database/primitives/tables';
import { Button, OutlinedInput, Typography } from '@mui/material';
import { Component } from 'react';
import { observer } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
import { MultiToken } from '../../../../api/common/lib/MultiToken';
import { ReactComponent as SearchIcon } from '../../../../assets/images/assets-page/search.inline.svg';
import { ReactComponent as NoItemsFoundImg } from '../../../../assets/images/assets-page/no-nfts.inline.svg';
import { getNFTs } from '../../../../utils/wallet';
import { OutlinedInput, Typography } from '@mui/material';
import { isCardanoHaskell } from '../../../../api/ada/lib/storage/database/prepackaged/networks';
import { Box } from '@mui/system';
import { ampli } from '../../../../../ampli/index';
import MinAda from './MinAda';
import Dialog from '../../../widgets/Dialog';
import styles from './AddNFTDialog.scss';
import BigNumber from 'bignumber.js';
import NFTImage from './NFTImage';
import globalMessages from '../../../../i18n/global-messages';
import MaxAssetsError from '../MaxAssetsError';
import { Box } from '@mui/system';
import { ampli } from '../../../../../ampli/index';

type Props = {|
+onClose: void => void,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ import { Component } from 'react';
import { observer } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
import { MultiToken } from '../../../../api/common/lib/MultiToken';
import { Button, Typography } from '@mui/material';
import { Typography } from '@mui/material';
import { isCardanoHaskell } from '../../../../api/ada/lib/storage/database/prepackaged/networks';
import { compareNumbers, compareStrings } from '../../assets/AssetsList';
import { getTokens } from '../../../../utils/wallet';
import { Box } from '@mui/system';
import { formattedAmountToNaturalUnits } from '../../../../utils/formatters';
import Dialog from '../../../widgets/Dialog';
import styles from './AddTokenDialog.scss';
import { ReactComponent as SearchIcon } from '../../../../assets/images/assets-page/search.inline.svg';
import { ReactComponent as ArrowsListFromBottom } from '../../../../assets/images/assets-page/arrows-list-from-bottom.inline.svg';
import { ReactComponent as ArrowsListFromTop } from '../../../../assets/images/assets-page/arrows-list-from-top.inline.svg';
import { ReactComponent as InfoIcon } from '../../../../assets/images/revamp/fingerprint-info.inline.svg';
import { ReactComponent as ArrowsList } from '../../../../assets/images/assets-page/arrows-list.inline.svg';
import { ReactComponent as NoItemsFoundImg } from '../../../../assets/images/assets-page/no-tokens.inline.svg';
import { ampli } from '../../../../../ampli/index';
import Dialog from '../../../widgets/Dialog';
import styles from './AddTokenDialog.scss';
import SingleTokenRow from './SingleTokenRow';
import BigNumber from 'bignumber.js';
import MinAda from './MinAda';
import globalMessages from '../../../../i18n/global-messages';
import MaxAssetsError from '../MaxAssetsError';
import OutlinedInput from '@mui/material/OutlinedInput';
import { ampli } from '../../../../../ampli/index';

type Props = {|
+onClose: void => void,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default class ChangeWalletPasswordDialog extends Component<Props> {
render(): Node {
const { form } = this;
const { intl } = this.context;
const { onCancel, isSubmitting, dialogData, error, isClassicTheme, isRevampTheme } = this.props;
const { onCancel, isSubmitting, dialogData, error, isClassicTheme } = this.props;

const dialogClasses = classnames(['changePasswordDialog', styles.dialog]);

Expand Down
5 changes: 2 additions & 3 deletions packages/yoroi-extension/app/components/widgets/Dialog.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-nested-ternary */
// @flow
import type { Node, Element, ComponentType } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import React, { useEffect, useState } from 'react';
import classnames from 'classnames';
import { map } from 'lodash';
import { IconButton, Modal, Typography, alpha } from '@mui/material';
Expand Down Expand Up @@ -55,7 +55,6 @@ function DialogFn(props: Props & InjectedProps): Node {
isRevampLayout,
} = props;

const hasScroll = useRef(null);
const [contentHasScroll, setContentHasScroll] = useState(false);

useEffect(() => {
Expand Down Expand Up @@ -206,7 +205,7 @@ const ModalContainer = styled(Box)(({ theme, contentHasScroll }) => ({
: '648px',
borderRadius: theme.name === 'classic' ? 0 : 8,
paddingTop: theme.name === 'classic' ? '25px' : '0px',
paddingBottom: theme.name === 'classic' ? '30px' : '0px',
paddingBottom: theme.name === 'classic' || theme.name === 'modern' ? '30px' : '0px',
maxWidth: theme.name === 'classic' ? '785px' : '824px',
backgroundColor: 'var(--yoroi-comp-dialog-background)',
color: 'var(--yoroi-comp-dialog-text)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import type { Node, ComponentType } from 'react';
import type { Props } from './Dialog';
import { withLayout } from '../../styles/context/layout';
import type { InjectedLayoutProps } from '../../styles/context/layout';
import DialogClassic from './Dialog';
import DialogRevamp from './DialogRevamp';
import Dialog from './Dialog';

class ThemedDialog extends Component<Props & InjectedLayoutProps> {
render(): Node {
const {
isRevampLayout,
children,
title,
actions,
Expand All @@ -20,7 +18,6 @@ class ThemedDialog extends Component<Props & InjectedLayoutProps> {
closeButton,
backButton,
} = this.props;
const Dialog = DialogClassic;

const dialogProps = {
title,
Expand All @@ -31,6 +28,7 @@ class ThemedDialog extends Component<Props & InjectedLayoutProps> {
className,
backButton,
};

return <Dialog {...dialogProps}>{children}</Dialog>;
}
}
Expand Down

0 comments on commit 893cd5b

Please sign in to comment.