Skip to content

Commit 189909b

Browse files
committed
Merge branch 'frontend-style-remember-account'
2 parents 66648b7 + 4fb2f72 commit 189909b

File tree

8 files changed

+191
-116
lines changed

8 files changed

+191
-116
lines changed

backend/handlers/handlers.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ type Backend interface {
9797
SetAccountActive(accountCode accountsTypes.Code, active bool) error
9898
SetTokenActive(accountCode accountsTypes.Code, tokenCode string, active bool) error
9999
RenameAccount(accountCode accountsTypes.Code, name string) error
100-
AccountSetWatch(filter func(*config.Account) bool, watch *bool) error
100+
// disabling for now, we'll either bring this back (if user request it) or remove for good
101+
// AccountSetWatch(filter func(*config.Account) bool, watch *bool) error
101102
AOPP() backend.AOPP
102103
AOPPCancel()
103104
AOPPApprove()
@@ -213,7 +214,8 @@ func NewHandlers(
213214
getAPIRouterNoError(apiRouter)("/set-account-active", handlers.postSetAccountActiveHandler).Methods("POST")
214215
getAPIRouterNoError(apiRouter)("/set-token-active", handlers.postSetTokenActiveHandler).Methods("POST")
215216
getAPIRouterNoError(apiRouter)("/rename-account", handlers.postRenameAccountHandler).Methods("POST")
216-
getAPIRouterNoError(apiRouter)("/account-set-watch", handlers.postAccountSetWatchHandler).Methods("POST")
217+
// disabling for now, we'll either bring this back (if user request it) or remove for good
218+
// getAPIRouterNoError(apiRouter)("/account-set-watch", handlers.postAccountSetWatchHandler).Methods("POST")
217219
getAPIRouterNoError(apiRouter)("/accounts/reinitialize", handlers.postAccountsReinitializeHandler).Methods("POST")
218220
getAPIRouter(apiRouter)("/account-summary", handlers.getAccountSummary).Methods("GET")
219221
getAPIRouterNoError(apiRouter)("/supported-coins", handlers.getSupportedCoinsHandler).Methods("GET")
@@ -800,6 +802,8 @@ func (handlers *Handlers) postRenameAccountHandler(r *http.Request) interface{}
800802
return response{Success: true}
801803
}
802804

805+
// disabling for now, we'll either bring this back (if user request it) or remove for good
806+
/*
803807
func (handlers *Handlers) postAccountSetWatchHandler(r *http.Request) interface{} {
804808
var jsonBody struct {
805809
AccountCode accountsTypes.Code `json:"accountCode"`
@@ -823,6 +827,7 @@ func (handlers *Handlers) postAccountSetWatchHandler(r *http.Request) interface{
823827
}
824828
return response{Success: true}
825829
}
830+
*/
826831

827832
func (handlers *Handlers) postAccountsReinitializeHandler(_ *http.Request) interface{} {
828833
handlers.backend.ReinitializeAccounts()
Lines changed: 13 additions & 0 deletions
Loading

frontends/web/src/components/icon/icon.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import creditCardDarkSVG from './assets/icons/credit-card.svg';
3636
import creditCardLightSVG from './assets/icons/credit-card-light.svg';
3737
import editSVG from './assets/icons/edit.svg';
3838
import editLightSVG from './assets/icons/edit-light.svg';
39+
import editActiveSVG from './assets/icons/edit-active.svg';
3940
import ethColorSVG from './assets//eth-color.svg';
4041
import redDotSVG from './assets/icons/red-dot.svg';
4142
import copySVG from './assets/icons/copy.svg';
@@ -157,6 +158,7 @@ export const CloseXWhite = (props: ImgProps) => (<img src={closeXWhiteSVG} dragg
157158
export const CloseXDark = (props: ImgProps) => (<img src={closeXDarkSVG} draggable={false} {...props} />);
158159
export const Edit = (props: ImgProps) => (<img src={editSVG} draggable={false} {...props} />);
159160
export const EditLight = (props: ImgProps) => (<img src={editLightSVG} draggable={false} {...props} />);
161+
export const EditActive = (props: ImgProps) => (<img src={editActiveSVG} draggable={false} {...props} />);
160162
export const ETHLogo = (props: ImgProps) => (<img src={ethColorSVG} draggable={false} {...props} />);
161163
export const ExternalLink = (props: ImgProps) => (<img src={externalLink} draggable={false} {...props} />);
162164
export const EyeClosed = (props: ImgProps) => (<img src={eyeClosedSVG} draggable={false} {...props} />);

frontends/web/src/locales/en/app.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,10 @@
11111111
"description": "Select your default currency",
11121112
"title": "Default currency"
11131113
},
1114+
"enableWallet": {
1115+
"description": "Disabling your account means it will not appear in the sidebar or the portfolio. You can always enable it again from here. Coins on this account will not be affected and will remain safe.",
1116+
"title": "Enable/disable wallet"
1117+
},
11141118
"hideAmounts": {
11151119
"description": "Displays a toggle to hide your balance and amounts to improve your privacy when using the app in public.",
11161120
"hideAmounts": "Hide amounts",
@@ -1121,14 +1125,13 @@
11211125
"description": "Which language you want the BitBoxApp to use.",
11221126
"title": "Language"
11231127
},
1128+
"remebmerWallet": {
1129+
"name": "Remember wallet",
1130+
"warning": "This will remove your remembered wallet. To see it again, you will need to plug in the BitBox02 for this wallet. Any coins on this wallet are not affected. Do you want to continue?",
1131+
"warningTitle": "Disable remember wallet"
1132+
},
11241133
"toggleSats": {
11251134
"description": "Enable or disable Satoshis."
1126-
},
1127-
"watchonly": {
1128-
"description": "Let's you see your accounts and portfolio without the BitBox02. The BitBox02 is still needed for signing.",
1129-
"title": "Watch-only",
1130-
"warning": "This will remove all your watch-only accounts. To see them again, you will need to plug in your BitBox02. Do you want to continue?",
1131-
"warningTitle": "Disable watch-only"
11321135
}
11331136
}
11341137
},

frontends/web/src/routes/settings/components/manage-accounts/watchonlySetting.tsx

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
import { useEffect, useState } from 'react';
1818
import { useTranslation } from 'react-i18next';
1919
import { Toggle } from '../../../../components/toggle/toggle';
20-
import { SettingsItem } from '../settingsItem/settingsItem';
2120
import * as backendAPI from '../../../../api/backend';
2221
import * as accountAPI from '../../../../api/account';
2322
import { useLoad } from '../../../../hooks/api';
2423
import { getConfig } from '../../../../utils/config';
2524
import { Dialog, DialogButtons } from '../../../../components/dialog/dialog';
26-
import { Button } from '../../../../components/forms';
25+
import { Button, Label } from '../../../../components/forms';
26+
import style from './watchonlySettings.module.css';
2727

2828
type Props = {
2929
keystore: accountAPI.TKeystore;
@@ -74,32 +74,25 @@ export const WatchonlySetting = ({ keystore }: Props) => {
7474

7575
return (
7676
<>
77-
<Dialog title={t('newSettings.appearance.watchonly.warningTitle')} medium onClose={handleCloseDialog} open={warningDialogOpen}>
78-
<p>{t('newSettings.appearance.watchonly.warning')}</p>
77+
<Dialog title={t('newSettings.appearance.remebmerWallet.warningTitle')} medium onClose={handleCloseDialog} open={warningDialogOpen}>
78+
<p>{t('newSettings.appearance.remebmerWallet.warning')}</p>
7979
<DialogButtons>
8080
<Button primary onClick={handleConfirmDisableWatchonly}>{t('dialog.confirm')}</Button>
8181
<Button secondary onClick={handleCloseDialog}>{t('dialog.cancel')}</Button>
8282
</DialogButtons>
8383
</Dialog>
84-
<SettingsItem
85-
settingName={t('newSettings.appearance.watchonly.title')}
86-
secondaryText={t('newSettings.appearance.watchonly.description')}
87-
extraComponent={
88-
<>
89-
{
90-
watchonly !== undefined ?
91-
(
92-
<Toggle
93-
checked={watchonly}
94-
disabled={disabled}
95-
onChange={toggleWatchonly}
96-
/>
97-
) :
98-
null
99-
}
100-
</>
101-
}
102-
/>
84+
{ watchonly !== undefined ? (
85+
<Label>
86+
<span className={style.labelText}>
87+
{t('newSettings.appearance.remebmerWallet.name')}
88+
</span>
89+
<Toggle
90+
checked={watchonly}
91+
disabled={disabled}
92+
onChange={toggleWatchonly}
93+
/>
94+
</Label>
95+
) : null}
10396
</>
10497
);
10598
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.labelText {
2+
font-size: 14px;
3+
line-height: 1;
4+
margin-right: 8px;
5+
vertical-align: sub;
6+
}

frontends/web/src/routes/settings/manage-accounts.module.css

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,31 @@
33
margin-bottom: var(--spacing-default);
44
}
55

6+
.walletHeader {
7+
display: flex;
8+
flex-wrap: wrap;
9+
justify-content: space-between;
10+
margin-bottom: var(--space-eight);
11+
}
12+
13+
.walletTitle {
14+
font-size: 20px;
15+
font-weight: 400;
16+
margin: 0;
17+
}
18+
619
.setting {
720
align-items: center;
821
display: flex;
922
flex-direction: row;
1023
flex-wrap: wrap;
11-
justify-content: flex-end;
24+
justify-content: space-between;
1225
min-height: var(--item-height);
13-
padding: 10px var(--space-half);
26+
padding: var(--space-quarter) 0;
27+
}
28+
29+
.setting:not(:last-child) {
30+
border-bottom: solid 1px var(--background);
1431
}
1532

1633
.coinLogo {
@@ -21,20 +38,38 @@
2138
.acccountLink {
2239
align-items: center;
2340
display: flex;
24-
flex-basis: calc(100% - 180px);
25-
flex-grow: 0;
41+
flex-basis: calc(100% - 100px);
42+
flex-grow: 1;
2643
flex-shrink: 1;
2744
}
2845

2946
.editBtn {
30-
background: transparent;
31-
border: none;
32-
color: var(--color-primary);
33-
flex-basis: content;
34-
flex-grow: 1;
35-
flex-shrink: 1;
36-
line-height: 2;
37-
text-align: right;
47+
min-width: 0;
48+
padding: 0 0 0 var(--space-quarter);
49+
}
50+
51+
.editBtn img {
52+
margin-right: var(--space-quarter);
53+
max-width: 18px;
54+
height: auto;
55+
vertical-align: text-bottom;
56+
}
57+
58+
.toggleLabel {
59+
align-items: center;
60+
display: flex;
61+
justify-content: space-between;
62+
}
63+
64+
.toggleLabelText {
65+
color: var(--color-secondary);
66+
}
67+
68+
.toggleLabelText img {
69+
color: var(--color-secondary);
70+
margin-right: var(--space-quarter);
71+
max-width: 18px;
72+
vertical-align: bottom;
3873
}
3974

4075
.toggle {
@@ -149,12 +184,6 @@
149184
margin-top: var(--space-half);
150185
}
151186

152-
.watchOnlyTitle {
153-
color: var(--color-secondary);
154-
margin: 0;
155-
margin-left: var(--space-quarter);
156-
}
157-
158187
.watchOnlyNote {
159188
margin: 0;
160189
margin-top: var(--space-half);

0 commit comments

Comments
 (0)