Skip to content

Commit

Permalink
Merge branch 'main' into pwa
Browse files Browse the repository at this point in the history
Use staging sim on this branch as it now has service worker support.
  • Loading branch information
microbit-matt-hillsdon committed May 28, 2024
2 parents de7fdd4 + b727b8a commit 4fb45ed
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/simulator/Simulator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
useToken,
VStack,
} from "@chakra-ui/react";
import { useEffect, useRef, useState } from "react";
import { useEffect, useMemo, useRef, useState } from "react";
import { IntlShape, useIntl } from "react-intl";
import HideSplitViewButton from "../common/SplitView/HideSplitViewButton";
import { topBarHeight } from "../deployment/misc";
Expand All @@ -23,6 +23,7 @@ import SimulatorActionBar from "./SimulatorActionBar";
import SimulatorSplitView from "./SimulatorSplitView";
import SimSerialTabControlProvider from "./tab-control-hooks";
import { flags } from "../flags";
import { stage } from "../environment";

export enum RunningStatus {
RUNNING,
Expand All @@ -44,15 +45,20 @@ const Simulator = ({
minWidth,
simFocus,
}: SimulatorProps) => {
// const production =
// "https://python-simulator.usermbit.org/v/0.1/simulator.html";
// const staging =
// "https://python-simulator.usermbit.org/staging/simulator.html";
// const url = stage === "PRODUCTION" ? production : staging;
// For testing with sim branches:
// TODO: Revert.
const branch = "service-worker";
const url = `https://review-python-simulator.usermbit.org/${branch}/simulator.html`;
const [brand500] = useToken("colors", ["brand.500"]);
const url = useMemo(() => {
const production =
"https://python-simulator.usermbit.org/v/0.1/simulator.html";
const staging =
"https://python-simulator.usermbit.org/staging/simulator.html?flag=sw";

// For testing with sim branches:
//const branch = "upgrade-mpy";
//const url = new URL(`https://review-python-simulator.usermbit.org/${branch}/simulator.html`);
const url = new URL(stage === "PRODUCTION" ? production : staging);
url.searchParams.append("color", brand500);
return url.toString();
}, [brand500]);

const ref = useRef<HTMLIFrameElement>(null);
const intl = useIntl();
Expand All @@ -74,7 +80,6 @@ const Simulator = ({
updateTranslations(simulator.current, intl);
}, [simulator, intl]);
const simControlsRef = useRef<HTMLDivElement>(null);
const [brand500] = useToken("colors", ["brand.500"]);
const [running, setRunning] = useState<RunningStatus>(RunningStatus.STOPPED);
const previouslyShown = usePrevious(shown);

Expand Down Expand Up @@ -119,9 +124,13 @@ const Simulator = ({
<Box
ref={ref}
as="iframe"
<<<<<<< HEAD

Check failure on line 127 in src/simulator/Simulator.tsx

View workflow job for this annotation

GitHub Actions / build

Merge conflict marker encountered.
src={`${url}?color=${encodeURIComponent(brand500)}${
flags.pwa ? "&flag=sw" : ""
}`}
=======

Check failure on line 131 in src/simulator/Simulator.tsx

View workflow job for this annotation

GitHub Actions / build

Merge conflict marker encountered.
src={url}
>>>>>>> main

Check failure on line 133 in src/simulator/Simulator.tsx

View workflow job for this annotation

GitHub Actions / build

Merge conflict marker encountered.
title={simulatorTitle}
name={simulatorTitle}
frameBorder="no"
Expand Down

0 comments on commit 4fb45ed

Please sign in to comment.