Skip to content

Commit f22368a

Browse files
committed
frontend: display Bluetooth section with firmware version info
1 parent 18f75f8 commit f22368a

File tree

3 files changed

+68
-6
lines changed

3 files changed

+68
-6
lines changed

frontends/web/src/api/bitbox02.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ import { TSubscriptionCallback, subscribeEndpoint } from './subscribe';
2323
export const errUserAbort = 104;
2424

2525
export type DeviceInfo = {
26-
initialized: boolean;
27-
mnemonicPassphraseEnabled: boolean;
28-
name: string;
29-
securechipModel: string;
30-
version: string;
26+
initialized: boolean;
27+
mnemonicPassphraseEnabled: boolean;
28+
name: string;
29+
securechipModel: string;
30+
version: string;
31+
bluetooth: null | {
32+
firmwareVersion: string;
33+
enabled: boolean;
34+
};
3135
}
3236

3337
type DeviceInfoResponse = SuccessResponse & {
34-
deviceInfo: DeviceInfo;
38+
deviceInfo: DeviceInfo;
3539
};
3640

3741
export const resetDevice = (deviceID: string): Promise<SuccessResponse | FailResponse> => {

frontends/web/src/routes/settings/bb02-settings.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { alertUser } from '@/components/alert/Alert';
3030
import { Skeleton } from '@/components/skeleton/skeleton';
3131
import { AttestationCheckSetting } from './components/device-settings/attestation-check-setting';
3232
import { FirmwareSetting } from './components/device-settings/firmware-setting';
33+
import { BluetoothFirmwareSetting } from './components/device-settings/bluetooth-firmware-setting';
3334
import { SecureChipSetting } from './components/device-settings/secure-chip-setting';
3435
import { DeviceNameSetting } from './components/device-settings/device-name-setting';
3536
import { FactoryResetSetting } from './components/device-settings/factory-reset-setting';
@@ -106,6 +107,7 @@ const Content = ({ deviceID }: TProps) => {
106107
return;
107108
}
108109
setDeviceInfo(result.deviceInfo);
110+
console.log('LOL', result);
109111
})
110112
.catch(console.error);
111113
}, [deviceID, t]);
@@ -154,6 +156,18 @@ const Content = ({ deviceID }: TProps) => {
154156
}
155157
</div>
156158

159+
{/*"Bluetooth" section*/}
160+
{ deviceInfo && deviceInfo.bluetooth ? (
161+
<>
162+
<div className={styles.section}>
163+
<SubTitle className={styles.withMobilePadding}>Bluetooth</SubTitle>
164+
<BluetoothFirmwareSetting
165+
firmwareVersion={deviceInfo.bluetooth.firmwareVersion}
166+
/>
167+
</div>
168+
</>
169+
) : null }
170+
157171
{/*"Expert settings" section*/}
158172
<div className={styles.section}>
159173
<SubTitle className={styles.withMobilePadding}>{t('settings.expert.title')}</SubTitle>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* Copyright 2025 Shift Crypto AG
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { useTranslation } from 'react-i18next';
18+
import { Checked, RedDot } from '@/components/icon';
19+
import { SettingsItem } from '@/routes/settings/components/settingsItem/settingsItem';
20+
21+
export type TProps = {
22+
firmwareVersion: string;
23+
}
24+
25+
export const BluetoothFirmwareSetting = ({ firmwareVersion }: TProps) => {
26+
const { t } = useTranslation();
27+
28+
// So far there is only one BLE firmware version. This can be adjusted once there is an upgrade
29+
// available.
30+
const canUpgrade = false;
31+
const secondaryText = canUpgrade ? t('deviceSettings.firmware.upgradeAvailable') : t('deviceSettings.firmware.upToDate');
32+
const extraComponent = canUpgrade ? <RedDot width={8} height={8}/> : <Checked />;
33+
34+
return (
35+
<>
36+
<SettingsItem
37+
settingName={t('deviceSettings.firmware.title')}
38+
secondaryText={secondaryText}
39+
displayedValue={firmwareVersion}
40+
extraComponent={extraComponent}
41+
/>
42+
</>
43+
);
44+
};

0 commit comments

Comments
 (0)