Skip to content

Commit

Permalink
Misc: tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
willm30 committed Jan 31, 2023
1 parent 4c3227c commit 6d714d9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 31 deletions.
4 changes: 1 addition & 3 deletions src/Entry.tsx
Expand Up @@ -8,14 +8,13 @@ import layout from '~styles/layout.css';
import '~utils/yup/customMethods'; // ensures custom yup methods are available when components load
import { DialogProvider } from '~shared/Dialog';
// import { TokenActivationProvider } from '~users/TokenActivationProvider';
import { AppContextProvider, getContext, ContextModule } from '~context';

import messages from './i18n/en.json';
import actionMessages from './i18n/en-actions';
import eventsMessages from './i18n/en-events';
import motionMessages from './i18n/en-motions';
import systemMessages from './i18n/en-system-messages';
import Routes from './routes';
import { AppContextProvider, getContext, ContextModule } from '~context';

// @ts-ignore
if (!Intl.RelativeTimeFormat) {
Expand All @@ -41,7 +40,6 @@ const Entry = ({ store }: Props) => {
...actionMessages,
...eventsMessages,
...systemMessages,
...motionMessages,
}}
>
<ApolloProvider client={apolloClient}>
Expand Down
20 changes: 7 additions & 13 deletions src/components/shared/Fields/InputLabel/InputLabel.tsx
@@ -1,8 +1,8 @@
import React, { ReactNode } from 'react';
import { MessageDescriptor, useIntl } from 'react-intl';

import { Message, SimpleMessageValues } from '~types';
import { Message, UniversalMessageValues } from '~types';
import { getMainClasses } from '~utils/css';
import { formatText } from '~utils/intl';

import { InputComponentAppearance as Appearance } from '../Input';
import styles from './InputLabel.css';
Expand All @@ -17,10 +17,10 @@ interface Props {
extra?: ReactNode;

/** Help text (will appear next to label text) */
help?: string | MessageDescriptor;
help?: Message;

/** Values for help text (react-intl interpolation) */
helpValues?: SimpleMessageValues;
helpValues?: UniversalMessageValues;

/** `id` attribute value of accompanied input field */
inputId?: string;
Expand All @@ -29,7 +29,7 @@ interface Props {
label: Message;

/** Values for label text (react-intl interpolation) */
labelValues?: SimpleMessageValues;
labelValues?: UniversalMessageValues;

/** Should only be visible for screenreaders, but not for display users */
screenReaderOnly?: boolean;
Expand All @@ -45,14 +45,8 @@ const InputLabel = ({
labelValues,
screenReaderOnly = false,
}: Props) => {
const { formatMessage } = useIntl();

const helpText =
typeof help === 'object' ? formatMessage(help, helpValues) : help;
const labelText =
typeof inputLabel === 'object'
? formatMessage(inputLabel, labelValues)
: inputLabel;
const helpText = formatText(help, helpValues);
const labelText = formatText(inputLabel, labelValues);

return (
<label
Expand Down
21 changes: 6 additions & 15 deletions src/utils/web3/index.ts
@@ -1,24 +1,15 @@
import BN from 'bn.js';
import { getAddress, hexlify } from 'ethers/lib.esm/utils';
import { ClientType, TokenClientType } from '@colony/colony-js';

import { Address, ExtendedClientType } from '~types';
import { ExtendedClientType } from '~types';
import { TransactionError } from '~redux/immutable/Transaction';
import { NETWORK_DATA } from '~constants';

export const createAddress = (address: string): Address => getAddress(address);

// @TODO ethers v5 will have an isAddress utility function
export const isAddress = (address: string) => {
try {
getAddress(address);
} catch {
return false;
}
return true;
};

export const toHex = hexlify;
export {
isAddress,
hexlify as toHex,
getAddress as createAddress,
} from 'ethers/lib.esm/utils';

export type Unit =
| 'noether'
Expand Down

0 comments on commit 6d714d9

Please sign in to comment.