Skip to content

Commit

Permalink
add warning messages
Browse files Browse the repository at this point in the history
  • Loading branch information
hzrd149 committed Feb 23, 2024
1 parent ad6fa82 commit a4eac4d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import Files from "./pages/Files.svelte";
import Misc from "./pages/Misc.svelte";
import Drive from "./pages/Drive.svelte";
import { Button, Checkbox } from "flowbite-svelte";
import { Alert, Button, Checkbox } from "flowbite-svelte";
import { InfoCircleSolid } from "flowbite-svelte-icons";
let remember = localStorage.getItem("auto-login") === "true";
Expand All @@ -35,6 +36,12 @@
{:else}
<div class="flex h-full w-full flex-col items-center gap-4">
<h1 class="text-4xl" style="margin-bottom: 20vh; margin-top: 10vh;">🌸 Blossom Drive</h1>
<Alert color="red">
<InfoCircleSolid slot="icon" class="h-4 w-4" />
<span class="font-medium">Warning!</span>
Everything on blossom is public, don't upload private files
</Alert>

<Button size="xl" on:click={loginWithExtension}>Login with nostr</Button>
<Checkbox bind:checked={remember}>Stay logged in</Checkbox>
</div>
Expand Down
15 changes: 11 additions & 4 deletions src/components/UploadFileModal.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<script lang="ts">
import { Button, Input, Label, Modal, Select, Spinner } from "flowbite-svelte";
import { BlossomClient } from "blossom-client";
import { Alert, Button, Input, Label, Modal, Select, Spinner } from "flowbite-svelte";
import { BlossomClient, type Blob } from "blossom-client";
import { handleEvent, drives } from "../services/drives";
import { NDKEvent } from "@nostr-dev-kit/ndk";
import { getFileTree, parsePath, setFile, setDriveFileTree } from "../helpers/tree";
import { servers } from "../services/servers";
import type { Blob } from "../services/blobs";
import { signEventTemplate } from "../services/ndk";
import { cloneEvent } from "../helpers/event";
import { getDriveName } from "../helpers/drives";
import { InfoCircleSolid } from "flowbite-svelte-icons";
export let open = false;
export let drive: NDKEvent | undefined = undefined;
Expand Down Expand Up @@ -77,6 +77,13 @@
<span>{loading}</span>
</div>
{:else}
{#if $servers.length === 0}
<Alert color="red">
<InfoCircleSolid slot="icon" class="h-4 w-4" />
<span class="font-medium">No Servers!</span>
Go setup some <a href="#/servers" class="underline">servers</a> first before uploading
</Alert>
{/if}
<form class="flex flex-col space-y-4" on:submit={upload}>
<Input type="file" name="file" required on:change={fileChange} />
{#if !drive}
Expand All @@ -93,7 +100,7 @@
><span>Filename</span>
<Input type="text" name="name" required bind:value={name} />
</Label>
<Button type="submit" class="w-full">Upload</Button>
<Button type="submit" class="w-full" disabled={!file || $servers.length === 0}>Upload</Button>
</form>
{/if}
</Modal>

0 comments on commit a4eac4d

Please sign in to comment.