Skip to content

Commit

Permalink
add webconfig flag clientside
Browse files Browse the repository at this point in the history
  • Loading branch information
srietkerk committed Feb 13, 2025
1 parent d3b668f commit 0cdd4c6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pxtlib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ namespace pxt {
teachertoolUrl?: string; // "/beta---eval"
isStatic?: boolean;
verprefix?: string; // "v1"
ocvEnabled: boolean;
}

export function localWebConfig() {
Expand All @@ -418,7 +419,8 @@ namespace pxt {
simUrl: "/sim/simulator.html",
simserviceworkerUrl: "/simulatorserviceworker.js",
simworkerconfigUrl: "/sim/workerConfig.js",
partsUrl: "/sim/siminstructions.html"
partsUrl: "/sim/siminstructions.html",
ocvEnabled: true,
}
return r
}
Expand Down
1 change: 1 addition & 0 deletions tests/blocks-test/blocksrunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pxt.webConfig = {
docsUrl: undefined,
multiUrl: undefined,
isStatic: undefined,
ocvEnabled: undefined
};

class BlocklyCompilerTestHost implements pxt.Host {
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5283,7 +5283,7 @@ export class ProjectView
const hideMenuBar = targetTheme.hideMenuBar || hideTutorialIteration || (isTabTutorial && pxt.appTarget.appTheme.embeddedTutorial) || pxt.shell.isTimeMachineEmbed();
const isHeadless = simOpts && simOpts.headless;
const selectLanguage = targetTheme.selectLanguage;
const feedbackEnabled = targetTheme.feedbackEnabled && targetTheme.ocvFrameUrl && targetTheme.ocvAppId;
const feedbackEnabled = pxt.webConfig.ocvEnabled && targetTheme.feedbackEnabled && targetTheme.ocvFrameUrl && targetTheme.ocvAppId;
const showEditorToolbar = inEditor && !hideEditorToolbar && this.editor.hasEditorToolbar();
const useSerialEditor = pxt.appTarget.serial && !!pxt.appTarget.serial.useEditor;
const showSideDoc = sideDocs && this.state.sideDocsLoadUrl && !this.state.sideDocsCollapsed;
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export class SettingsMenu extends data.Component<SettingsMenuProps, SettingsMenu
const showPairDevice = pxt.usb.isEnabled;

const showCenterDivider = targetTheme.selectLanguage || targetTheme.highContrast || showGreenScreen || githubUser;
const showFeedbackOption = targetTheme.feedbackEnabled && targetTheme.ocvAppId && targetTheme.ocvFrameUrl;
const showFeedbackOption = pxt.webConfig.ocvEnabled && targetTheme.feedbackEnabled && targetTheme.ocvAppId && targetTheme.ocvFrameUrl;

const simCollapseText = headless ? lf("Toggle the File Explorer") : lf("Toggle the simulator");

Expand Down
2 changes: 1 addition & 1 deletion webapp/src/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export class ProjectSettingsMenu extends data.Component<ProjectSettingsMenuProps
const githubUser = !hasIdentity && this.getData("github:user") as UserInfo;
const reportAbuse = pxt.appTarget.cloud && pxt.appTarget.cloud.sharing && pxt.appTarget.cloud.importing;
const showDivider = targetTheme.selectLanguage || targetTheme.highContrast || githubUser;
const showFeedbackOption = targetTheme.feedbackEnabled && targetTheme.ocvFrameUrl && targetTheme.ocvAppId;
const showFeedbackOption = pxt.webConfig.ocvEnabled && targetTheme.feedbackEnabled && targetTheme.ocvFrameUrl && targetTheme.ocvAppId;
sendUpdateFeedbackTheme(highContrast);

return <sui.DropdownMenu role="menuitem" icon={'setting large'} title={lf("Settings")} className="item icon more-dropdown-menuitem" ref={ref => this.dropdown = ref}>
Expand Down

0 comments on commit 0cdd4c6

Please sign in to comment.