2302ef4378
* feat: 447 Refactored 'progress' intent to be 'prompt' as now white. Added yellow 'selected' intent * feat: 447 Colour consolidation * feat: 447 Colour consolidation extra renaming * feat: 447 Fixing specified red colours * feat: 447 Removed unused darker red * feat: 447 Documenting additional colours in storybook * feat: 447 Buttons updated (except 'accent', which will probably get removed when navs built) * feat: 447 Text inputs updated * feat:frontend-monorepo-447: Trading nav * feat:frontend-monorepo-447: Updated toggle button colours * feat:frontend-monorepo-447: Custom checkboxes * feat:frontend-monorepo-447: Tweaks to radio buttons * feat:frontend-monorepo-447: Input dates get dark color scheme in dark mode * feat:frontend-monorepo-447: Dropdown updates * feat:frontend-monorepo-447: Icon menu * feat:frontend-monorepo-447: Focus visual styles moved to focus-visible for radios and toggle * feat:frontend-monorepo-447: Tweak to focus styles for text input and textarea * feat:frontend-monorepo-447: Labeled input * feat:frontend-monorepo-447: Labeled input description red when in error * feat:frontend-monorepo-447: Tooltip visual update * feat:frontend-monorepo-447: Added disabled state to checkbox * feat:frontend-monorepo-447: Custom select with radix * feat:frontend-monorepo-447: Reverted back to native Select for a11y concerns * feat:frontend-monorepo-447: Added visual cue for dropdown items when multiple can be selected * feat:frontend-monorepo-447: Removed shadow from buttons in Explorer where it looked wrong * feat:frontend-monorepo-447: Added box shadow classes into tailwind theme * feat:frontend-monorepo-447: Colour primitives documentation updated * feat:frontend-monorepo-447: Cleaning up box shadow use further * feat:frontend-monorepo-447: Intents util updated * feat:frontend-monorepo-447: Dialog component updated * feat:frontend-monorepo-447: Callout component updated * feat:frontend-monorepo-447: Adjusted apps to handle toolkit changes * feat:frontend-monorepo-447: Moved tabs to ui-toolkit and styled * feat:frontend-monorepo-447: Fixed ui-toolkit tests * feat:frontend-monorepo-447: Token eth wallet made dark to support new buttons * feat:frontend-monorepo-447: Ran prettier * frontend-monorepo-447: Simplified button class functions and exported for use on other elements * frontend-monorepo-447: Used newly exported button classes on Link elements in eth-wallet * frontend-monorepo-447: Moved trading nav from ui-toolkit to trading app * frontend-monorepo-447: Simplified intents and updated stories * frontend-monorepo-447: Using classnames in requested spot * frontend-monorepo-447: Removed unnecessary 'asChild' prop on dropdown triggers * frontend-monorepo-447: Made use of the XPrimitive Radix naming convention * frontend-monorepo-447: Simplified types in 'getButtonClasses' * frontend-monorepo-447: Added 'asChild' to dropdown trigger to avoid nested buttons * frontend-monorepo-447: Moved input label and description into Formgroup component. Refactored based on tweaked structure * frontend-monorepo-447: Externally linked input label * frontend-monorepo-447: Adding correct text colours to Intent.None backgrounds * frontend-monorepo-447: Improved intent function name * frontend-monorepo-447: Removed new navbar until implementation ticket is picked up * frontend-monorepo-447: using testing-library/user-event for tab click unit tests * frontend-monorepo-447: Removed unused button import * frontend-monorepo-447: Little extra use of classnames in form-group.tsx * feat: make navbar pink for light mode * fix: problem with theme not switching when dependent in js on theme value * fix: bg of row hover * fix: dont use vega pink for sell red * fix: type error in generate orders func * fix: lint Co-authored-by: Matthew Russell <mattrussell36@gmail.com>
106 lines
3.7 KiB
TypeScript
106 lines
3.7 KiB
TypeScript
import type { AppProps } from 'next/app';
|
|
import Head from 'next/head';
|
|
import { useRouter } from 'next/router';
|
|
import { Navbar } from '../components/navbar';
|
|
import { t, ThemeContext, useThemeSwitcher } from '@vegaprotocol/react-helpers';
|
|
import {
|
|
VegaConnectDialog,
|
|
VegaManageDialog,
|
|
VegaWalletProvider,
|
|
} from '@vegaprotocol/wallet';
|
|
import {
|
|
useEnvironment,
|
|
EnvironmentProvider,
|
|
NetworkSwitcherDialog,
|
|
} from '@vegaprotocol/environment';
|
|
import { Connectors } from '../lib/vega-connectors';
|
|
import { ThemeSwitcher } from '@vegaprotocol/ui-toolkit';
|
|
import { AppLoader } from '../components/app-loader';
|
|
import { VegaWalletConnectButton } from '../components/vega-wallet-connect-button';
|
|
import './styles.css';
|
|
import { useGlobalStore } from '../stores';
|
|
|
|
function AppBody({ Component, pageProps }: AppProps) {
|
|
const { push } = useRouter();
|
|
const store = useGlobalStore();
|
|
const { VEGA_NETWORKS } = useEnvironment();
|
|
const [theme, toggleTheme] = useThemeSwitcher();
|
|
|
|
return (
|
|
<ThemeContext.Provider value={theme}>
|
|
<div className="h-full dark:bg-black dark:text-white-60 bg-white relative z-0 text-black-60 grid grid-rows-[min-content,1fr]">
|
|
<AppLoader>
|
|
<div className="flex items-stretch border-b-[7px] border-vega-pink dark:border-vega-yellow">
|
|
<Navbar />
|
|
<div className="flex items-center gap-4 ml-auto mr-8">
|
|
<VegaWalletConnectButton
|
|
setConnectDialog={(open) => {
|
|
store.setVegaWalletConnectDialog(open);
|
|
}}
|
|
setManageDialog={(open) => {
|
|
store.setVegaWalletManageDialog(open);
|
|
}}
|
|
/>
|
|
<ThemeSwitcher onToggle={toggleTheme} className="-my-4" />
|
|
</div>
|
|
</div>
|
|
<main data-testid={pageProps.page}>
|
|
{/* @ts-ignore conflict between @types/react and nextjs internal types */}
|
|
<Component {...pageProps} />
|
|
</main>
|
|
<VegaConnectDialog
|
|
connectors={Connectors}
|
|
dialogOpen={store.vegaWalletConnectDialog}
|
|
setDialogOpen={(open) => store.setVegaWalletConnectDialog(open)}
|
|
/>
|
|
<VegaManageDialog
|
|
dialogOpen={store.vegaWalletManageDialog}
|
|
setDialogOpen={(open) => store.setVegaWalletManageDialog(open)}
|
|
/>
|
|
<NetworkSwitcherDialog
|
|
dialogOpen={store.vegaNetworkSwitcherDialog}
|
|
setDialogOpen={(open) => store.setVegaNetworkSwitcherDialog(open)}
|
|
onConnect={({ network }) => {
|
|
if (VEGA_NETWORKS[network]) {
|
|
push(VEGA_NETWORKS[network] ?? '');
|
|
}
|
|
}}
|
|
/>
|
|
</AppLoader>
|
|
</div>
|
|
</ThemeContext.Provider>
|
|
);
|
|
}
|
|
|
|
function VegaTradingApp(props: AppProps) {
|
|
return (
|
|
<EnvironmentProvider>
|
|
<VegaWalletProvider>
|
|
<Head>
|
|
<link
|
|
rel="preload"
|
|
href="https://static.vega.xyz/AlphaLyrae-Medium.woff2"
|
|
as="font"
|
|
type="font/woff2"
|
|
crossOrigin="anonymous"
|
|
/>
|
|
<title>{t('Welcome to Vega trading!')}</title>
|
|
<link
|
|
rel="icon"
|
|
type="image/x-icon"
|
|
href="https://static.vega.xyz/favicon.ico"
|
|
/>
|
|
<link rel="stylesheet" href="https://static.vega.xyz/fonts.css" />
|
|
{['1', 'true'].includes(process.env['NX_USE_ENV_OVERRIDES'] || '') ? (
|
|
/* eslint-disable-next-line @next/next/no-sync-scripts */
|
|
<script src="./env-config.js" type="text/javascript" />
|
|
) : null}
|
|
</Head>
|
|
<AppBody {...props} />
|
|
</VegaWalletProvider>
|
|
</EnvironmentProvider>
|
|
);
|
|
}
|
|
|
|
export default VegaTradingApp;
|