Skip to content

Commit dcaee5b

Browse files
microbit-gracemicrobit-robert
authored andcommitted
Trigger help docs if accessible blocks has just been enabled (#43)
1 parent 55416e1 commit dcaee5b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

webapp/src/app.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -1802,6 +1802,13 @@ export class ProjectView
18021802
this.shouldTryDecompile = true;
18031803
}
18041804

1805+
// Onboard accessible blocks if accessible blocks has just been enabled
1806+
const onboardAccessibleBlocks = pxt.storage.getLocal("onboardAccessibleBlocks") === "1"
1807+
const sideDocsLoadUrl = onboardAccessibleBlocks ? `${container.builtInPrefix}keyboardNav` : ""
1808+
if (onboardAccessibleBlocks) {
1809+
pxt.storage.setLocal("onboardAccessibleBlocks", "0")
1810+
}
1811+
18051812
this.setState({
18061813
home: false,
18071814
showFiles: h.githubId ? true : false,
@@ -1810,7 +1817,7 @@ export class ProjectView
18101817
header: h,
18111818
projectName: h.name,
18121819
currFile: file,
1813-
sideDocsLoadUrl: '',
1820+
sideDocsLoadUrl: sideDocsLoadUrl,
18141821
debugging: false,
18151822
isMultiplayerGame: false
18161823
});
@@ -5179,6 +5186,10 @@ export class ProjectView
51795186
}
51805187

51815188
async toggleAccessibleBlocks() {
5189+
const nextEnabled = !this.getData<boolean>(auth.ACCESSIBLE_BLOCKS);
5190+
if (nextEnabled) {
5191+
pxt.storage.setLocal("onboardAccessibleBlocks", "1")
5192+
}
51825193
await core.toggleAccessibleBlocks()
51835194
this.reloadEditor();
51845195
}

webapp/src/container.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ export interface SideDocsState {
590590
sideDocsCollapsed?: boolean;
591591
}
592592

593-
const builtInPrefix = "/builtin/";
593+
export const builtInPrefix = "/builtin/";
594594

595595
export class SideDocs extends data.Component<SideDocsProps, SideDocsState> {
596596
private openingSideDoc = false;

0 commit comments

Comments
 (0)