import * as React from "react";
export function renderUsbPairDialog(firmwareUrl?: string, failedOnce?: boolean): JSX.Element {
const boardName = pxt.appTarget.appTheme.boardName || "???";
const helpUrl = pxt.appTarget.appTheme.usbDocs;
firmwareUrl = failedOnce && `${helpUrl}/webusb/troubleshoot`; // todo mo
const instructions =
1
{lf("Connect the {0} to your computer with a USB cable", boardName)}
{lf("Use the microUSB port on the top of the {0}", boardName)}
2
{lf("Pair your {0}", boardName)}
{lf("Click 'Pair device' below and select 'Calliope mini' or 'DAPLink CMSIS-DAP' from the list")}
;
if (!firmwareUrl) return instructions;
return ;
}
export function renderBrowserDownloadInstructions(): JSX.Element {
const boardName = pxt.appTarget.appTheme.boardName || lf("device");
const boardDriveName = pxt.appTarget.appTheme.driveDisplayName || pxt.appTarget.compile.driveName || "???";
return
1
{lf("Connect the {0} to your computer with a USB cable", boardName)}
{lf("Use the microUSB port on the top of the {0}", boardName)}
2
{lf("Move the .hex file to the {0}", boardName)}
{lf("Locate the downloaded .hex file and drag it to the {0} drive", boardDriveName)}
;
}
export function cantImportAsync(project: pxt.editor.IProjectView) {
// this feature is support in v0 only
return project.showModalDialogAsync({
header: lf("Can't import microbit.co.uk scripts..."),
body: lf("Importing microbit.co.uk programs is not supported in this editor anymore. Please open this script in the https://makecode.microbit.org/v0 editor."),
buttons: [
{
label: lf("Go to the old editor"),
url: `https://makecode.microbit.org/v0`
}
]
}).then(() => project.openHome())
}