Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ const PyodideRunner = ({ active, outputPanels = ["text", "visual"] }) => {
};

if (!pyodideWorker && active) {
console.warn("PyodideWorker is not initialized");
return;
return null;
}

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ const SkulptRunner = ({ active, outputPanels = ["text", "visual"] }) => {
) : (
<Tabs
forceRenderTabPanel={true}
defaultIndex={showVisualOutput ? 0 : 1}
selectedIndex={tabbedViewSelectedIndex}
onSelect={setTabbedViewSelectedIndex}
>
Expand Down
1 change: 1 addition & 0 deletions src/components/Menus/Sidebar/FilePanel/FilePanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const FilePanel = ({ isMobile }) => {
? []
: [
<DesignSystemButton
key="new-file"
text={t("filePanel.newFileButton")}
textAways={true}
icon={<PlusIcon />}
Expand Down
15 changes: 14 additions & 1 deletion src/components/ScratchEditor/ScratchIntegrationHOC.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ const ScratchIntegrationHOC = function (WrappedComponent) {
return;
}

if (event.data?.type === "webpackOk") {
return;
}

Comment thread
abcampo-iry marked this conversation as resolved.
switch (event.data.type) {
case "scratch-gui-download":
this.handleDownload(event);
Expand Down Expand Up @@ -80,7 +84,16 @@ const ScratchIntegrationHOC = function (WrappedComponent) {
this.props.onClickSave();
}
render() {
const { ...componentProps } = this.props;
const {
loadProject,
localesOnly,
onClickRemix,
onClickSave,
saveProjectSb3,
setStageSize,
...componentProps
} = this.props;

return <WrappedComponent {...componentProps} />;
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/containers/WebComponentLoader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ import {
projectOwnerLoadedEvent,
} from "../events/WebComponentCustomEvents";

const TOAST_CONTAINER_DEFAULTS = {
...(ToastContainer.defaultProps || {}),
};

// react-toastify v8 uses defaultProps on a function component, which React
// warns about in development. We pass the same defaults explicitly instead.
// We should upgrade to version 10 in a different commit, this removes the warning
ToastContainer.defaultProps = undefined;
Comment thread
abcampo-iry marked this conversation as resolved.
Outdated

const WebComponentLoader = (props) => {
const {
assetsIdentifier,
Expand Down Expand Up @@ -222,6 +231,7 @@ const WebComponentLoader = (props) => {
{internalStyles.toString()}
<div id="wc" className={`--${cookies.theme || themeDefault}`}>
<ToastContainer
{...TOAST_CONTAINER_DEFAULTS}
enableMultiContainer
containerId="top-center"
position="top-center"
Expand Down
8 changes: 7 additions & 1 deletion src/hooks/useProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,13 @@ export const useProject = ({
return;
}

const data = defaultPythonProject;
const data = {
...defaultPythonProject,
name: i18n.t("project.untitled", {
lng: effectiveLocale,
defaultValue: defaultPythonProject.name,
}),
};
dispatch(setProject(data));
}
}, [
Expand Down
7 changes: 6 additions & 1 deletion src/hooks/useProject.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ describe("When not embedded", () => {

test("If no identifier uses default python project", () => {
renderHook(() => useProject({}), { wrapper });
expect(setProject).toHaveBeenCalledWith(defaultPythonProject);
expect(setProject).toHaveBeenCalledWith(
expect.objectContaining({
...defaultPythonProject,
name: "project.untitled",
}),
);
});

test("sets project to initialProject if provided", () => {
Expand Down
6 changes: 3 additions & 3 deletions src/utils/defaultProjects.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import i18n from "./i18n";
const UNTITLED_PROJECT_NAME = "Untitled project";

export const defaultPythonProject = {
project_type: "python",
name: i18n.t("project.untitled"),
name: UNTITLED_PROJECT_NAME,
locale: null,
components: [{ extension: "py", name: "main", content: "", default: true }],
image_list: [],
};

export const defaultHtmlProject = {
project_type: "html",
name: i18n.t("project.untitled"),
name: UNTITLED_PROJECT_NAME,
components: [
{
extension: "html",
Expand Down
1 change: 1 addition & 0 deletions src/web-component.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" href="data:," />
<title>Editor Web component</title>
</head>
<body>
Expand Down
15 changes: 15 additions & 0 deletions src/web-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ import { stopCodeRun, stopDraw, triggerCodeRun } from "./redux/EditorSlice";
import { BrowserRouter } from "react-router-dom";
import { resetStore } from "./redux/RootSlice";

const originalWarn = console.warn.bind(console);
let hasShownDesignSystemIconWarning = false;
const warningText = "DEPRECATED: icons as React elements will not be supported in future releases";
// This should be addressed by applying the fix, in @raspberrypifoundation/design-system-react
// This shows the warning once instead of N times
console.warn = (...args) => {
if (args[0] === warningText) {
if (hasShownDesignSystemIconWarning) {
return;
}
hasShownDesignSystemIconWarning = true;
}
originalWarn(...args);
};

Comment thread
zetter-rpf marked this conversation as resolved.
Outdated
Sentry.init({
dsn: process.env.REACT_APP_SENTRY_DSN,
integrations: [new BrowserTracing()],
Expand Down