Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Move insurance to Marketplace

## v4.51.0
- Bundle BitBox02 and BitBox02 Nova firmware version v9.26.1
Expand Down
5 changes: 0 additions & 5 deletions frontends/web/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ export const App = () => {
navigate('/');
return;
}
// if on the /bitsurance/ view and there are no accounts view route to /
if (accounts.length === 0 && currentURL.startsWith('/bitsurance/')) {
navigate('/');
return;
}
// if in no-accounts settings and has account go to manage-accounts
if (accounts.length && currentURL === '/settings/no-accounts') {
navigate('/settings/manage-accounts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const BottomNavigation = ({
<Link
className={`
${styles.link || ''}
${pathname.startsWith('/settings') || pathname.startsWith('/bitsurance/') ? (styles.active || '') : ''}
${pathname.startsWith('/settings') ? (styles.active || '') : ''}
`}
to="/settings/more"
>
Expand Down
2 changes: 1 addition & 1 deletion frontends/web/src/components/bottom-navigation/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const getBottomNavKey = (pathname: string): string => {
if (pathname.startsWith('/market/')) {
return 'market';
}
if (pathname.startsWith('/settings') || pathname.startsWith('/bitsurance/')) {
if (pathname.startsWith('/settings')) {
return 'more';
}
return 'other';
Expand Down
17 changes: 3 additions & 14 deletions frontends/web/src/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { deregisterTest } from '@/api/keystores';
import { getVersion } from '@/api/bitbox02';
import { debug } from '@/utils/env';
import { AppLogoInverted, Logo } from '@/components/icon/logo';
import { CloseXWhite, CogLight, Coins, Device, Eject, Linechart, RedDot, ShieldLight } from '@/components/icon';
import { CloseXWhite, CogLight, Coins, Device, Eject, Linechart, RedDot } from '@/components/icon';
import { getAccountsByKeystore } from '@/routes/account/utils';
import { SkipForTesting } from '@/routes/device/components/skipfortesting';
import { AppContext } from '@/contexts/AppContext';
Expand Down Expand Up @@ -92,7 +92,7 @@ const Sidebar = ({
};

const accountsByKeystore = getAccountsByKeystore(accounts);
const userInSpecificAccountMarketPage = (pathname.startsWith('/market'));
const inMarketSection = pathname.startsWith('/market');

return (
<div className={style.sidebarContainer}>
Expand Down Expand Up @@ -150,7 +150,7 @@ const Sidebar = ({
<>
<div key="market" className={style.sidebarItem}>
<NavLink
className={({ isActive }) => isActive || userInSpecificAccountMarketPage ? style.sidebarActive : ''}
className={({ isActive }) => isActive || inMarketSection ? style.sidebarActive : ''}
to="/market/select">
<div className={style.single}>
<Coins />
Expand All @@ -167,17 +167,6 @@ const Sidebar = ({
</span>
</NavLink>
</div>
<div key="insurance" className={style.sidebarItem}>
<NavLink
className={({ isActive }) => isActive ? style.sidebarActive : ''}
to="/bitsurance/bitsurance"
>
<div className={style.single}>
<ShieldLight alt={t('sidebar.insurance')} />
</div>
<span className={style.sidebarLabel}>{t('sidebar.insurance')}</span>
Comment thread
thisconnect marked this conversation as resolved.
</NavLink>
</div>
</>
) : null }

Expand Down
19 changes: 15 additions & 4 deletions frontends/web/src/contexts/BackNavigationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ const getTabId = (pathname: string): TabId => {
}
if (pathname.startsWith('/manage-backups/')
|| pathname.startsWith('/settings')
|| pathname.startsWith('/add-account')
|| pathname.startsWith('/bitsurance/')) {
|| pathname.startsWith('/add-account')) {
return 'settings';
}
return 'unknown';
Expand Down Expand Up @@ -71,8 +70,20 @@ const implicitBackRules: ImplicitBackRule[] = [
previousPattern: '/account/:code',
})),
{
currentPattern: '/bitsurance/bitsurance',
previousPattern: '/settings/more',
currentPattern: '/market/bitsurance',
previousPattern: '/market/select',
},
{
currentPattern: '/market/bitsurance',
previousPattern: '/market/select/:code',
},
{
currentPattern: '/market/bitsurance/dashboard',
previousPattern: '/market/select',
},
{
currentPattern: '/market/bitsurance/dashboard',
previousPattern: '/market/select/:code',
},
];

Expand Down
5 changes: 2 additions & 3 deletions frontends/web/src/locales/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,7 @@
"bitsuranceAccount": {
"errorNoXpub": "Error: Was not able to get xpub from account.",
"noAccount": "There are no accounts that can be insured.",
"select": "Select account",
"title": "Insurance"
"select": "Select account"
},
"blink": {
"button": "Blink"
Expand Down Expand Up @@ -1022,6 +1021,7 @@
"enable": "Enable",
"enabled_false": "Disabled",
"enabled_true": "Enabled",
"insure": "Insure",
"max": "Max",
"new": "New",
"noOptionOnIos": "Not available on iOS",
Expand Down Expand Up @@ -1996,7 +1996,6 @@
"setup": "Setup device",
"sidebar": {
"device": "Manage device",
"insurance": "Insurance",
"leave": "Leave",
"settings": "Settings"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import style from './insuredtag.module.css';
export const Insured = () => {
const { t } = useTranslation();
return (
<Link className={style.insured} to="/bitsurance/dashboard">
<Link className={style.insured} to="/market/bitsurance/dashboard">
<div>
<Shield/>
<span>{t('account.insured')}</span>
Expand Down
51 changes: 23 additions & 28 deletions frontends/web/src/routes/bitsurance/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { useState, useEffect, useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { TAccount } from '@/api/account';
import { BitsuranceGuide } from './guide';
import { GroupedAccountSelector } from '@/components/groupedaccountselector/groupedaccountselector';
import { GuidedContent, GuideWrapper, Header, Main } from '@/components/layout';
import { Spinner } from '@/components/spinner/Spinner';
import { View, ViewContent } from '@/components/view/view';
import { bitsuranceLookup } from '@/api/bitsurance';
Expand Down Expand Up @@ -63,7 +61,7 @@ export const BitsuranceAccount = ({ code, accounts }: TProps) => {
return;
}
// replace current history item when redirecting so that the user can go back
navigate(`/bitsurance/widget/${account.code}`, { replace: true });
navigate(`/market/bitsurance/widget/${account.code}`, { replace: true });
});
}
}, [btcAccounts, navigate]);
Expand All @@ -82,37 +80,34 @@ export const BitsuranceAccount = ({ code, accounts }: TProps) => {
} finally {
setDisabled(false);
}
navigate(`/bitsurance/widget/${selected}`);
navigate(`/market/bitsurance/widget/${selected}`);
};

if (btcAccounts === undefined) {
return <Spinner text={t('loading')} />;
}

return (
<Main>
<GuideWrapper>
<GuidedContent>
<Header title={<h2>{t('bitsuranceAccount.title')}</h2>} />
Comment thread
thisconnect marked this conversation as resolved.
<View width="550px" verticallyCentered fullscreen={false}>
<ViewContent>
{ btcAccounts.length === 0 ? (
<div>{t('bitsuranceAccount.noAccount')}</div>
) : (
<GroupedAccountSelector
title={t('bitsuranceAccount.select')}
disabled={disabled}
accounts={btcAccounts}
selected={selected}
onChange={handleChangeAccount}
onProceed={handleProceed}
/>
)}
</ViewContent>
</View>
</GuidedContent>
<BitsuranceGuide/>
</GuideWrapper>
</Main>
<View
fullscreen={false}
minHeight="600px"
verticallyCentered
width="550px"
>
<ViewContent>
{ btcAccounts.length === 0 ? (
<div>{t('bitsuranceAccount.noAccount')}</div>
) : (
<GroupedAccountSelector
title={t('bitsuranceAccount.select')}
disabled={disabled}
accounts={btcAccounts}
selected={selected}
onChange={handleChangeAccount}
onProceed={handleProceed}
/>
)}
</ViewContent>
</View>
);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
};
Loading