diff --git a/CHANGELOG.md b/CHANGELOG.md index 391380a3a..37ab3328d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Made `INSTRUCTIONS.md` a reserved file name (#1160) - Login to save now logs in and automatically saves (#1162) +- Switching project `image_list` to `images` to match latest API version (#1180) ## [0.28.14] - 2025-01-06 diff --git a/src/components/DownloadButton/DownloadButton.jsx b/src/components/DownloadButton/DownloadButton.jsx index b37342633..a1fe9a7b2 100644 --- a/src/components/DownloadButton/DownloadButton.jsx +++ b/src/components/DownloadButton/DownloadButton.jsx @@ -47,7 +47,7 @@ const DownloadButton = (props) => { zip.file(`${file.name}.${file.extension}`, file.content); }); - project.image_list.forEach((image) => { + project.images.forEach((image) => { zip.file(image.filename, urlToPromise(image.url), { binary: true }); }); diff --git a/src/components/DownloadButton/DownloadButton.test.js b/src/components/DownloadButton/DownloadButton.test.js index 1d8a5a655..d92a2d177 100644 --- a/src/components/DownloadButton/DownloadButton.test.js +++ b/src/components/DownloadButton/DownloadButton.test.js @@ -33,7 +33,7 @@ describe("Downloading project with name set", () => { content: "print('hello world')", }, ], - image_list: [ + images: [ { url: "a.com/b", }, @@ -113,7 +113,7 @@ describe("Downloading project with no name set", () => { content: "", }, ], - image_list: [], + images: [], }, }, }; @@ -156,7 +156,7 @@ describe("Downloading project with no instructions set", () => { content: "", }, ], - image_list: [], + images: [], }, }, }; diff --git a/src/components/Editor/ImageUploadButton/ImageUploadButton.jsx b/src/components/Editor/ImageUploadButton/ImageUploadButton.jsx index ecb3b144d..962fde18f 100644 --- a/src/components/Editor/ImageUploadButton/ImageUploadButton.jsx +++ b/src/components/Editor/ImageUploadButton/ImageUploadButton.jsx @@ -38,7 +38,7 @@ const ImageUploadButton = ({ reactAppApiEndpoint }) => { const projectIdentifier = useSelector( (state) => state.editor.project.identifier, ); - const projectImages = useSelector((state) => state.editor.project.image_list); + const projectImages = useSelector((state) => state.editor.project.images); const imageNames = projectImages.map((image) => `${image.filename}`); const user = useSelector((state) => state.auth.user); @@ -84,7 +84,7 @@ const ImageUploadButton = ({ reactAppApiEndpoint }) => { user.access_token, files, ); - dispatch(updateImages(response.data.image_list)); + dispatch(updateImages(response.data.images)); closeModal(); } }; diff --git a/src/components/Editor/ImageUploadButton/ImageUploadButton.test.js b/src/components/Editor/ImageUploadButton/ImageUploadButton.test.js index df575e530..845391cef 100644 --- a/src/components/Editor/ImageUploadButton/ImageUploadButton.test.js +++ b/src/components/Editor/ImageUploadButton/ImageUploadButton.test.js @@ -22,7 +22,7 @@ describe("When user logged in and owns project", () => { extension: "py", }, ], - image_list: [], + images: [], project_type: "python", user_id: "b48e70e2-d9ed-4a59-aee5-fc7cf09dbfaf", }, diff --git a/src/components/Editor/Runners/HtmlRunner/HtmlRunner.jsx b/src/components/Editor/Runners/HtmlRunner/HtmlRunner.jsx index ae8a47720..5172e3023 100644 --- a/src/components/Editor/Runners/HtmlRunner/HtmlRunner.jsx +++ b/src/components/Editor/Runners/HtmlRunner/HtmlRunner.jsx @@ -32,7 +32,7 @@ function HtmlRunner() { const project = useSelector((state) => state.editor.project); const projectCode = project.components; const projectMedia = [ - ...(project.image_list || []), + ...(project.images || []), ...(project.audio || []), ...(project.videos || []), ]; diff --git a/src/components/Editor/Runners/HtmlRunner/HtmlRunner.test.js b/src/components/Editor/Runners/HtmlRunner/HtmlRunner.test.js index 40ad19de9..5a75532a8 100644 --- a/src/components/Editor/Runners/HtmlRunner/HtmlRunner.test.js +++ b/src/components/Editor/Runners/HtmlRunner/HtmlRunner.test.js @@ -512,7 +512,7 @@ describe("When media is rendered", () => { components: [ { name: "index", extension: "html", content: mediaHTML }, ], - image_list: [ + images: [ { filename: "image.jpeg", url: "https://example.com/image.jpeg", diff --git a/src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideRunner.jsx b/src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideRunner.jsx index 50594e250..61bcb5309 100644 --- a/src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideRunner.jsx +++ b/src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideRunner.jsx @@ -50,7 +50,7 @@ const PyodideRunner = ({ active, outputPanels = ["text", "visual"] }) => { const stdinBuffer = useRef(); const stdinClosed = useRef(); const loadedRunner = useSelector((state) => state.editor.loadedRunner); - const projectImages = useSelector((s) => s.editor.project.image_list); + const projectImages = useSelector((s) => s.editor.project.images); const projectCode = useSelector((s) => s.editor.project.components); const projectIdentifier = useSelector((s) => s.editor.project.identifier); const focussedFileIndex = useSelector( diff --git a/src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideRunner.test.js b/src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideRunner.test.js index bea6c9264..4add9f416 100644 --- a/src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideRunner.test.js +++ b/src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideRunner.test.js @@ -32,9 +32,7 @@ const project = { { name: "main", extension: "py", content: "print('hello')" }, { name: "existing_file", extension: "txt", content: "hello" }, ], - image_list: [ - { filename: "image1.jpg", url: "http://example.com/image1.jpg" }, - ], + images: [{ filename: "image1.jpg", url: "http://example.com/image1.jpg" }], }; window.crossOriginIsolated = true; diff --git a/src/components/Editor/Runners/PythonRunner/PythonRunner.test.js b/src/components/Editor/Runners/PythonRunner/PythonRunner.test.js index b92f9cf3f..ed347ba53 100644 --- a/src/components/Editor/Runners/PythonRunner/PythonRunner.test.js +++ b/src/components/Editor/Runners/PythonRunner/PythonRunner.test.js @@ -26,7 +26,7 @@ const initialState = { content: "", }, ], - image_list: [], + images: [], }, }, auth: {}, diff --git a/src/components/Editor/Runners/PythonRunner/SkulptRunner/SkulptRunner.test.js b/src/components/Editor/Runners/PythonRunner/SkulptRunner/SkulptRunner.test.js index 293bc9925..a9adf3913 100644 --- a/src/components/Editor/Runners/PythonRunner/SkulptRunner/SkulptRunner.test.js +++ b/src/components/Editor/Runners/PythonRunner/SkulptRunner/SkulptRunner.test.js @@ -48,7 +48,7 @@ describe("Testing basic input span functionality", () => { content: "input()", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, }, @@ -104,7 +104,7 @@ test("Input box not there when input function not called", () => { content: "print('Hello')", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, }, @@ -136,7 +136,7 @@ describe("Testing stopping the code run with input", () => { content: "input()", }, ], - image_list: [], + images: [], }, codeRunStopped: true, }, @@ -185,7 +185,7 @@ describe("When an error occurs", () => { content: "boom!", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, }, @@ -242,7 +242,7 @@ describe("When an error has occurred", () => { content: "boom!", }, ], - image_list: [], + images: [], }, error: "SyntaxError: bad token T_OP on line 1 of main.py", }, @@ -295,7 +295,7 @@ describe("When there is an import error and the site is cross-origin isolated", content: "import fake_module", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, }, @@ -336,7 +336,7 @@ describe("When there is an import error and the site is cross-origin isolated", // content: "print('hello world')", // }, // ], -// image_list: [], +// images: [], // }, // codeRunTriggered: true, // isSplitView: true, @@ -382,7 +382,7 @@ describe("When in split view, py5 imported and code run", () => { content: "import py5", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, isSplitView: true, @@ -431,7 +431,7 @@ describe("When in split view, py5_imported imported and code run", () => { content: "import py5_imported", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, isSplitView: true, @@ -476,7 +476,7 @@ describe("When in split view, pygal imported and code run", () => { content: "import pygal", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, isSplitView: true, @@ -521,7 +521,7 @@ describe("When in split view, turtle imported and code run", () => { content: "import turtle", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, isSplitView: true, @@ -566,7 +566,7 @@ describe("When in split view, sense_hat imported and code run", () => { content: "import _internal_sense_hat", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, isSplitView: true, @@ -612,7 +612,7 @@ describe("When in split view, sense_hat imported and code run", () => { // content: "print('hello world')", // }, // ], -// image_list: [], +// images: [], // }, // codeRunTriggered: true, // isSplitView: false, @@ -658,7 +658,7 @@ describe("When in tabbed view, py5 imported and code run", () => { content: "import py5", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, isSplitView: false, @@ -707,7 +707,7 @@ describe("When in tabbed view, py5_imported imported and code run", () => { content: "import py5_imported", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, isSplitView: false, @@ -752,7 +752,7 @@ describe("When in tabbed view, pygal imported and code run", () => { content: "import pygal", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, isSplitView: false, @@ -797,7 +797,7 @@ describe("When in tabbed view, turtle imported and code run", () => { content: "import turtle", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, isSplitView: false, @@ -842,7 +842,7 @@ describe("When in tabbed view, sense_hat imported and code run", () => { content: "import _internal_sense_hat", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, isSplitView: false, @@ -884,7 +884,7 @@ test("When embedded in split view with visual output does not render output view content: "import p5", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, isSplitView: true, @@ -1089,7 +1089,7 @@ describe("When on desktop", () => { content: "print('Hello')", }, ], - image_list: [], + images: [], }, }, auth: { @@ -1124,7 +1124,7 @@ describe("When on mobile and not embedded", () => { content: "print('Hello')", }, ], - image_list: [], + images: [], }, isEmbedded: false, }, @@ -1160,7 +1160,7 @@ describe("When active and first loaded", () => { content: "print('Hello')", }, ], - image_list: [], + images: [], }, isEmbedded: false, }, @@ -1198,7 +1198,7 @@ describe("When not active", () => { content: "print('Hello')", }, ], - image_list: [], + images: [], }, isEmbedded: false, }, @@ -1233,7 +1233,7 @@ describe("When not active and a code run has been triggered", () => { content: "print('Hello')", }, ], - image_list: [], + images: [], }, isEmbedded: false, codeRunTriggered: true, diff --git a/src/components/Editor/Runners/PythonRunner/VisualOutputPane.jsx b/src/components/Editor/Runners/PythonRunner/VisualOutputPane.jsx index 86e405b2d..db7b9dac1 100644 --- a/src/components/Editor/Runners/PythonRunner/VisualOutputPane.jsx +++ b/src/components/Editor/Runners/PythonRunner/VisualOutputPane.jsx @@ -15,7 +15,7 @@ const VisualOutputPane = () => { (state) => state.editor.senseHatAlwaysEnabled, ); const senseHatEnabled = useSelector((state) => state.editor.senseHatEnabled); - const projectImages = useSelector((state) => state.editor.project.image_list); + const projectImages = useSelector((state) => state.editor.project.images); const error = useSelector((state) => state.editor.error); const turtleOutput = useRef(); diff --git a/src/components/Editor/Runners/PythonRunner/VisualOutputPane.test.js b/src/components/Editor/Runners/PythonRunner/VisualOutputPane.test.js index 0b8a29180..d7df6d101 100644 --- a/src/components/Editor/Runners/PythonRunner/VisualOutputPane.test.js +++ b/src/components/Editor/Runners/PythonRunner/VisualOutputPane.test.js @@ -21,7 +21,7 @@ describe("When Sense Hat library used", () => { content: "import _internal_sense_hat", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, }, @@ -55,7 +55,7 @@ describe("When Sense Hat library not used", () => { content: "print('Hello world')", }, ], - image_list: [], + images: [], }, codeRunTriggered: true, }, @@ -85,7 +85,7 @@ describe("When code run is triggered", () => { editor: { project: { components: [], - image_list: [], + images: [], }, codeRunTriggered: true, }, diff --git a/src/components/Menus/Sidebar/DownloadPanel/DownloadPanel.test.js b/src/components/Menus/Sidebar/DownloadPanel/DownloadPanel.test.js index c5fb0852e..e9fd995bc 100644 --- a/src/components/Menus/Sidebar/DownloadPanel/DownloadPanel.test.js +++ b/src/components/Menus/Sidebar/DownloadPanel/DownloadPanel.test.js @@ -38,7 +38,7 @@ describe("DownloadPanel", () => { content: "print('hello world')", }, ], - image_list: [ + images: [ { url: "a.com/b", }, @@ -142,7 +142,7 @@ describe("DownloadPanel", () => { content: "print('hello world')", }, ], - image_list: [ + images: [ { url: "a.com/b", }, @@ -238,7 +238,7 @@ describe("DownloadPanel", () => { content: "print('hello world')", }, ], - image_list: [ + images: [ { url: "a.com/b", }, diff --git a/src/components/Menus/Sidebar/ImagePanel/ImagePanel.test.js b/src/components/Menus/Sidebar/ImagePanel/ImagePanel.test.js index 22d77d3d3..71c6caa35 100644 --- a/src/components/Menus/Sidebar/ImagePanel/ImagePanel.test.js +++ b/src/components/Menus/Sidebar/ImagePanel/ImagePanel.test.js @@ -11,7 +11,7 @@ const createMockStore = () => { editor: { project: { components: [], - image_list: [ + images: [ { url: "path/to/image1", filename: "image1.jpg", diff --git a/src/components/Menus/Sidebar/ImagePanel/ProjectImages/ProjectImages.jsx b/src/components/Menus/Sidebar/ImagePanel/ProjectImages/ProjectImages.jsx index 158762df5..83a50e305 100644 --- a/src/components/Menus/Sidebar/ImagePanel/ProjectImages/ProjectImages.jsx +++ b/src/components/Menus/Sidebar/ImagePanel/ProjectImages/ProjectImages.jsx @@ -4,7 +4,7 @@ import { useSelector } from "react-redux"; import "../../../../../assets/stylesheets/ProjectImages.scss"; const ProjectImages = () => { - const projectImages = useSelector((state) => state.editor.project.image_list); + const projectImages = useSelector((state) => state.editor.project.images); return (