From 349cf5dc43414bd0aaffc7e85a63abadd304c7f9 Mon Sep 17 00:00:00 2001 From: Thomas Gauvin Date: Sun, 25 Feb 2024 17:39:26 -0500 Subject: [PATCH] made folder view not have editor view --- package-lock.json | 10 ++++++ package.json | 1 + .../\342\234\205 Todo list.md" | 10 +++--- src/models/DirectoryNode.ts | 4 +++ src/pages/Editor.tsx | 32 ++++++++++++------- tailwind.config.js | 1 + vite.config.ts | 3 ++ 7 files changed, 46 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6b3319c..36bfcf7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,6 +45,7 @@ "eslint-plugin-react-refresh": "^0.4.5", "postcss": "^8.4.33", "tailwindcss": "^3.4.1", + "tailwindcss-bg-patterns": "^0.3.0", "typescript": "^5.2.2", "vite": "^5.0.8" }, @@ -8638,6 +8639,15 @@ "tailwindcss": ">=3.0.0 || insiders" } }, + "node_modules/tailwindcss-bg-patterns": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/tailwindcss-bg-patterns/-/tailwindcss-bg-patterns-0.3.0.tgz", + "integrity": "sha512-3pXCiu9MPBvfBAEYgrxpNZLZoDlVHdkofpuQ9uhVQ2RT+80BTTweL9s0uIvakfH2LRl4GCG+nncyCB+1aN1gpA==", + "dev": true, + "peerDependencies": { + "tailwindcss": ">2" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", diff --git a/package.json b/package.json index c2546e2..9ea9287 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "eslint-plugin-react-refresh": "^0.4.5", "postcss": "^8.4.33", "tailwindcss": "^3.4.1", + "tailwindcss-bg-patterns": "^0.3.0", "typescript": "^5.2.2", "vite": "^5.0.8" }, diff --git "a/sample-markdown-folder/\342\234\205 Todo list.md" "b/sample-markdown-folder/\342\234\205 Todo list.md" index c853ffa..c4ce226 100644 --- "a/sample-markdown-folder/\342\234\205 Todo list.md" +++ "b/sample-markdown-folder/\342\234\205 Todo list.md" @@ -47,7 +47,7 @@ ### P0 -* The lines for indentation is a bit annoying (styling) ✅ (removed spines) +* The lines for indentation is a bit annoying (styling) (removed spines) ✅ * Add a button to indicate this doesn't work on unsupported browsers ✅ @@ -66,9 +66,9 @@ * Rename files issue causing duplicate selected files ✅ -* Renaming a folder does not update the folder directory +* Renaming a folder does not update the folder directory when in a note within the folder -* Folder view should not have a Editor view, or the Editor view should be functional to rename a folder +* Folder view should not have a Editor view, or the Editor view should be functional to rename a folder ✅ * Easier way to go from title to text. Maybe enter should go to text, or tab. @@ -76,12 +76,14 @@ * Renaming files should not be supported in the file tree viewer, or should but currently isn't working -* Add new folder/new file to tree viewer +* **Add new folder/new file to tree viewer** * Make it so that you can start editing and save later (maybe make it a zip on unsupported devices) * Make it mobile UI responsive +* Make the UI have resizable side bar + ### P1 diff --git a/src/models/DirectoryNode.ts b/src/models/DirectoryNode.ts index d0496fc..b62969e 100644 --- a/src/models/DirectoryNode.ts +++ b/src/models/DirectoryNode.ts @@ -303,6 +303,10 @@ class DirectoryNode { return !!this.directoryHandle; } + isFile(): boolean { + return !this.isDirectory(); + } + //function is markdown isMarkdown(): boolean { return this.name.endsWith(".md"); diff --git a/src/pages/Editor.tsx b/src/pages/Editor.tsx index bb690df..64b02ce 100644 --- a/src/pages/Editor.tsx +++ b/src/pages/Editor.tsx @@ -33,7 +33,7 @@ export const EditorPage: React.FC = () => {
@@ -50,16 +50,26 @@ export const EditorPage: React.FC = () => {
- {selectedFile?.blobUrl ? ( -
- -
- ) : ( - - )} + { + selectedFile?.blobUrl && ( +
+ +
+ ) + } + {/* { + selectedFile && selectedFile.isDirectory() && ( +
test
+ ) + } */} + { + selectedFile && selectedFile.isFile() && ( + + ) + }
diff --git a/tailwind.config.js b/tailwind.config.js index 4f16e55..9f28f57 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -11,6 +11,7 @@ export default { nocompatible: true, preferredStrategy: "pseudoelements", }), + require('tailwindcss-bg-patterns'), ], }; diff --git a/vite.config.ts b/vite.config.ts index 5a33944..205b555 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + build: { //add this property + sourcemap: true, + } })