Skip to content

Commit

Permalink
Add disconnect/reconnect video
Browse files Browse the repository at this point in the history
Fix remaining invalid DOM nesting issue.
  • Loading branch information
microbit-robert committed Apr 11, 2024
1 parent 905678c commit f7bc93b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lang/ui.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@
"description": "Default title for error messages relating to WebUSB"
},
"webusb-error-reconnect-microbit-description": {
"defaultMessage": "Please: <ul><li>check that this micro:bit does not have a battery pack connected</li><li>unplug and replug the USB cable</li></ul>",
"defaultMessage": "<p>Please:</p><ul><li>check that this micro:bit does not have a battery pack connected</li><li>unplug and replug the USB cable</li></ul>",
"description": "Part of WebUSB error message"
},
"webusb-not-supported": {
Expand Down
10 changes: 8 additions & 2 deletions src/messages/ui.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2447,8 +2447,14 @@
],
"webusb-error-reconnect-microbit-description": [
{
"type": 0,
"value": "Please: "
"children": [
{
"type": 0,
"value": "Please:"
}
],
"type": 8,
"value": "p"
},
{
"children": [
Expand Down
39 changes: 23 additions & 16 deletions src/project/project-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: MIT
*/
import { Link, List, ListItem, Stack } from "@chakra-ui/layout";
import { Text, UnorderedList, VStack } from "@chakra-ui/react";
import { Box, Text, UnorderedList, VStack } from "@chakra-ui/react";
import { isMakeCodeForV1Hex as isMakeCodeForV1HexNoErrorHandling } from "@microbit/microbit-universal-hex";
import { saveAs } from "file-saver";
import { ReactNode } from "react";
Expand Down Expand Up @@ -71,6 +71,7 @@ import {
} from "./project-utils";
import ProjectNameQuestion from "./ProjectNameQuestion";
import WebUSBErrorDialog from "../workbench/connect-dialogs/WebUSBErrorDialog";
import reconnectVideo from "../workbench/connect-dialogs/reconnect.webm";

/**
* Distinguishes the different ways to trigger the load action.
Expand Down Expand Up @@ -902,21 +903,27 @@ export class ProjectActions {
return {
title: this.intl.formatMessage({ id: "webusb-error-default-title" }),
description: (
<Text>
<FormattedMessage
id="webusb-error-reconnect-microbit-description"
values={{
li: (chunks: ReactNode) => (
<ListItem>
<Text as="span">{chunks}</Text>
</ListItem>
),
ul: (chunks: ReactNode) => (
<UnorderedList pl={2}>{chunks}</UnorderedList>
),
}}
/>
</Text>
<>
<Box>
<FormattedMessage
id="webusb-error-reconnect-microbit-description"
values={{
p: (chunks: ReactNode) => <Text>{chunks}</Text>,
li: (chunks: ReactNode) => (
<ListItem>
<Text as="span">{chunks}</Text>
</ListItem>
),
ul: (chunks: ReactNode) => (
<UnorderedList pl={2}>{chunks}</UnorderedList>
),
}}
/>
</Box>
<video autoPlay loop>
<source src={reconnectVideo} type="video/webm" />
</video>
</>
),
};
case "timeout-error":
Expand Down
Binary file added src/workbench/connect-dialogs/reconnect.webm
Binary file not shown.

0 comments on commit f7bc93b

Please sign in to comment.