From cf886b89836db2f8d4c50672cec46c790869ee64 Mon Sep 17 00:00:00 2001 From: Hayden Hargreaves Date: Thu, 6 Mar 2025 18:53:33 -0700 Subject: [PATCH] FIX: Spinner for the editor content. --- backend/src/server.ts | 2 +- frontend/src/components/ContentLoading.jsx | 20 ++++++++++++++++++++ frontend/src/components/Editor.jsx | 20 ++++++++++++-------- frontend/src/pages/Dashboard.jsx | 14 +++++++++----- 4 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 frontend/src/components/ContentLoading.jsx diff --git a/backend/src/server.ts b/backend/src/server.ts index fbbf948..6255602 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -31,7 +31,7 @@ try { /** * Invalid file extensions for the file editor. */ -const INVALID_EXTS: string[] = ["exe", "dll", "obj", "lib", "bin", "dat", "pdf", "jpg", "jpeg", "png", "gif", "webm", "webp", "bmp", "mp3", "wav", "mp4", "avi", "zip", "rar", "7z", "iso", "dmg", "class", "pyc", "o", "a", "woff", "woff2", "ttf", "otf", "db", "sqlite", "mdb", "accdb", "psd", "ai", "indd", "blend", "fbx", "unitypackage", "pak", "sav", "msi", ".doc", ".docx", ".dot", ".dotx", ".docm", ".dotm", ".rtf", ".txt", ".xls", ".xlsx", ".xlsm", ".xltx", ".xltm", ".csv", ".ppt", ".pptx", ".pptm", ".potx", ".potm", ".ppsx", ".ppsm", ".mdb", ".accdb", ".accde", ".accdt", ".pst", ".ost", ".msg", ".one", ".onetoc2", ".pub", ".vsd", ".vsdx", ".vssx", ".vstx", ".odc", ".oft", ".pki"]; +const INVALID_EXTS: string[] = ["exe", "dll", "obj", "lib", "bin", "dat", "pdf", "jpg", "jpeg", "png", "gif", "webm", "webp", "bmp", "mp3", "wav", "mp4", "avi", "zip", "rar", "7z", "iso", "dmg", "class", "pyc", "o", "a", "woff", "woff2", "ttf", "otf", "db", "sqlite", "mdb", "accdb", "psd", "ai", "indd", "blend", "fbx", "unitypackage", "pak", "sav", "msi", "doc", "docx", "dot", "dotx", "docm", "dotm", "rtf", "txt", "xls", "xlsx", "xlsm", "xltx", "xltm", "csv", "ppt", "pptx", "pptm", "potx", "potm", "ppsx", "ppsm", "mdb", "accdb", "accde", "accdt", "pst", "ost", "msg", "one", "onetoc2", "pub", "vsd", "vsdx", "vssx", "vstx", "odc", "oft", "pki", "odg"]; /** * Configure cors, this should work for both production and development. diff --git a/frontend/src/components/ContentLoading.jsx b/frontend/src/components/ContentLoading.jsx new file mode 100644 index 0000000..494c9a0 --- /dev/null +++ b/frontend/src/components/ContentLoading.jsx @@ -0,0 +1,20 @@ +import "../index.css" + +/** + * Simple loading spinner for the text editor. + * @returns {JSX.Element} + * @constructor + */ +export default function ContentLoading() { + return ( +
+
+
+
+

Content loading...

+
+

For large files, this may take a while.

+
+ ); +}; diff --git a/frontend/src/components/Editor.jsx b/frontend/src/components/Editor.jsx index b611afb..8b65634 100644 --- a/frontend/src/components/Editor.jsx +++ b/frontend/src/components/Editor.jsx @@ -1,6 +1,7 @@ import {useEffect, useRef, useState} from "react"; +import ContentLoading from "./ContentLoading.jsx"; -export default function Editor({content, path, exit, saveExit}) { +export default function Editor({content, path, exit, saveExit, loading}) { const [text, setText] = useState(""); /** * Store a reference to the text area object @@ -54,14 +55,17 @@ export default function Editor({content, path, exit, saveExit}) {

Editing File: {path}

- + }