From 155ffc7c415f64d6bd2d232d32a3565dd54d3f0a Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Sun, 12 Dec 2021 15:16:25 -0700 Subject: [PATCH] add message when no files exist in the folder --- main.js | 4 ++-- scripts/contextmenu/newfolder.js | 2 +- scripts/fileview/load/render.js | 10 ++++++++- styles/files.css | 38 ++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index 3bdcaf6..17417ba 100644 --- a/main.js +++ b/main.js @@ -8,8 +8,8 @@ async function createWindow () { mainWindow = new BrowserWindow({ width: 800, height: 600, - minHeight: 400, - minWidth: 600, + minHeight: 600, + minWidth: 750, webPreferences: { preload: path.join(__dirname, 'scripts/startup/preload.js'), nodeIntegration: true, diff --git a/scripts/contextmenu/newfolder.js b/scripts/contextmenu/newfolder.js index ed568a5..d0981e0 100644 --- a/scripts/contextmenu/newfolder.js +++ b/scripts/contextmenu/newfolder.js @@ -60,7 +60,7 @@ module.exports = () => { "Folder created", [`Folder "${input.value}" created successfully`, `${window.kade.cpath}\\${input.value}`], undefined, false, 5, () => { refresh(`${window.kade.cpath}\\${input.value}`); - require('electron').clipboard.writeText(`${window.kade.cpath}\\${input.value}`); + require('electron').clipboard.writeText(`${window.kade.cpath}`); newToast("Copied!", "The folder's path has been copied to your clipboard.", "#19df46"); } ); diff --git a/scripts/fileview/load/render.js b/scripts/fileview/load/render.js index 1f087bd..b0af687 100644 --- a/scripts/fileview/load/render.js +++ b/scripts/fileview/load/render.js @@ -6,10 +6,10 @@ module.exports = (dir, options) => { const refresh = require("../refresh"); let cdir = dir || window.kade.cdir; + const exp = document.getElementById('files'); let num = 0; for (let i = 0; i < cdir.length; i++) { let file = cdir[i]; - const exp = document.getElementById('files'); let cfc = document.createElement("div"); cfc.className = 'file'; if (options.animate) {cfc.classList.add('rise');} @@ -74,4 +74,12 @@ module.exports = (dir, options) => { window.scrollTo(0, window.kade.scrollY); window.kade.scrollY = 0; } + + if (!cdir.length) { + let nts = document.createElement('p'); + nts.id = 'nothing-to-show'; + nts.innerHTML = "There's nothing to show here!
But you can look at this really pretty box :)

The folder is empty, or I don't have the permissions to show you your files."; + nts.className = 'nosel'; + exp.appendChild(nts); + } }; \ No newline at end of file diff --git a/styles/files.css b/styles/files.css index a3806f8..8ad5053 100644 --- a/styles/files.css +++ b/styles/files.css @@ -98,4 +98,42 @@ padding: 0 0; width: 27%; height: 100%; +} + +#nothing-to-show { + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + text-align: center; + color: #afafaf; + font-family: 'Montserrat', sans-serif; + font-size: 24px; + padding: 15px; + --angle: 0deg; + border: 4px solid; + border-image: linear-gradient(var(--angle), rgb(92, 18, 72) 20%, rgb(60, 62, 131) 60%, rgb(92, 18, 72) 100%) 1; + animation: 10s rotate linear infinite, moving-stripes 10s linear infinite; + background-image: repeating-linear-gradient(-45deg, #a172a64f, #afafaf19 30px); + background-size: 200%; +} + +@media only screen and (max-width: 900px) { + #nothing-to-show {font-size: 16px;} +} + +@keyframes rotate { + to { + --angle: 360deg; + } +} + +@keyframes moving-stripes { + 100% {background-position: 100% 100%;} +} + +@property --angle { + syntax: ''; + initial-value: 0deg; + inherits: false; } \ No newline at end of file