Skip to content

Commit

Permalink
Fixed switching between old and new UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan-Mahda committed Oct 17, 2024
1 parent d46ad0f commit d5e242c
Show file tree
Hide file tree
Showing 18 changed files with 109 additions and 191 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ package.json
!.storybook

packages/browser-wallet-api-helpers/lib
packages/browser-wallet/src/popup/popupX/styles/_bundle.scss
3 changes: 0 additions & 3 deletions packages/browser-wallet/src/popup/constants/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ type RouteChildren = {
};

export const relativeRoutes = {
onboarding: {
path: '/onboarding',
},
home: {
path: '/',
account: {
Expand Down
21 changes: 2 additions & 19 deletions packages/browser-wallet/src/popup/pages/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { popupMessageHandler } from '@popup/shared/message-handler';
import { InternalMessageType } from '@messaging';
import Button from '@popup/shared/Button';
import { isFullscreenWindow } from '@popup/shared/window-helpers';
import { noOp } from 'wallet-common-helpers';
import { routePrefix } from '@popup/popupX/constants/routes';

function LightDarkModeToggle() {
const { t } = useTranslation('settings');
Expand Down Expand Up @@ -63,24 +63,7 @@ export default function Settings() {
{t('fullscreenWallet')}
</Button>
)}
<Link
className="settings-page__link"
to={absoluteRoutes.onboarding.path}
onClick={() => {
const body = document.getElementsByTagName('body').item(0);
const html = document.getElementsByTagName('html').item(0);
const bg = document.getElementsByClassName('bg').item(0);
body?.classList.add('popup-x');
bg?.classList.add('welcome-page');
body?.setAttribute('style', 'width:375px; height:600px; margin: auto;');

popupMessageHandler
.sendInternalMessage(InternalMessageType.SetViewSize, { width: 375, height: 600 })
.catch(noOp);
html?.classList.remove('ui-scale-medium');
html?.classList.add('ui-scale-large');
}}
>
<Link className="settings-page__link" to={`${routePrefix}/home`}>
Wallet X
</Link>
<Link className="settings-page__link" to={absoluteRoutes.home.settings.about.path}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Plant from '@assets/svgX/plant.svg';
import LinkSimple from '@assets/svgX/link-simple-horizontal.svg';
import Info from '@assets/svgX/info2.svg';
import Restore from '@assets/svgX/arrow-counter-clock.svg';
import Eye from '@assets/svgX/eye.svg';
import IconButton from '@popup/shared/IconButton';
import Text from '@popup/popupX/shared/Text';
import { Link } from 'react-router-dom';
Expand Down Expand Up @@ -49,7 +50,7 @@ export default function MenuTiles({ menuOpen, setMenuOpen }: MenuTilesProps) {
<Text.Capture>{t('seedPhrase')}</Text.Capture>
</IconButton>
</Link>
<Link to="/">
<Link to={absoluteRoutes.settings.passcode.path}>
<IconButton className="main-header__menu-tiles_tile">
<Password />
<Text.Capture>{t('passcode')}</Text.Capture>
Expand Down Expand Up @@ -85,6 +86,12 @@ export default function MenuTiles({ menuOpen, setMenuOpen }: MenuTilesProps) {
<Text.Capture>{t('restore')}</Text.Capture>
</IconButton>
</Link>
<Link to="/account/tokens">
<IconButton className="main-header__menu-tiles_tile">
<Eye />
<Text.Capture>{t('oldUI')}</Text.Capture>
</IconButton>
</Link>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const t = {
network: 'Network',
about: 'About',
restore: 'Restore',
oldUI: 'Old UI',
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { useAtomValue } from 'jotai';
import { displayAsCcd } from 'wallet-common-helpers';
import { Ratio } from '@concordium/web-sdk';
import { AccountInfoType, Ratio } from '@concordium/web-sdk';
import { relativeRoutes } from '@popup/popupX/constants/routes';
import Img from '@popup/shared/Img';
import { WalletCredential } from '@shared/storage/types';
Expand Down Expand Up @@ -142,6 +142,8 @@ function MainPage({ credential }: MainPageProps) {
return <>Loading</>;
}

const isStaked = [AccountInfoType.Delegator, AccountInfoType.Baker].includes(accountInfo.type);

return (
<Page className="main-page-x">
<Balance credential={credential} />
Expand All @@ -161,7 +163,7 @@ function MainPage({ credential }: MainPageProps) {
onClick={() => nav(`${relativeRoutes.home.token.path}/ccd`)}
thumbnail={<ConcordiumLogo />}
symbol="CCD"
staked
staked={isStaked}
balance={displayAsCcd(accountInfo.accountAmount.microCcdAmount, false)}
balanceBase={accountInfo.accountAmount.microCcdAmount}
microCcdPerEur={microCcdPerEur}
Expand Down
110 changes: 0 additions & 110 deletions packages/browser-wallet/src/popup/popupX/pages/ReceiveFunds/QRcode.svg

This file was deleted.

Loading

0 comments on commit d5e242c

Please sign in to comment.