Skip to content
Merged
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
10 changes: 5 additions & 5 deletions lang/ui.ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@
"defaultMessage": "If needed, change the pattern below to match.",
"description": "Native Bluetooth pattern dialog subtitle"
},
"connect-native-start-battery-check": {
"defaultMessage": "Connect the battery pack, then check the light on the back of the micro:bit is on.",
"description": "Instruction to check the micro:bit is powered on via the battery pack"
},
"connect-native-start-heading": {
"defaultMessage": "What you need to connect",
"defaultMessage": "Connect micro:bit battery pack",
"description": "Connection dialog heading"
},
"connect-native-start-requirements1": {
"defaultMessage": "micro:bit with battery pack",
"description": "Label for image of a micro:bit and battery pack"
},
"connect-or-import": {
"defaultMessage": "<link1>Connecta una micro:bit de recollida de dades</link1> o <link2>importa mostres de dades</link2>",
"description": "Empty data samples page text"
Expand Down
10 changes: 5 additions & 5 deletions lang/ui.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@
"defaultMessage": "If needed, change the pattern below to match.",
"description": "Native Bluetooth pattern dialog subtitle"
},
"connect-native-start-battery-check": {
"defaultMessage": "Connect the battery pack, then check the light on the back of the micro:bit is on.",
"description": "Instruction to check the micro:bit is powered on via the battery pack"
},
"connect-native-start-heading": {
"defaultMessage": "What you need to connect",
"defaultMessage": "Connect micro:bit battery pack",
"description": "Connection dialog heading"
},
"connect-native-start-requirements1": {
"defaultMessage": "micro:bit with battery pack",
"description": "Label for image of a micro:bit and battery pack"
},
"connect-or-import": {
"defaultMessage": "<link1>Connect a data collection micro:bit</link1> or <link2>import data samples</link2>",
"description": "Empty data samples page text"
Expand Down
10 changes: 5 additions & 5 deletions lang/ui.es-es.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@
"defaultMessage": "If needed, change the pattern below to match.",
"description": "Native Bluetooth pattern dialog subtitle"
},
"connect-native-start-battery-check": {
"defaultMessage": "Connect the battery pack, then check the light on the back of the micro:bit is on.",
"description": "Instruction to check the micro:bit is powered on via the battery pack"
},
"connect-native-start-heading": {
"defaultMessage": "What you need to connect",
"defaultMessage": "Connect micro:bit battery pack",
"description": "Connection dialog heading"
},
"connect-native-start-requirements1": {
"defaultMessage": "micro:bit with battery pack",
"description": "Label for image of a micro:bit and battery pack"
},
"connect-or-import": {
"defaultMessage": "<link1>Conecta una colección de datos de micro:bit</link1> o <link2>importa muestras de datos</link2>",
"description": "Empty data samples page text"
Expand Down
10 changes: 5 additions & 5 deletions lang/ui.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@
"defaultMessage": "If needed, change the pattern below to match.",
"description": "Native Bluetooth pattern dialog subtitle"
},
"connect-native-start-battery-check": {
"defaultMessage": "Connect the battery pack, then check the light on the back of the micro:bit is on.",
"description": "Instruction to check the micro:bit is powered on via the battery pack"
},
"connect-native-start-heading": {
"defaultMessage": "What you need to connect",
"defaultMessage": "Connect micro:bit battery pack",
"description": "Connection dialog heading"
},
"connect-native-start-requirements1": {
"defaultMessage": "micro:bit with battery pack",
"description": "Label for image of a micro:bit and battery pack"
},
"connect-or-import": {
"defaultMessage": "<link1>Connecter un micro:bit de collecte de données</link1> ou <link2>importer des échantillons de données</link2>",
"description": "Empty data samples page text"
Expand Down
10 changes: 5 additions & 5 deletions lang/ui.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@
"defaultMessage": "If needed, change the pattern below to match.",
"description": "Native Bluetooth pattern dialog subtitle"
},
"connect-native-start-battery-check": {
"defaultMessage": "Connect the battery pack, then check the light on the back of the micro:bit is on.",
"description": "Instruction to check the micro:bit is powered on via the battery pack"
},
"connect-native-start-heading": {
"defaultMessage": "What you need to connect",
"defaultMessage": "Connect micro:bit battery pack",
"description": "Connection dialog heading"
},
"connect-native-start-requirements1": {
"defaultMessage": "micro:bit with battery pack",
"description": "Label for image of a micro:bit and battery pack"
},
"connect-or-import": {
"defaultMessage": "<link1>データ収集用micro:bitを接続</link1> または <link2>データサンプルのインポート</link2>",
"description": "Empty data samples page text"
Expand Down
10 changes: 5 additions & 5 deletions lang/ui.ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@
"defaultMessage": "If needed, change the pattern below to match.",
"description": "Native Bluetooth pattern dialog subtitle"
},
"connect-native-start-battery-check": {
"defaultMessage": "Connect the battery pack, then check the light on the back of the micro:bit is on.",
"description": "Instruction to check the micro:bit is powered on via the battery pack"
},
"connect-native-start-heading": {
"defaultMessage": "What you need to connect",
"defaultMessage": "Connect micro:bit battery pack",
"description": "Connection dialog heading"
},
"connect-native-start-requirements1": {
"defaultMessage": "micro:bit with battery pack",
"description": "Label for image of a micro:bit and battery pack"
},
"connect-or-import": {
"defaultMessage": "<link1>데이터 수집 micro:bit에 연결하기</link1> 또는 <link2>데이터 샘플 가져오기</link2>를 하세요.",
"description": "Empty data samples page text"
Expand Down
10 changes: 5 additions & 5 deletions lang/ui.lol.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@
"defaultMessage": "If needed, change the pattern below to match.",
"description": "Native Bluetooth pattern dialog subtitle"
},
"connect-native-start-battery-check": {
"defaultMessage": "Connect the battery pack, then check the light on the back of the micro:bit is on.",
"description": "Instruction to check the micro:bit is powered on via the battery pack"
},
"connect-native-start-heading": {
"defaultMessage": "What you need to connect",
"defaultMessage": "Connect micro:bit battery pack",
"description": "Connection dialog heading"
},
"connect-native-start-requirements1": {
"defaultMessage": "micro:bit with battery pack",
"description": "Label for image of a micro:bit and battery pack"
},
"connect-or-import": {
"defaultMessage": "crwdns362772:0crwdne362772:0",
"description": "Empty data samples page text"
Expand Down
10 changes: 5 additions & 5 deletions lang/ui.nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@
"defaultMessage": "If needed, change the pattern below to match.",
"description": "Native Bluetooth pattern dialog subtitle"
},
"connect-native-start-battery-check": {
"defaultMessage": "Connect the battery pack, then check the light on the back of the micro:bit is on.",
"description": "Instruction to check the micro:bit is powered on via the battery pack"
},
"connect-native-start-heading": {
"defaultMessage": "What you need to connect",
"defaultMessage": "Connect micro:bit battery pack",
"description": "Connection dialog heading"
},
"connect-native-start-requirements1": {
"defaultMessage": "micro:bit with battery pack",
"description": "Label for image of a micro:bit and battery pack"
},
"connect-or-import": {
"defaultMessage": "<link1>Verbind een micro:bit die gegevens verzamelt</link1> of <link2>importeer data samples</link2>",
"description": "Empty data samples page text"
Expand Down
10 changes: 5 additions & 5 deletions lang/ui.pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@
"defaultMessage": "If needed, change the pattern below to match.",
"description": "Native Bluetooth pattern dialog subtitle"
},
"connect-native-start-battery-check": {
"defaultMessage": "Connect the battery pack, then check the light on the back of the micro:bit is on.",
"description": "Instruction to check the micro:bit is powered on via the battery pack"
},
"connect-native-start-heading": {
"defaultMessage": "What you need to connect",
"defaultMessage": "Connect micro:bit battery pack",
"description": "Connection dialog heading"
},
"connect-native-start-requirements1": {
"defaultMessage": "micro:bit with battery pack",
"description": "Label for image of a micro:bit and battery pack"
},
"connect-or-import": {
"defaultMessage": "<link1>Podłącz micro:bit zbierający dane</link1> lub <link2>importuj próbki danych</link2>",
"description": "Empty data samples page text"
Expand Down
10 changes: 5 additions & 5 deletions lang/ui.pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@
"defaultMessage": "If needed, change the pattern below to match.",
"description": "Native Bluetooth pattern dialog subtitle"
},
"connect-native-start-battery-check": {
"defaultMessage": "Connect the battery pack, then check the light on the back of the micro:bit is on.",
"description": "Instruction to check the micro:bit is powered on via the battery pack"
},
"connect-native-start-heading": {
"defaultMessage": "What you need to connect",
"defaultMessage": "Connect micro:bit battery pack",
"description": "Connection dialog heading"
},
"connect-native-start-requirements1": {
"defaultMessage": "micro:bit with battery pack",
"description": "Label for image of a micro:bit and battery pack"
},
"connect-or-import": {
"defaultMessage": "<link1>Conecte um micro:bit de coleta de dados</link1> ou <link2>importe as amostras de dados</link2>",
"description": "Empty data samples page text"
Expand Down
10 changes: 5 additions & 5 deletions lang/ui.zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,14 @@
"defaultMessage": "If needed, change the pattern below to match.",
"description": "Native Bluetooth pattern dialog subtitle"
},
"connect-native-start-battery-check": {
"defaultMessage": "Connect the battery pack, then check the light on the back of the micro:bit is on.",
"description": "Instruction to check the micro:bit is powered on via the battery pack"
},
"connect-native-start-heading": {
"defaultMessage": "What you need to connect",
"defaultMessage": "Connect micro:bit battery pack",
"description": "Connection dialog heading"
},
"connect-native-start-requirements1": {
"defaultMessage": "micro:bit with battery pack",
"description": "Label for image of a micro:bit and battery pack"
},
"connect-or-import": {
"defaultMessage": "<link1>連線數據收集用的 micro:bit</link1> 或<link2>匯入數據樣本</link2>",
"description": "Empty data samples page text"
Expand Down
26 changes: 18 additions & 8 deletions src/components/DataConnectionDialogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ import {
DataConnectionStep,
DataConnectionType,
isDataConnectionDialogOpen,
useDataConnectionActions,
} from "../data-connection-flow";
import { DataConnectionState } from "../data-connection-flow/data-connection-types";
import { bluetoothUniversalHex } from "../device/get-hex-file";
import { isAndroid } from "../platform";
import { useStore } from "../store";
import { useDataConnectionActions } from "../data-connection-flow";
import BluetoothConnectingDialog from "./BluetoothConnectingDialog";
import PermissionErrorDialog from "./BluetoothPermissionErrorDialog";
import BrokenFirmwareDialog from "./BrokenFirmwareDialog";
import ConnectBatteryDialog from "./ConnectBatteryDialog";
Expand All @@ -25,8 +29,11 @@ import DownloadProgressDialog, {
import EnterBluetoothPatternDialog from "./EnterBluetoothPatternDialog";
import LoadingDialog from "./LoadingDialog";
import ManualFlashingDialog from "./ManualFlashingDialog";
import NativeBluetoothConnectBatteryDialog from "./NativeBluetoothConnectBatteryDialog";
import NativeBluetoothErrorDialog from "./NativeBluetoothErrorDialog";
import NativeBluetoothPairingLostDialog from "./NativeBluetoothPairingLostDialog";
import ResetToBluetoothModeDialog from "./ResetToBluetoothModeDialog";
import ResetToBluetoothModeTroubleshootDialog from "./ResetToBluetoothModeTroubleshootDialog";
import SelectMicrobitBluetoothDialog from "./SelectMicrobitBluetoothDialog";
import SelectMicrobitUsbDialog, {
getHeadingId as getSelectMicrobitUsbHeadingId,
Expand All @@ -35,12 +42,6 @@ import TryAgainDialog from "./TryAgainDialog";
import UnsupportedMicrobitDialog from "./UnsupportedMicrobitDialog";
import WebUsbBluetoothUnsupportedDialog from "./WebUsbBluetoothUnsupportedDialog";
import WhatYouWillNeedDialog from "./WhatYouWillNeedDialog";
import { bluetoothUniversalHex } from "../device/get-hex-file";
import { isAndroid } from "../platform";
import { DataConnectionState } from "../data-connection-flow/data-connection-types";
import NativeBluetoothPairingLostDialog from "./NativeBluetoothPairingLostDialog";
import ResetToBluetoothModeTroubleshootDialog from "./ResetToBluetoothModeTroubleshootDialog";
import BluetoothConnectingDialog from "./BluetoothConnectingDialog";

const getDeviceType = (state: DataConnectionState): ConnectionErrorDeviceType =>
state.type === DataConnectionType.Radio
Expand All @@ -62,9 +63,18 @@ const DataConnectionDialogs = () => {
switch (state.step) {
case DataConnectionStep.StartOver:
case DataConnectionStep.Start: {
if (state.type === DataConnectionType.NativeBluetooth) {
return (
<NativeBluetoothConnectBatteryDialog
{...dialogCommonProps}
onNextClick={actions.onNextClick}
reconnect={state.step === DataConnectionStep.StartOver}
/>
);
}
return (
<WhatYouWillNeedDialog
type={state.type}
type={state.type === DataConnectionType.Radio ? "radio" : "bluetooth"}
{...dialogCommonProps}
onLinkClick={
actions.canSwitchFlowType() ? actions.switchFlowType : undefined
Expand Down
52 changes: 52 additions & 0 deletions src/components/NativeBluetoothConnectBatteryDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* (c) 2026, Micro:bit Educational Foundation and contributors
*
* SPDX-License-Identifier: MIT
*/
import { Image, Text, VStack } from "@chakra-ui/react";
import { FormattedMessage } from "react-intl";
import microbitWithBatteryPack from "../images/microbit-with-battery-pack.svg";
import ConnectContainerDialog, {
ConnectContainerDialogProps,
} from "./ConnectContainerDialog";

export interface NativeBluetoothConnectBatteryDialogProps
extends Omit<ConnectContainerDialogProps, "children" | "headingId"> {
reconnect: boolean;
}

const NativeBluetoothConnectBatteryDialog = ({
reconnect,
...props
}: NativeBluetoothConnectBatteryDialogProps) => {
return (
<ConnectContainerDialog
{...props}
headingId={
reconnect
? "reconnect-failed-native-heading"
: "connect-native-start-heading"
}
>
<VStack gap={5} width="100%">
{reconnect && (
<Text width="100%">
<FormattedMessage id="reconnect-failed-subtitle" />
</Text>
)}
<Text width="100%">
<FormattedMessage id="connect-native-start-battery-check" />
</Text>
<Image
src={microbitWithBatteryPack}
alt=""
width="22rem"
aspectRatio={250 / 148}
my={3.5}
/>
</VStack>
</ConnectContainerDialog>
);
};

export default NativeBluetoothConnectBatteryDialog;
Loading
Loading