run nx format (#295)

This commit is contained in:
Dexter Edwards 2022-04-25 15:03:58 +01:00 committed by GitHub
parent 037108b4d7
commit ce5d7bc15b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
135 changed files with 868 additions and 864 deletions

View File

@ -1,8 +1,7 @@
---
name: Auto Assign Issue to New Project
"on":
'on':
issues:
types: [opened]

View File

@ -1,16 +1,16 @@
import { ApolloClient, from, HttpLink, InMemoryCache } from "@apollo/client";
import { onError } from "@apollo/client/link/error";
import { RetryLink } from "@apollo/client/link/retry";
import { ApolloClient, from, HttpLink, InMemoryCache } from '@apollo/client';
import { onError } from '@apollo/client/link/error';
import { RetryLink } from '@apollo/client/link/retry';
export function createClient(base?: string) {
if (!base) {
throw new Error("Base must be passed into createClient!");
throw new Error('Base must be passed into createClient!');
}
const gqlPath = "query";
const gqlPath = 'query';
const urlHTTP = new URL(gqlPath, base);
const urlWS = new URL(gqlPath, base);
// Replace http with ws, preserving if its a secure connection eg. https => wss
urlWS.protocol = urlWS.protocol.replace("http", "ws");
urlWS.protocol = urlWS.protocol.replace('http', 'ws');
const cache = new InMemoryCache({
typePolicies: {
@ -37,7 +37,7 @@ export function createClient(base?: string) {
const httpLink = new HttpLink({
uri: urlHTTP.href,
credentials: "same-origin",
credentials: 'same-origin',
});
const errorLink = onError(({ graphQLErrors, networkError }) => {
@ -46,7 +46,7 @@ export function createClient(base?: string) {
});
return new ApolloClient({
connectToDevTools: process.env["NODE_ENV"] === "development",
connectToDevTools: process.env['NODE_ENV'] === 'development',
link: from([errorLink, retryLink, httpLink]),
cache,
});

View File

@ -1,4 +1,4 @@
@import "./styles/colors";
@import './styles/colors';
.app {
max-width: 1300px;

View File

@ -1 +1 @@
export { AddLockedTokenAddress } from "./add-locked-token";
export { AddLockedTokenAddress } from './add-locked-token';

View File

@ -1 +1 @@
export { AddTokenButton, AddTokenButtonLink } from "./add-token-button";
export { AddTokenButton, AddTokenButtonLink } from './add-token-button';

View File

@ -1,4 +1,4 @@
@import "../../styles/colors";
@import '../../styles/colors';
.app-banner {
background: $white;

View File

@ -1,7 +1,7 @@
import "./app-banner.scss";
import './app-banner.scss';
import { useAppState } from "../../contexts/app-state/app-state-context";
import { Error } from "../icons";
import { useAppState } from '../../contexts/app-state/app-state-context';
import { Error } from '../icons';
export const AppBanner = () => {
const {

View File

@ -1 +1 @@
export * from "./app-banner";
export * from './app-banner';

View File

@ -1 +1 @@
export * from "./app-footer";
export * from './app-footer';

View File

@ -1 +1 @@
export * from "./balance-manager";
export * from './balance-manager';

View File

@ -1,4 +1,4 @@
@import "../../styles/colors";
@import '../../styles/colors';
.bullet-header {
font-size: 16px;
@ -10,7 +10,7 @@
width: 100%;
&::before {
content: "";
content: '';
display: inline-block;
width: 12px;
height: 12px;

View File

@ -1,9 +1,9 @@
import "./bullet-header.scss";
import './bullet-header.scss';
import React from "react";
import React from 'react';
interface BulletHeaderProps {
tag: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
children: React.ReactNode;
style?: React.CSSProperties;
}
@ -11,7 +11,7 @@ interface BulletHeaderProps {
export const BulletHeader = ({ tag, children, style }: BulletHeaderProps) => {
return React.createElement(
tag,
{ className: "bullet-header", style },
{ className: 'bullet-header', style },
children
);
};

View File

@ -1 +1 @@
export * from "./bullet-header";
export * from './bullet-header';

View File

@ -1,4 +1,4 @@
@import "../../styles/colors";
@import '../../styles/colors';
.connected-vega-key {
color: $white;

View File

@ -1,15 +1,15 @@
import "./connected-vega-key.scss";
import './connected-vega-key.scss';
import { useTranslation } from "react-i18next";
import { useTranslation } from 'react-i18next';
import { ConnectToVega } from "../../routes/staking/connect-to-vega";
import { ConnectToVega } from '../../routes/staking/connect-to-vega';
export const ConnectedVegaKey = ({ pubKey }: { pubKey: string | null }) => {
const { t } = useTranslation();
return (
<section className="connected-vega-key">
<strong data-testid="connected-vega-key-label">
{pubKey ? t("Connected Vega key") : <ConnectToVega />}
{pubKey ? t('Connected Vega key') : <ConnectToVega />}
</strong>
<p data-testid="connected-vega-key">{pubKey}</p>
</section>

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
export { CountrySelector } from "./country-selector";
export { CountrySelector } from './country-selector';

View File

@ -1 +1 @@
export * from "./epoch-countdown";
export * from './epoch-countdown';

View File

@ -1 +1 @@
export * from "./eth-connect-promp";
export * from './eth-connect-promp';

View File

@ -1 +1 @@
export * from "./eth-wallet-container";
export * from './eth-wallet-container';

View File

@ -1,5 +1,5 @@
@import "../../styles/colors";
@import "../../styles/fonts";
@import '../../styles/colors';
@import '../../styles/fonts';
.eth-wallet {
&__pending-tx-button {

View File

@ -1 +1 @@
export * from "./eth-wallet";
export * from './eth-wallet';

View File

@ -1,7 +1,7 @@
import { ApolloProvider } from "@apollo/client";
import React from "react";
import { ApolloProvider } from '@apollo/client';
import React from 'react';
import { client } from "../../lib/apollo-client";
import { client } from '../../lib/apollo-client';
export const GraphQlProvider = ({
children,

View File

@ -1 +1 @@
export * from "./graphql-provider";
export * from './graphql-provider';

View File

@ -1 +1 @@
export { Heading } from "./heading";
export { Heading } from './heading';

View File

@ -1,6 +1,6 @@
import "./icons.scss";
import './icons.scss';
export * from "./error";
export * from "./tick";
export * from "./hand-up";
export * from "./ethereum";
export * from './error';
export * from './tick';
export * from './hand-up';
export * from './ethereum';

View File

@ -1 +1 @@
export { KeyValueTable, KeyValueTableRow } from './key-value-table'
export { KeyValueTable, KeyValueTableRow } from './key-value-table';

View File

@ -1,7 +1,7 @@
@import "../../styles/colors";
@import "../../styles/fonts";
@import '../../styles/colors';
@import '../../styles/fonts';
$ns: "key-value-table";
$ns: 'key-value-table';
.#{$ns}__header,
.#{$ns}__footer {

View File

@ -1,12 +1,12 @@
import { render, screen } from "@testing-library/react";
import { render, screen } from '@testing-library/react';
import { KeyValueTable, KeyValueTableRow } from "./key-value-table";
import { KeyValueTable, KeyValueTableRow } from './key-value-table';
const props = {
title: "Title",
title: 'Title',
};
it("Renders the correct elements", () => {
it('Renders the correct elements', () => {
const { container } = render(
<KeyValueTable {...props}>
<KeyValueTableRow>
@ -22,20 +22,20 @@ it("Renders the correct elements", () => {
expect(screen.getByText(props.title)).toBeInTheDocument();
expect(container.querySelector(".key-value-table")).toBeInTheDocument();
expect(container.querySelectorAll(".key-value-table__row")).toHaveLength(2);
expect(container.querySelector('.key-value-table')).toBeInTheDocument();
expect(container.querySelectorAll('.key-value-table__row')).toHaveLength(2);
const rows = container.querySelectorAll(".key-value-table__row");
const rows = container.querySelectorAll('.key-value-table__row');
// Row 1
expect(rows[0].firstChild).toHaveTextContent("My label");
expect(rows[0].children[1]).toHaveTextContent("My value");
expect(rows[0].firstChild).toHaveTextContent('My label');
expect(rows[0].children[1]).toHaveTextContent('My value');
// Row 2
expect(rows[1].firstChild).toHaveTextContent("My label 2");
expect(rows[1].children[1]).toHaveTextContent("My value 2");
expect(rows[1].firstChild).toHaveTextContent('My label 2');
expect(rows[1].children[1]).toHaveTextContent('My value 2');
});
it("Applies numeric class if prop is passed", () => {
it('Applies numeric class if prop is passed', () => {
render(
<KeyValueTable numerical={true} {...props}>
<KeyValueTableRow>
@ -45,12 +45,12 @@ it("Applies numeric class if prop is passed", () => {
</KeyValueTable>
);
expect(screen.getByTestId("key-value-table")).toHaveClass(
"key-value-table--numerical"
expect(screen.getByTestId('key-value-table')).toHaveClass(
'key-value-table--numerical'
);
});
it("Applies muted class if prop is passed", () => {
it('Applies muted class if prop is passed', () => {
render(
<KeyValueTable muted={true} {...props}>
<KeyValueTableRow>
@ -60,7 +60,7 @@ it("Applies muted class if prop is passed", () => {
</KeyValueTable>
);
expect(screen.getByTestId("key-value-table")).toHaveClass(
"key-value-table--muted"
expect(screen.getByTestId('key-value-table')).toHaveClass(
'key-value-table--muted'
);
});

View File

@ -1,6 +1,6 @@
import "./key-value-table.scss";
import './key-value-table.scss';
import * as React from "react";
import * as React from 'react';
export interface KeyValueTableProps
extends React.HTMLAttributes<HTMLTableElement> {
@ -24,10 +24,10 @@ export const KeyValueTable = ({
<table
data-testid="key-value-table"
{...rest}
className={`key-value-table ${className ? className : ""} ${
numerical ? "key-value-table--numerical" : ""
className={`key-value-table ${className ? className : ''} ${
numerical ? 'key-value-table--numerical' : ''
}
${muted ? "key-value-table--muted" : ""}`}
${muted ? 'key-value-table--muted' : ''}`}
>
<tbody>{children}</tbody>
</table>
@ -49,7 +49,7 @@ export const KeyValueTableRow = ({
return (
<tr
{...rest}
className={`key-value-table__row ${className ? className : ""}`}
className={`key-value-table__row ${className ? className : ''}`}
>
{children[0]}
{children[1]}

View File

@ -1 +1 @@
export * from "./loader";
export * from './loader';

View File

@ -1,6 +1,6 @@
import "./loader.scss";
import './loader.scss';
import React from "react";
import React from 'react';
interface LoaderProps {
invert?: boolean;
@ -8,7 +8,7 @@ interface LoaderProps {
export const Loader = ({ invert = false }: LoaderProps) => {
const [, forceRender] = React.useState(false);
const className = ["loader", invert ? "loader--dark" : ""].join(" ");
const className = ['loader', invert ? 'loader--dark' : ''].join(' ');
React.useEffect(() => {
const interval = setInterval(() => {

View File

@ -1 +1 @@
export { LockedProgress } from "./locked-progress";
export { LockedProgress } from './locked-progress';

View File

@ -1,5 +1,5 @@
@import "../../styles/colors";
@import "../../styles/fonts";
@import '../../styles/colors';
@import '../../styles/fonts';
.tranche-item {
&__progress {

View File

@ -1 +1 @@
export * from "./modal";
export * from './modal';

View File

@ -1,4 +1,4 @@
@import "../../styles/colors";
@import '../../styles/colors';
.modal {
left: calc(50vw - 200px);

View File

@ -1,6 +1,6 @@
import "./modal.scss";
import './modal.scss';
import React from "react";
import React from 'react';
interface ModalProps {
children: React.ReactNode;

View File

@ -1 +1 @@
export * from "./nav";
export * from './nav';

View File

@ -1,4 +1,4 @@
@import "../../styles/colors";
@import '../../styles/colors';
.nav {
padding: 20px;
@ -28,7 +28,7 @@
&--inverted {
border-bottom: none;
background: $vega-yellow3 url("../../images/clouds.png");
background: $vega-yellow3 url('../../images/clouds.png');
background-repeat: no-repeat;
background-size: cover;
background-position: 0 -300px;
@ -85,7 +85,7 @@
}
&__drawer {
background-image: url("../../images/banner.png");
background-image: url('../../images/banner.png');
display: flex;
flex-flow: column nowrap;
justify-content: space-between;

View File

@ -1,4 +1,4 @@
@import "../../styles/colors";
@import '../../styles/colors';
.template-sidebar {
border-bottom: 1px solid $white;
@ -15,7 +15,7 @@
aside {
padding: 20px;
background-image: url("../../images/banner.png");
background-image: url('../../images/banner.png');
background-size: 100% auto;
}

View File

@ -1,8 +1,8 @@
import "./template-sidebar.scss";
import './template-sidebar.scss';
import React from "react";
import React from 'react';
import { Nav } from "../nav";
import { Nav } from '../nav';
export interface TemplateSidebarProps {
children: React.ReactNode;

View File

@ -1 +1 @@
export * from "./splash-error";
export * from './splash-error';

View File

@ -1,4 +1,4 @@
@import "../../styles/colors";
@import '../../styles/colors';
.splash-error__icon {
display: flex;

View File

@ -1,6 +1,6 @@
import "./splash-error.scss";
import './splash-error.scss';
import { useTranslation } from "react-i18next";
import { useTranslation } from 'react-i18next';
export const SplashError = () => {
const { t } = useTranslation();
@ -10,7 +10,7 @@ export const SplashError = () => {
<span />
<span />
</div>
{t("networkDown")}
{t('networkDown')}
</div>
);
};

View File

@ -1 +1 @@
export * from "./splash-loader";
export * from './splash-loader';

View File

@ -1,4 +1,4 @@
@import "../../styles/colors";
@import '../../styles/colors';
.loading {
display: flex;

View File

@ -1,8 +1,8 @@
import "./splash-loader.scss";
import './splash-loader.scss';
import React from "react";
import React from 'react';
export const SplashLoader = ({ text = "Loading" }: { text?: string }) => {
export const SplashLoader = ({ text = 'Loading' }: { text?: string }) => {
const [, forceRender] = React.useState(false);
React.useEffect(() => {
const interval = setInterval(() => {

View File

@ -1 +1 @@
export * from "./stateful-button";
export * from './stateful-button';

View File

@ -1,4 +1,4 @@
@import "../../styles/colors";
@import '../../styles/colors';
.stateful-button {
display: flex;

View File

@ -1 +1 @@
export { SyntaxHighlighter } from "./syntax-highlighter";
export { SyntaxHighlighter } from './syntax-highlighter';

View File

@ -1,11 +1,11 @@
import { render, screen } from "@testing-library/react";
import { render, screen } from '@testing-library/react';
import { SyntaxHighlighter } from "./syntax-highlighter";
import { SyntaxHighlighter } from './syntax-highlighter';
it("Renders test id and content", () => {
it('Renders test id and content', () => {
const data = {};
render(<SyntaxHighlighter data={data} />);
expect(screen.getByTestId("syntax-highlighter")).toHaveTextContent(
expect(screen.getByTestId('syntax-highlighter')).toHaveTextContent(
JSON.stringify(data, null, 2)
);
});

View File

@ -1 +1 @@
export * from "./token-input";
export * from './token-input';

View File

@ -1 +1 @@
export * from "./transaction-button";
export * from './transaction-button';

View File

@ -1,4 +1,4 @@
@import "../../styles/colors";
@import '../../styles/colors';
.transaction-button {
margin-bottom: 20px;

View File

@ -1 +1 @@
export { TransactionCallout } from "./transaction-callout";
export { TransactionCallout } from './transaction-callout';

View File

@ -1 +1 @@
export * from "./transactions-modal";
export * from './transactions-modal';

View File

@ -1,4 +1,4 @@
@import "../../styles/colors";
@import '../../styles/colors';
.transactions-modal {
&__table {

View File

@ -1 +1 @@
export * from "./vega-wallet-container";
export * from './vega-wallet-container';

View File

@ -1,12 +1,12 @@
import { useTranslation } from "react-i18next";
import { useTranslation } from 'react-i18next';
import { Colors, Links } from "../../config";
import { Colors, Links } from '../../config';
export const DownloadWalletPrompt = () => {
const { t } = useTranslation();
return (
<>
<h3>{t("getWallet")}</h3>
<h3>{t('getWallet')}</h3>
<p style={{ margin: 0 }}>
<a
style={{ color: Colors.DEEMPHASISE }}
@ -14,7 +14,7 @@ export const DownloadWalletPrompt = () => {
target="_blank"
rel="noreferrer"
>
{t("readGuide")}
{t('readGuide')}
</a>
</p>
<p style={{ margin: 0 }}>
@ -24,7 +24,7 @@ export const DownloadWalletPrompt = () => {
target="_blank"
rel="noreferrer"
>
{t("downloadWallet")}
{t('downloadWallet')}
</a>
</p>
</>

View File

@ -1 +1 @@
export * from "./vega-wallet";
export * from './vega-wallet';

View File

@ -1,5 +1,5 @@
@import "../../styles/colors";
@import "../../styles/fonts";
@import '../../styles/colors';
@import '../../styles/fonts';
.vega-wallet {
&__connect {

View File

@ -1 +1 @@
export * from "./wallet-card";
export * from './wallet-card';

View File

@ -1 +1 @@
export * from "./web3-connector";
export * from './web3-connector';

View File

@ -1,24 +1,24 @@
export const Colors = {
WHITE: "#FFF",
RED: "#ED1515",
PINK: "#ff2d5e",
GREEN: "#26ff8a",
TEXT: "#c7c7c7",
WHITE: '#FFF',
RED: '#ED1515',
PINK: '#ff2d5e',
GREEN: '#26ff8a',
TEXT: '#c7c7c7',
BLACK: "#000",
DEEMPHASISE: "#8a9ba8",
GRAY_DARK_1: "#292929",
GRAY_DARK_2: "#333",
GRAY: "#494949",
GRAY_LIGHT: "#ccc",
GRAY_LIGHT_1: "#6e6e6e",
GREEN_DARK: "#246340", // Same as GREEN_TRANSPARENT given a background of #1f1f1f
GREEN_TRANSPARENT: "rgba(38, 255, 138, 0.3)",
RED_TRANSPARENT: "rgba(255, 38, 65, 0.3)",
TRANSPARENT: "rgba(0,0,0,0)",
BLACK: '#000',
DEEMPHASISE: '#8a9ba8',
GRAY_DARK_1: '#292929',
GRAY_DARK_2: '#333',
GRAY: '#494949',
GRAY_LIGHT: '#ccc',
GRAY_LIGHT_1: '#6e6e6e',
GREEN_DARK: '#246340', // Same as GREEN_TRANSPARENT given a background of #1f1f1f
GREEN_TRANSPARENT: 'rgba(38, 255, 138, 0.3)',
RED_TRANSPARENT: 'rgba(255, 38, 65, 0.3)',
TRANSPARENT: 'rgba(0,0,0,0)',
VEGA_RED: "#ff261a",
VEGA_ORANGE: "#d9822b",
VEGA_GREEN: "#26ff8a",
VEGA_YELLOW: "#daff0d",
VEGA_RED: '#ff261a',
VEGA_ORANGE: '#d9822b',
VEGA_GREEN: '#26ff8a',
VEGA_YELLOW: '#daff0d',
};

View File

@ -1,6 +1,6 @@
export * from "./colors";
export * from "./flags";
export * from "./ethereum";
export * from "./links";
export * from "./network-params";
export * from "./vega";
export * from './colors';
export * from './flags';
export * from './ethereum';
export * from './links';
export * from './network-params';
export * from './vega';

View File

@ -1,15 +1,15 @@
export const Links = {
WALLET_RELEASES: "https://github.com/vegaprotocol/vegawallet-desktop/releases",
WALLET_GUIDE:
"https://docs.vega.xyz/docs/tools/vega-wallet",
SUSHI_PAIRS: "https://analytics.sushi.com/pairs/",
SUSHI_ONSEN_MENU: "https://app.sushi.com/farm",
WALLET_RELEASES:
'https://github.com/vegaprotocol/vegawallet-desktop/releases',
WALLET_GUIDE: 'https://docs.vega.xyz/docs/tools/vega-wallet',
SUSHI_PAIRS: 'https://analytics.sushi.com/pairs/',
SUSHI_ONSEN_MENU: 'https://app.sushi.com/farm',
SUSHI_ONSEN_WHAT_IS:
"https://docs.sushi.com/products/yield-farming/what-is-onsen",
SUSHI_ONSEN_FAQ: "https://docs.sushi.com/faq-1/onsen-faq",
FEEDBACK: "https://github.com/vegaprotocol/feedback/discussions",
GITHUB: "https://github.com/vegaprotocol/token-frontend",
DISCORD: "https://vega.xyz/discord",
'https://docs.sushi.com/products/yield-farming/what-is-onsen',
SUSHI_ONSEN_FAQ: 'https://docs.sushi.com/faq-1/onsen-faq',
FEEDBACK: 'https://github.com/vegaprotocol/feedback/discussions',
GITHUB: 'https://github.com/vegaprotocol/token-frontend',
DISCORD: 'https://vega.xyz/discord',
STAKING_GUIDE:
"https://docs.vega.xyz/docs/concepts/vega-chain/#staking-on-vega",
'https://docs.vega.xyz/docs/concepts/vega-chain/#staking-on-vega',
};

View File

@ -1,21 +1,21 @@
export const NetworkParams = {
ETHEREUM_CONFIG: "blockchains.ethereumConfig",
REWARD_ASSET: "reward.asset",
REWARD_PAYOUT_DURATION: "reward.staking.delegation.payoutDelay",
ETHEREUM_CONFIG: 'blockchains.ethereumConfig',
REWARD_ASSET: 'reward.asset',
REWARD_PAYOUT_DURATION: 'reward.staking.delegation.payoutDelay',
GOV_UPDATE_MARKET_REQUIRED_MAJORITY:
"governance.proposal.updateMarket.requiredMajority",
'governance.proposal.updateMarket.requiredMajority',
GOV_UPDATE_MARKET_REQUIRED_PARTICIPATION:
"governance.proposal.updateMarket.requiredParticipation",
'governance.proposal.updateMarket.requiredParticipation',
GOV_NEW_MARKET_REQUIRED_MAJORITY:
"governance.proposal.market.requiredMajority",
'governance.proposal.market.requiredMajority',
GOV_NEW_MARKET_REQUIRED_PARTICIPATION:
"governance.proposal.market.requiredParticipation",
GOV_ASSET_REQUIRED_MAJORITY: "governance.proposal.asset.requiredMajority",
'governance.proposal.market.requiredParticipation',
GOV_ASSET_REQUIRED_MAJORITY: 'governance.proposal.asset.requiredMajority',
GOV_ASSET_REQUIRED_PARTICIPATION:
"governance.proposal.asset.requiredParticipation",
'governance.proposal.asset.requiredParticipation',
GOV_UPDATE_NET_PARAM_REQUIRED_MAJORITY:
"governance.proposal.updateNetParam.requiredMajority",
'governance.proposal.updateNetParam.requiredMajority',
GOV_UPDATE_NET_PARAM_REQUIRED_PARTICIPATION:
"governance.proposal.updateNetParam.requiredParticipation",
VALIDATOR_DELEGATION_MIN_AMOUNT: "validators.delegation.minAmount",
'governance.proposal.updateNetParam.requiredParticipation',
VALIDATOR_DELEGATION_MIN_AMOUNT: 'validators.delegation.minAmount',
};

View File

@ -1,7 +1,7 @@
import React from "react";
import React from 'react';
export function useDocumentTitle(name?: string) {
const base = "VEGA token";
const base = 'VEGA token';
React.useEffect(() => {
if (name) {

View File

@ -1,8 +1,8 @@
import * as Sentry from "@sentry/react";
import React from "react";
import * as Sentry from '@sentry/react';
import React from 'react';
import { NetworkParams } from "../config";
import { useNetworkParam } from "./use-network-param";
import { NetworkParams } from '../config';
import { useNetworkParam } from './use-network-param';
export const useEthereumConfig = () => {
const { data: ethereumConfigJSON, loading } = useNetworkParam([
@ -22,7 +22,7 @@ export const useEthereumConfig = () => {
const config = JSON.parse(configJson);
return config;
} catch {
Sentry.captureMessage("Ethereum config JSON is invalid");
Sentry.captureMessage('Ethereum config JSON is invalid');
return null;
}
}, [ethereumConfigJSON, loading]);

View File

@ -1,4 +1,4 @@
import { useCallback, useEffect, useReducer, useRef } from "react";
import { useCallback, useEffect, useReducer, useRef } from 'react';
interface State<T> {
data?: T;
@ -7,9 +7,9 @@ interface State<T> {
}
enum ActionType {
LOADING = "LOADING",
ERROR = "ERROR",
FETCHED = "FETCHED",
LOADING = 'LOADING',
ERROR = 'ERROR',
FETCHED = 'FETCHED',
}
// discriminated union type
@ -57,7 +57,7 @@ function useFetch<T = unknown>(
}
const data = (await response.json()) as T;
if ("error" in data) {
if ('error' in data) {
// @ts-ignore - data.error
throw new Error(data.error);
}

View File

@ -1,7 +1,7 @@
import { useQuery } from "@apollo/client";
import { gql } from "@apollo/client";
import { useQuery } from '@apollo/client';
import { gql } from '@apollo/client';
import type { NetworkParams } from "./__generated__/NetworkParams";
import type { NetworkParams } from './__generated__/NetworkParams';
export const NETWORK_PARAMS_QUERY = gql`
query NetworkParams {

View File

@ -1,6 +1,6 @@
import React from "react";
import React from 'react';
import { useContracts } from "../contexts/contracts/contracts-context";
import { useContracts } from '../contexts/contracts/contracts-context';
export const usePendingTransactions = () => {
const { transactions } = useContracts();

View File

@ -1,4 +1,4 @@
import React from "react";
import React from 'react';
export function usePrevious<T>(value: T): T | undefined {
const ref = React.useRef<T | undefined>(value);

View File

@ -1,10 +1,10 @@
import React from "react";
import React from 'react';
import {
AppStateActionType,
useAppState,
} from "../contexts/app-state/app-state-context";
import { useContracts } from "../contexts/contracts/contracts-context";
} from '../contexts/app-state/app-state-context';
import { useContracts } from '../contexts/contracts/contracts-context';
export function useRefreshAssociatedBalances() {
const { appDispatch } = useAppState();

View File

@ -1,4 +1,4 @@
import BigNumber from "bignumber.js";
import BigNumber from 'bignumber.js';
BigNumber.config({ EXPONENTIAL_AT: 20000 });

View File

@ -1,2 +1,2 @@
export const DATE_FORMAT_DETAILED = "dd MMMM yyyy HH:mm";
export const DATE_FORMAT_LONG = "dd MMM yyyy";
export const DATE_FORMAT_DETAILED = 'dd MMMM yyyy HH:mm';
export const DATE_FORMAT_LONG = 'dd MMM yyyy';

View File

@ -1,20 +1,25 @@
import { BigNumber } from "./bignumber";
import {addDecimal, removeDecimal} from "./decimals";
import { BigNumber } from './bignumber';
import { addDecimal, removeDecimal } from './decimals';
test('Do not pad numbers with 0s when the number length is less than the specified DPs', () => {
expect(addDecimal(new BigNumber(10000), 10)).toEqual("0.000001");
})
expect(addDecimal(new BigNumber(10000), 10)).toEqual('0.000001');
});
test('Handles large numbers correctly', () => {
const claimCode = new BigNumber("20000000000000000000000000")
const decimals = 18
const claimCode = new BigNumber('20000000000000000000000000');
const decimals = 18;
const decimalised = addDecimal(claimCode, decimals)
expect(decimalised.toString()).toEqual("20000000");
const decimalised = addDecimal(claimCode, decimals);
expect(decimalised.toString()).toEqual('20000000');
const undecimalised = removeDecimal(claimCode, decimals)
expect(undecimalised.toString()).toEqual("20000000000000000000000000000000000000000000");
const undecimalised = removeDecimal(claimCode, decimals);
expect(undecimalised.toString()).toEqual(
'20000000000000000000000000000000000000000000'
);
const mangled = removeDecimal(new BigNumber(addDecimal(claimCode, decimals)), decimals)
expect(mangled.toString()).toEqual("20000000000000000000000000")
})
const mangled = removeDecimal(
new BigNumber(addDecimal(claimCode, decimals)),
decimals
);
expect(mangled.toString()).toEqual('20000000000000000000000000');
});

View File

@ -1,9 +1,9 @@
import { sigToId } from "./sig-to-id";
import { sigToId } from './sig-to-id';
test("creating an id from a signature", () => {
test('creating an id from a signature', () => {
const sig =
"3594b7f4e1c078aaa65b3efac57e1436da64d60c2961bf432dc62daa36f8b0b2602ed9c990ee46dd8ab5181e19c19b06587f080d22fc4543c1869970e678f20f";
'3594b7f4e1c078aaa65b3efac57e1436da64d60c2961bf432dc62daa36f8b0b2602ed9c990ee46dd8ab5181e19c19b06587f080d22fc4543c1869970e678f20f';
const expected =
"9ebd2c424a9426bf5f38112878eb2f99bfdf5ec17b5782b944e6be8177084327";
'9ebd2c424a9426bf5f38112878eb2f99bfdf5ec17b5782b944e6be8177084327';
expect(sigToId(sig)).toEqual(expected);
});

View File

@ -1,10 +1,10 @@
import { ethers } from "ethers";
import { SHA3 } from "sha3";
import { ethers } from 'ethers';
import { SHA3 } from 'sha3';
export const sigToId = (sig: string) => {
// Prepend 0x
if (sig.slice(0, 2) !== "0x") {
sig = "0x" + sig;
if (sig.slice(0, 2) !== '0x') {
sig = '0x' + sig;
}
// Create the ID

View File

@ -1,7 +1,7 @@
export function truncateMiddle(address: string) {
return (
address.slice(0, 6) +
"\u2026" +
'\u2026' +
address.slice(address.length - 4, address.length)
);
}

View File

@ -17,7 +17,7 @@ const IgnoreCodes = {
* and thus not capture in Sentry
*/
export const isUnexpectedError = (error: Error | TxError) => {
if ("code" in error && Object.values(IgnoreCodes).includes(error.code)) {
if ('code' in error && Object.values(IgnoreCodes).includes(error.code)) {
return false;
}
return true;
@ -28,7 +28,7 @@ export const isUnexpectedError = (error: Error | TxError) => {
* a transaction confirmation prompt
*/
export const isUserRejection = (error: Error | TxError) => {
if ("code" in error && error.code === IgnoreCodes.USER_REJECTED) {
if ('code' in error && error.code === IgnoreCodes.USER_REJECTED) {
return true;
}
return false;
@ -39,7 +39,7 @@ export const isUserRejection = (error: Error | TxError) => {
* a transaction confirmation prompt
*/
export const isAlreadyProcessing = (error: Error | TxError) => {
if ("code" in error && error.code === IgnoreCodes.ALREADY_PROCESSING) {
if ('code' in error && error.code === IgnoreCodes.ALREADY_PROCESSING) {
return true;
}
return false;

View File

@ -1,12 +1,16 @@
import React from "react";
import { useTranslation } from "react-i18next";
import React from 'react';
import { useTranslation } from 'react-i18next';
export const ClaimError = () => {
const { t } = useTranslation()
const { t } = useTranslation();
return (
<section>
<h1 data-testid="invalid-claim-code-error-msg">{t("Something doesn't look right")}</h1>
<p>{t("If you have been given a link please double check and try again")}</p>
<h1 data-testid="invalid-claim-code-error-msg">
{t("Something doesn't look right")}
</h1>
<p>
{t('If you have been given a link please double check and try again')}
</p>
</section>
);
};

View File

@ -1 +1 @@
export * from "./claim-form";
export * from './claim-form';

View File

@ -1,11 +1,11 @@
import { useTranslation } from "react-i18next";
import { useTranslation } from 'react-i18next';
export const ClaimRestricted = () => {
const { t } = useTranslation();
return (
<section>
<h1>{t("Service unavailable")}</h1>
<p>{t("This service is not available in your country")}</p>
<h1>{t('Service unavailable')}</h1>
<p>{t('This service is not available in your country')}</p>
</section>
);
};

View File

@ -1 +1 @@
export { ClaimStep1 } from "./claim-step-1";
export { ClaimStep1 } from './claim-step-1';

View File

@ -1 +1 @@
export { ClaimStep2 } from "./claim-step-2";
export { ClaimStep2 } from './claim-step-2';

View File

@ -1,29 +1,29 @@
import { isRestricted } from "./is-restricted";
import { isRestricted } from './is-restricted';
afterEach(() => {
document.cookie = "";
})
document.cookie = '';
});
test("Returns false on no cookie", () => {
expect(isRestricted()).toEqual(false);
})
test('Returns false on no cookie', () => {
expect(isRestricted()).toEqual(false);
});
test("Returns false on no restricted cookie", () => {
document.cookie = "one=a;two=b"
expect(isRestricted()).toEqual(false);
})
test('Returns false on no restricted cookie', () => {
document.cookie = 'one=a;two=b';
expect(isRestricted()).toEqual(false);
});
test("Returns true if a cookie called restricted is set but false", () => {
document.cookie = "restricted=false"
expect(isRestricted()).toEqual(false);
})
test('Returns true if a cookie called restricted is set but false', () => {
document.cookie = 'restricted=false';
expect(isRestricted()).toEqual(false);
});
test("Returns true if a cookie called restricted is set and true", () => {
document.cookie = "restricted=true"
expect(isRestricted()).toEqual(true);
})
test('Returns true if a cookie called restricted is set and true', () => {
document.cookie = 'restricted=true';
expect(isRestricted()).toEqual(true);
});
test("Handle weird data", () => {
document.cookie = ";🍪;;;;;🍪=🍪;;;;;;;;;🍪"
expect(isRestricted()).toEqual(true);
})
test('Handle weird data', () => {
document.cookie = ';🍪;;;;;🍪=🍪;;;;;;;;;🍪';
expect(isRestricted()).toEqual(true);
});

View File

@ -1,6 +1,6 @@
import { Trans, useTranslation } from "react-i18next";
import { Trans, useTranslation } from 'react-i18next';
import { Colors } from "../../config/colors";
import { Colors } from '../../config/colors';
interface TargetAddressMismatchProps {
connectedAddress: string;
@ -15,7 +15,7 @@ export const TargetAddressMismatch = ({
return (
<>
<p>
{t("connectedAddress", {
{t('connectedAddress', {
address: connectedAddress,
})}
</p>

View File

@ -1 +1 @@
export { TargetedClaim } from "./targeted-claim";
export { TargetedClaim } from './targeted-claim';

View File

@ -1 +1 @@
export { UntargetedClaim } from "./untargeted-claim";
export { UntargetedClaim } from './untargeted-claim';

View File

@ -1,6 +1,6 @@
import { useTranslation } from "react-i18next";
import { useTranslation } from 'react-i18next';
import { SplashLoader } from "../../components/splash-loader";
import { SplashLoader } from '../../components/splash-loader';
export const Verifying = () => {
const { t } = useTranslation();
@ -8,12 +8,12 @@ export const Verifying = () => {
<div
style={{
minHeight: 260,
display: "flex",
justifyContent: "center",
alignItems: "center",
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}
>
<SplashLoader text={t("Verifying your claim")} />
<SplashLoader text={t('Verifying your claim')} />
</div>
);
};

View File

@ -1,4 +1,4 @@
@import "../../../../styles/colors";
@import '../../../../styles/colors';
.current-proposal-state {
&__pass {

View File

@ -1 +1 @@
export { CurrentProposalState } from "./current-proposal-state";
export { CurrentProposalState } from './current-proposal-state';

View File

@ -1,4 +1,4 @@
@import "../../../../styles/colors";
@import '../../../../styles/colors';
.current-proposal-status {
&__pass {

View File

@ -1 +1 @@
export { CurrentProposalStatus } from "./current-proposal-status";
export { CurrentProposalStatus } from './current-proposal-status';

View File

@ -1 +1 @@
export { ProposalChangeTable } from "./proposal-change-table";
export { ProposalChangeTable } from './proposal-change-table';

View File

@ -1 +1 @@
export { ProposalTermsJson } from "./proposal-terms-json";
export { ProposalTermsJson } from './proposal-terms-json';

View File

@ -1 +1 @@
export { ProposalVotesTable } from "./proposal-votes-table";
export { ProposalVotesTable } from './proposal-votes-table';

View File

@ -1 +1 @@
export { Proposal } from "./proposal";
export { Proposal } from './proposal';

View File

@ -1 +1 @@
export { ProposalsList } from "./proposals-list";
export { ProposalsList } from './proposals-list';

Some files were not shown because too many files have changed in this diff Show More