Skip to content

Commit ce5f7c0

Browse files
committed
Merge branch 'frontend-use-message-component'
2 parents 37f55f4 + e20c2e5 commit ce5f7c0

File tree

14 files changed

+51
-41
lines changed

14 files changed

+51
-41
lines changed

frontends/web/src/components/banners/offline.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
import { useTranslation } from 'react-i18next';
17-
import { Status } from '@/components/status/status';
17+
import { Message } from '@/components/message/message';
1818
import { AppContext } from '@/contexts/AppContext';
1919
import { useContext } from 'react';
2020

@@ -27,9 +27,8 @@ export const Offline = () => {
2727
}
2828

2929
return (
30-
<Status type="warning"
31-
hidden={isOnline}>
30+
<Message type="warning" hidden={isOnline}>
3231
{t('warning.offline')}
33-
</Status>
32+
</Message>
3433
);
3534
};

frontends/web/src/components/banners/sdcard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { useTranslation } from 'react-i18next';
1818
import type { AccountCode } from '@/api/account';
1919
import type { TDevices } from '@/api/devices';
2020
import { useSDCard } from '@/hooks/sdcard';
21-
import { Status } from '@/components/status/status';
21+
import { Message } from '@/components/message/message';
2222

2323
type Props = {
2424
code?: AccountCode;
@@ -33,8 +33,8 @@ export const SDCardWarning = ({
3333
const hasCard = useSDCard(devices, code ? [code] : undefined);
3434

3535
return (
36-
<Status hidden={!hasCard} type="warning">
36+
<Message hidden={!hasCard} type="warning">
3737
{t('warning.sdcard')}
38-
</Status>
38+
</Message>
3939
);
4040
};

frontends/web/src/components/banners/testing.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import { useContext } from 'react';
1818
import { useTranslation } from 'react-i18next';
1919
import { AppContext } from '@/contexts/AppContext';
20-
import { Status } from '@/components/status/status';
20+
import { Message } from '@/components/message/message';
2121

2222
export const Testing = () => {
2323
const { t } = useTranslation();
@@ -28,8 +28,8 @@ export const Testing = () => {
2828
}
2929

3030
return (
31-
<Status type="warning">
31+
<Message type="warning">
3232
{t('warning.testnet')}
33-
</Status>
33+
</Message>
3434
);
3535
};

frontends/web/src/components/bluetooth/bluetooth.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { useEffect, useRef, useState } from 'react';
1919
import { useSync } from '@/hooks/api';
2020
import { connect, getState, syncState, TPeripheral } from '@/api/bluetooth';
2121
import { runningInIOS } from '@/utils/env';
22-
import { Status } from '@/components/status/status';
22+
import { Message } from '@/components/message/message';
2323
import { ActionableItem } from '@/components/actionable-item/actionable-item';
2424
import { Badge } from '@/components/badge/badge';
2525
import { HorizontallyCenteredSpinner, SpinnerRingAnimated } from '@/components/spinner/SpinnerAnimation';
@@ -70,9 +70,9 @@ const BluetoothInner = ({ peripheralContainerClassName }: Props) => {
7070
}
7171
if (!state.bluetoothAvailable) {
7272
return (
73-
<Status type="warning">
73+
<Message type="warning">
7474
{t('bluetooth.enable')}
75-
</Status>
75+
</Message>
7676
);
7777
}
7878
const hasConnection = state.peripherals.some(isConnectedOrConnecting);

frontends/web/src/components/devices/bitbox02bootloader/bitbox02bootloader.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { useSync, useLoad } from '@/hooks/api';
2222
import { Button } from '@/components/forms';
2323
import { View, ViewContent } from '@/components/view/view';
2424
import { BitBox02, BitBox02Inverted, BitBox02Nova, BitBox02NovaInverted } from '@/components/icon/logo';
25-
import { Status } from '@/components/status/status';
25+
import { Message } from '@/components/message/message';
2626
import { SubTitle } from '@/components/title';
2727
import { ToggleShowFirmwareHash } from './toggleshowfirmwarehash';
2828
import style from './bitbox02bootloader.module.css';
@@ -145,7 +145,9 @@ export const BitBox02Bootloader = ({ deviceID }: TProps) => {
145145
<ViewContent>
146146
{logo}
147147
{status && status.errMsg && (
148-
<Status type="warning">{status.errMsg}</Status>
148+
<Message type="warning">
149+
{status.errMsg}
150+
</Message>
149151
)}
150152
{contents}
151153
</ViewContent>

frontends/web/src/components/message/message.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const MessageIcon = ({ type, icon }: TMessageIconProps) => {
5050
};
5151

5252
type MessageProps = {
53+
className?: string;
5354
hidden?: boolean;
5455
small?: boolean;
5556
title?: string;
@@ -60,6 +61,7 @@ type MessageProps = {
6061
}
6162

6263
export const Message = ({
64+
className = '',
6365
hidden,
6466
small,
6567
title,
@@ -75,6 +77,7 @@ export const Message = ({
7577
<div className={`
7678
${styles[type] || ''}
7779
${small && styles.small || ''}
80+
${className || ''}
7881
`.trim()}>
7982
{!noIcon && <MessageIcon type={type} icon={icon} />}
8083
<div className={styles.content}>

frontends/web/src/components/status/status.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type TProps = {
3030
// used as keyName in the config if dismissing the status should be persisted, so it is not
3131
// shown again. Use an empty string if it should be dismissible without storing it in the
3232
// config, so the status will be shown again the next time.
33-
dismissible?: string;
33+
dismissible: string;
3434
className?: string;
3535
children: ReactNode;
3636
}

frontends/web/src/routes/account/account.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { HeadersSync } from '@/components/headerssync/headerssync';
2929
import { Info, LoupeBlue } from '@/components/icon';
3030
import { GuidedContent, GuideWrapper, Header, Main } from '@/components/layout';
3131
import { Spinner } from '@/components/spinner/Spinner';
32-
import { Status } from '@/components/status/status';
32+
import { Message } from '@/components/message/message';
3333
import { useLoad, useSubscribe, useSync } from '@/hooks/api';
3434
import { useDebounce } from '@/hooks/debounce';
3535
import { HideAmountsButton } from '@/components/hideamountsbutton/hideamountsbutton';
@@ -273,13 +273,19 @@ const RemountAccount = ({
273273
<Main>
274274
<ContentWrapper>
275275
<GlobalBanners code={code} devices={devices} />
276-
<Status className={style.status} hidden={status === undefined || !status.offlineError} type="error">
276+
<Message
277+
className={style.status}
278+
hidden={status === undefined || !status.offlineError}
279+
type="error">
277280
{offlineErrorTextLines.join('\n')}
278-
</Status>
279-
<Status className={style.status} hidden={status === undefined || status.synced || !!status.offlineError} type="info">
281+
</Message>
282+
<Message
283+
className={style.status}
284+
hidden={status === undefined || status.synced || !!status.offlineError}
285+
type="info">
280286
{t('account.initializing')}
281287
{notSyncedText}
282-
</Status>
288+
</Message>
283289
</ContentWrapper>
284290
<Dialog open={insured && uncoveredFunds.length !== 0} medium title={t('account.warning')} onClose={() => setUncoveredFunds([])}>
285291
<MultilineMarkup tagName="p" markup={t('account.uncoveredFunds', {

frontends/web/src/routes/account/info/info.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Header } from '@/components/layout';
2424
import { BackButton } from '@/components/backbutton/backbutton';
2525
import { SigningConfiguration } from './signingconfiguration';
2626
import { BitcoinBasedAccountInfoGuide } from './guide';
27-
import { Status } from '@/components/status/status';
27+
import { Message } from '@/components/message/message';
2828
import { Button } from '@/components/forms';
2929
import { alertUser } from '@/components/alert/Alert';
3030
import { statusChanged } from '@/api/accountsync';
@@ -126,9 +126,9 @@ export const Info = ({
126126
</Button>
127127
{ (config?.bitcoinSimple?.scriptType === 'p2tr') ? (
128128
<>
129-
<Status type="info">
129+
<Message type="info">
130130
{t('accountInfo.taproot')}
131-
</Status>
131+
</Message>
132132
<BackButton enableEsc>
133133
{t('button.back')}
134134
</BackButton>

frontends/web/src/routes/device/bitbox02/passphrase.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { Button, Checkbox } from '@/components/forms';
2626
import { alertUser } from '@/components/alert/Alert';
2727
import { View, ViewButtons, ViewContent, ViewHeader } from '@/components/view/view';
2828
import { PointToBitBox02 } from '@/components/icon';
29-
import { Status } from '@/components/status/status';
29+
import { Message } from '@/components/message/message';
3030

3131
// The enable wizard has five steps that can be navigated by clicking
3232
// 'back' or 'continue'. On the last step the passphrase will be enabled.
@@ -218,14 +218,14 @@ const EnableInfo = ({ handleAbort, setPassphrase }: TInfoProps) => {
218218
<SimpleMarkup key="info-3" tagName="li" markup={t('passphrase.summary.understandList.2')} />
219219
<SimpleMarkup key="info-4" tagName="li" markup={t('passphrase.summary.understandList.3')} />
220220
</ul>
221-
<Status noIcon type={understood ? 'success' : 'warning'}>
221+
<Message noIcon type={understood ? 'success' : 'warning'}>
222222
<Checkbox
223223
onChange={e => setUnderstood(e.target.checked)}
224224
id="understood"
225225
checked={understood}
226226
label={t('passphrase.summary.understand')}
227227
checkboxStyle={understood ? 'success' : 'warning'} />
228-
</Status>
228+
</Message>
229229
</ViewContent>
230230
)}
231231
<ViewButtons>

0 commit comments

Comments
 (0)