Skip to content

Commit d7685d6

Browse files
sra405create-issue-branch[bot]loiswells97magdalenajadachMagdalena Jadach
authored
HTML/CSS MVP (#479)
Closes #462 --------- Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com> Co-authored-by: loiswells97 <[email protected]> Co-authored-by: Lois Wells <[email protected]> Co-authored-by: Lois Wells <[email protected]> Co-authored-by: magdalenajadach <[email protected]> Co-authored-by: Magdalena Jadach <[email protected]> Co-authored-by: Dan Halson <[email protected]> Co-authored-by: sra405 <[email protected]>
1 parent 8e8b317 commit d7685d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2391
-888
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
77
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
88
"dockerComposeFile": [
9-
"../docker-compose.yml",
9+
"../docker-compose.yml"
1010
],
1111

1212
// The 'service' property is the name of the service for the container that VS Code should
@@ -20,7 +20,6 @@
2020

2121
// Features to add to the dev container. More info: https://containers.dev/features.
2222
"features": {
23-
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
2423
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {
2524
"omzPlugins": "git docker-compose macos zsh-autosuggestions yarn fzf-zsh-plugin asdf zsh-nvm"
2625
}
@@ -59,13 +58,13 @@
5958
"ivangabriele.vscode-heroku",
6059
"pkosta2005.heroku-command",
6160
"yzhang.markdown-all-in-one",
62-
"dzannotti.vscode-babel-coloring",
6361
"mikestead.dotenv",
6462
"wingrunr21.vscode-ruby",
6563
"ms-vscode.remote-repositories",
6664
"github.remotehub",
6765
"circleci.circleci",
68-
"stylelint.vscode-stylelint"
66+
"stylelint.vscode-stylelint",
67+
"Orta.vscode-jest"
6968
],
7069
"settings": {
7170
"terminal.integrated.defaultProfile.linux": "zsh"

.github/workflows/ci-cd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,15 @@ jobs:
7070
run: yarn install --frozen-lock-file
7171

7272
- name: Cypress run
73-
uses: cypress-io/github-action@v4
73+
uses: cypress-io/github-action@v5
7474
with:
7575
install: false
7676
start: |
7777
yarn start
7878
yarn start:wc
7979
wait-on: 'http://localhost:3000, http://localhost:3001'
8080
env:
81+
REACT_APP_API_ENDPOINT: "https://staging-editor-api.raspberrypi.org"
8182
PUBLIC_URL: 'http://localhost:3000'
8283

8384
- name: Archive cypress artifacts
@@ -87,7 +88,6 @@ jobs:
8788
name: cypress-artifacts
8889
path: |
8990
cypress/screenshots
90-
cypress/videos
9191
9292
9393
deploy-tag:

.vscode/launch.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "chrome",
6+
"request": "launch",
7+
"name": "Launch Chrome against localhost",
8+
"url": "http://localhost:3000",
9+
"webRoot": "${workspaceFolder}"
10+
}
11+
]
12+
}

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,36 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1010

1111
- New colors (#474)
1212
- New typography (#475, #513)
13+
- Ability to create `HTML` and `CSS` files in a `HTML` project (#478)
14+
- Help text in the new file modal (#478)
1315
- Add dev-container support (#489)
16+
- Add input/output responsiveness (#473)
17+
- Ability to drag and drop input panel tabs (#438)
18+
- Distinguish icon type (#470)
1419
- Custom callback when Enter pressed in modals (#491)
15-
- `GeneralModal` and `InputModal` to encapsulate the common modal behaviour (#491)
20+
- `GeneralModal` and `InputModal` to encapsulate the common modal behaviour (#491, #517)
1621

1722
### Changed
1823

1924
- Updated spacing variables to match the new design system (#460)
25+
- Position run button in separate bar (#471)
2026
- Color usage (#474)
27+
- Handling of internal/external links for HTML/CSS projects (#483)
2128
- Existing modals to use `GeneralModal` or `InputModal` (#491)
2229
- Refactored login logic to make this available outside of the login button (#491)
30+
- Turned off HTML autorun (#515)
2331

2432
### Fixed
2533

2634
- Modal button alignment support (#460)
2735
- Storybook setup and dev deployment (#461)
36+
- HTML auto-run functionality (#481)
2837
- Updating Sentry to fix compile-time error (#487)
2938
- Fix local package build process (#488)
3039
- Color naming convention (#474)
3140
- Fix Web App Manifest logos, colors, and titles (#446)
41+
- Ability to run HTML projects by clicking run button (#481)
42+
- Internal/external HTML project links (#521)
3243

3344
## [0.15.0] - 2023-04-27
3445

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM node:16.13.1
22

3-
RUN apt-get update && apt-get install -y curl wget git zsh
3+
RUN apt-get update && apt-get install -y sudo curl wget vim git zsh docker.io
44

55
RUN sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
66

cypress.config.mjs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1-
import { defineConfig } from 'cypress'
1+
import { defineConfig } from "cypress";
22

33
export default defineConfig({
44
e2e: {
5+
chromeWebSecurity: false,
56
supportFile: false,
67
defaultCommandTimeout: 10000,
7-
screenshotOnRunFailure: (process.env.CI !== 'true')
8-
}
9-
})
8+
screenshotOnRunFailure: process.env.CI !== "true",
9+
video: false,
10+
setupNodeEvents(on, config) {
11+
on("task", {
12+
log(message) {
13+
console.log(message);
14+
15+
return null;
16+
},
17+
});
18+
},
19+
retries: {
20+
runMode: 3,
21+
openMode: 0,
22+
},
23+
},
24+
});

cypress/e2e/spec-html.cy.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
const baseUrl = "localhost:3000/en/projects/blank-html-starter";
2+
3+
const getIframeDocument = () => {
4+
return cy
5+
.get("iframe[class=htmlrunner-iframe]")
6+
.its("0.contentDocument")
7+
.should("exist");
8+
};
9+
10+
const getIframeBody = () => {
11+
return getIframeDocument()
12+
.its("body")
13+
.should("not.be.undefined")
14+
.then(cy.wrap);
15+
};
16+
17+
const makeNewFile = (filename = "new.html") => {
18+
cy.get("div[class=file-pane]").contains("Add file").click();
19+
cy.get("div[class=modal-content__input]").find("input").type(filename);
20+
cy.get("div[class=modal-content__buttons]").contains("Add file").click();
21+
};
22+
23+
it("renders the html runner", () => {
24+
cy.visit(baseUrl);
25+
cy.get(".htmlrunner-container").should("be.visible");
26+
});
27+
28+
it("can make a new file", () => {
29+
cy.visit(baseUrl);
30+
cy.get(".htmlrunner-container").should("be.visible");
31+
});
32+
33+
it("updates the preview after a change when you click run", () => {
34+
localStorage.clear();
35+
cy.visit(baseUrl);
36+
cy.get(".btn--run").click();
37+
getIframeBody().should("not.include.text", "hello world");
38+
cy.get("div[class=cm-content]").invoke("text", "<p>hello world</p>");
39+
cy.get(".btn--run").click();
40+
getIframeBody().find("p").should("include.text", "hello world");
41+
});
42+
43+
it("blocks external links", () => {
44+
localStorage.clear();
45+
cy.visit(baseUrl);
46+
cy.get("div[class=cm-content]").invoke(
47+
"text",
48+
'<a href="https://raspberrypi.org/en/">some external link</a>'
49+
);
50+
cy.get(".btn--run").click();
51+
getIframeBody().find("a").click();
52+
cy.get("div[class=modal-content__header]")
53+
.find("h2")
54+
.should("include.text", "An error has occurred");
55+
});
56+
57+
it("allows internal links", () => {
58+
localStorage.clear();
59+
cy.visit(baseUrl);
60+
cy.get("div[class=cm-content]").invoke("text", "<p>hello world</p>");
61+
cy.get(".btn--run").click();
62+
makeNewFile();
63+
cy.get("div[class=cm-content]").invoke(
64+
"text",
65+
'<a href="index.html">some internal link</a>'
66+
);
67+
cy.get(".btn--run").click();
68+
69+
const internalLink = getIframeBody().find("a");
70+
internalLink.click();
71+
const content = getIframeBody().find("p");
72+
content.should("include.text", "hello world");
73+
});

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ services:
99
stdin_open: true
1010
volumes:
1111
- .:/app
12+
- /var/run/docker.sock:/var/run/docker.sock
1213
- node_modules:/app/node_modules # ensures we retain node_modules from docker build
1314
react-ui-wc:
1415
build: .

package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@codemirror/lang-python": "^6.0.2",
1313
"@codemirror/language": "^6.2.1",
1414
"@codemirror/view": "^6.3.0",
15+
"@hello-pangea/dnd": "^16.2.0",
1516
"@juggle/resize-observer": "^3.3.1",
1617
"@lezer/highlight": "^1.0.0",
1718
"@react-three/drei": "^9.65.5",
@@ -24,6 +25,7 @@
2425
"@szhsin/react-menu": "^3.2.0",
2526
"apollo-link-sentry": "^3.2.3",
2627
"axios": "^0.24.0",
28+
"classnames": "^2.3.2",
2729
"codemirror": "^6.0.1",
2830
"container-query-polyfill": "^1.0.2",
2931
"date-fns": "^2.29.3",
@@ -39,12 +41,17 @@
3941
"js-convert-case": "^4.2.0",
4042
"jszip": "^3.10.1",
4143
"jszip-utils": "^0.1.0",
44+
"node-html-parser": "^6.1.5",
4245
"oidc-client": "^1.11.5",
4346
"parse-link-header": "^2.0.0",
4447
"prompts": "2.4.0",
48+
"prop-types": "^15.8.1",
49+
"rc-resize-observer": "^1.3.1",
50+
"re-resizable": "6.9.9",
4551
"react": "^18.1.0",
4652
"react-app-polyfill": "^2.0.0",
4753
"react-confirm-alert": "^2.8.0",
54+
"react-container-query": "^0.12.1",
4855
"react-cookie": "^4.1.1",
4956
"react-dom": "^18.1.0",
5057
"react-dropzone": "^12.0.4",
@@ -57,7 +64,6 @@
5764
"react-timer-hook": "^3.0.5",
5865
"react-toastify": "^8.1.0",
5966
"react-toggle": "^4.1.3",
60-
"re-resizable": "6.9.9",
6167
"redux-oidc": "^4.0.0-beta1",
6268
"skulpt": "^1.2.0",
6369
"three": "^0.140.0",
@@ -119,7 +125,7 @@
119125
"copy-webpack-plugin": "^6.4.0",
120126
"css-loader": "4.3.0",
121127
"curl": "^0.1.4",
122-
"cypress": "^10.1.0",
128+
"cypress": "12.12.0",
123129
"dotenv": "8.2.0",
124130
"dotenv-expand": "5.1.0",
125131
"dotenv-webpack": "^7.1.0",
@@ -197,6 +203,9 @@
197203
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
198204
],
199205
"testEnvironment": "jsdom",
206+
"testEnvironmentOptions": {
207+
"resources": "usable"
208+
},
200209
"testRunner": "jest-circus/runner",
201210
"transform": {
202211
"^.+\\.(js|jsx|mjs|cjs|ts|tsx)$": "<rootDir>/config/jest/babelTransform.js",

src/Icons.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ export const RunIcon = () => {
432432
fill="none"
433433
xmlns="http://www.w3.org/2000/svg"
434434
>
435-
<path d="M0 14V0L11 7L0 14ZM2 10.35L7.25 7L2 3.65V10.35Z" />
435+
<path d="M0 14V0L11 7L0 14Z"/>
436436
</svg>
437437
);
438438
};
@@ -480,7 +480,7 @@ export const StopIcon = () => {
480480
fill="none"
481481
xmlns="http://www.w3.org/2000/svg"
482482
>
483-
<path d="M2 2V10V2ZM0 12V0H12V12H0ZM2 10H10V2H2V10Z" />
483+
<path d="M0 12V0H12V12H0Z"/>
484484
</svg>
485485
);
486486
};

0 commit comments

Comments
 (0)