Skip to content

Commit

Permalink
add pxtarget theme for passing query params to time machine
Browse files Browse the repository at this point in the history
  • Loading branch information
riknoll committed Oct 27, 2023
1 parent 352aa9e commit 12baa47
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions localtypings/pxtarget.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ declare namespace pxt {
cloudProfileIcon?: string; // the file path for added imagery on smaller profile dialogs
timeMachine?: boolean; // Save/restore old versions of a project experiment
blocklySoundVolume?: number; // A number between 0 and 1 that sets the volume for blockly sounds (e.g. connect, disconnect, click)
timeMachineQueryParams?: string[]; // An array of query params to pass to timemachine iframe embed
}

interface DownloadDialogTheme {
Expand Down
16 changes: 15 additions & 1 deletion webapp/src/timeMachine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,21 @@ export const TimeMachine = (props: TimeMachineProps) => {
onProjectCopy(files, editorVersion, selected?.timestamp)
}, [selected, onProjectCopy]);

const url = `${window.location.origin + window.location.pathname}?timeMachine=1&controller=1&skillsMap=1&noproject=1&nocookiebanner=1`;
let queryParams = [
"timeMachine",
"controller",
"skillsMap",
"noproject",
"nocookiebanner"
];

if (pxt.appTarget?.appTheme.timeMachineQueryParams) {
queryParams = queryParams.concat(pxt.appTarget.appTheme.timeMachineQueryParams);
}

const argString = queryParams.map(p => p.indexOf("=") === -1 ? `${p}=1` : p).join("&");

const url = `${window.location.origin + window.location.pathname}?${argString}`;

return createPortal(
<FocusTrap className="time-machine" onEscape={hideDialog}>
Expand Down

0 comments on commit 12baa47

Please sign in to comment.