Skip to content

Commit 09cc2fc

Browse files
Merge branch 'home-page' into goodbye-ideas
Both sides added a test at the same place in the storage fallback tests: the ideas notice here, and a #project: link without IndexedDB on home-page. Both are kept.
2 parents 4bfa8d9 + 6460bf5 commit 09cc2fc

40 files changed

Lines changed: 730 additions & 378 deletions

‎.github/workflows/build.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ env:
1515
# renovate: datasource=npm depName=npm
1616
NPM_VERSION: "11"
1717
# renovate: datasource=npm depName=@microbit-foundation/python-editor-v3-microbit registryUrl=https://npm.pkg.github.com
18-
THEME_VERSION: 0.0.0-home.page.134
18+
THEME_VERSION: 0.5.0
1919

2020
jobs:
2121
stages:

‎docs/home-page.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,17 @@ Still to try:
3636
- Writes are coalesced per file with a short delay and flushed on `pagehide` and `visibilitychange`, stamped with the edit time so "last modified" is the edit. A flush never reads before it writes, and one from a hidden or unloading page commits explicitly: a transaction that waits on a read, or on its requests finishing, does not survive the page unloading. So the open project's storage holds the project's name and writes the whole record. A failed flush drops that batch, keeps the in-memory copy, logs once per session and shows ml-trainer's persistent toast: "Browser storage full" for a quota error, "Failed to save your project to browser storage" otherwise. Page actions that hit the quota show the same toast.
3737
- Cross-tab: a `BroadcastChannel` carries `changed` and `deleted` project ids. Tabs refresh their lists; a tab with a changed project open reloads it; one with a deleted project open lets go of it, stops writing it and, if the editor is showing, goes to the home page with a message. Timestamp bumps (e.g. from open) are not broadcast.
3838
- No IndexedDB (private browsing, blocked storage): one implicit project in session storage as today, no project management, pages redirect to the editor. Iframe controller mode is unchanged: the host owns the project.
39-
- Migration: on first load, session-storage files with no current project id become a new project with the stored name, and the editor opens on them. A `#project:` link takes precedence.
39+
- Migration: when the database opens, session-storage files left by the editor from before the database become a new project with the stored name, and the tab's current project. So the pages list it and the editor opens it, whichever loads first: the editor's old address is now the home page, so a tab reloaded after the upgrade lands there. A `#project:` link still opens its own project; the migrated one is then just in the list.
4040
- The dirty flag is not stored in the database. The before-unload prompt applies only without the database, where closing the tab still loses work.
4141
- Not done, deliberately: `navigator.storage.persist()` (Firefox prompts, Safari ignores it). The home page's info tooltip says projects are stored in this browser.
4242

4343
### Routing
4444

4545
- `react-router` 7, `createBrowserRouter`, one root layout route with `errorElement`, `urls.ts` builders as route paths, as ml-trainer. No project id in the URL; the tab's project is in `sessionStorage`.
4646
- Editor at `/project` with tabs at `/project/:tab/:slug`; the old `/:tab/:slug` paths redirect; unknown paths are the shared not-found page. Iframe mode has a single-route router with the editor at the root.
47-
- The editor route's loader chooses the project: the tab's, else migrated session storage, else the most recent, else a new one with the starter program. So `/project` in a fresh tab goes straight to code, which ml-trainer does not do; the editor is low friction today and some users bookmark it.
47+
- The editor route's loader chooses the project: the tab's (which a migrated session-storage project becomes), else the most recent, else a new one with the starter program. So `/project` in a fresh tab goes straight to code, which ml-trainer does not do; the editor is low friction today and some users bookmark it.
4848
- The editor's project is chosen when its route loads, not at boot, so the pages render without one.
49+
- A `#project:` link is removed from the address once it has become a project. One that cannot be read is removed at startup. The home page sends a link on to the editor only while one is waiting to be opened, which it asks the projects session rather than reading from the address.
4950

5051
### Pages and sharing
5152

‎lang/ui.ca.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
"back-action": {
4848
"defaultMessage": "Enrera"
4949
},
50-
"back-to-main": {
51-
"defaultMessage": "tornar al codi principal"
52-
},
5350
"cancel-action": {
5451
"defaultMessage": "Cancel·lar"
5552
},

‎lang/ui.de.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
"back-action": {
4848
"defaultMessage": "Zurück"
4949
},
50-
"back-to-main": {
51-
"defaultMessage": "zurück zum Hauptcode"
52-
},
5350
"cancel-action": {
5451
"defaultMessage": "Abbrechen"
5552
},

‎lang/ui.en.json‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@
8383
"defaultMessage": "Back",
8484
"description": "Back button text"
8585
},
86-
"back-to-main": {
87-
"defaultMessage": "back to the main code",
88-
"description": "Text button, takes back to main code"
89-
},
9086
"breadcrumb-label": {
9187
"defaultMessage": "Breadcrumb",
9288
"description": "Accessible name of the breadcrumb above the code editor: Home, the project name and the open file"

‎lang/ui.es-ES.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
"back-action": {
4848
"defaultMessage": "Volver"
4949
},
50-
"back-to-main": {
51-
"defaultMessage": "volver al código principal"
52-
},
5350
"cancel-action": {
5451
"defaultMessage": "Cancelar"
5552
},

‎lang/ui.fr.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
"back-action": {
4848
"defaultMessage": "Précédent"
4949
},
50-
"back-to-main": {
51-
"defaultMessage": "revenir au code principal"
52-
},
5350
"cancel-action": {
5451
"defaultMessage": "Annuler"
5552
},

‎lang/ui.ga-IE.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
"back-action": {
4848
"defaultMessage": "Ar ais"
4949
},
50-
"back-to-main": {
51-
"defaultMessage": "ar ais go dtí an príomhchód"
52-
},
5350
"cancel-action": {
5451
"defaultMessage": "Cealaigh"
5552
},

‎lang/ui.ja.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
"back-action": {
4848
"defaultMessage": "戻る"
4949
},
50-
"back-to-main": {
51-
"defaultMessage": "メインコードに戻る"
52-
},
5350
"cancel-action": {
5451
"defaultMessage": "キャンセル"
5552
},

‎lang/ui.ko.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@
4747
"back-action": {
4848
"defaultMessage": "뒤로"
4949
},
50-
"back-to-main": {
51-
"defaultMessage": "메인 코드로 돌아가기"
52-
},
5350
"cancel-action": {
5451
"defaultMessage": "취소"
5552
},

0 commit comments

Comments
 (0)