Merge pull request #167 from vegaprotocol/feat/160-explorer-theme-switcher

Feat/160 explorer theme switcher
This commit is contained in:
Sam Keen 2022-03-31 14:57:03 +01:00 committed by GitHub
commit ed6c22d7d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 333 additions and 409 deletions

View File

@ -1,76 +0,0 @@
@import './styles/colors';
@import './styles/fonts';
html,
body,
#root {
background-color: $black;
color: $white;
font-family: $font-main;
height: 100%;
margin: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.app {
max-width: 1300px;
margin: 0 auto;
display: grid;
grid-template-rows: 1fr min-content;
min-height: 100%;
@media (min-width: 960px) {
border-left: 1px solid $white;
border-right: 1px solid $white;
}
}
.template-sidebar {
border-bottom: 1px solid $white;
display: grid;
grid-template-rows: auto minmax(700px, 1fr);
grid-template-columns: 300px minmax(auto, 1fr);
nav {
border-right: 1px solid $white;
padding: 20px;
grid-column-start: 1;
grid-column-end: 1;
grid-row-start: 2;
grid-row-end: 3;
overflow: hidden;
}
header {
border-bottom: 1px solid $white;
grid-column-start: 1;
grid-column-end: 3;
grid-row-start: 1;
grid-row-end: 2;
h1 {
font-family: $font-alpa-lyrae;
font-feature-settings: 'calt';
text-transform: uppercase;
}
}
main {
padding: 20px;
grid-column-start: 2;
grid-column-end: 2;
grid-row-start: 2;
grid-row-end: 3;
overflow: hidden;
}
footer {
border-top: 1px solid $white;
padding: 20px;
grid-column-start: 1;
grid-column-end: 3;
grid-row-start: 3;
grid-row-end: 4;
}
}

View File

@ -1 +0,0 @@
/* Your styles goes here. */

View File

@ -1,7 +1,6 @@
import './App.scss';
import { ApolloProvider } from '@apollo/client';
import { ThemeContext } from '@vegaprotocol/react-helpers';
import { useThemeSwitcher } from '@vegaprotocol/react-helpers';
import { createClient } from './lib/apollo-client';
import { Nav } from './components/nav';
import { Header } from './components/header';
@ -11,22 +10,27 @@ import { DATA_SOURCES } from './config';
import { TendermintWebsocketProvider } from './contexts/websocket/tendermint-websocket-provider';
function App() {
const [theme, toggleTheme] = useThemeSwitcher();
const client = React.useMemo(
() => createClient(DATA_SOURCES.dataNodeUrl),
[]
);
return (
<TendermintWebsocketProvider>
<ApolloProvider client={client}>
<div className="app">
<div className="template-sidebar">
<Nav />
<Header />
<Main />
<ThemeContext.Provider value={theme}>
<TendermintWebsocketProvider>
<ApolloProvider client={client}>
<div className="antialiased m-0 bg-white dark:bg-black text-black dark:text-white ">
<div className="min-h-[100vh] max-w-[1300px] grid grid-rows-[auto_minmax(700px,_1fr)] grid-cols-[300px_minmax(auto,_1fr)] border-b-1 border-black dark:border-white lg:border-l-1 lg:border-r-1 mx-auto">
<Nav />
<Header toggleTheme={toggleTheme} />
<Main />
</div>
</div>
</div>
</ApolloProvider>
</TendermintWebsocketProvider>
</ApolloProvider>
</TendermintWebsocketProvider>
</ThemeContext.Provider>
);
}

View File

@ -3,7 +3,7 @@ import type { BlockMeta } from '../../routes/blocks/tendermint-blockchain-respon
import { Routes } from '../../routes/router-config';
import { Link } from 'react-router-dom';
import { SecondsAgo } from '../seconds-ago';
import { Table, TableRow, TableCell } from '../table';
import { TableWithTbody, TableRow, TableCell } from '../table';
import { t } from '@vegaprotocol/react-helpers';
interface BlockProps {
@ -13,7 +13,7 @@ interface BlockProps {
export const BlockData = ({ block, className }: BlockProps) => {
return (
<Table
<TableWithTbody
aria-label={`Data for block ${block.header?.height}`}
className={className}
>
@ -56,6 +56,6 @@ export const BlockData = ({ block, className }: BlockProps) => {
<SecondsAgo date={block.header?.time} />
</TableCell>
</TableRow>
</Table>
</TableWithTbody>
);
};

View File

@ -1,13 +1,22 @@
import { ThemeSwitcher } from '@vegaprotocol/ui-toolkit';
import { t } from '@vegaprotocol/react-helpers';
import { Search } from '../search';
export const Header = () => {
interface ThemeToggleProps {
toggleTheme: () => void;
}
export const Header = ({ toggleTheme }: ThemeToggleProps) => {
return (
<header className="flex px-16 pt-16 pb-8">
<h1 className="text-h3" data-testid="explorer-header">
<header className="flex items-center px-16 py-16 border-b-1 col-start-1 col-end-3 row-start-1 row-end-2">
<h1
className="text-h3 font-alpha uppercase calt"
data-testid="explorer-header"
>
{t('Vega Explorer')}
</h1>
<Search />
<ThemeSwitcher onToggle={toggleTheme} />
</header>
);
};

View File

@ -0,0 +1,22 @@
import { Link } from 'react-router-dom';
interface HighlightedLinkProps {
to: string;
text: string | undefined;
}
export const HighlightedLink = ({
to,
text,
...props
}: HighlightedLinkProps) => {
return (
<Link
className="font-bold underline dark:text-vega-yellow dark:font-normal dark:no-underline"
to={to}
{...props}
>
{text}
</Link>
);
};

View File

@ -1,8 +1,8 @@
import { AppRouter } from "../../routes";
import { AppRouter } from '../../routes';
export const Main = () => {
return (
<main>
<main className="p-20 col-start-2 col-end-2 row-start-2 row-end-3 overflow-hidden">
<AppRouter />
</main>
);

View File

@ -3,7 +3,7 @@ import routerConfig from '../../routes/router-config';
export const Nav = () => {
return (
<nav>
<nav className="border-r-1 p-20 col-start-1 col-end-1 row-start-2 row-end-3 overflow-hidden">
{routerConfig.map((r) => (
<NavLink
key={r.name}

View File

@ -53,9 +53,9 @@ export const Search = () => {
return (
<form
onSubmit={handleSubmit(onSubmit)}
className="flex-1 flex ml-16 justify-end"
className="flex-1 flex ml-16 mr-12 justify-end"
>
<FormGroup className="w-2/3 mb-0">
<FormGroup className="relative w-2/3 mb-0">
<Input
{...register('search')}
id="search"
@ -65,16 +65,14 @@ export const Search = () => {
autoFocus={true}
placeholder={t('Enter block number or transaction hash')}
/>
{error?.message ? (
{error?.message && (
<InputError
data-testid="search-error"
intent="danger"
className="flex-1 w-full"
className="absolute top-[100%] flex-1 w-full"
>
{error.message}
</InputError>
) : (
<div className="h-28"></div>
)}
</FormGroup>
<Button type="submit" variant="secondary" data-testid="search-button">

View File

@ -26,6 +26,21 @@ interface TableCellProps extends ThHTMLAttributes<HTMLTableCellElement> {
}
export const Table = ({ children, className, ...props }: TableProps) => {
const classes = classnames(className, 'overflow-x-auto whitespace-nowrap');
return (
<div className={classes}>
<table className="w-full" {...props}>
{children}
</table>
</div>
);
};
export const TableWithTbody = ({
children,
className,
...props
}: TableProps) => {
const classes = classnames(className, 'overflow-x-auto whitespace-nowrap');
return (
<div className={classes}>
@ -58,8 +73,9 @@ export const TableRow = ({
...props
}: TableRowProps) => {
const cellClasses = classnames(className, {
'border-b border-white-40': modifier === 'bordered',
'bg-white-25 border-b-4 border-b-black': modifier === 'background',
'border-b border-black-40 dark:border-white-40': modifier === 'bordered',
'border-b-4 bg-black-40 border-b-white dark:bg-white-25 dark:border-b-black':
modifier === 'background',
});
return (
<tr className={cellClasses} {...props}>

View File

@ -1,15 +1,15 @@
import { render, screen } from '@testing-library/react';
import { Table, TableRow, TableHeader, TableCell } from './index';
import { TableWithTbody, TableRow, TableHeader, TableCell } from './index';
describe('Renders all table components', () => {
render(
<Table data-testid="test-table">
<TableWithTbody data-testid="test-table">
<TableRow data-testid="test-tr">
<TableHeader data-testid="test-th">Title</TableHeader>
<TableCell data-testid="test-td">Content</TableCell>
</TableRow>
</Table>
</TableWithTbody>
);
expect(screen.getByTestId('test-table')).toBeInTheDocument();
@ -21,27 +21,27 @@ describe('Renders all table components', () => {
describe('Table row', () => {
it('should include classes based on custom "modifier" prop', () => {
render(
<Table>
<TableWithTbody>
<TableRow data-testid="modifier-test" modifier="bordered">
<TableCell>With modifier</TableCell>
</TableRow>
</Table>
</TableWithTbody>
);
expect(screen.getByTestId('modifier-test')).toHaveClass('border-white-40');
expect(screen.getByTestId('modifier-test')).toHaveClass('border-b');
});
});
describe('Table header', () => {
it('should accept props i.e. scope="row"', () => {
render(
<Table>
<TableWithTbody>
<TableRow>
<TableHeader data-testid="props-test" scope="row">
Test
</TableHeader>
</TableRow>
</Table>
</TableWithTbody>
);
expect(screen.getByTestId('props-test')).toHaveAttribute('scope');
@ -49,13 +49,13 @@ describe('Table header', () => {
it('should include custom class based on scope="row"', () => {
render(
<Table>
<TableWithTbody>
<TableRow>
<TableHeader data-testid="scope-class-test" scope="row">
With scope attribute
</TableHeader>
</TableRow>
</Table>
</TableWithTbody>
);
expect(screen.getByTestId('scope-class-test')).toHaveClass('text-left');
@ -65,13 +65,13 @@ describe('Table header', () => {
describe('Table cell', () => {
it('should include class based on custom "modifier" prop', () => {
render(
<Table>
<TableWithTbody>
<TableRow>
<TableCell data-testid="modifier-class-test" modifier="bordered">
With modifier
</TableCell>
</TableRow>
</Table>
</TableWithTbody>
);
expect(screen.getByTestId('modifier-class-test')).toHaveClass('py-4');

View File

@ -0,0 +1,27 @@
import { TruncateInline } from './truncate';
import { Link } from 'react-router-dom';
interface TruncatedLinkProps {
to: string;
text: string;
startChars: number;
endChars: number;
}
export const TruncatedLink = ({
to,
text,
startChars,
endChars,
}: TruncatedLinkProps) => {
return (
<Link to={to}>
<TruncateInline
text={text}
startChars={startChars}
endChars={endChars}
className="font-mono font-bold underline dark:text-vega-yellow dark:font-normal dark:no-underline"
/>
</Link>
);
};

View File

@ -2,10 +2,10 @@ import useFetch from '../../hooks/use-fetch';
import type { ChainExplorerTxResponse } from '../../routes/types/chain-explorer-response';
import { Routes } from '../../routes/router-config';
import { DATA_SOURCES } from '../../config';
import { Link } from 'react-router-dom';
import { RenderFetched } from '../render-fetched';
import { TruncateInline } from '../truncate/truncate';
import { TruncatedLink } from '../truncate/truncated-link';
import { TxOrderType } from './tx-order-type';
import { Table, TableRow, TableCell } from '../table';
import { t } from '@vegaprotocol/react-helpers';
interface TxsPerBlockProps {
@ -34,46 +34,46 @@ export const TxsPerBlock = ({ blockHeight }: TxsPerBlockProps) => {
<RenderFetched error={error} loading={loading} className="text-body-large">
{decodedBlockData && decodedBlockData.length ? (
<div className="overflow-x-auto whitespace-nowrap mb-28">
<table className="w-full">
<Table>
<thead>
<tr className="font-mono">
<TableRow modifier="bordered" className="font-mono">
<td>{t('Transaction')}</td>
<td>{t('From')}</td>
<td>{t('Type')}</td>
</tr>
</TableRow>
</thead>
<tbody>
{decodedBlockData.map(({ TxHash, PubKey, Type }) => {
return (
<tr key={TxHash} data-testid="transaction-row">
<td>
<Link to={`/${Routes.TX}/${TxHash}`}>
<TruncateInline
text={TxHash}
startChars={truncateLength}
endChars={truncateLength}
className="text-vega-yellow font-mono"
/>
</Link>
</td>
<td>
<Link to={`/${Routes.PARTIES}/${PubKey}`}>
<TruncateInline
text={PubKey}
startChars={truncateLength}
endChars={truncateLength}
className="text-vega-yellow font-mono"
/>
</Link>
</td>
<td>
<TxOrderType className="mb-4" orderType={Type} />
</td>
</tr>
<TableRow
modifier="bordered"
key={TxHash}
data-testid="transaction-row"
>
<TableCell modifier="bordered">
<TruncatedLink
to={`/${Routes.TX}/${TxHash}`}
text={TxHash}
startChars={truncateLength}
endChars={truncateLength}
/>
</TableCell>
<TableCell modifier="bordered">
<TruncatedLink
to={`/${Routes.PARTIES}/${PubKey}`}
text={PubKey}
startChars={truncateLength}
endChars={truncateLength}
/>
</TableCell>
<TableCell modifier="bordered">
<TxOrderType orderType={Type} />
</TableCell>
</TableRow>
);
})}
</tbody>
</table>
</Table>
</div>
) : (
<div className="font-mono mb-28">

View File

@ -3,7 +3,7 @@
// @generated
// This file was automatically generated and should not be edited.
import { AccountType } from "./../../../../../../../libs/types/src/__generated__/globalTypes";
import { AccountType } from "@vegaprotocol/types";
// ====================================================
// GraphQL query operation: AssetsQuery

View File

@ -6,7 +6,7 @@ import type { TendermintBlocksResponse } from '../tendermint-blocks-response';
import { RouteTitle } from '../../../components/route-title';
import { SecondsAgo } from '../../../components/seconds-ago';
import {
Table,
TableWithTbody,
TableRow,
TableHeader,
TableCell,
@ -15,6 +15,7 @@ import { TxsPerBlock } from '../../../components/txs/txs-per-block';
import { Button } from '@vegaprotocol/ui-toolkit';
import { Routes } from '../../router-config';
import { RenderFetched } from '../../../components/render-fetched';
import { HighlightedLink } from '../../../components/highlighted-link';
import { t } from '@vegaprotocol/react-helpers';
const Block = () => {
@ -57,17 +58,15 @@ const Block = () => {
</Button>
</Link>
</div>
<Table className="mb-28">
<TableWithTbody className="mb-28">
<TableRow modifier="bordered">
<TableHeader scope="row">Mined by</TableHeader>
<TableCell modifier="bordered">
<Link
data-testid="block-validator"
className="text-vega-yellow font-mono"
<HighlightedLink
to={`/${Routes.VALIDATORS}`}
>
{header.proposer_address}
</Link>
text={header.proposer_address}
data-testid="block-validator"
/>
</TableCell>
</TableRow>
<TableRow modifier="bordered">
@ -76,7 +75,7 @@ const Block = () => {
<SecondsAgo data-testid="block-time" date={header.time} />
</TableCell>
</TableRow>
</Table>
</TableWithTbody>
{blockData && blockData.result.block.data.txs.length > 0 ? (
<TxsPerBlock blockHeight={block} />
) : null}

View File

@ -3,7 +3,7 @@
// @generated
// This file was automatically generated and should not be edited.
import { ProposalState, ProposalRejectionReason, VoteValue } from "./../../../../../../../libs/types/src/__generated__/globalTypes";
import { ProposalState, ProposalRejectionReason, VoteValue } from "@vegaprotocol/types";
// ====================================================
// GraphQL query operation: ProposalsQuery

View File

@ -3,7 +3,7 @@
// @generated
// This file was automatically generated and should not be edited.
import { MarketTradingMode, MarketState, AccountType, AuctionTrigger } from "./../../../../../../../libs/types/src/__generated__/globalTypes";
import { MarketTradingMode, MarketState, AccountType, AuctionTrigger } from "@vegaprotocol/types";
// ====================================================
// GraphQL query operation: MarketsQuery
@ -488,14 +488,14 @@ export interface MarketsQuery_markets {
/**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the Market. (uint64)
*
*
* Examples:
* Currency Balance decimalPlaces Real Balance
* GBP 100 0 GBP 100
* GBP 100 2 GBP 1.00
* GBP 100 4 GBP 0.01
* GBP 1 4 GBP 0.0001 ( 0.01p )
*
*
* GBX (pence) 100 0 GBP 1.00 (100p )
* GBX (pence) 100 2 GBP 0.01 ( 1p )
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )

View File

@ -3,7 +3,7 @@
// @generated
// This file was automatically generated and should not be edited.
import { AccountType } from "./../../../../../../../../libs/types/src/__generated__/globalTypes";
import { AccountType } from "@vegaprotocol/types";
// ====================================================
// GraphQL query operation: PartyAssetsQuery

View File

@ -2,13 +2,13 @@ import { t } from '@vegaprotocol/react-helpers';
import { StatusMessage } from '../../../components/status-message';
import { SyntaxHighlighter } from '../../../components/syntax-highlighter';
import {
Table,
TableWithTbody,
TableCell,
TableHeader,
TableRow,
} from '../../../components/table';
import { TxOrderType } from '../../../components/txs';
import type { ChainExplorerTxResponse } from '../../../routes/types/chain-explorer-response';
import type { ChainExplorerTxResponse } from '../../types/chain-explorer-response';
interface TxContentProps {
data: ChainExplorerTxResponse | undefined;
@ -25,7 +25,7 @@ export const TxContent = ({ data }: TxContentProps) => {
return (
<>
<Table className="mb-12">
<TableWithTbody className="mb-12">
<TableRow modifier="bordered">
<TableHeader scope="row" className="w-[160px]">
{t('Type')}
@ -34,7 +34,7 @@ export const TxContent = ({ data }: TxContentProps) => {
<TxOrderType orderType={data.Type} />
</TableCell>
</TableRow>
</Table>
</TableWithTbody>
<h3 className="font-mono mb-8">{t('Decoded transaction content')}</h3>
<SyntaxHighlighter data={JSON.parse(data.Command)} />

View File

@ -1,15 +1,15 @@
import { t } from '@vegaprotocol/react-helpers';
import { Link } from 'react-router-dom';
import { Routes } from '../../router-config';
import type { Result } from '../tendermint-transaction-response.d';
import {
Table,
TableWithTbody,
TableCell,
TableHeader,
TableRow,
} from '../../../components/table';
import { TruncateInline } from '../../../components/truncate/truncate';
import { Routes } from '../../../routes/router-config';
import type { Result } from '../../../routes/txs/tendermint-transaction-response.d';
import { t } from '@vegaprotocol/react-helpers';
import { HighlightedLink } from '../../../components/highlighted-link';
interface TxDetailsProps {
txData: Result | undefined;
pubKey: string | undefined;
@ -24,7 +24,7 @@ export const TxDetails = ({ txData, pubKey, className }: TxDetailsProps) => {
}
return (
<Table className={className}>
<TableWithTbody className={className}>
<TableRow modifier="bordered">
<TableCell>{t('Hash')}</TableCell>
<TableCell modifier="bordered" data-testid="hash">
@ -36,23 +36,16 @@ export const TxDetails = ({ txData, pubKey, className }: TxDetailsProps) => {
{t('Submitted by')}
</TableHeader>
<TableCell modifier="bordered" data-testid="submitted-by">
<Link
className="text-vega-yellow"
to={`/${Routes.PARTIES}/${pubKey}`}
>
{pubKey}
</Link>
<HighlightedLink to={`/${Routes.PARTIES}/${pubKey}`} text={pubKey} />
</TableCell>
</TableRow>
<TableRow modifier="bordered">
<TableCell>{t('Block')}</TableCell>
<TableCell modifier="bordered" data-testid="block">
<Link
className="text-vega-yellow"
<HighlightedLink
to={`/${Routes.BLOCKS}/${txData.height}`}
>
{txData.height}
</Link>
text={txData.height}
/>
</TableCell>
</TableRow>
<TableRow modifier="bordered">
@ -65,6 +58,6 @@ export const TxDetails = ({ txData, pubKey, className }: TxDetailsProps) => {
/>
</TableCell>
</TableRow>
</Table>
</TableWithTbody>
);
};

View File

@ -3,7 +3,7 @@
// @generated
// This file was automatically generated and should not be edited.
import { NodeStatus } from "./../../../../../../../libs/types/src/__generated__/globalTypes";
import { NodeStatus } from "@vegaprotocol/types";
// ====================================================
// GraphQL query operation: NodesQuery

View File

@ -1,99 +0,0 @@
/* === BLUEPRINT COLOR OVERRIDES === */
$black: #000;
$white: #fff;
$dark-gray1: #1f1f1f;
$dark-gray2: #2a2a2a;
$dark-gray3: #363636;
$dark-gray4: #3f3f3f;
$dark-gray5: #494949;
$gray1: #6e6e6e;
$gray2: #848484;
$gray3: #999;
$gray4: #b5b5b5;
$gray5: #cbcbcb;
$light-gray1: #d7d7d7;
$light-gray2: #e0e0e0;
$light-gray3: #e7e7e7;
$light-gray4: #f0f0f0;
$light-gray5: #f8f8f8;
/* === VEGA COLORS === */
/*
Note: We follow blueprints color naming scheme. https://blueprintjs.com/docs/#core/colors EG:
$color1 = Darkest
$color2
$color3 = Base color
$color4
$color5 = Lightest
*/
$vega-pink: #ff2d5e;
$vega-green: #00f780;
$vega-green3: #26ff8a;
$vega-red3: #ff261a;
$vega-blue3: #48aff0;
$vega-yellow3: #daff0d;
$vega-orange3: #ff7a1a;
$vega-yellow4: #edff22;
$vega-red1: darken($vega-red3, 38%);
$vega-green1: darken($vega-green3, 38%);
$vega-yellow1: darken($vega-yellow3, 38%);
$vega-orange1: darken($vega-orange3, 38%);
/* === TEXT COLORS === */
$text-color: #c7c7c7;
$text-color-inverse: #1a1821;
$text-color-deemphasise: #8a9ba8;
$text-color-emphasise: #f5f8fa;
$text-color-error: $vega-red3;
/* === BUY/SELL BUTTONS === */
$button-sell-hover: #893939;
$button-sell-active: #ff5e5e;
$button-buy-hover: #0a4023;
$button-buy-active: #00ffb2;
/* === MISC BLUEPRINT COLOR OVERRIDES === */
$pt-intent-danger: $vega-red3;
$input-background: #3f3f3f;
// App background
$pt-dark-app-background-color: $dark-gray2;
// Card
$dark-card-background-color: $dark-gray2;
// Menu
$dark-menu-background-color: $dark-gray2;
// Navbar
$dark-navbar-background-color: $black;
// Popover
$dark-popover-background-color: $dark-gray2;
//overlay-backdrop
.bp3-overlay-backdrop {
background-color: rgba(73, 73, 73, 0.7);
}
// Text helpers
.text-deemphasise {
color: $text-color-deemphasise;
}
.text-error {
color: $text-color-error;
}
// hover row
$row-hover-background-color: $dark-gray5;
// backdrop
$backdrop-black: rgba(0, 0, 0, 0.6);

View File

@ -1,16 +0,0 @@
$font-main: 'Helvetica neue', 'Helvetica', arial, sans-serif;
$font-mono: 'Roboto Mono', monospace;
$font-alpa-lyrae: AlphaLyrae, 'Helvetica neue', 'Helvetica', arial, sans-serif;
.font-main {
font-family: $font-main;
}
.font-mono {
font-family: $font-mono;
}
@font-face {
font-family: AlphaLyrae;
src: url(./styles/AlphaLyrae-Medium.woff);
}

View File

@ -9,6 +9,6 @@
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
<body>
<div id="root" class="dark"></div>
<div id="root"></div>
</body>
</html>

View File

@ -1,4 +1,10 @@
/* You can add global styles to this file, and also import other style files */
@tailwind base;
@tailwind components;
@font-face {
font-family: 'AlphaLyrae-Medium';
src: url('./AlphaLyrae-Medium.woff');
}
@tailwind utilities;

View File

@ -1,6 +1,7 @@
const { join } = require('path');
const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind');
const theme = require('../../libs/tailwindcss-config/src/theme');
const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes');
module.exports = {
content: [
@ -9,5 +10,5 @@ module.exports = {
],
darkMode: 'class',
theme,
plugins: [],
plugins: [vegaCustomClasses],
};

View File

@ -1,6 +1,7 @@
const { join } = require('path');
const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind');
const theme = require('../../libs/tailwindcss-config/src/theme');
const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes');
module.exports = {
content: [
@ -9,5 +10,5 @@ module.exports = {
],
darkMode: 'class',
theme,
plugins: [],
plugins: [vegaCustomClasses],
};

View File

@ -1,6 +1,7 @@
const { join } = require('path');
const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind');
const theme = require('../../libs/tailwindcss-config/src/theme');
const vegaCustomClasses = require('../../libs/tailwindcss-config/src/vega-custom-classes');
module.exports = {
content: [
@ -10,5 +11,5 @@ module.exports = {
],
darkMode: 'class',
theme,
plugins: [],
plugins: [vegaCustomClasses],
};

View File

@ -3,14 +3,14 @@
// @generated
// This file was automatically generated and should not be edited.
import { MarketState, MarketTradingMode } from "./../../../types/src/__generated__/globalTypes";
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
// ====================================================
// GraphQL query operation: DealTicketQuery
// ====================================================
export interface DealTicketQuery_market_tradableInstrument_instrument_product {
__typename: "Future";
__typename: 'Future';
/**
* String representing the quote (e.g. BTCUSD -> USD is quote)
*/
@ -18,7 +18,7 @@ export interface DealTicketQuery_market_tradableInstrument_instrument_product {
}
export interface DealTicketQuery_market_tradableInstrument_instrument {
__typename: "Instrument";
__typename: 'Instrument';
/**
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
*/
@ -26,7 +26,7 @@ export interface DealTicketQuery_market_tradableInstrument_instrument {
}
export interface DealTicketQuery_market_tradableInstrument {
__typename: "TradableInstrument";
__typename: 'TradableInstrument';
/**
* An instance of or reference to a fully specified instrument.
*/
@ -34,7 +34,7 @@ export interface DealTicketQuery_market_tradableInstrument {
}
export interface DealTicketQuery_market_depth_lastTrade {
__typename: "Trade";
__typename: 'Trade';
/**
* The price of the trade (probably initially the passive order price, other determination algorithms are possible though) (uint64)
*/
@ -42,7 +42,7 @@ export interface DealTicketQuery_market_depth_lastTrade {
}
export interface DealTicketQuery_market_depth {
__typename: "MarketDepth";
__typename: 'MarketDepth';
/**
* Last trade for the given market (if available)
*/
@ -50,7 +50,7 @@ export interface DealTicketQuery_market_depth {
}
export interface DealTicketQuery_market {
__typename: "Market";
__typename: 'Market';
/**
* Market ID
*/
@ -58,14 +58,14 @@ export interface DealTicketQuery_market {
/**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the Market. (uint64)
*
*
* Examples:
* Currency Balance decimalPlaces Real Balance
* GBP 100 0 GBP 100
* GBP 100 2 GBP 1.00
* GBP 100 4 GBP 0.01
* GBP 1 4 GBP 0.0001 ( 0.01p )
*
*
* GBX (pence) 100 0 GBP 1.00 (100p )
* GBX (pence) 100 2 GBP 0.01 ( 1p )
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )

View File

@ -3,18 +3,47 @@
// @generated
// This file was automatically generated and should not be edited.
import { BusEventType, OrderType, OrderStatus, OrderRejectionReason } from "./../../../types/src/__generated__/globalTypes";
import {
BusEventType,
OrderType,
OrderStatus,
OrderRejectionReason,
} from '@vegaprotocol/types';
// ====================================================
// GraphQL subscription operation: OrderEvent
// ====================================================
export interface OrderEvent_busEvents_event_TimeUpdate {
__typename: "TimeUpdate" | "MarketEvent" | "TransferResponses" | "PositionResolution" | "Trade" | "Account" | "Party" | "MarginLevels" | "Proposal" | "Vote" | "MarketData" | "NodeSignature" | "LossSocialization" | "SettlePosition" | "Market" | "Asset" | "MarketTick" | "SettleDistressed" | "AuctionEvent" | "RiskFactor" | "Deposit" | "Withdrawal" | "OracleSpec" | "LiquidityProvision";
__typename:
| 'TimeUpdate'
| 'MarketEvent'
| 'TransferResponses'
| 'PositionResolution'
| 'Trade'
| 'Account'
| 'Party'
| 'MarginLevels'
| 'Proposal'
| 'Vote'
| 'MarketData'
| 'NodeSignature'
| 'LossSocialization'
| 'SettlePosition'
| 'Market'
| 'Asset'
| 'MarketTick'
| 'SettleDistressed'
| 'AuctionEvent'
| 'RiskFactor'
| 'Deposit'
| 'Withdrawal'
| 'OracleSpec'
| 'LiquidityProvision';
}
export interface OrderEvent_busEvents_event_Order_market {
__typename: "Market";
__typename: 'Market';
/**
* Market full name
*/
@ -22,14 +51,14 @@ export interface OrderEvent_busEvents_event_Order_market {
/**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the Market. (uint64)
*
*
* Examples:
* Currency Balance decimalPlaces Real Balance
* GBP 100 0 GBP 100
* GBP 100 2 GBP 1.00
* GBP 100 4 GBP 0.01
* GBP 1 4 GBP 0.0001 ( 0.01p )
*
*
* GBX (pence) 100 0 GBP 1.00 (100p )
* GBX (pence) 100 2 GBP 0.01 ( 1p )
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
@ -39,7 +68,7 @@ export interface OrderEvent_busEvents_event_Order_market {
}
export interface OrderEvent_busEvents_event_Order {
__typename: "Order";
__typename: 'Order';
/**
* Type the order type (defaults to PARTY)
*/
@ -74,10 +103,12 @@ export interface OrderEvent_busEvents_event_Order {
market: OrderEvent_busEvents_event_Order_market | null;
}
export type OrderEvent_busEvents_event = OrderEvent_busEvents_event_TimeUpdate | OrderEvent_busEvents_event_Order;
export type OrderEvent_busEvents_event =
| OrderEvent_busEvents_event_TimeUpdate
| OrderEvent_busEvents_event_Order;
export interface OrderEvent_busEvents {
__typename: "BusEvent";
__typename: 'BusEvent';
/**
* the id for this event
*/

View File

@ -15,7 +15,7 @@ export const TimeInForceSelector = ({
order.type === OrderType.Limit
? Object.entries(OrderTimeInForce)
: Object.entries(OrderTimeInForce).filter(
([key, value]) =>
([_, value]) =>
value === OrderTimeInForce.FOK || value === OrderTimeInForce.IOC
);

View File

@ -64,11 +64,7 @@ export const useOrderSubmit = (market: UseOrderSubmitMarket) => {
return false;
}
if (e.event.id === id) {
return true;
}
return false;
return e.event.id === id;
});
if (

View File

@ -3,14 +3,14 @@
// @generated
// This file was automatically generated and should not be edited.
import { MarketState, MarketTradingMode } from "./../../../../types/src/__generated__/globalTypes";
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
// ====================================================
// GraphQL fragment: MarketDataFields
// ====================================================
export interface MarketDataFields_market {
__typename: "Market";
__typename: 'Market';
/**
* Market ID
*/
@ -26,7 +26,7 @@ export interface MarketDataFields_market {
}
export interface MarketDataFields {
__typename: "MarketData";
__typename: 'MarketData';
/**
* market id of the associated mark price
*/

View File

@ -3,14 +3,14 @@
// @generated
// This file was automatically generated and should not be edited.
import { MarketState, MarketTradingMode } from "./../../../../types/src/__generated__/globalTypes";
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
// ====================================================
// GraphQL subscription operation: MarketDataSub
// ====================================================
export interface MarketDataSub_marketData_market {
__typename: "Market";
__typename: 'Market';
/**
* Market ID
*/
@ -26,7 +26,7 @@ export interface MarketDataSub_marketData_market {
}
export interface MarketDataSub_marketData {
__typename: "MarketData";
__typename: 'MarketData';
/**
* market id of the associated mark price
*/

View File

@ -3,14 +3,14 @@
// @generated
// This file was automatically generated and should not be edited.
import { MarketState, MarketTradingMode } from "./../../../../types/src/__generated__/globalTypes";
import { MarketState, MarketTradingMode } from '@vegaprotocol/types';
// ====================================================
// GraphQL query operation: Markets
// ====================================================
export interface Markets_markets_data_market {
__typename: "Market";
__typename: 'Market';
/**
* Market ID
*/
@ -26,7 +26,7 @@ export interface Markets_markets_data_market {
}
export interface Markets_markets_data {
__typename: "MarketData";
__typename: 'MarketData';
/**
* market id of the associated mark price
*/
@ -46,7 +46,7 @@ export interface Markets_markets_data {
}
export interface Markets_markets_tradableInstrument_instrument_product_settlementAsset {
__typename: "Asset";
__typename: 'Asset';
/**
* The symbol of the asset (e.g: GBP)
*/
@ -54,7 +54,7 @@ export interface Markets_markets_tradableInstrument_instrument_product_settlemen
}
export interface Markets_markets_tradableInstrument_instrument_product {
__typename: "Future";
__typename: 'Future';
/**
* The name of the asset (string)
*/
@ -62,7 +62,7 @@ export interface Markets_markets_tradableInstrument_instrument_product {
}
export interface Markets_markets_tradableInstrument_instrument {
__typename: "Instrument";
__typename: 'Instrument';
/**
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
*/
@ -74,7 +74,7 @@ export interface Markets_markets_tradableInstrument_instrument {
}
export interface Markets_markets_tradableInstrument {
__typename: "TradableInstrument";
__typename: 'TradableInstrument';
/**
* An instance of or reference to a fully specified instrument.
*/
@ -82,7 +82,7 @@ export interface Markets_markets_tradableInstrument {
}
export interface Markets_markets {
__typename: "Market";
__typename: 'Market';
/**
* Market ID
*/
@ -94,14 +94,14 @@ export interface Markets_markets {
/**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the Market. (uint64)
*
*
* Examples:
* Currency Balance decimalPlaces Real Balance
* GBP 100 0 GBP 100
* GBP 100 2 GBP 1.00
* GBP 100 4 GBP 0.01
* GBP 1 4 GBP 0.0001 ( 0.01p )
*
*
* GBX (pence) 100 0 GBP 1.00 (100p )
* GBX (pence) 100 2 GBP 0.01 ( 1p )
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )

View File

@ -3,7 +3,7 @@
// @generated
// This file was automatically generated and should not be edited.
import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce } from "./../../../types/src/__generated__/globalTypes";
import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce } from "@vegaprotocol/types";
// ====================================================
// GraphQL fragment: OrderFields
@ -38,14 +38,14 @@ export interface OrderFields_market {
/**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the Market. (uint64)
*
*
* Examples:
* Currency Balance decimalPlaces Real Balance
* GBP 100 0 GBP 100
* GBP 100 2 GBP 1.00
* GBP 100 4 GBP 0.01
* GBP 1 4 GBP 0.0001 ( 0.01p )
*
*
* GBX (pence) 100 0 GBP 1.00 (100p )
* GBX (pence) 100 2 GBP 0.01 ( 1p )
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )

View File

@ -3,7 +3,7 @@
// @generated
// This file was automatically generated and should not be edited.
import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce } from "./../../../types/src/__generated__/globalTypes";
import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce } from "@vegaprotocol/types";
// ====================================================
// GraphQL subscription operation: OrderSub
@ -38,14 +38,14 @@ export interface OrderSub_orders_market {
/**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the Market. (uint64)
*
*
* Examples:
* Currency Balance decimalPlaces Real Balance
* GBP 100 0 GBP 100
* GBP 100 2 GBP 1.00
* GBP 100 4 GBP 0.01
* GBP 1 4 GBP 0.0001 ( 0.01p )
*
*
* GBX (pence) 100 0 GBP 1.00 (100p )
* GBX (pence) 100 2 GBP 0.01 ( 1p )
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )

View File

@ -3,7 +3,7 @@
// @generated
// This file was automatically generated and should not be edited.
import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce } from "./../../../types/src/__generated__/globalTypes";
import { OrderType, Side, OrderStatus, OrderRejectionReason, OrderTimeInForce } from "@vegaprotocol/types";
// ====================================================
// GraphQL query operation: Orders
@ -38,14 +38,14 @@ export interface Orders_party_orders_market {
/**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the Market. (uint64)
*
*
* Examples:
* Currency Balance decimalPlaces Real Balance
* GBP 100 0 GBP 100
* GBP 100 2 GBP 1.00
* GBP 100 4 GBP 0.01
* GBP 1 4 GBP 0.0001 ( 0.01p )
*
*
* GBX (pence) 100 0 GBP 1.00 (100p )
* GBX (pence) 100 2 GBP 0.01 ( 1p )
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )

View File

@ -10,7 +10,6 @@ import {
OrderType,
OrderTimeInForce,
} from '@vegaprotocol/types';
import {} from '@vegaprotocol/wallet';
import type { ReactNode } from 'react';
import { ORDERS_QUERY, ORDERS_SUB, useOrders } from './use-orders';

View File

@ -79,8 +79,7 @@ export const useOrders = (partyId: string): UseOrders => {
},
'desc'
);
const uniq = uniqBy(sorted, 'id');
return uniq;
return uniqBy(sorted, 'id');
});
}, []);

View File

@ -3,14 +3,14 @@
// @generated
// This file was automatically generated and should not be edited.
import { MarketTradingMode } from "./../../../../types/src/__generated__/globalTypes";
import { MarketTradingMode } from '@vegaprotocol/types';
// ====================================================
// GraphQL fragment: PositionDetails
// ====================================================
export interface PositionDetails_market_data_market {
__typename: "Market";
__typename: 'Market';
/**
* Market ID
*/
@ -18,7 +18,7 @@ export interface PositionDetails_market_data_market {
}
export interface PositionDetails_market_data {
__typename: "MarketData";
__typename: 'MarketData';
/**
* the mark price (actually an unsigned int)
*/
@ -34,7 +34,7 @@ export interface PositionDetails_market_data {
}
export interface PositionDetails_market_tradableInstrument_instrument_metadata {
__typename: "InstrumentMetadata";
__typename: 'InstrumentMetadata';
/**
* An arbitrary list of tags to associated to associate to the Instrument (string list)
*/
@ -42,7 +42,7 @@ export interface PositionDetails_market_tradableInstrument_instrument_metadata {
}
export interface PositionDetails_market_tradableInstrument_instrument_product_settlementAsset {
__typename: "Asset";
__typename: 'Asset';
/**
* The id of the asset
*/
@ -62,7 +62,7 @@ export interface PositionDetails_market_tradableInstrument_instrument_product_se
}
export interface PositionDetails_market_tradableInstrument_instrument_product {
__typename: "Future";
__typename: 'Future';
/**
* The name of the asset (string)
*/
@ -74,7 +74,7 @@ export interface PositionDetails_market_tradableInstrument_instrument_product {
}
export interface PositionDetails_market_tradableInstrument_instrument {
__typename: "Instrument";
__typename: 'Instrument';
/**
* Uniquely identify an instrument across all instruments available on Vega (string)
*/
@ -98,7 +98,7 @@ export interface PositionDetails_market_tradableInstrument_instrument {
}
export interface PositionDetails_market_tradableInstrument {
__typename: "TradableInstrument";
__typename: 'TradableInstrument';
/**
* An instance of or reference to a fully specified instrument.
*/
@ -106,7 +106,7 @@ export interface PositionDetails_market_tradableInstrument {
}
export interface PositionDetails_market {
__typename: "Market";
__typename: 'Market';
/**
* Market ID
*/
@ -122,14 +122,14 @@ export interface PositionDetails_market {
/**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the Market. (uint64)
*
*
* Examples:
* Currency Balance decimalPlaces Real Balance
* GBP 100 0 GBP 100
* GBP 100 2 GBP 1.00
* GBP 100 4 GBP 0.01
* GBP 1 4 GBP 0.0001 ( 0.01p )
*
*
* GBX (pence) 100 0 GBP 1.00 (100p )
* GBX (pence) 100 2 GBP 0.01 ( 1p )
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
@ -143,7 +143,7 @@ export interface PositionDetails_market {
}
export interface PositionDetails {
__typename: "Position";
__typename: 'Position';
/**
* Realised Profit and Loss (int64)
*/

View File

@ -3,14 +3,14 @@
// @generated
// This file was automatically generated and should not be edited.
import { MarketTradingMode } from "./../../../../types/src/__generated__/globalTypes";
import { MarketTradingMode } from '@vegaprotocol/types';
// ====================================================
// GraphQL subscription operation: PositionSubscribe
// ====================================================
export interface PositionSubscribe_positions_market_data_market {
__typename: "Market";
__typename: 'Market';
/**
* Market ID
*/
@ -18,7 +18,7 @@ export interface PositionSubscribe_positions_market_data_market {
}
export interface PositionSubscribe_positions_market_data {
__typename: "MarketData";
__typename: 'MarketData';
/**
* the mark price (actually an unsigned int)
*/
@ -34,7 +34,7 @@ export interface PositionSubscribe_positions_market_data {
}
export interface PositionSubscribe_positions_market_tradableInstrument_instrument_metadata {
__typename: "InstrumentMetadata";
__typename: 'InstrumentMetadata';
/**
* An arbitrary list of tags to associated to associate to the Instrument (string list)
*/
@ -42,7 +42,7 @@ export interface PositionSubscribe_positions_market_tradableInstrument_instrumen
}
export interface PositionSubscribe_positions_market_tradableInstrument_instrument_product_settlementAsset {
__typename: "Asset";
__typename: 'Asset';
/**
* The id of the asset
*/
@ -62,7 +62,7 @@ export interface PositionSubscribe_positions_market_tradableInstrument_instrumen
}
export interface PositionSubscribe_positions_market_tradableInstrument_instrument_product {
__typename: "Future";
__typename: 'Future';
/**
* The name of the asset (string)
*/
@ -74,7 +74,7 @@ export interface PositionSubscribe_positions_market_tradableInstrument_instrumen
}
export interface PositionSubscribe_positions_market_tradableInstrument_instrument {
__typename: "Instrument";
__typename: 'Instrument';
/**
* Uniquely identify an instrument across all instruments available on Vega (string)
*/
@ -98,7 +98,7 @@ export interface PositionSubscribe_positions_market_tradableInstrument_instrumen
}
export interface PositionSubscribe_positions_market_tradableInstrument {
__typename: "TradableInstrument";
__typename: 'TradableInstrument';
/**
* An instance of or reference to a fully specified instrument.
*/
@ -106,7 +106,7 @@ export interface PositionSubscribe_positions_market_tradableInstrument {
}
export interface PositionSubscribe_positions_market {
__typename: "Market";
__typename: 'Market';
/**
* Market ID
*/
@ -122,14 +122,14 @@ export interface PositionSubscribe_positions_market {
/**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the Market. (uint64)
*
*
* Examples:
* Currency Balance decimalPlaces Real Balance
* GBP 100 0 GBP 100
* GBP 100 2 GBP 1.00
* GBP 100 4 GBP 0.01
* GBP 1 4 GBP 0.0001 ( 0.01p )
*
*
* GBX (pence) 100 0 GBP 1.00 (100p )
* GBX (pence) 100 2 GBP 0.01 ( 1p )
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
@ -143,7 +143,7 @@ export interface PositionSubscribe_positions_market {
}
export interface PositionSubscribe_positions {
__typename: "Position";
__typename: 'Position';
/**
* Realised Profit and Loss (int64)
*/

View File

@ -3,14 +3,14 @@
// @generated
// This file was automatically generated and should not be edited.
import { MarketTradingMode } from "./../../../../types/src/__generated__/globalTypes";
import { MarketTradingMode } from '@vegaprotocol/types';
// ====================================================
// GraphQL query operation: Positions
// ====================================================
export interface Positions_party_positions_market_data_market {
__typename: "Market";
__typename: 'Market';
/**
* Market ID
*/
@ -18,7 +18,7 @@ export interface Positions_party_positions_market_data_market {
}
export interface Positions_party_positions_market_data {
__typename: "MarketData";
__typename: 'MarketData';
/**
* the mark price (actually an unsigned int)
*/
@ -34,7 +34,7 @@ export interface Positions_party_positions_market_data {
}
export interface Positions_party_positions_market_tradableInstrument_instrument_metadata {
__typename: "InstrumentMetadata";
__typename: 'InstrumentMetadata';
/**
* An arbitrary list of tags to associated to associate to the Instrument (string list)
*/
@ -42,7 +42,7 @@ export interface Positions_party_positions_market_tradableInstrument_instrument_
}
export interface Positions_party_positions_market_tradableInstrument_instrument_product_settlementAsset {
__typename: "Asset";
__typename: 'Asset';
/**
* The id of the asset
*/
@ -62,7 +62,7 @@ export interface Positions_party_positions_market_tradableInstrument_instrument_
}
export interface Positions_party_positions_market_tradableInstrument_instrument_product {
__typename: "Future";
__typename: 'Future';
/**
* The name of the asset (string)
*/
@ -74,7 +74,7 @@ export interface Positions_party_positions_market_tradableInstrument_instrument_
}
export interface Positions_party_positions_market_tradableInstrument_instrument {
__typename: "Instrument";
__typename: 'Instrument';
/**
* Uniquely identify an instrument across all instruments available on Vega (string)
*/
@ -98,7 +98,7 @@ export interface Positions_party_positions_market_tradableInstrument_instrument
}
export interface Positions_party_positions_market_tradableInstrument {
__typename: "TradableInstrument";
__typename: 'TradableInstrument';
/**
* An instance of or reference to a fully specified instrument.
*/
@ -106,7 +106,7 @@ export interface Positions_party_positions_market_tradableInstrument {
}
export interface Positions_party_positions_market {
__typename: "Market";
__typename: 'Market';
/**
* Market ID
*/
@ -122,14 +122,14 @@ export interface Positions_party_positions_market {
/**
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
* number denominated in the currency of the Market. (uint64)
*
*
* Examples:
* Currency Balance decimalPlaces Real Balance
* GBP 100 0 GBP 100
* GBP 100 2 GBP 1.00
* GBP 100 4 GBP 0.01
* GBP 1 4 GBP 0.0001 ( 0.01p )
*
*
* GBX (pence) 100 0 GBP 1.00 (100p )
* GBX (pence) 100 2 GBP 0.01 ( 1p )
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
@ -143,7 +143,7 @@ export interface Positions_party_positions_market {
}
export interface Positions_party_positions {
__typename: "Position";
__typename: 'Position';
/**
* Realised Profit and Loss (int64)
*/
@ -167,7 +167,7 @@ export interface Positions_party_positions {
}
export interface Positions_party {
__typename: "Party";
__typename: 'Party';
/**
* Party identifier
*/

View File

@ -184,7 +184,7 @@ export function makeDataProvider<QueryData, Data, SubscriptionData, Delta>(
getDelta: GetDelta<SubscriptionData, Delta>,
fetchPolicy: FetchPolicy = 'no-cache'
): Subscribe<Data, Delta> {
const getInstance = memoize<Data, Delta>((variables) =>
const getInstance = memoize<Data, Delta>(() =>
makeDataProviderInternal(
query,
subscriptionQuery,

View File

@ -1,4 +1,7 @@
const theme = require('./theme');
const vegaCustomClasses = require('./vega-custom-classes');
module.exports = {
theme,
plugins: [vegaCustomClasses],
};

View File

@ -0,0 +1,11 @@
const plugin = require('tailwindcss/plugin');
const vegaCustomClasses = plugin(function ({ addUtilities }) {
addUtilities({
'.calt': {
fontFeatureSettings: "'calt'",
},
});
});
module.exports = vegaCustomClasses;

View File

@ -20,7 +20,10 @@ export const FormGroup = ({
'text-right': labelAlign === 'right',
});
return (
<div data-testid="form-group" className={classNames(className, 'mb-20')}>
<div
data-testid="form-group"
className={className?.includes('mb') ? className : `${className} mb-20`}
>
{label && (
<label className={labelClasses} htmlFor={labelFor}>
{label}

View File

@ -1,7 +1,7 @@
import type { SelectHTMLAttributes } from 'react';
import { forwardRef } from 'react';
import classNames from 'classnames';
import { inputClassNames } from '../input/input';
import { inputClassNames } from '../input';
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
hasError?: boolean;

View File

@ -1,6 +1,6 @@
import type { TextareaHTMLAttributes } from 'react';
import { forwardRef } from 'react';
import { inputClassNames } from '../input/input';
import { inputClassNames } from '../input';
export interface TextAreaProps
extends TextareaHTMLAttributes<HTMLTextAreaElement> {

View File

@ -6,7 +6,7 @@ export default {
title: 'ThemeSwitcher',
} as Meta;
const Template: Story = (args) => (
const Template: Story = () => (
<ThemeSwitcher onToggle={() => document.body.classList.toggle('dark')} />
);

View File

@ -3,7 +3,7 @@ import { Dialog } from '@vegaprotocol/ui-toolkit';
import type { VegaConnector } from './connectors';
import { RestConnectorForm } from './rest-connector-form';
import { useEffect } from 'react';
import { RestConnector } from './connectors/rest-connector';
import { RestConnector } from './connectors';
import { useVegaWallet } from './hooks';
import { t } from '@vegaprotocol/react-helpers';
@ -39,7 +39,7 @@ export function VegaConnectDialog({
useEffect(() => {
if (
selectedConnector !== null &&
selectedConnector instanceof RestConnector === false
!(selectedConnector instanceof RestConnector)
) {
connectAndClose(selectedConnector);
}

View File

@ -3,8 +3,8 @@ import type {
OrderSubmissionBody,
} from '@vegaprotocol/vegawallet-service-api-client';
import {
DefaultApi,
createConfiguration,
DefaultApi,
} from '@vegaprotocol/vegawallet-service-api-client';
import { LocalStorage } from '@vegaprotocol/react-helpers';
import { WALLET_CONFIG } from '../storage-keys';
@ -89,8 +89,7 @@ export class RestConnector implements VegaConnector {
async sendTx(body: OrderSubmissionBody) {
try {
const res = await this.service.commandSyncPost(body);
return res;
return await this.service.commandSyncPost(body);
} catch (err) {
return this.handleSendTxError(err);
}
@ -100,8 +99,7 @@ export class RestConnector implements VegaConnector {
if (typeof err === 'object' && err && 'body' in err) {
try {
// @ts-ignore Not sure why TS can't infer that 'body' does indeed exist on object
const parsedError = JSON.parse(err.body);
return parsedError;
return JSON.parse(err.body);
} catch {
// Unexpected response
return {
@ -123,8 +121,7 @@ export class RestConnector implements VegaConnector {
const cfg = LocalStorage.getItem(this.configKey);
if (cfg) {
try {
const obj = JSON.parse(cfg);
return obj;
return JSON.parse(cfg);
} catch {
return null;
}