From 018514af1a08f69bbebb47c122b2d712d1d300ae Mon Sep 17 00:00:00 2001 From: Alexis Date: Fri, 8 Sep 2023 13:50:04 +1000 Subject: [PATCH 1/9] docs: add default stories for IDE components --- .../modules/IDE/components/About.stories.jsx | 8 ++++++ .../IDE/components/AssetPreview.stories.jsx | 13 ++++++++++ .../IDE/components/AssetSize.stories.jsx | 12 +++++++++ .../IDE/components/Console.stories.jsx | 8 ++++++ .../IDE/components/ConsoleInput.stories.jsx | 8 ++++++ .../IDE/components/CopyableInput.stories.jsx | 12 +++++++++ .../IDE/components/EditableInput.stories.jsx | 13 ++++++++++ .../EditorAccessibility.stories.jsx | 19 ++++++++++++++ .../IDE/components/Feedback.stories.jsx | 8 ++++++ .../IDE/components/FileUploader.stories.jsx | 8 ++++++ .../FloatingActionButton.stories.jsx | 8 ++++++ .../KeyboardShortcutModal.stories.jsx | 8 ++++++ .../IDE/components/NewFileForm.stories.jsx | 8 ++++++ .../IDE/components/NewFileModal.stories.jsx | 8 ++++++ .../IDE/components/NewFolderForm.stories.jsx | 8 ++++++ .../IDE/components/NewFolderModal.stories.jsx | 8 ++++++ .../IDE/components/ShareModal.stories.jsx | 8 ++++++ .../IDE/components/SketchList.stories.jsx | 25 +++++++++++++++++++ .../components/UploadFileModal.stories.jsx | 8 ++++++ 19 files changed, 198 insertions(+) create mode 100644 client/modules/IDE/components/About.stories.jsx create mode 100644 client/modules/IDE/components/AssetPreview.stories.jsx create mode 100644 client/modules/IDE/components/AssetSize.stories.jsx create mode 100644 client/modules/IDE/components/Console.stories.jsx create mode 100644 client/modules/IDE/components/ConsoleInput.stories.jsx create mode 100644 client/modules/IDE/components/CopyableInput.stories.jsx create mode 100644 client/modules/IDE/components/EditableInput.stories.jsx create mode 100644 client/modules/IDE/components/EditorAccessibility.stories.jsx create mode 100644 client/modules/IDE/components/Feedback.stories.jsx create mode 100644 client/modules/IDE/components/FileUploader.stories.jsx create mode 100644 client/modules/IDE/components/FloatingActionButton.stories.jsx create mode 100644 client/modules/IDE/components/KeyboardShortcutModal.stories.jsx create mode 100644 client/modules/IDE/components/NewFileForm.stories.jsx create mode 100644 client/modules/IDE/components/NewFileModal.stories.jsx create mode 100644 client/modules/IDE/components/NewFolderForm.stories.jsx create mode 100644 client/modules/IDE/components/NewFolderModal.stories.jsx create mode 100644 client/modules/IDE/components/ShareModal.stories.jsx create mode 100644 client/modules/IDE/components/SketchList.stories.jsx create mode 100644 client/modules/IDE/components/UploadFileModal.stories.jsx diff --git a/client/modules/IDE/components/About.stories.jsx b/client/modules/IDE/components/About.stories.jsx new file mode 100644 index 0000000000..97289f9bc8 --- /dev/null +++ b/client/modules/IDE/components/About.stories.jsx @@ -0,0 +1,8 @@ +import About from './About'; + +export default { + title: 'IDE/About', + component: About +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/AssetPreview.stories.jsx b/client/modules/IDE/components/AssetPreview.stories.jsx new file mode 100644 index 0000000000..c2e1bf4fbe --- /dev/null +++ b/client/modules/IDE/components/AssetPreview.stories.jsx @@ -0,0 +1,13 @@ +import AssetPreview from './AssetPreview'; + +export default { + title: 'IDE/AssetPreview', + component: AssetPreview +}; + +export const Default = { + args: { + url: 'https://p5js.org/assets/img/p5js.svg', + name: 'P5 Logo' + } +}; diff --git a/client/modules/IDE/components/AssetSize.stories.jsx b/client/modules/IDE/components/AssetSize.stories.jsx new file mode 100644 index 0000000000..958365ab0c --- /dev/null +++ b/client/modules/IDE/components/AssetSize.stories.jsx @@ -0,0 +1,12 @@ +import AssetSize from './AssetSize'; + +export default { + title: 'IDE/AssetSize', + component: AssetSize +}; + +export const Default = { + args: { + totalSize: 123 + } +}; diff --git a/client/modules/IDE/components/Console.stories.jsx b/client/modules/IDE/components/Console.stories.jsx new file mode 100644 index 0000000000..40bbb0631e --- /dev/null +++ b/client/modules/IDE/components/Console.stories.jsx @@ -0,0 +1,8 @@ +import Console from './Console'; + +export default { + title: 'IDE/Console', + component: Console +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/ConsoleInput.stories.jsx b/client/modules/IDE/components/ConsoleInput.stories.jsx new file mode 100644 index 0000000000..daf3d88d83 --- /dev/null +++ b/client/modules/IDE/components/ConsoleInput.stories.jsx @@ -0,0 +1,8 @@ +import ConsoleInput from './ConsoleInput'; + +export default { + title: 'IDE/ConsoleInput', + component: ConsoleInput +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/CopyableInput.stories.jsx b/client/modules/IDE/components/CopyableInput.stories.jsx new file mode 100644 index 0000000000..f4a6258cb2 --- /dev/null +++ b/client/modules/IDE/components/CopyableInput.stories.jsx @@ -0,0 +1,12 @@ +import CopyableInput from './CopyableInput'; + +export default { + title: 'IDE/CopyableInput', + component: CopyableInput +}; + +export const Default = { + args: { + value: 'Lorem Ipsum' + } +}; diff --git a/client/modules/IDE/components/EditableInput.stories.jsx b/client/modules/IDE/components/EditableInput.stories.jsx new file mode 100644 index 0000000000..a3cf638b61 --- /dev/null +++ b/client/modules/IDE/components/EditableInput.stories.jsx @@ -0,0 +1,13 @@ +import EditableInput from './EditableInput'; + +export default { + title: 'IDE/EditableInput', + component: EditableInput +}; + +export const Default = { + args: { + value: 'an@email.com', + label: 'Example' + } +}; diff --git a/client/modules/IDE/components/EditorAccessibility.stories.jsx b/client/modules/IDE/components/EditorAccessibility.stories.jsx new file mode 100644 index 0000000000..577add5cca --- /dev/null +++ b/client/modules/IDE/components/EditorAccessibility.stories.jsx @@ -0,0 +1,19 @@ +import EditorAccessibility from './EditorAccessibility'; + +export default { + title: 'IDE/EditorAccessibility', + component: EditorAccessibility +}; + +export const Default = { + args: { + lintMessages: [ + { + severity: 'warn', + line: '10', + message: 'Warning Foo', + id: '123' + } + ] + } +}; diff --git a/client/modules/IDE/components/Feedback.stories.jsx b/client/modules/IDE/components/Feedback.stories.jsx new file mode 100644 index 0000000000..f8267e193d --- /dev/null +++ b/client/modules/IDE/components/Feedback.stories.jsx @@ -0,0 +1,8 @@ +import Feedback from './Feedback'; + +export default { + title: 'IDE/Feedback', + component: Feedback +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/FileUploader.stories.jsx b/client/modules/IDE/components/FileUploader.stories.jsx new file mode 100644 index 0000000000..ed3097f000 --- /dev/null +++ b/client/modules/IDE/components/FileUploader.stories.jsx @@ -0,0 +1,8 @@ +import FileUploader from './FileUploader'; + +export default { + title: 'IDE/FileUploader', + component: FileUploader +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/FloatingActionButton.stories.jsx b/client/modules/IDE/components/FloatingActionButton.stories.jsx new file mode 100644 index 0000000000..d80247a0d9 --- /dev/null +++ b/client/modules/IDE/components/FloatingActionButton.stories.jsx @@ -0,0 +1,8 @@ +import FloatingActionButton from './FloatingActionButton'; + +export default { + title: 'IDE/FloatingActionButton', + component: FloatingActionButton +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/KeyboardShortcutModal.stories.jsx b/client/modules/IDE/components/KeyboardShortcutModal.stories.jsx new file mode 100644 index 0000000000..393e356d65 --- /dev/null +++ b/client/modules/IDE/components/KeyboardShortcutModal.stories.jsx @@ -0,0 +1,8 @@ +import KeyboardShortcutModal from './KeyboardShortcutModal'; + +export default { + title: 'IDE/KeyboardShortcutModal', + component: KeyboardShortcutModal +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/NewFileForm.stories.jsx b/client/modules/IDE/components/NewFileForm.stories.jsx new file mode 100644 index 0000000000..0c47ddf669 --- /dev/null +++ b/client/modules/IDE/components/NewFileForm.stories.jsx @@ -0,0 +1,8 @@ +import NewFileForm from './NewFileForm'; + +export default { + title: 'IDE/NewFileForm', + component: NewFileForm +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/NewFileModal.stories.jsx b/client/modules/IDE/components/NewFileModal.stories.jsx new file mode 100644 index 0000000000..84e7bdc15b --- /dev/null +++ b/client/modules/IDE/components/NewFileModal.stories.jsx @@ -0,0 +1,8 @@ +import NewFileModal from './NewFileModal'; + +export default { + title: 'IDE/NewFileModal', + component: NewFileModal +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/NewFolderForm.stories.jsx b/client/modules/IDE/components/NewFolderForm.stories.jsx new file mode 100644 index 0000000000..0a05116bb1 --- /dev/null +++ b/client/modules/IDE/components/NewFolderForm.stories.jsx @@ -0,0 +1,8 @@ +import NewFolderForm from './NewFolderForm'; + +export default { + title: 'IDE/NewFolderForm', + component: NewFolderForm +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/NewFolderModal.stories.jsx b/client/modules/IDE/components/NewFolderModal.stories.jsx new file mode 100644 index 0000000000..36db3e45bd --- /dev/null +++ b/client/modules/IDE/components/NewFolderModal.stories.jsx @@ -0,0 +1,8 @@ +import NewFolderModal from './NewFolderModal'; + +export default { + title: 'IDE/NewFolderModal', + component: NewFolderModal +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/ShareModal.stories.jsx b/client/modules/IDE/components/ShareModal.stories.jsx new file mode 100644 index 0000000000..37bf731b90 --- /dev/null +++ b/client/modules/IDE/components/ShareModal.stories.jsx @@ -0,0 +1,8 @@ +import ShareModal from './ShareModal'; + +export default { + title: 'IDE/ShareModal', + component: ShareModal +}; + +export const Default = {}; diff --git a/client/modules/IDE/components/SketchList.stories.jsx b/client/modules/IDE/components/SketchList.stories.jsx new file mode 100644 index 0000000000..58971fefd9 --- /dev/null +++ b/client/modules/IDE/components/SketchList.stories.jsx @@ -0,0 +1,25 @@ +import SketchList from './SketchList'; + +export default { + title: 'IDE/SketchList', + component: SketchList +}; + +export const Default = { + args: { + user: { + username: 'Joe Blogs', + authenticated: true + }, + username: 'Joe Blogs', + loading: false, + sketches: [ + { + id: '1', + name: 'Play Sketch', + createdAt: Date.now().toString(), + updatedAt: Date.now().toString() + } + ] + } +}; diff --git a/client/modules/IDE/components/UploadFileModal.stories.jsx b/client/modules/IDE/components/UploadFileModal.stories.jsx new file mode 100644 index 0000000000..187c292c11 --- /dev/null +++ b/client/modules/IDE/components/UploadFileModal.stories.jsx @@ -0,0 +1,8 @@ +import UploadFileModal from './UploadFileModal'; + +export default { + title: 'IDE/UploadFileModal', + component: UploadFileModal +}; + +export const Default = {}; From 994636bc6976d9c0e15c547e870f795185916a31 Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 19 Sep 2023 01:38:09 +1000 Subject: [PATCH 2/9] docs: remove unnecessary story --- .../EditorAccessibility.stories.jsx | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 client/modules/IDE/components/EditorAccessibility.stories.jsx diff --git a/client/modules/IDE/components/EditorAccessibility.stories.jsx b/client/modules/IDE/components/EditorAccessibility.stories.jsx deleted file mode 100644 index 577add5cca..0000000000 --- a/client/modules/IDE/components/EditorAccessibility.stories.jsx +++ /dev/null @@ -1,19 +0,0 @@ -import EditorAccessibility from './EditorAccessibility'; - -export default { - title: 'IDE/EditorAccessibility', - component: EditorAccessibility -}; - -export const Default = { - args: { - lintMessages: [ - { - severity: 'warn', - line: '10', - message: 'Warning Foo', - id: '123' - } - ] - } -}; From 0a016b7f7d072b5624c40dc49477fc183917762f Mon Sep 17 00:00:00 2001 From: rajatmohan22 Date: Sat, 23 Sep 2023 20:07:25 +0530 Subject: [PATCH 3/9] delete session after logout --- server/controllers/session.controller.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/controllers/session.controller.js b/server/controllers/session.controller.js index 29b7f1be3f..df014c460b 100644 --- a/server/controllers/session.controller.js +++ b/server/controllers/session.controller.js @@ -31,11 +31,19 @@ export function getSession(req, res) { } export function destroySession(req, res, next) { - req.logout((err) => { + req.session.destroy((err) => { if (err) { next(err); return; } - res.json({ success: true }); + req.logout((err) => { + if (err) { + next(err); + return; + } + + res.json({ success: true }); + res.redirect('/login'); + }); }); } From 88cbe22780d36a485a653b5f66664e4dee7aad4e Mon Sep 17 00:00:00 2001 From: rajatmohan22 Date: Sun, 24 Sep 2023 01:42:50 +0530 Subject: [PATCH 4/9] remove res.redirect && rename err --- server/controllers/session.controller.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/controllers/session.controller.js b/server/controllers/session.controller.js index df014c460b..458e17def1 100644 --- a/server/controllers/session.controller.js +++ b/server/controllers/session.controller.js @@ -36,14 +36,12 @@ export function destroySession(req, res, next) { next(err); return; } - req.logout((err) => { - if (err) { - next(err); + req.logout((error) => { + if (error) { + next(error); return; } - res.json({ success: true }); - res.redirect('/login'); }); }); } From cdc2676777cbc0a711f7fc198ac6d634527e2e33 Mon Sep 17 00:00:00 2001 From: raclim <43053081+raclim@users.noreply.github.com> Date: Tue, 31 Oct 2023 10:11:11 -0400 Subject: [PATCH 5/9] Revert "fixes of the issue window.p5._report is not defined" --- client/modules/Preview/EmbedFrame.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/modules/Preview/EmbedFrame.jsx b/client/modules/Preview/EmbedFrame.jsx index e445fc152d..43f229fa2d 100644 --- a/client/modules/Preview/EmbedFrame.jsx +++ b/client/modules/Preview/EmbedFrame.jsx @@ -252,7 +252,7 @@ function injectLocalFiles(files, htmlFile, options) { 'PREVIEW_SCRIPTS_URL' )}`; previewScripts.setAttribute('crossorigin', ''); - sketchDoc.body.appendChild(previewScripts); + sketchDoc.head.appendChild(previewScripts); const sketchDocString = `\n${sketchDoc.documentElement.outerHTML}`; scriptOffs = getAllScriptOffsets(sketchDocString); From 95cfad52716814c670cb0f8069fbb349eb348a4f Mon Sep 17 00:00:00 2001 From: Rachel Lim Date: Tue, 31 Oct 2023 10:40:44 -0400 Subject: [PATCH 6/9] 2.9.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6bd70dc0fe..ce124adb9b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "p5.js-web-editor", - "version": "2.9.0", + "version": "2.9.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "p5.js-web-editor", - "version": "2.9.0", + "version": "2.9.1", "license": "LGPL-2.1", "dependencies": { "@auth0/s3": "^1.0.0", diff --git a/package.json b/package.json index fa6862731b..9c6aaabcff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p5.js-web-editor", - "version": "2.9.0", + "version": "2.9.1", "description": "The web editor for p5.js.", "scripts": { "clean": "rimraf dist", From 5829c3ff0d60f80d5d0fb8d91b9b5e10f8e0a937 Mon Sep 17 00:00:00 2001 From: Akhilbisht798 Date: Tue, 31 Oct 2023 21:38:03 +0530 Subject: [PATCH 7/9] fix: displays random sketch name on reload --- client/modules/IDE/components/EditableInput.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/modules/IDE/components/EditableInput.jsx b/client/modules/IDE/components/EditableInput.jsx index 405cc61920..9f951d1de4 100644 --- a/client/modules/IDE/components/EditableInput.jsx +++ b/client/modules/IDE/components/EditableInput.jsx @@ -31,6 +31,9 @@ function EditableInput({ inputRef.current?.focus(); } }, [isEditing]); + React.useEffect(() => { + setCurrentValue(value); + }, [value]); function beginEditing() { setIsEditing(true); From 1deeac35c1fae83cfeaa3bb82c0fd99bdbb21a39 Mon Sep 17 00:00:00 2001 From: raclim <43053081+raclim@users.noreply.github.com> Date: Fri, 3 Nov 2023 10:12:39 -0400 Subject: [PATCH 8/9] Revert "Fix: Logout Glitch" --- server/controllers/session.controller.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/server/controllers/session.controller.js b/server/controllers/session.controller.js index 458e17def1..29b7f1be3f 100644 --- a/server/controllers/session.controller.js +++ b/server/controllers/session.controller.js @@ -31,17 +31,11 @@ export function getSession(req, res) { } export function destroySession(req, res, next) { - req.session.destroy((err) => { + req.logout((err) => { if (err) { next(err); return; } - req.logout((error) => { - if (error) { - next(error); - return; - } - res.json({ success: true }); - }); + res.json({ success: true }); }); } From d32f3dc0c86a55f99b3b0676e2edb0eb568bb24a Mon Sep 17 00:00:00 2001 From: Rachel Lim Date: Fri, 3 Nov 2023 11:04:53 -0400 Subject: [PATCH 9/9] 2.9.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index ce124adb9b..4297d2d114 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "p5.js-web-editor", - "version": "2.9.1", + "version": "2.9.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "p5.js-web-editor", - "version": "2.9.1", + "version": "2.9.2", "license": "LGPL-2.1", "dependencies": { "@auth0/s3": "^1.0.0", diff --git a/package.json b/package.json index 9c6aaabcff..6f43829a0b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p5.js-web-editor", - "version": "2.9.1", + "version": "2.9.2", "description": "The web editor for p5.js.", "scripts": { "clean": "rimraf dist",