From 9de628e9e8f1b6b62169b77fe505c5cc05edde1e Mon Sep 17 00:00:00 2001 From: hzrd149 Date: Wed, 21 Feb 2024 07:44:56 +0000 Subject: [PATCH] rename packs to drives fix bugs --- src/App.svelte | 21 ++++++--- src/components/FileCard.svelte | 6 ++- ...wPackModal.svelte => NewDriveModal.svelte} | 4 +- src/components/NewFolderModal.svelte | 10 ++--- src/components/SpeedDialMenu.svelte | 27 ++++++------ src/components/TopNav.svelte | 14 +----- src/components/UploadFileModal.svelte | 34 +++++++------- src/helpers/drives.ts | 9 ++++ src/helpers/packs.ts | 10 ----- src/helpers/tree.ts | 6 +-- src/pages/{Pack.svelte => Drive.svelte} | 44 +++++++++---------- src/pages/Home.svelte | 27 ++++-------- src/services/{packs.ts => drives.ts} | 8 ++-- src/services/ndk.ts | 15 ++++++- 14 files changed, 120 insertions(+), 115 deletions(-) rename src/components/{NewPackModal.svelte => NewDriveModal.svelte} (89%) create mode 100644 src/helpers/drives.ts delete mode 100644 src/helpers/packs.ts rename src/pages/{Pack.svelte => Drive.svelte} (86%) rename src/services/{packs.ts => drives.ts} (77%) diff --git a/src/App.svelte b/src/App.svelte index 54a4a4e..2c236c0 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -3,27 +3,38 @@ import NotFound from "./pages/404.svelte"; import Home from "./pages/Home.svelte"; import TopNav from "./components/TopNav.svelte"; - import { activeUser } from "./services/ndk"; + import { activeUser, loginWithExtension } from "./services/ndk"; import Servers from "./pages/Servers.svelte"; import Files from "./pages/Files.svelte"; import Misc from "./pages/Misc.svelte"; - import Pack from "./pages/Pack.svelte"; + import Drive from "./pages/Drive.svelte"; + import { Button, Checkbox } from "flowbite-svelte"; + + let remember = localStorage.getItem("auto-login") === "true"; + + $: { + localStorage.setItem("auto-login", remember ? "true" : "false"); + } const routes = { "/files": Files, "/servers": Servers, "/misc": Misc, - "/pack/:naddr": Pack, + "/drive/:naddr": Drive, "/": Home, "*": NotFound, }; -
{#if $activeUser} + {:else} -

Login first

+
+

🌸 Blossom Drive

+ + Stay logged in +
{/if}
diff --git a/src/components/FileCard.svelte b/src/components/FileCard.svelte index 1fe647a..c93bc25 100644 --- a/src/components/FileCard.svelte +++ b/src/components/FileCard.svelte @@ -15,6 +15,10 @@ ? "border border-primary-200 dark:border-primary-700" : "border border-gray-200 dark:border-gray-700"; + $: link = $servers[0] + ? new URL(file.hash + (file.mimeType ? "." + mime.getExtension(file.mimeType) : ""), $servers[0]).toString() + : undefined; + function toggleSelect() { if (selected) dispatch("unselect", file.name); else dispatch("select", file.name); @@ -28,7 +32,7 @@ - +
- +