Skip to content

Commit

Permalink
Toggle V2 features warning via settings and diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-robert committed May 7, 2024
1 parent 0f277b1 commit 36c4e84
Show file tree
Hide file tree
Showing 29 changed files with 446 additions and 38 deletions.
12 changes: 12 additions & 0 deletions lang/ui.ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@
"defaultMessage": "Canviar mòduls de tercers pot significar que no funcionin com s'havia previst.",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features": {
"defaultMessage": "Show warnings about V2-only features",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features-info": {
"defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected",
"description": "Checkbox setting label"
},
"settings": {
"defaultMessage": "Configuració",
"description": "Settings text"
Expand Down Expand Up @@ -1110,6 +1118,10 @@
"defaultMessage": "visita microbit.org (s'obre en una pestanya nova)",
"description": "alt text for logo link to .org"
},
"warn-on-v2-only-features-action": {
"defaultMessage": "Disable warnings about V2-only features",
"description": "Label for editor action"
},
"webusb-error-clear-connect-description-1": {
"defaultMessage": "Un altre procés està connectat a aquest dispositiu.",
"description": "Part of WebUSB error message"
Expand Down
12 changes: 12 additions & 0 deletions lang/ui.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@
"defaultMessage": "Wenn du Module von Drittanbietern änderst, kann es sein, dass sie nicht mehr wie vorgesehen funktionieren.",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features": {
"defaultMessage": "Show warnings about V2-only features",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features-info": {
"defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected",
"description": "Checkbox setting label"
},
"settings": {
"defaultMessage": "Einstellungen",
"description": "Settings text"
Expand Down Expand Up @@ -1110,6 +1118,10 @@
"defaultMessage": "besuche microbit.org (öffnet in neuen Tab)",
"description": "alt text for logo link to .org"
},
"warn-on-v2-only-features-action": {
"defaultMessage": "Disable warnings about V2-only features",
"description": "Label for editor action"
},
"webusb-error-clear-connect-description-1": {
"defaultMessage": "Ein anderer Prozess ist mit diesem Gerät verbunden.",
"description": "Part of WebUSB error message"
Expand Down
14 changes: 13 additions & 1 deletion lang/ui.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,14 @@
"defaultMessage": "Changing third-party modules may mean they don’t work as intended.",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features": {
"defaultMessage": "Show warnings about V2-only features",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features-info": {
"defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected",
"description": "Checkbox setting label"
},
"settings": {
"defaultMessage": "Settings",
"description": "Settings text"
Expand Down Expand Up @@ -1111,6 +1119,10 @@
"defaultMessage": "visit microbit.org (opens in a new tab)",
"description": "alt text for logo link to .org"
},
"warn-on-v2-only-features-action": {
"defaultMessage": "Disable warnings about V2-only features",
"description": "Label for editor action"
},
"webusb-error-clear-connect-description-1": {
"defaultMessage": "Another process is connected to this device.",
"description": "Part of WebUSB error message"
Expand Down Expand Up @@ -1163,4 +1175,4 @@
"defaultMessage": "Zoom out",
"description": "Text label for zoom out button"
}
}
}
12 changes: 12 additions & 0 deletions lang/ui.es-es.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@
"defaultMessage": "Cambiar los módulos de terceros puede provocar que no funcionen como deberían.",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features": {
"defaultMessage": "Show warnings about V2-only features",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features-info": {
"defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected",
"description": "Checkbox setting label"
},
"settings": {
"defaultMessage": "Configuración",
"description": "Settings text"
Expand Down Expand Up @@ -1110,6 +1118,10 @@
"defaultMessage": "visitar microbit.org (abre en una nueva pestaña)",
"description": "alt text for logo link to .org"
},
"warn-on-v2-only-features-action": {
"defaultMessage": "Disable warnings about V2-only features",
"description": "Label for editor action"
},
"webusb-error-clear-connect-description-1": {
"defaultMessage": "Otro proceso está conectado a este dispositivo.",
"description": "Part of WebUSB error message"
Expand Down
12 changes: 12 additions & 0 deletions lang/ui.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@
"defaultMessage": "La modification de modules tiers peut empêcher leur bon fonctionnement.",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features": {
"defaultMessage": "Show warnings about V2-only features",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features-info": {
"defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected",
"description": "Checkbox setting label"
},
"settings": {
"defaultMessage": "Paramètres",
"description": "Settings text"
Expand Down Expand Up @@ -1110,6 +1118,10 @@
"defaultMessage": "visiter microbit.org (s’ouvre dans un nouvel onglet)",
"description": "alt text for logo link to .org"
},
"warn-on-v2-only-features-action": {
"defaultMessage": "Disable warnings about V2-only features",
"description": "Label for editor action"
},
"webusb-error-clear-connect-description-1": {
"defaultMessage": "Un autre processus est connecté à cet appareil.",
"description": "Part of WebUSB error message"
Expand Down
12 changes: 12 additions & 0 deletions lang/ui.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@
"defaultMessage": "サードパーティ製モジュールを変更すると、意図した通りに動作しない可能性があります。",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features": {
"defaultMessage": "Show warnings about V2-only features",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features-info": {
"defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected",
"description": "Checkbox setting label"
},
"settings": {
"defaultMessage": "設定",
"description": "Settings text"
Expand Down Expand Up @@ -1110,6 +1118,10 @@
"defaultMessage": "microbit.orgにアクセスします(新しいタブで開きます)",
"description": "alt text for logo link to .org"
},
"warn-on-v2-only-features-action": {
"defaultMessage": "Disable warnings about V2-only features",
"description": "Label for editor action"
},
"webusb-error-clear-connect-description-1": {
"defaultMessage": "別のプロセスがこのデバイスに接続されています。",
"description": "Part of WebUSB error message"
Expand Down
12 changes: 12 additions & 0 deletions lang/ui.ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@
"defaultMessage": "서드파티 모듈을 변경하면 모듈이 의도대로 작동하지 않을 수 있습니다.",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features": {
"defaultMessage": "Show warnings about V2-only features",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features-info": {
"defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected",
"description": "Checkbox setting label"
},
"settings": {
"defaultMessage": "설정",
"description": "Settings text"
Expand Down Expand Up @@ -1110,6 +1118,10 @@
"defaultMessage": "microbit.org 방문(새 탭에서 열기)",
"description": "alt text for logo link to .org"
},
"warn-on-v2-only-features-action": {
"defaultMessage": "Disable warnings about V2-only features",
"description": "Label for editor action"
},
"webusb-error-clear-connect-description-1": {
"defaultMessage": "다른 프로세스가 이 장치에 연결되어 있습니다.",
"description": "Part of WebUSB error message"
Expand Down
20 changes: 12 additions & 8 deletions lang/ui.lol.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@
"defaultMessage": "crwdns331722:0crwdne331722:0",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features": {
"defaultMessage": "Show warnings about V2-only features",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features-info": {
"defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected",
"description": "Checkbox setting label"
},
"settings": {
"defaultMessage": "crwdns331724:0crwdne331724:0",
"description": "Settings text"
Expand Down Expand Up @@ -1110,6 +1118,10 @@
"defaultMessage": "crwdns331784:0crwdne331784:0",
"description": "alt text for logo link to .org"
},
"warn-on-v2-only-features-action": {
"defaultMessage": "Disable warnings about V2-only features",
"description": "Label for editor action"
},
"webusb-error-clear-connect-description-1": {
"defaultMessage": "crwdns331786:0crwdne331786:0",
"description": "Part of WebUSB error message"
Expand All @@ -1130,14 +1142,6 @@
"defaultMessage": "crwdns331794:0crwdne331794:0",
"description": "Part of WebUSB error message"
},
"webusb-error-update-req-description": {
"defaultMessage": "crwdns331796:0crwdne331796:0",
"description": "WebUSB error telling user to update firmware"
},
"webusb-error-update-req-title": {
"defaultMessage": "crwdns331798:0crwdne331798:0",
"description": "Error text telling user to update firmware"
},
"webusb-not-supported": {
"defaultMessage": "crwdns331800:0crwdne331800:0",
"description": "Explantion shown when user's browser doesn't support WebUSB"
Expand Down
12 changes: 12 additions & 0 deletions lang/ui.nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@
"defaultMessage": "Wijzigen van modules van derden kan betekenen dat ze niet werken zoals bedoeld.",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features": {
"defaultMessage": "Show warnings about V2-only features",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features-info": {
"defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected",
"description": "Checkbox setting label"
},
"settings": {
"defaultMessage": "Instellingen",
"description": "Settings text"
Expand Down Expand Up @@ -1110,6 +1118,10 @@
"defaultMessage": "bezoek microbit.org (opent in een nieuw tabblad)",
"description": "alt text for logo link to .org"
},
"warn-on-v2-only-features-action": {
"defaultMessage": "Disable warnings about V2-only features",
"description": "Label for editor action"
},
"webusb-error-clear-connect-description-1": {
"defaultMessage": "Een ander proces is verbonden met dit apparaat.",
"description": "Part of WebUSB error message"
Expand Down
12 changes: 12 additions & 0 deletions lang/ui.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@
"defaultMessage": "更改第三方模块可能意味着它们无法按预期工作。",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features": {
"defaultMessage": "Show warnings about V2-only features",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features-info": {
"defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected",
"description": "Checkbox setting label"
},
"settings": {
"defaultMessage": "设置",
"description": "Settings text"
Expand Down Expand Up @@ -1110,6 +1118,10 @@
"defaultMessage": "访问 microbit.org (在新标签页中打开)",
"description": "alt text for logo link to .org"
},
"warn-on-v2-only-features-action": {
"defaultMessage": "Disable warnings about V2-only features",
"description": "Label for editor action"
},
"webusb-error-clear-connect-description-1": {
"defaultMessage": "另一个进程已连接到此设备。",
"description": "Part of WebUSB error message"
Expand Down
12 changes: 12 additions & 0 deletions lang/ui.zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@
"defaultMessage": "變更第三方模組,可能代表它們無法按預期運作。",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features": {
"defaultMessage": "Show warnings about V2-only features",
"description": "Checkbox setting label"
},
"setting-warn-on-v2-only-features-info": {
"defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected",
"description": "Checkbox setting label"
},
"settings": {
"defaultMessage": "設置",
"description": "Settings text"
Expand Down Expand Up @@ -1110,6 +1118,10 @@
"defaultMessage": "造訪 microbit.org (在新索引標籤中開啟)",
"description": "alt text for logo link to .org"
},
"warn-on-v2-only-features-action": {
"defaultMessage": "Disable warnings about V2-only features",
"description": "Label for editor action"
},
"webusb-error-clear-connect-description-1": {
"defaultMessage": "其他程序連線至此裝置。",
"description": "Part of WebUSB error message"
Expand Down
8 changes: 7 additions & 1 deletion src/editor/EditorContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* SPDX-License-Identifier: MIT
*/
import { useCallback } from "react";
import { useProjectFileText } from "../project/project-hooks";
import { useSettings } from "../settings/settings";
import { WorkbenchSelection } from "../workbench/use-selection";
Expand All @@ -18,7 +19,10 @@ interface EditorContainerProps {
* and wires it to the currently open file.
*/
const EditorContainer = ({ selection }: EditorContainerProps) => {
const [settings] = useSettings();
const [settings, setSettings] = useSettings();
const disableV2OnlyFeaturesWarning = useCallback(() => {
setSettings({ ...settings, warnOnV2OnlyFeatures: false });
}, [setSettings, settings]);
// Note fileInfo is not updated for ordinary text edits.
const [fileInfo, onFileChange] = useProjectFileText(selection.file);
if (fileInfo === undefined) {
Expand All @@ -36,6 +40,8 @@ const EditorContainer = ({ selection }: EditorContainerProps) => {
fontSize={settings.fontSize}
codeStructureOption={settings.codeStructureHighlight}
parameterHelpOption={settings.parameterHelp}
warnOnV2OnlyFeatures={settings.warnOnV2OnlyFeatures}
disableV2OnlyFeaturesWarning={disableV2OnlyFeaturesWarning}
/>
);
};
Expand Down
Loading

0 comments on commit 36c4e84

Please sign in to comment.