Add path to bookmarks, add logout button
This commit is contained in:
@@ -4,8 +4,9 @@ import { copy_text } from "util/Util.svelte";
|
||||
import FileStats from "./FileStats.svelte";
|
||||
import type { FSNavigator } from "./FSNavigator";
|
||||
import EditWindow from "./edit_window/EditWindow.svelte";
|
||||
import { fs_share_url } from "lib/FilesystemAPI";
|
||||
import { fs_share_url, path_is_shared } from "lib/FilesystemAPI";
|
||||
import ShareDialog from "./ShareDialog.svelte";
|
||||
import { bookmark_add, bookmark_del, bookmarks_store, is_bookmark } from "lib/Bookmarks";
|
||||
|
||||
let dispatch = createEventDispatcher()
|
||||
|
||||
@@ -14,10 +15,9 @@ export let details_visible = false
|
||||
export let edit_window: EditWindow
|
||||
export let edit_visible = false
|
||||
let share_dialog: ShareDialog
|
||||
|
||||
$: share_url = fs_share_url($nav.path)
|
||||
let link_copied = false
|
||||
export const copy_link = () => {
|
||||
const share_url = fs_share_url($nav.path)
|
||||
if (share_url === "") {
|
||||
edit_window.edit(nav.base, true, "share")
|
||||
return
|
||||
@@ -50,7 +50,19 @@ export const copy_link = () => {
|
||||
<span>Download</span>
|
||||
</button>
|
||||
|
||||
{#if share_url !== ""}
|
||||
{#if is_bookmark($bookmarks_store, $nav.base.id)}
|
||||
<button on:click={() => bookmark_del($nav.base.id)}>
|
||||
<i class="icon">bookmark_remove</i>
|
||||
<span>Bookmark</span>
|
||||
</button>
|
||||
{:else}
|
||||
<button on:click={() => bookmark_add($nav.base)}>
|
||||
<i class="icon">bookmark_add</i>
|
||||
<span>Bookmark</span>
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
{#if path_is_shared($nav.path)}
|
||||
<button on:click={copy_link} class:button_highlight={link_copied}>
|
||||
<i class="icon">content_copy</i>
|
||||
<span><u>C</u>opy link</span>
|
||||
@@ -58,7 +70,7 @@ export const copy_link = () => {
|
||||
{/if}
|
||||
|
||||
<!-- Share button is enabled when: The browser has a sharing API, or the user can edit the file (to enable sharing)-->
|
||||
{#if $nav.base.id !== "me" && (navigator.share !== undefined || $nav.permissions.write === true)}
|
||||
{#if navigator.share !== undefined || $nav.permissions.write === true}
|
||||
<button on:click={(e) => share_dialog.open(e, nav.path)}>
|
||||
<i class="icon">share</i>
|
||||
<span>Share</span>
|
||||
|
Reference in New Issue
Block a user