From bca0dab5a7d9001971369edbec91eb11a4adc9a7 Mon Sep 17 00:00:00 2001 From: Marcin Mazurek Date: Wed, 10 Aug 2022 14:48:10 +0200 Subject: [PATCH] [DDW-809] Code review --- source/renderer/app/components/wallet/WalletSendForm.tsx | 4 ++-- .../app/components/wallet/send-form/AssetInput.tsx | 4 ++-- .../wallet/widgets/{Divider.tsx => VerticalSeparator.tsx} | 2 +- source/renderer/app/features/discreet-mode/feature.ts | 8 ++------ source/renderer/app/stores/AssetsStore.ts | 4 +--- storybook/stories/common/Widgets.stories.tsx | 6 ++++++ 6 files changed, 14 insertions(+), 14 deletions(-) rename source/renderer/app/components/wallet/widgets/{Divider.tsx => VerticalSeparator.tsx} (75%) diff --git a/source/renderer/app/components/wallet/WalletSendForm.tsx b/source/renderer/app/components/wallet/WalletSendForm.tsx index c1244a3ff1..060cbd35e9 100755 --- a/source/renderer/app/components/wallet/WalletSendForm.tsx +++ b/source/renderer/app/components/wallet/WalletSendForm.tsx @@ -40,7 +40,7 @@ import type { ReactIntlMessage } from '../../types/i18nTypes'; import { DiscreetWalletAmount } from '../../features/discreet-mode'; import WalletTokenPicker from './tokens/wallet-token-picker/WalletTokenPicker'; import { ClearButton } from './widgets/ClearButton'; -import { Divider } from './widgets/Divider'; +import { VerticalSeparator } from './widgets/VerticalSeparator'; import { AnalyticsTracker, EventCategories } from '../../analytics'; import { CoinSelectionsResponse } from '../../api/transactions/types'; @@ -1147,7 +1147,7 @@ class WalletSendForm extends Component { onClick={this.clearAdaAmountFieldValue} />
- +
)} diff --git a/source/renderer/app/components/wallet/send-form/AssetInput.tsx b/source/renderer/app/components/wallet/send-form/AssetInput.tsx index 6dde6ff1fd..ae2541d470 100644 --- a/source/renderer/app/components/wallet/send-form/AssetInput.tsx +++ b/source/renderer/app/components/wallet/send-form/AssetInput.tsx @@ -11,7 +11,7 @@ import removeIcon from '../../../assets/images/remove.inline.svg'; import type { NumberFormat } from '../../../../../common/types/number.types'; import { DiscreetTokenWalletAmount } from '../../../features/discreet-mode'; import Asset from '../../assets/Asset'; -import { Divider } from '../widgets/Divider'; +import { VerticalSeparator } from '../widgets/VerticalSeparator'; import { ClearButton } from '../widgets/ClearButton'; import styles from './AssetInput.scss'; import messages from './messages'; @@ -152,7 +152,7 @@ class AssetInput extends Component { )} {ticker ? ( <> - + {ticker} ) : null} diff --git a/source/renderer/app/components/wallet/widgets/Divider.tsx b/source/renderer/app/components/wallet/widgets/VerticalSeparator.tsx similarity index 75% rename from source/renderer/app/components/wallet/widgets/Divider.tsx rename to source/renderer/app/components/wallet/widgets/VerticalSeparator.tsx index dee00283b9..d79a795011 100644 --- a/source/renderer/app/components/wallet/widgets/Divider.tsx +++ b/source/renderer/app/components/wallet/widgets/VerticalSeparator.tsx @@ -2,6 +2,6 @@ import React from 'react'; import styles from './Divider.scss'; -export function Divider() { +export function VerticalSeparator() { return ; } diff --git a/source/renderer/app/features/discreet-mode/feature.ts b/source/renderer/app/features/discreet-mode/feature.ts index 54f12fa1a6..9d59a72e99 100644 --- a/source/renderer/app/features/discreet-mode/feature.ts +++ b/source/renderer/app/features/discreet-mode/feature.ts @@ -53,9 +53,7 @@ export class DiscreetMode extends Feature { this.isDiscreetMode = !this.isDiscreetMode; this.analyticsTracker.sendEvent( EventCategories.SETTINGS, - this.isDiscreetMode - ? 'Turned on discreet mode' - : 'Turned off discreet mode' + `Turned ${this.isDiscreetMode ? 'on' : 'off'} discreet mode` ); }; @action @@ -68,9 +66,7 @@ export class DiscreetMode extends Feature { }); this.analyticsTracker.sendEvent( EventCategories.SETTINGS, - nextSetting - ? 'Turned on discreet mode by default' - : 'Turned off discreet mode by default' + `Turned ${nextSetting ? 'on' : 'off'} discreet mode by default` ); }; diff --git a/source/renderer/app/stores/AssetsStore.ts b/source/renderer/app/stores/AssetsStore.ts index 721cbd6588..44d228bb60 100644 --- a/source/renderer/app/stores/AssetsStore.ts +++ b/source/renderer/app/stores/AssetsStore.ts @@ -202,9 +202,7 @@ export default class AssetsStore extends Store { this.analytics.sendEvent( EventCategories.WALLETS, - !isFavorite - ? 'Added token from favorites' - : 'Removed token from favorites' + `${!isFavorite ? 'Added' : 'Removed'} token from favorites` ); }; _retrieveAssetsRequest = (walletId: string): Request => diff --git a/storybook/stories/common/Widgets.stories.tsx b/storybook/stories/common/Widgets.stories.tsx index d53078973a..4bd601e419 100644 --- a/storybook/stories/common/Widgets.stories.tsx +++ b/storybook/stories/common/Widgets.stories.tsx @@ -24,6 +24,7 @@ import ButtonLink from '../../../source/renderer/app/components/widgets/ButtonLi import NormalSwitch from '../../../source/renderer/app/components/widgets/forms/NormalSwitch'; import { Separator } from '../../../source/renderer/app/components/widgets/separator/Separator'; import { CollapsibleSection } from '../../../source/renderer/app/components/widgets/collapsible-section/CollapsibleSection'; +import { VerticalSeparator } from '../../../source/renderer/app/components/wallet/widgets/VerticalSeparator'; const { intl: enIntl } = new IntlProvider({ locale: 'en-US', @@ -266,4 +267,9 @@ storiesOf('Common / Widgets', module) + )) + .add('VerticalSeparator', () => ( + + + ));