Skip to content
Draft
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f9503f3
WIP
microbit-matt-hillsdon Oct 10, 2025
25ae243
Better
microbit-matt-hillsdon Oct 10, 2025
26f18e6
Skip e2e
microbit-matt-hillsdon Oct 10, 2025
c420a9b
Lint
microbit-matt-hillsdon Oct 10, 2025
a738e60
animation experiment; enable train model always
microbit-matt-hillsdon Oct 10, 2025
f72e022
Experiment with a non-tour prompt to move the micro:bit
microbit-matt-hillsdon Oct 10, 2025
a1e45b6
Remove debug
microbit-matt-hillsdon Oct 10, 2025
9b49d24
Clearer intentions
microbit-matt-hillsdon Oct 10, 2025
e0ec830
A minimal version of the skeleton idea
microbit-matt-hillsdon Oct 10, 2025
30ee2b3
Lint
microbit-matt-hillsdon Oct 10, 2025
a9949ff
Have the first action in place always
microbit-matt-hillsdon Oct 10, 2025
0b51ae9
WIP
microbit-matt-hillsdon Oct 14, 2025
f266fb1
Merge branch 'main' into alt-flow-2
microbit-matt-hillsdon Oct 17, 2025
7f0d52d
Break down the eyes
microbit-matt-hillsdon Oct 17, 2025
257eb41
Merge branch 'emoji-split' into alt-flow-2
microbit-matt-hillsdon Oct 17, 2025
90af0fb
Decompose the emoji and add support for tick eyes.
microbit-matt-hillsdon Oct 17, 2025
cdabb08
Better animation
microbit-matt-hillsdon Oct 17, 2025
697e905
WIP
microbit-matt-hillsdon Oct 17, 2025
fc91b8f
Move micro:bit
microbit-matt-hillsdon Oct 17, 2025
2298534
Better wait for move logic
microbit-matt-hillsdon Oct 17, 2025
60f0278
Lint
microbit-matt-hillsdon Oct 17, 2025
a9dbf5d
Works
microbit-matt-hillsdon Oct 17, 2025
1240503
Sane hint logic, animate Train model.
microbit-matt-hillsdon Oct 17, 2025
b1f80b0
Logical rather than hacky timing
microbit-matt-hillsdon Oct 17, 2025
360b9cb
Whoops
microbit-matt-hillsdon Oct 17, 2025
ddc5c19
Tweak assistant hint for live graph
microbit-grace Oct 20, 2025
41772b9
Tweak copy
microbit-grace Oct 20, 2025
5cf370f
Prettier
microbit-grace Oct 20, 2025
4a713e8
Replace pre-connect placeholder animation
microbit-grace Oct 23, 2025
f6835af
Fix video autoplay
microbit-grace Oct 29, 2025
d08bbe6
Tweak graph nudge copy
microbit-grace Oct 29, 2025
4cc37ef
Disable data samples table when move microbit hint is shown
microbit-grace Nov 3, 2025
8ce9561
Remove unused import
microbit-grace Nov 3, 2025
a22fe19
Add press button B diagram to record hint
microbit-grace Nov 3, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ jobs:
- run: node ./bin/print-ci-env.cjs >> $GITHUB_ENV
- run: npm run ci
- name: Run Playwright tests
if: env.STAGE == 'REVIEW' || env.STAGE == 'STAGING'
if: false
uses: docker://mcr.microsoft.com/playwright:v1.45.0-jammy
with:
args: npx playwright test
- name: Store reports
if: (env.STAGE == 'REVIEW' || env.STAGE == 'STAGING') && failure()
if: false
uses: actions/upload-artifact@v4
with:
name: playwright-report
Expand Down
7 changes: 5 additions & 2 deletions lang/ui.ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,10 @@
"defaultMessage": "Comencem",
"description": "Get started action"
},
"go-action": { "defaultMessage": "Ves", "description": "Go action" },
"go-action": {
"defaultMessage": "Ves",
"description": "Go action"
},
"graph-color-scheme": {
"defaultMessage": "Esquema de colors del gràfic",
"description": "Graph colour scheme setting label"
Expand Down Expand Up @@ -1752,4 +1755,4 @@
"defaultMessage": "desconnecta i torna a connectar el cable USB",
"description": "WebUSB error dialog"
}
}
}
9 changes: 6 additions & 3 deletions lang/ui.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,10 @@
"defaultMessage": "Get started",
"description": "Get started action"
},
"go-action": { "defaultMessage": "Go", "description": "Go action" },
"go-action": {
"defaultMessage": "Go",
"description": "Go action"
},
"graph-color-scheme": {
"defaultMessage": "Graph colour scheme",
"description": "Graph colour scheme setting label"
Expand Down Expand Up @@ -1125,7 +1128,7 @@
"description": "Aria label for the additional actions menu to the right of the Edit in MakeCode button"
},
"name-action-hint": {
"defaultMessage": "Name an action you want the micro:bit to recognise",
"defaultMessage": "Name an action you want the micro:bit to recognise, e.g. ‘waving’ or ‘jumping’",
"description": "Hint shown when you have an unnamed action"
},
"name-project": {
Expand Down Expand Up @@ -1752,4 +1755,4 @@
"defaultMessage": "unplug and replug the USB cable",
"description": "WebUSB error dialog"
}
}
}
7 changes: 5 additions & 2 deletions lang/ui.es-es.json
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,10 @@
"defaultMessage": "Empieza",
"description": "Get started action"
},
"go-action": { "defaultMessage": "Ir", "description": "Go action" },
"go-action": {
"defaultMessage": "Ir",
"description": "Go action"
},
"graph-color-scheme": {
"defaultMessage": "Esquema de colores del gráfico",
"description": "Graph colour scheme setting label"
Expand Down Expand Up @@ -1752,4 +1755,4 @@
"defaultMessage": "desenchufa y vuelve a enchufar el cable USB",
"description": "WebUSB error dialog"
}
}
}
47 changes: 45 additions & 2 deletions lang/ui.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
"defaultMessage": "Modifier les échantillons de données",
"description": "Back button text"
},
"blocks-preview-title": {
"defaultMessage": "Blocks preview",
"description": "Blocks preview heading text"
},
"bluetooth-unsupported-advice": {
"defaultMessage": "Nous recommandons Google Chrome ou Microsoft Edge pour que vous puissiez vous connecter directement à votre micro:bit.",
"description": "Note on supported browsers"
Expand Down Expand Up @@ -427,6 +431,10 @@
"defaultMessage": "Afficher les fonctionnalités des données",
"description": "Show data features button text"
},
"data-preview-title": {
"defaultMessage": "Data preview",
"description": "Data preview heading text"
},
"data-samples-actions-region": {
"defaultMessage": "Barre d'outils d'échantillons de données",
"description": "Region label for data samples actions"
Expand Down Expand Up @@ -715,7 +723,10 @@
"defaultMessage": "C'est parti",
"description": "Get started action"
},
"go-action": { "defaultMessage": "Aller", "description": "Go action" },
"go-action": {
"defaultMessage": "Aller",
"description": "Go action"
},
"graph-color-scheme": {
"defaultMessage": "Schéma de couleurs du graphique",
"description": "Graph colour scheme setting label"
Expand Down Expand Up @@ -1216,6 +1227,34 @@
"defaultMessage": "Ouvrir le fichier lorsqu’il est déposé",
"description": "Aria label for file drop target"
},
"open-project-action": {
"defaultMessage": "Open project",
"description": "Open project button text"
},
"open-project-setup-description": {
"defaultMessage": "Opening this project will overwrite any existing session. You may want to <link>save your existing session</link> first.",
"description": "Open project setup description"
},
"open-shared-project-blocks-preview-description": {
"defaultMessage": "Preview of the MakeCode code contained within this project.",
"description": "Blocks preview description text"
},
"open-shared-project-data-preview-description": {
"defaultMessage": "Preview of the actions and data contained within this project.",
"description": "Data preview description text"
},
"open-shared-project-description": {
"defaultMessage": "This is a Microsoft MakeCode shared project compatible with CreateAI.",
"description": "Import shared CreateAI project description"
},
"open-shared-project-error-description": {
"defaultMessage": "Check the link you followed is correct, and make sure you are connected to the internet before trying again.",
"description": "Import shared CreateAI error description"
},
"open-shared-project-title": {
"defaultMessage": "Open shared CreateAI project",
"description": "Import shared CreateAI project title"
},
"other-tabs-body1": {
"defaultMessage": "Un autre processus est connecté à cet appareil.",
"description": "Connection error dialog"
Expand Down Expand Up @@ -1496,6 +1535,10 @@
"defaultMessage": "Test du modèle",
"description": "Testing model page title"
},
"third-party-content-description": {
"defaultMessage": "This project is provided by a user, and not endorsed by Microsoft or the Micro:bit Educational Foundation. Visit the <link>MakeCode shared project</link> to report abuse to Microsoft MakeCode if you think it's not appropriate.",
"description": "Notify user of third party content"
},
"tour-action": {
"defaultMessage": "Visite",
"description": "Button label that starts a tour of the app's features"
Expand Down Expand Up @@ -1712,4 +1755,4 @@
"defaultMessage": "débrancher et rebrancher le câble USB",
"description": "WebUSB error dialog"
}
}
}
7 changes: 5 additions & 2 deletions lang/ui.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,10 @@
"defaultMessage": "はじめよう",
"description": "Get started action"
},
"go-action": { "defaultMessage": "実行", "description": "Go action" },
"go-action": {
"defaultMessage": "実行",
"description": "Go action"
},
"graph-color-scheme": {
"defaultMessage": "グラフの配色設定",
"description": "Graph colour scheme setting label"
Expand Down Expand Up @@ -1752,4 +1755,4 @@
"defaultMessage": "USBケーブルを抜いて再接続",
"description": "WebUSB error dialog"
}
}
}
7 changes: 5 additions & 2 deletions lang/ui.ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,10 @@
"defaultMessage": "시작하기",
"description": "Get started action"
},
"go-action": { "defaultMessage": "이동", "description": "Go action" },
"go-action": {
"defaultMessage": "이동",
"description": "Go action"
},
"graph-color-scheme": {
"defaultMessage": "그래프 색 구성표",
"description": "Graph colour scheme setting label"
Expand Down Expand Up @@ -1752,4 +1755,4 @@
"defaultMessage": "USB 케이블을 분리했다가 다시 연결하세요.",
"description": "WebUSB error dialog"
}
}
}
2 changes: 1 addition & 1 deletion lang/ui.lol.json
Original file line number Diff line number Diff line change
Expand Up @@ -1755,4 +1755,4 @@
"defaultMessage": "crwdns363476:0crwdne363476:0",
"description": "WebUSB error dialog"
}
}
}
7 changes: 5 additions & 2 deletions lang/ui.nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,10 @@
"defaultMessage": "Hoe te beginnen",
"description": "Get started action"
},
"go-action": { "defaultMessage": "Gaan", "description": "Go action" },
"go-action": {
"defaultMessage": "Gaan",
"description": "Go action"
},
"graph-color-scheme": {
"defaultMessage": "Grafiek kleurschema",
"description": "Graph colour scheme setting label"
Expand Down Expand Up @@ -1752,4 +1755,4 @@
"defaultMessage": "de USB-kabel ontkoppelen en opnieuw aansluiten",
"description": "WebUSB error dialog"
}
}
}
7 changes: 5 additions & 2 deletions lang/ui.pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,10 @@
"defaultMessage": "Rozpocznij",
"description": "Get started action"
},
"go-action": { "defaultMessage": "Dalej", "description": "Go action" },
"go-action": {
"defaultMessage": "Dalej",
"description": "Go action"
},
"graph-color-scheme": {
"defaultMessage": "Schemat kolorów wykresu",
"description": "Graph colour scheme setting label"
Expand Down Expand Up @@ -1752,4 +1755,4 @@
"defaultMessage": "odłącz i podłącz kabel USB",
"description": "WebUSB error dialog"
}
}
}
7 changes: 5 additions & 2 deletions lang/ui.pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,10 @@
"defaultMessage": "Começar",
"description": "Get started action"
},
"go-action": { "defaultMessage": "Ir", "description": "Go action" },
"go-action": {
"defaultMessage": "Ir",
"description": "Go action"
},
"graph-color-scheme": {
"defaultMessage": "Esquema de cores do gráfico",
"description": "Graph colour scheme setting label"
Expand Down Expand Up @@ -1752,4 +1755,4 @@
"defaultMessage": "Desconecte e reconecte o cabo USB.",
"description": "WebUSB error dialog"
}
}
}
17 changes: 13 additions & 4 deletions lang/ui.zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,10 @@
"defaultMessage": "入門指南",
"description": "Get started action"
},
"go-action": { "defaultMessage": "進行", "description": "Go action" },
"go-action": {
"defaultMessage": "進行",
"description": "Go action"
},
"graph-color-scheme": {
"defaultMessage": "圖表顏色方案",
"description": "Graph colour scheme setting label"
Expand Down Expand Up @@ -784,7 +787,10 @@
"defaultMessage": "主頁",
"description": "Home button text"
},
"homepage": { "defaultMessage": "首頁", "description": "Link to home page" },
"homepage": {
"defaultMessage": "首頁",
"description": "Link to home page"
},
"homepage-alt": {
"defaultMessage": "顯示代表 micro:bit 加速計數據的 x、y、z 圖線的圖表,並重疊拍手圖示",
"description": "Alt text for image in homepage"
Expand Down Expand Up @@ -1085,7 +1091,10 @@
"defaultMessage": "正在載入",
"description": "Aria label for loading spinner"
},
"main-menu": { "defaultMessage": "主選單", "description": "Main menu label" },
"main-menu": {
"defaultMessage": "主選單",
"description": "Main menu label"
},
"makecode-back-alt": {
"defaultMessage": "MakeCode 傳回的左箭頭圖標",
"description": "Testing model page title"
Expand Down Expand Up @@ -1746,4 +1755,4 @@
"defaultMessage": "拔下並重新插入 USB 纜線",
"description": "WebUSB error dialog"
}
}
}
62 changes: 61 additions & 1 deletion src/buffered-data-hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
*
* SPDX-License-Identifier: MIT
*/
import { AccelerometerDataEvent } from "@microbit/microbit-connection";
import {
AccelerometerData,
AccelerometerDataEvent,
} from "@microbit/microbit-connection";
import {
ReactNode,
createContext,
useCallback,
useContext,
useEffect,
useRef,
useState,
} from "react";
import { BufferedData } from "./buffered-data";
import { useConnectActions } from "./connect-actions-hooks";
Expand Down Expand Up @@ -73,3 +77,59 @@ const useBufferedDataInternal = (): BufferedData => {
}, [connection, connectStatus, getBuffer]);
return getBuffer();
};

export const useHasMoved = (): boolean => {
const [hasMoved, setHasMoved] = useState(false);
const [connectStatus] = useConnectStatus();
const connection = useConnectActions();
useEffect(() => {
if (connectStatus !== ConnectionStatus.Connected) {
setHasMoved(false);
}
let ignore = false;
const delta: AccelerometerData = { x: 0, y: 0, z: 0 };
let lastSample: AccelerometerData | undefined;
const threshold = 40_000;
const minDelta = 100;
const skipSamples = 10;
let skipped = 0;
const listener = (e: AccelerometerDataEvent) => {
if (skipped < skipSamples) {
skipped++;
} else if (lastSample) {
const deltaX = Math.abs(lastSample.x - e.data.x);
if (deltaX > minDelta) {
delta.x += deltaX;
}
const deltaY = Math.abs(lastSample.y - e.data.y);
if (deltaY > minDelta) {
delta.y += deltaY;
}
const deltaZ = Math.abs(lastSample.z - e.data.z);
if (deltaZ > minDelta) {
delta.z += deltaZ;
}
}
lastSample = e.data;
if (
(delta.x > threshold ? 1 : 0) +
(delta.y > threshold ? 1 : 0) +
(delta.z > threshold ? 1 : 0) >
1
) {
connection.removeAccelerometerListener(listener);
if (!ignore) {
setHasMoved(true);
}
}
};
if (!hasMoved) {
connection.addAccelerometerListener(listener);
}
return () => {
ignore = true;
connection.removeAccelerometerListener(listener);
};
}, [connection, connectStatus, hasMoved]);
return hasMoved;
};
Loading