diff --git a/apps/simple-trading-app-e2e/src/integration/header.test.ts b/apps/simple-trading-app-e2e/src/integration/header.test.ts new file mode 100644 index 000000000..65243eaab --- /dev/null +++ b/apps/simple-trading-app-e2e/src/integration/header.test.ts @@ -0,0 +1,30 @@ +describe('console lite header', () => { + beforeEach(() => { + window.localStorage.setItem('theme', 'dark'); + cy.visit('/'); + }); + + it('logo should linked home', () => { + cy.get('span').contains('Markets').click(); + cy.location('pathname').should('eq', '/markets'); + cy.getByTestId('header').find('a').click(); + cy.location('pathname').should('eq', '/'); + }); + + it('theme switcher should switch theme', () => { + cy.get('#root').children().eq(0).as('Container'); + cy.get('@Container').should('have.css', 'background-color', 'rgb(8, 8, 8)'); + cy.getByTestId('theme-switcher').click(); + cy.get('@Container').should( + 'have.css', + 'background-color', + 'rgb(255, 255, 255)' + ); + }); + + it('wallet connector should open a dialog', () => { + cy.get('[role="dialog"]').should('not.exist'); + cy.getByTestId('connect-vega-wallet').click(); + cy.get('[role="dialog"]').should('be.visible'); + }); +}); diff --git a/apps/simple-trading-app/netlify.toml b/apps/simple-trading-app/netlify.toml new file mode 100644 index 000000000..b87b8d3dd --- /dev/null +++ b/apps/simple-trading-app/netlify.toml @@ -0,0 +1,4 @@ +[[redirects]] + from = "/*" + to = "/index.html" + status = 200 diff --git a/apps/simple-trading-app/project.json b/apps/simple-trading-app/project.json index 3905d0432..d65b5d432 100644 --- a/apps/simple-trading-app/project.json +++ b/apps/simple-trading-app/project.json @@ -68,6 +68,15 @@ "jestConfig": "apps/simple-trading-app/jest.config.js", "passWithNoTests": true } + }, + "build-netlify": { + "builder": "@nrwl/workspace:run-commands", + "options": { + "commands": [ + "cp apps/simple-trading-app/netlify.toml netlify.toml", + "nx build simple-trading-app" + ] + } } }, "tags": [] diff --git a/apps/simple-trading-app/src/app/app.tsx b/apps/simple-trading-app/src/app/app.tsx index a4a53f682..daf1e5358 100644 --- a/apps/simple-trading-app/src/app/app.tsx +++ b/apps/simple-trading-app/src/app/app.tsx @@ -8,13 +8,11 @@ import { VegaManageDialog, VegaWalletProvider, } from '@vegaprotocol/wallet'; -import { VegaWalletConnectButton } from './components/vega-wallet-connect-button'; -import { ThemeSwitcher } from '@vegaprotocol/ui-toolkit'; import { Connectors } from './lib/vega-connectors'; import '../styles.scss'; import { AppLoader } from './components/app-loader'; +import Header from './components/header'; import { Main } from './components/main'; -import { DrawerToggle, DRAWER_TOGGLE_VARIANTS } from './components/drawer'; import { useLocation } from 'react-router-dom'; function App() { @@ -39,32 +37,12 @@ function App() { -
-
-
- - setVegaWallet((x) => ({ ...x, connect: open })) - } - setManageDialog={(open) => - setVegaWallet((x) => ({ ...x, manage: open })) - } - /> - -
- -
- +
+
- { - const classes = classNames('flex dark:bg-black md:flex-row', className); + const classes = classNames('flex dark:bg-lite-black md:flex-row', className); return
{children}
; }; diff --git a/apps/simple-trading-app/src/app/components/drawer/drawer.tsx b/apps/simple-trading-app/src/app/components/drawer/drawer.tsx index 128259e32..ef7fb9015 100644 --- a/apps/simple-trading-app/src/app/components/drawer/drawer.tsx +++ b/apps/simple-trading-app/src/app/components/drawer/drawer.tsx @@ -34,11 +34,14 @@ export const NavigationDrawer = ({ const translateClose = rtl ? 'translate-x-full' : '-translate-x-full'; - const innerStyles = classNames('w-3/4 md:w-full bg-white dark:bg-black', { - 'translate-x-0 transition-transform md:transform-none': isMenuOpen, - [`${translateClose} md:transform-none`]: !isMenuOpen, - [innerClasses]: innerClasses, - }); + const innerStyles = classNames( + 'w-3/4 md:w-full bg-white dark:bg-lite-black', + { + 'translate-x-0 transition-transform md:transform-none': isMenuOpen, + [`${translateClose} md:transform-none`]: !isMenuOpen, + [innerClasses]: innerClasses, + } + ); return (