Merge remote-tracking branch 'origin/develop' into release/2022-06-08

This commit is contained in:
picklesrus 2022-06-08 17:35:48 +00:00
commit cc229a28f1
11 changed files with 201 additions and 143 deletions

120
package-lock.json generated
View file

@ -28,7 +28,7 @@
"@formatjs/intl-locale": "2.4.34", "@formatjs/intl-locale": "2.4.34",
"@formatjs/intl-pluralrules": "4.1.0", "@formatjs/intl-pluralrules": "4.1.0",
"@formatjs/intl-relativetimeformat": "8.1.8", "@formatjs/intl-relativetimeformat": "8.1.8",
"async": "3.1.0", "async": "3.2.2",
"autoprefixer": "10.4.2", "autoprefixer": "10.4.2",
"babel-cli": "6.26.0", "babel-cli": "6.26.0",
"babel-core": "6.26.3", "babel-core": "6.26.3",
@ -99,8 +99,8 @@
"regenerator-runtime": "0.13.9", "regenerator-runtime": "0.13.9",
"sass": "1.49.7", "sass": "1.49.7",
"sass-loader": "10.2.1", "sass-loader": "10.2.1",
"scratch-gui": "0.1.0-prerelease.20220601144935", "scratch-gui": "0.1.0-prerelease.20220605140952",
"scratch-l10n": "3.14.20220601031612", "scratch-l10n": "3.14.20220605031627",
"selenium-webdriver": "4.1.0", "selenium-webdriver": "4.1.0",
"slick-carousel": "1.6.0", "slick-carousel": "1.6.0",
"style-loader": "0.12.3", "style-loader": "0.12.3",
@ -2638,9 +2638,9 @@
} }
}, },
"node_modules/async": { "node_modules/async": {
"version": "3.1.0", "version": "3.2.2",
"resolved": "https://registry.npmjs.org/async/-/async-3.1.0.tgz", "resolved": "https://registry.npmjs.org/async/-/async-3.2.2.tgz",
"integrity": "sha512-4vx/aaY6j/j3Lw3fbCHNWP0pPaTCew3F6F3hYyl/tHs/ndmV1q7NW9T5yuJ2XAGwdQrP+6Wu20x06U4APo/iQQ==", "integrity": "sha512-H0E+qZaDEfx/FY4t7iLRv1W2fFI6+pyCeTw1uN20AQPiwqwM6ojPxHxdLv4z8hi2DtnW9BOckSspLucW7pIE5g==",
"dev": true "dev": true
}, },
"node_modules/async-each": { "node_modules/async-each": {
@ -22878,9 +22878,9 @@
} }
}, },
"node_modules/scratch-gui": { "node_modules/scratch-gui": {
"version": "0.1.0-prerelease.20220601144935", "version": "0.1.0-prerelease.20220605140952",
"resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20220601144935.tgz", "resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20220605140952.tgz",
"integrity": "sha512-3O4E3DR9NhyvOHRkks1zKsTpP8rxxwzJX7ZGxNu9QFf+/nUiWrWa7CTOf2Ex5foiLBrTa0fUNWtYjR432+aQJA==", "integrity": "sha512-BSYEB10tQx9Y58ERV33CSOAbsLxz+7THzMUN3+QPlKu6lFoK6yB4n9o47A8WFHUiCEoT/J8HWh8juWl88Ic2Sw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"arraybuffer-loader": "^1.0.6", "arraybuffer-loader": "^1.0.6",
@ -22932,13 +22932,13 @@
"redux-throttle": "0.1.1", "redux-throttle": "0.1.1",
"scratch-audio": "0.1.0-prerelease.20200528195344", "scratch-audio": "0.1.0-prerelease.20200528195344",
"scratch-blocks": "0.1.0-prerelease.20220524062105", "scratch-blocks": "0.1.0-prerelease.20220524062105",
"scratch-l10n": "3.14.20220601031612", "scratch-l10n": "3.14.20220605031627",
"scratch-paint": "0.2.0-prerelease.20220530095633", "scratch-paint": "0.2.0-prerelease.20220605112441",
"scratch-render": "0.1.0-prerelease.20211028200436", "scratch-render": "0.1.0-prerelease.20211028200436",
"scratch-render-fonts": "1.0.0-prerelease.20210401210003", "scratch-render-fonts": "1.0.0-prerelease.20210401210003",
"scratch-storage": "2.0.2", "scratch-storage": "2.0.2",
"scratch-svg-renderer": "0.2.0-prerelease.20210727023023", "scratch-svg-renderer": "0.2.0-prerelease.20210727023023",
"scratch-vm": "0.2.0-prerelease.20220601111129", "scratch-vm": "0.2.0-prerelease.20220602121716",
"startaudiocontext": "1.2.1", "startaudiocontext": "1.2.1",
"style-loader": "^0.23.0", "style-loader": "^0.23.0",
"text-encoding": "0.7.0", "text-encoding": "0.7.0",
@ -23228,9 +23228,9 @@
} }
}, },
"node_modules/scratch-gui/node_modules/scratch-paint": { "node_modules/scratch-gui/node_modules/scratch-paint": {
"version": "0.2.0-prerelease.20220530095633", "version": "0.2.0-prerelease.20220605112441",
"resolved": "https://registry.npmjs.org/scratch-paint/-/scratch-paint-0.2.0-prerelease.20220530095633.tgz", "resolved": "https://registry.npmjs.org/scratch-paint/-/scratch-paint-0.2.0-prerelease.20220605112441.tgz",
"integrity": "sha512-jEGvWClwkRyyzq+tH6utI2rdbwZn1a2CjDtIdZM9rCeJ1f88RiZucpdS68xexK5asLurfveaJMif69K3T7wX/g==", "integrity": "sha512-GgwKhp+yDJNQLbpykw3J5JUgCptgfDW66JObuTLpVDlRUVtbV9eamSuIdUWLgVrbTXVUtfHQT2z1KMi31t4thg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@scratch/paper": "0.11.20200728195508", "@scratch/paper": "0.11.20200728195508",
@ -23330,9 +23330,9 @@
} }
}, },
"node_modules/scratch-l10n": { "node_modules/scratch-l10n": {
"version": "3.14.20220601031612", "version": "3.14.20220605031627",
"resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.14.20220601031612.tgz", "resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.14.20220605031627.tgz",
"integrity": "sha512-x5IhyAjNKKC2CIg973jDhrSdHnD6VV8/94HVLwnyqjxsSQVCY+jU1omenXk/hFzOsyZn10FhaNpqYQbmD5oAFQ==", "integrity": "sha512-uVnAOlyiZrNL52ltFRJvDQTVuSnXl+TxWrxQP99I1kpZsokHuh7/NXczw+tDdbM0oiaY1D8FMi49KXPIFolMpQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@babel/cli": "^7.1.2", "@babel/cli": "^7.1.2",
@ -23528,9 +23528,9 @@
"dev": true "dev": true
}, },
"node_modules/scratch-vm": { "node_modules/scratch-vm": {
"version": "0.2.0-prerelease.20220601111129", "version": "0.2.0-prerelease.20220602121716",
"resolved": "https://registry.npmjs.org/scratch-vm/-/scratch-vm-0.2.0-prerelease.20220601111129.tgz", "resolved": "https://registry.npmjs.org/scratch-vm/-/scratch-vm-0.2.0-prerelease.20220602121716.tgz",
"integrity": "sha512-NMfIbpvxNwODCU2oWpn+P0FUTbP0Fd1vIsPDOov6sPAFUtdnU6f/I/OPtKO+kKL0Jn+p7i+8GXsDIW3ffsJmbw==", "integrity": "sha512-N7hY2OeMJMybH1GdYwxaj+zu8BUBsiDUCmA0o3UsrVVsKCxcPgHQxJYksWalH1zV3GsWlkXwX6qBarviRmVfbg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@vernier/godirect": "1.5.0", "@vernier/godirect": "1.5.0",
@ -33686,9 +33686,9 @@
"dev": true "dev": true
}, },
"async": { "async": {
"version": "3.1.0", "version": "3.2.2",
"resolved": "https://registry.npmjs.org/async/-/async-3.1.0.tgz", "resolved": "https://registry.npmjs.org/async/-/async-3.2.2.tgz",
"integrity": "sha512-4vx/aaY6j/j3Lw3fbCHNWP0pPaTCew3F6F3hYyl/tHs/ndmV1q7NW9T5yuJ2XAGwdQrP+6Wu20x06U4APo/iQQ==", "integrity": "sha512-H0E+qZaDEfx/FY4t7iLRv1W2fFI6+pyCeTw1uN20AQPiwqwM6ojPxHxdLv4z8hi2DtnW9BOckSspLucW7pIE5g==",
"dev": true "dev": true
}, },
"async-each": { "async-each": {
@ -38367,9 +38367,9 @@
}, },
"dependencies": { "dependencies": {
"ansi-regex": { "ansi-regex": {
"version": "3.0.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true "dev": true
}, },
"ansi-styles": { "ansi-styles": {
@ -42924,9 +42924,9 @@
}, },
"dependencies": { "dependencies": {
"ansi-regex": { "ansi-regex": {
"version": "3.0.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true "dev": true
}, },
"cliui": { "cliui": {
@ -42962,9 +42962,9 @@
}, },
"dependencies": { "dependencies": {
"ansi-regex": { "ansi-regex": {
"version": "3.0.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true "dev": true
}, },
"ansi-styles": { "ansi-styles": {
@ -43844,9 +43844,9 @@
}, },
"dependencies": { "dependencies": {
"ansi-regex": { "ansi-regex": {
"version": "3.0.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true "dev": true
}, },
"ansi-styles": { "ansi-styles": {
@ -47837,9 +47837,9 @@
}, },
"dependencies": { "dependencies": {
"ansi-regex": { "ansi-regex": {
"version": "3.0.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true "dev": true
}, },
"ansi-styles": { "ansi-styles": {
@ -50769,9 +50769,9 @@
} }
}, },
"scratch-gui": { "scratch-gui": {
"version": "0.1.0-prerelease.20220601144935", "version": "0.1.0-prerelease.20220605140952",
"resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20220601144935.tgz", "resolved": "https://registry.npmjs.org/scratch-gui/-/scratch-gui-0.1.0-prerelease.20220605140952.tgz",
"integrity": "sha512-3O4E3DR9NhyvOHRkks1zKsTpP8rxxwzJX7ZGxNu9QFf+/nUiWrWa7CTOf2Ex5foiLBrTa0fUNWtYjR432+aQJA==", "integrity": "sha512-BSYEB10tQx9Y58ERV33CSOAbsLxz+7THzMUN3+QPlKu6lFoK6yB4n9o47A8WFHUiCEoT/J8HWh8juWl88Ic2Sw==",
"dev": true, "dev": true,
"requires": { "requires": {
"arraybuffer-loader": "^1.0.6", "arraybuffer-loader": "^1.0.6",
@ -50823,13 +50823,13 @@
"redux-throttle": "0.1.1", "redux-throttle": "0.1.1",
"scratch-audio": "0.1.0-prerelease.20200528195344", "scratch-audio": "0.1.0-prerelease.20200528195344",
"scratch-blocks": "0.1.0-prerelease.20220524062105", "scratch-blocks": "0.1.0-prerelease.20220524062105",
"scratch-l10n": "3.14.20220601031612", "scratch-l10n": "3.14.20220605031627",
"scratch-paint": "0.2.0-prerelease.20220530095633", "scratch-paint": "0.2.0-prerelease.20220605112441",
"scratch-render": "0.1.0-prerelease.20211028200436", "scratch-render": "0.1.0-prerelease.20211028200436",
"scratch-render-fonts": "1.0.0-prerelease.20210401210003", "scratch-render-fonts": "1.0.0-prerelease.20210401210003",
"scratch-storage": "2.0.2", "scratch-storage": "2.0.2",
"scratch-svg-renderer": "0.2.0-prerelease.20210727023023", "scratch-svg-renderer": "0.2.0-prerelease.20210727023023",
"scratch-vm": "0.2.0-prerelease.20220601111129", "scratch-vm": "0.2.0-prerelease.20220602121716",
"startaudiocontext": "1.2.1", "startaudiocontext": "1.2.1",
"style-loader": "^0.23.0", "style-loader": "^0.23.0",
"text-encoding": "0.7.0", "text-encoding": "0.7.0",
@ -51065,9 +51065,9 @@
} }
}, },
"scratch-paint": { "scratch-paint": {
"version": "0.2.0-prerelease.20220530095633", "version": "0.2.0-prerelease.20220605112441",
"resolved": "https://registry.npmjs.org/scratch-paint/-/scratch-paint-0.2.0-prerelease.20220530095633.tgz", "resolved": "https://registry.npmjs.org/scratch-paint/-/scratch-paint-0.2.0-prerelease.20220605112441.tgz",
"integrity": "sha512-jEGvWClwkRyyzq+tH6utI2rdbwZn1a2CjDtIdZM9rCeJ1f88RiZucpdS68xexK5asLurfveaJMif69K3T7wX/g==", "integrity": "sha512-GgwKhp+yDJNQLbpykw3J5JUgCptgfDW66JObuTLpVDlRUVtbV9eamSuIdUWLgVrbTXVUtfHQT2z1KMi31t4thg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@scratch/paper": "0.11.20200728195508", "@scratch/paper": "0.11.20200728195508",
@ -51148,9 +51148,9 @@
} }
}, },
"scratch-l10n": { "scratch-l10n": {
"version": "3.14.20220601031612", "version": "3.14.20220605031627",
"resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.14.20220601031612.tgz", "resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-3.14.20220605031627.tgz",
"integrity": "sha512-x5IhyAjNKKC2CIg973jDhrSdHnD6VV8/94HVLwnyqjxsSQVCY+jU1omenXk/hFzOsyZn10FhaNpqYQbmD5oAFQ==", "integrity": "sha512-uVnAOlyiZrNL52ltFRJvDQTVuSnXl+TxWrxQP99I1kpZsokHuh7/NXczw+tDdbM0oiaY1D8FMi49KXPIFolMpQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@babel/cli": "^7.1.2", "@babel/cli": "^7.1.2",
@ -51340,9 +51340,9 @@
"dev": true "dev": true
}, },
"scratch-vm": { "scratch-vm": {
"version": "0.2.0-prerelease.20220601111129", "version": "0.2.0-prerelease.20220602121716",
"resolved": "https://registry.npmjs.org/scratch-vm/-/scratch-vm-0.2.0-prerelease.20220601111129.tgz", "resolved": "https://registry.npmjs.org/scratch-vm/-/scratch-vm-0.2.0-prerelease.20220602121716.tgz",
"integrity": "sha512-NMfIbpvxNwODCU2oWpn+P0FUTbP0Fd1vIsPDOov6sPAFUtdnU6f/I/OPtKO+kKL0Jn+p7i+8GXsDIW3ffsJmbw==", "integrity": "sha512-N7hY2OeMJMybH1GdYwxaj+zu8BUBsiDUCmA0o3UsrVVsKCxcPgHQxJYksWalH1zV3GsWlkXwX6qBarviRmVfbg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@vernier/godirect": "1.5.0", "@vernier/godirect": "1.5.0",
@ -52529,9 +52529,9 @@
}, },
"dependencies": { "dependencies": {
"ansi-regex": { "ansi-regex": {
"version": "3.0.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true "dev": true
}, },
"strip-ansi": { "strip-ansi": {
@ -52583,9 +52583,9 @@
}, },
"dependencies": { "dependencies": {
"ansi-regex": { "ansi-regex": {
"version": "3.0.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true "dev": true
}, },
"strip-ansi": { "strip-ansi": {

View file

@ -63,7 +63,7 @@
"@formatjs/intl-locale": "2.4.34", "@formatjs/intl-locale": "2.4.34",
"@formatjs/intl-pluralrules": "4.1.0", "@formatjs/intl-pluralrules": "4.1.0",
"@formatjs/intl-relativetimeformat": "8.1.8", "@formatjs/intl-relativetimeformat": "8.1.8",
"async": "3.1.0", "async": "3.2.2",
"autoprefixer": "10.4.2", "autoprefixer": "10.4.2",
"babel-cli": "6.26.0", "babel-cli": "6.26.0",
"babel-core": "6.26.3", "babel-core": "6.26.3",
@ -134,8 +134,8 @@
"regenerator-runtime": "0.13.9", "regenerator-runtime": "0.13.9",
"sass": "1.49.7", "sass": "1.49.7",
"sass-loader": "10.2.1", "sass-loader": "10.2.1",
"scratch-gui": "0.1.0-prerelease.20220601144935", "scratch-gui": "0.1.0-prerelease.20220605140952",
"scratch-l10n": "3.14.20220601031612", "scratch-l10n": "3.14.20220605031627",
"selenium-webdriver": "4.1.0", "selenium-webdriver": "4.1.0",
"slick-carousel": "1.6.0", "slick-carousel": "1.6.0",
"style-loader": "0.12.3", "style-loader": "0.12.3",

View file

@ -43,6 +43,10 @@
border-radius: 4px; border-radius: 4px;
width: 32px; width: 32px;
height: 32px; height: 32px;
display: block;
overflow: hidden;
text-indent: 100%;
white-space: nowrap;
} }
} }

View file

@ -11,9 +11,19 @@ class Storage extends ScratchStorage {
super(); super();
this.addWebSource( this.addWebSource(
[this.AssetType.Project], [this.AssetType.Project],
projectAsset => `${PROJECT_HOST}/${projectAsset.assetId}` this.getProjectGetConfig.bind(this)
); );
} }
setProjectToken (projectToken) {
this.projectToken = projectToken;
}
getProjectGetConfig (projectAsset) {
const path = `${PROJECT_HOST}/${projectAsset.assetId}`;
const qs = this.projectToken ? `?token=${this.projectToken}` : '';
return path + qs;
}
} }
const storage = new Storage(); const storage = new Storage();

View file

@ -73,6 +73,7 @@
.comment { .comment {
position: relative; position: relative;
width: 100%; width: 100%;
flex-direction: row;
flex-wrap: nowrap; flex-wrap: nowrap;
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: flex-start;
@ -98,6 +99,7 @@
.comment-top-row { .comment-top-row {
margin-bottom: 8px; margin-bottom: 8px;
width: 100%; width: 100%;
flex-direction: row;
.username { .username {
margin-right: auto; margin-right: auto;
@ -237,6 +239,7 @@
.comment-bottom-row { .comment-bottom-row {
padding-top: 1rem; padding-top: 1rem;
font-size: .75rem; font-size: .75rem;
flex-direction: row;
justify-content: space-between; justify-content: space-between;
.comment-time { .comment-time {
@ -265,6 +268,11 @@
.replies { .replies {
width: calc(100% - 4rem); width: calc(100% - 4rem);
.comment-reply-row {
margin-left: -3.5rem;
width: calc(100% + 3.5rem);
}
} }
.replies.collapsed > .comment:last-of-type { .replies.collapsed > .comment:last-of-type {
@ -303,7 +311,7 @@
margin-top: 2rem; margin-top: 2rem;
margin-bottom: .5rem; margin-bottom: .5rem;
margin-left: .5rem; margin-left: .5rem;
width: 100%; width: calc(100% - 0.5rem);
} }
.expand-thread { .expand-thread {

View file

@ -40,6 +40,7 @@ class EmbedView extends React.Component {
); );
} }
if (this.props.projectInfo && this.props.projectInfo.project_token){
return ( return (
<React.Fragment> <React.Fragment>
<Meta projectInfo={this.props.projectInfo} /> <Meta projectInfo={this.props.projectInfo} />
@ -50,10 +51,13 @@ class EmbedView extends React.Component {
projectHost={this.props.projectHost} projectHost={this.props.projectHost}
projectId={this.state.projectId} projectId={this.state.projectId}
projectTitle={this.props.projectInfo.title} projectTitle={this.props.projectInfo.title}
projectToken={this.props.projectInfo.project_token}
/> />
</React.Fragment> </React.Fragment>
); );
} }
return null;
}
} }
EmbedView.propTypes = { EmbedView.propTypes = {

View file

@ -359,6 +359,7 @@ const PreviewPresentation = ({
isFullScreen={isFullScreen} isFullScreen={isFullScreen}
previewInfoVisible="false" previewInfoVisible="false"
projectHost={projectHost} projectHost={projectHost}
projectToken={projectInfo.project_token}
projectId={projectId} projectId={projectId}
onGreenFlag={onGreenFlag} onGreenFlag={onGreenFlag}
onProjectLoaded={onProjectLoaded} onProjectLoaded={onProjectLoaded}

View file

@ -235,10 +235,6 @@ $stage-width: 480px;
width: 100%; width: 100%;
} }
.comment, .comment-top-row, .comment-bottom-row {
flex-direction: row;
}
.comment-bubble { .comment-bubble {
text-align: left; text-align: left;
} }

View file

@ -142,7 +142,6 @@ class Preview extends React.Component {
this.props.sessionStatus === sessionActions.Status.FETCHED) || this.props.sessionStatus === sessionActions.Status.FETCHED) ||
(this.state.projectId !== prevState.projectId))) { (this.state.projectId !== prevState.projectId))) {
this.fetchCommunityData(); this.fetchCommunityData();
this.getProjectData(this.state.projectId, true /* Show cloud/username alerts */);
if (this.state.justShared) { if (this.state.justShared) {
this.setState({ // eslint-disable-line react/no-did-update-set-state this.setState({ // eslint-disable-line react/no-did-update-set-state
justShared: false justShared: false
@ -158,6 +157,10 @@ class Preview extends React.Component {
}); });
} }
} }
if (this.props.projectInfo.id !== prevProps.projectInfo.id) {
storage.setProjectToken(this.props.projectInfo.project_token);
this.loadProjectData(this.state.projectId, true /* Show cloud/username alerts */);
}
if (this.props.projectInfo.id !== prevProps.projectInfo.id) { if (this.props.projectInfo.id !== prevProps.projectInfo.id) {
if (typeof this.props.projectInfo.id === 'undefined') { if (typeof this.props.projectInfo.id === 'undefined') {
this.initCounts(0, 0); this.initCounts(0, 0);
@ -196,7 +199,8 @@ class Preview extends React.Component {
// Switching out of editor mode, refresh data that comes from project json // Switching out of editor mode, refresh data that comes from project json
if (this.props.playerMode && !prevProps.playerMode) { if (this.props.playerMode && !prevProps.playerMode) {
this.getProjectData( storage.setProjectToken(this.props.projectInfo.project_token);
this.loadProjectData(
this.state.projectId, this.state.projectId,
false // Do not show cloud/username alerts again false // Do not show cloud/username alerts again
); );
@ -323,7 +327,7 @@ class Preview extends React.Component {
} }
} }
} }
getProjectData (projectId, showAlerts) { loadProjectData (projectId, showAlerts) {
if (projectId <= 0) return 0; if (projectId <= 0) return 0;
storage storage
.load(storage.AssetType.Project, projectId, storage.DataFormat.JSON) .load(storage.AssetType.Project, projectId, storage.DataFormat.JSON)
@ -713,6 +717,11 @@ class Preview extends React.Component {
); );
} }
render () { render () {
// Only show GUI if the project has no id, is a loaded local project, or has the project token loaded
const showGUI = (!this.state.projectId || this.state.projectId === '0' || this.state.isProjectLoaded ||
(this.props.projectInfo && this.props.projectInfo.project_token));
if (this.props.projectNotAvailable || this.state.invalidProject) { if (this.props.projectNotAvailable || this.state.invalidProject) {
return ( return (
<Page> <Page>
@ -829,6 +838,7 @@ class Preview extends React.Component {
/> />
</Page> : </Page> :
<React.Fragment> <React.Fragment>
{showGUI && (
<IntlGUI <IntlGUI
assetHost={this.props.assetHost} assetHost={this.props.assetHost}
authorId={this.props.authorId} authorId={this.props.authorId}
@ -849,6 +859,7 @@ class Preview extends React.Component {
hasCloudPermission={this.props.isScratcher} hasCloudPermission={this.props.isScratcher}
isShared={this.props.isShared} isShared={this.props.isShared}
projectHost={this.props.projectHost} projectHost={this.props.projectHost}
projectToken={this.props.projectInfo.project_token}
projectId={this.state.projectId} projectId={this.state.projectId}
projectTitle={this.props.projectInfo.title} projectTitle={this.props.projectInfo.title}
renderLogin={this.renderLogin} renderLogin={this.renderLogin}
@ -866,6 +877,7 @@ class Preview extends React.Component {
onUpdateProjectThumbnail={this.props.handleUpdateProjectThumbnail} onUpdateProjectThumbnail={this.props.handleUpdateProjectThumbnail}
onUpdateProjectTitle={this.handleUpdateProjectTitle} onUpdateProjectTitle={this.handleUpdateProjectTitle}
/> />
)}
{this.props.registrationOpen && ( {this.props.registrationOpen && (
this.props.useScratch3Registration ? ( this.props.useScratch3Registration ? (
<Scratch3Registration <Scratch3Registration

View file

@ -31,5 +31,6 @@ export const projectShape = shape({
remix: shape({ remix: shape({
parent: number, parent: number,
root: number root: number
}) }),
project_token: string
}); });

View file

@ -39,6 +39,8 @@ let ownedUnsharedScratch2Url = rootUrl + '/projects/' + ownedUnsharedScratch2ID;
let username = process.env.SMOKE_USERNAME + '6'; let username = process.env.SMOKE_USERNAME + '6';
let password = process.env.SMOKE_PASSWORD; let password = process.env.SMOKE_PASSWORD;
const remote = process.env.SMOKE_REMOTE || false;
jest.setTimeout(60000); jest.setTimeout(60000);
let driver; let driver;
@ -189,6 +191,14 @@ describe('www-integration project-creation signed in', () => {
await driver.sleep(1000); await driver.sleep(1000);
await signIn(username, password); await signIn(username, password);
await findByXpath('//span[contains(@class, "profile-name")]'); await findByXpath('//span[contains(@class, "profile-name")]');
// SauceLabs doesn't have access to the sb3 used in 'load project from file' test
// https://support.saucelabs.com/hc/en-us/articles/115003685593-Uploading-Files-to-a-Sauce-Labs-Virtual-Machine-during-a-Test
if (remote) {
await driver.get('https://github.com/LLK/scratch-www/blob/develop/test/fixtures/project1.sb3');
await clickText('Download');
await driver.sleep(3000);
}
}); });
beforeEach(async () => { beforeEach(async () => {
@ -197,26 +207,6 @@ describe('www-integration project-creation signed in', () => {
afterAll(async () => await driver.quit()); afterAll(async () => await driver.quit());
test.skip('load project from file', async () => {
await clickXpath('//li[@class="link create"]');
let gf = await findByXpath('//img[@class="green-flag_green-flag_1kiAo"]');
await gf.isDisplayed();
await clickText('File');
await clickText('Load from your computer');
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');
await input.sendKeys(path.resolve(__dirname, '../fixtures/project1.sb3'));
await driver.sleep(200);
let alert = await driver.switchTo().alert();
await alert.accept();
let spriteTile = await findText('project1-sprite');
let spriteTileVisible = await spriteTile.isDisplayed();
await expect(spriteTileVisible).toBe(true);
await driver.sleep(1000);
let infoArea = await findByXpath('//div[@class="sprite-info_sprite-info_3EyZh box_box_2jjDp"]');
let areaVisible = await infoArea.isDisplayed();
await expect(areaVisible).toBe(true);
});
test('make a copy of a project', async () => { test('make a copy of a project', async () => {
await driver.get(ownedUnsharedUrl + '/editor'); await driver.get(ownedUnsharedUrl + '/editor');
let gf = await findByXpath('//img[@class="green-flag_green-flag_1kiAo"]'); let gf = await findByXpath('//img[@class="green-flag_green-flag_1kiAo"]');
@ -245,4 +235,36 @@ describe('www-integration project-creation signed in', () => {
let areaVisible = await infoArea.isDisplayed(); let areaVisible = await infoArea.isDisplayed();
await expect(areaVisible).toBe(true); await expect(areaVisible).toBe(true);
}); });
test('load project from file', async () => {
// if remote, projectPath is Saucelabs path to downloaded file
const projectPath = remote ?
'/Users/chef/Downloads/project1.sb3' :
path.resolve(__dirname, '../fixtures/project1.sb3');
// upload file
await clickXpath('//li[@class="link create"]');
let gf = await findByXpath('//img[@class="green-flag_green-flag_1kiAo"]');
await gf.isDisplayed();
await clickText('File');
await clickText('Load from your computer');
await driver.sleep(1000);
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');
await input.sendKeys(projectPath);
// accept alert
let alert = await driver.switchTo().alert();
await alert.accept();
// check that project is loaded
let spriteTile = await findText('project1-sprite');
let spriteTileVisible = await spriteTile.isDisplayed();
await expect(spriteTileVisible).toBe(true);
// check that gui is still there after some time has passed
await driver.sleep(1000);
let infoArea = await findByXpath('//div[@class="sprite-info_sprite-info_3EyZh box_box_2jjDp"]');
let areaVisible = await infoArea.isDisplayed();
await expect(areaVisible).toBe(true);
});
}); });