Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change project image_list to images to match API change #1180

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/components/DownloadButton/DownloadButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});

Expand Down
6 changes: 3 additions & 3 deletions src/components/DownloadButton/DownloadButton.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe("Downloading project with name set", () => {
content: "print('hello world')",
},
],
image_list: [
images: [
{
url: "a.com/b",
},
Expand Down Expand Up @@ -113,7 +113,7 @@ describe("Downloading project with no name set", () => {
content: "",
},
],
image_list: [],
images: [],
},
},
};
Expand Down Expand Up @@ -156,7 +156,7 @@ describe("Downloading project with no instructions set", () => {
content: "",
},
],
image_list: [],
images: [],
},
},
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/Editor/ImageUploadButton/ImageUploadButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -84,7 +84,7 @@ const ImageUploadButton = ({ reactAppApiEndpoint }) => {
user.access_token,
files,
);
dispatch(updateImages(response.data.image_list));
dispatch(updateImages(response.data.images));
closeModal();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/Runners/HtmlRunner/HtmlRunner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 || []),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const initialState = {
content: "",
},
],
image_list: [],
images: [],
},
},
auth: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe("Testing basic input span functionality", () => {
content: "input()",
},
],
image_list: [],
images: [],
},
codeRunTriggered: true,
},
Expand Down Expand Up @@ -104,7 +104,7 @@ test("Input box not there when input function not called", () => {
content: "print('Hello')",
},
],
image_list: [],
images: [],
},
codeRunTriggered: true,
},
Expand Down Expand Up @@ -136,7 +136,7 @@ describe("Testing stopping the code run with input", () => {
content: "input()",
},
],
image_list: [],
images: [],
},
codeRunStopped: true,
},
Expand Down Expand Up @@ -185,7 +185,7 @@ describe("When an error occurs", () => {
content: "boom!",
},
],
image_list: [],
images: [],
},
codeRunTriggered: true,
},
Expand Down Expand Up @@ -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",
},
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -382,7 +382,7 @@ describe("When in split view, py5 imported and code run", () => {
content: "import py5",
},
],
image_list: [],
images: [],
},
codeRunTriggered: true,
isSplitView: true,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -476,7 +476,7 @@ describe("When in split view, pygal imported and code run", () => {
content: "import pygal",
},
],
image_list: [],
images: [],
},
codeRunTriggered: true,
isSplitView: true,
Expand Down Expand Up @@ -521,7 +521,7 @@ describe("When in split view, turtle imported and code run", () => {
content: "import turtle",
},
],
image_list: [],
images: [],
},
codeRunTriggered: true,
isSplitView: true,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -658,7 +658,7 @@ describe("When in tabbed view, py5 imported and code run", () => {
content: "import py5",
},
],
image_list: [],
images: [],
},
codeRunTriggered: true,
isSplitView: false,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -752,7 +752,7 @@ describe("When in tabbed view, pygal imported and code run", () => {
content: "import pygal",
},
],
image_list: [],
images: [],
},
codeRunTriggered: true,
isSplitView: false,
Expand Down Expand Up @@ -797,7 +797,7 @@ describe("When in tabbed view, turtle imported and code run", () => {
content: "import turtle",
},
],
image_list: [],
images: [],
},
codeRunTriggered: true,
isSplitView: false,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1089,7 +1089,7 @@ describe("When on desktop", () => {
content: "print('Hello')",
},
],
image_list: [],
images: [],
},
},
auth: {
Expand Down Expand Up @@ -1124,7 +1124,7 @@ describe("When on mobile and not embedded", () => {
content: "print('Hello')",
},
],
image_list: [],
images: [],
},
isEmbedded: false,
},
Expand Down Expand Up @@ -1160,7 +1160,7 @@ describe("When active and first loaded", () => {
content: "print('Hello')",
},
],
image_list: [],
images: [],
},
isEmbedded: false,
},
Expand Down Expand Up @@ -1198,7 +1198,7 @@ describe("When not active", () => {
content: "print('Hello')",
},
],
image_list: [],
images: [],
},
isEmbedded: false,
},
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("When Sense Hat library used", () => {
content: "import _internal_sense_hat",
},
],
image_list: [],
images: [],
},
codeRunTriggered: true,
},
Expand Down Expand Up @@ -55,7 +55,7 @@ describe("When Sense Hat library not used", () => {
content: "print('Hello world')",
},
],
image_list: [],
images: [],
},
codeRunTriggered: true,
},
Expand Down Expand Up @@ -85,7 +85,7 @@ describe("When code run is triggered", () => {
editor: {
project: {
components: [],
image_list: [],
images: [],
},
codeRunTriggered: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("DownloadPanel", () => {
content: "print('hello world')",
},
],
image_list: [
images: [
{
url: "a.com/b",
},
Expand Down Expand Up @@ -142,7 +142,7 @@ describe("DownloadPanel", () => {
content: "print('hello world')",
},
],
image_list: [
images: [
{
url: "a.com/b",
},
Expand Down Expand Up @@ -238,7 +238,7 @@ describe("DownloadPanel", () => {
content: "print('hello world')",
},
],
image_list: [
images: [
{
url: "a.com/b",
},
Expand Down
Loading
Loading