2026-09-02 00:12:25 +02:00
|
|
|
<script lang="ts" module>
|
|
|
|
|
// Scroll offset per directory path. The file manager is destroyed when a file
|
|
|
|
|
// is opened, so the positions are kept here to survive the remount
|
|
|
|
|
const scroll_positions = new Map<string, number>()
|
|
|
|
|
</script>
|
|
|
|
|
|
2025-03-28 14:16:20 +01:00
|
|
|
<script lang="ts">
|
2026-07-30 17:18:46 +02:00
|
|
|
import { fs_rename, fs_trash, FSNode } from "lib/FilesystemAPI.svelte"
|
2025-03-27 15:38:59 +01:00
|
|
|
import CreateDirectory from "./CreateDirectory.svelte"
|
|
|
|
|
import ListView from "./ListView.svelte"
|
|
|
|
|
import GalleryView from "./GalleryView.svelte"
|
|
|
|
|
import CompactView from "./CompactView.svelte"
|
|
|
|
|
import Button from "layout/Button.svelte";
|
2025-03-28 14:16:20 +01:00
|
|
|
import { formatDate } from "util/Formatting";
|
|
|
|
|
import { drop_target } from "lib/DropTarget"
|
|
|
|
|
import type { FSNavigator } from "filesystem/FSNavigator";
|
|
|
|
|
import FsUploadWidget from "filesystem/upload_widget/FSUploadWidget.svelte";
|
|
|
|
|
import EditWindow from "filesystem/edit_window/EditWindow.svelte";
|
2025-10-13 23:20:42 +02:00
|
|
|
import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
2025-10-09 15:48:23 +02:00
|
|
|
import FileMenu from "./FileMenu.svelte";
|
2025-10-10 00:12:14 +02:00
|
|
|
import { loading_finish, loading_start } from "lib/Loading";
|
2026-04-01 19:38:15 +02:00
|
|
|
import SearchBar from "../SearchBar.svelte";
|
2026-06-10 23:53:03 +02:00
|
|
|
import type { GenericResponse } from "lib/NovaAPI";
|
2026-10-01 11:14:34 +02:00
|
|
|
import { onMount } from "svelte";
|
|
|
|
|
import { toolbar_store } from "wrap/HeaderStore";
|
2020-11-17 23:39:27 +01:00
|
|
|
|
2025-10-13 16:05:50 +02:00
|
|
|
let {
|
|
|
|
|
nav = $bindable(),
|
|
|
|
|
upload_widget,
|
|
|
|
|
edit_window = $bindable(),
|
2026-04-01 19:38:15 +02:00
|
|
|
search_bar = $bindable(),
|
2026-09-02 00:12:25 +02:00
|
|
|
directory_view = $bindable(localStorage.getItem("directory_view") || "list"),
|
2025-10-13 16:05:50 +02:00
|
|
|
children
|
|
|
|
|
}: {
|
|
|
|
|
nav: FSNavigator;
|
|
|
|
|
upload_widget: FsUploadWidget;
|
|
|
|
|
edit_window: EditWindow;
|
2026-04-01 19:38:15 +02:00
|
|
|
search_bar: SearchBar;
|
2025-10-13 16:05:50 +02:00
|
|
|
directory_view?: string;
|
|
|
|
|
children?: import('svelte').Snippet;
|
|
|
|
|
} = $props();
|
|
|
|
|
|
2026-09-02 00:12:25 +02:00
|
|
|
let large_icons = $state(localStorage.getItem("large_icons") === "true")
|
2026-06-10 23:53:03 +02:00
|
|
|
let uploader!: FsUploadWidget
|
2025-10-13 16:05:50 +02:00
|
|
|
let mode = $state("viewing")
|
|
|
|
|
let creating_dir = $state(false)
|
|
|
|
|
let show_hidden = $state(false)
|
2026-06-10 23:53:03 +02:00
|
|
|
let file_menu!: FileMenu
|
2026-09-02 00:12:25 +02:00
|
|
|
$effect(() => {
|
|
|
|
|
window.scrollTo(0, scroll_positions.get($nav.base.path) ?? 0)
|
|
|
|
|
})
|
2022-02-21 21:55:09 +01:00
|
|
|
|
2025-03-28 14:16:20 +01:00
|
|
|
export const upload = (files: File[]) => {
|
2025-10-13 16:05:50 +02:00
|
|
|
return uploader.upload_files(files)
|
2022-02-21 21:55:09 +01:00
|
|
|
}
|
2020-11-17 23:39:27 +01:00
|
|
|
|
2023-11-16 19:05:30 +01:00
|
|
|
// Navigation functions
|
2025-10-13 23:20:42 +02:00
|
|
|
const file_event: FileActionHandler = (action: FileAction, index: number, orig: Event) => {
|
|
|
|
|
orig.preventDefault()
|
|
|
|
|
orig.stopPropagation()
|
2022-02-22 19:53:48 +01:00
|
|
|
|
2025-10-13 23:20:42 +02:00
|
|
|
switch (action) {
|
2025-04-30 13:21:11 +02:00
|
|
|
case FileAction.Click:
|
|
|
|
|
creating_dir = false
|
2020-11-17 23:39:27 +01:00
|
|
|
|
2025-04-30 13:21:11 +02:00
|
|
|
if (mode === "viewing") {
|
2024-08-09 13:02:07 +02:00
|
|
|
nav.navigate(nav.children[index].path, true)
|
2025-04-30 13:21:11 +02:00
|
|
|
} else if (mode === "moving") {
|
|
|
|
|
// If we are moving files we can only enter directories, and only if
|
|
|
|
|
// they're not selected. That last requirement prevents people from
|
|
|
|
|
// moving a directory into itself
|
|
|
|
|
if (nav.children[index].type === "dir" && !nav.children[index].fm_selected) {
|
|
|
|
|
nav.navigate(nav.children[index].path, true)
|
|
|
|
|
}
|
|
|
|
|
} else if (mode === "selecting") {
|
|
|
|
|
select_node(index)
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
case FileAction.Context:
|
|
|
|
|
// If this is a touch event we will select the item
|
|
|
|
|
if (navigator.maxTouchPoints && navigator.maxTouchPoints > 0) {
|
|
|
|
|
select_node(index)
|
2025-10-13 23:20:42 +02:00
|
|
|
} else {
|
2026-01-30 12:26:36 +01:00
|
|
|
file_menu.open(nav.children[index], orig.target, orig)
|
2023-11-16 16:33:35 +01:00
|
|
|
}
|
2025-04-30 13:21:11 +02:00
|
|
|
break
|
|
|
|
|
case FileAction.Edit:
|
|
|
|
|
edit_window.edit(nav.children[index], false, "file")
|
|
|
|
|
break
|
|
|
|
|
case FileAction.Share:
|
|
|
|
|
creating_dir = false
|
|
|
|
|
edit_window.edit(nav.children[index], false, "share")
|
|
|
|
|
break
|
|
|
|
|
case FileAction.Branding:
|
|
|
|
|
edit_window.edit(nav.children[index], false, "branding")
|
|
|
|
|
break
|
|
|
|
|
case FileAction.Select:
|
2023-11-17 13:14:16 +01:00
|
|
|
select_node(index)
|
2025-04-30 13:21:11 +02:00
|
|
|
break
|
2025-10-09 15:48:23 +02:00
|
|
|
case FileAction.Menu:
|
2026-01-30 12:26:36 +01:00
|
|
|
file_menu.open(nav.children[index], orig.target, orig)
|
2025-10-09 15:48:23 +02:00
|
|
|
break
|
2023-11-16 19:05:30 +01:00
|
|
|
}
|
|
|
|
|
}
|
2024-02-16 14:50:34 +01:00
|
|
|
|
2023-05-29 22:15:46 +02:00
|
|
|
const navigate_back = () => {
|
|
|
|
|
creating_dir = false
|
|
|
|
|
history.back()
|
|
|
|
|
}
|
2020-11-17 23:39:27 +01:00
|
|
|
|
2023-11-16 19:05:30 +01:00
|
|
|
// Deletion function
|
|
|
|
|
|
2023-11-16 16:33:35 +01:00
|
|
|
const delete_selected = async () => {
|
|
|
|
|
try {
|
2025-10-10 00:12:14 +02:00
|
|
|
loading_start()
|
|
|
|
|
|
2023-11-16 16:33:35 +01:00
|
|
|
// Save all promises with deletion requests in an array
|
2026-06-10 23:53:03 +02:00
|
|
|
let promises: Promise<GenericResponse>[] = []
|
2024-08-09 13:02:07 +02:00
|
|
|
nav.children.forEach(child => {
|
2024-08-30 15:16:01 +02:00
|
|
|
if (!child.fm_selected) {
|
|
|
|
|
return
|
|
|
|
|
}
|
2026-06-10 23:53:03 +02:00
|
|
|
promises.push(fs_trash(child.path))
|
2023-11-16 16:33:35 +01:00
|
|
|
})
|
2020-11-17 23:39:27 +01:00
|
|
|
|
2023-11-16 16:33:35 +01:00
|
|
|
// Wait for all the promises to finish
|
|
|
|
|
await Promise.all(promises)
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.log(err)
|
|
|
|
|
alert("Delete failed: " + err.message + " ("+err.value+")")
|
|
|
|
|
} finally {
|
|
|
|
|
viewing_mode()
|
2025-10-10 00:12:14 +02:00
|
|
|
loading_finish()
|
2025-11-03 19:15:57 +01:00
|
|
|
await nav.reload()
|
2020-11-17 23:39:27 +01:00
|
|
|
}
|
2023-11-16 16:33:35 +01:00
|
|
|
}
|
2023-11-16 19:05:30 +01:00
|
|
|
|
|
|
|
|
// Mode switches
|
|
|
|
|
|
2023-11-16 16:33:35 +01:00
|
|
|
const selecting_mode = () => {
|
|
|
|
|
mode = "selecting"
|
|
|
|
|
}
|
|
|
|
|
const viewing_mode = () => {
|
|
|
|
|
// Remove any items which we were moving
|
|
|
|
|
moving_items = []
|
2020-11-17 23:39:27 +01:00
|
|
|
|
2020-12-01 23:01:21 +01:00
|
|
|
// Unmark all the selected files and return to viewing mode
|
2024-08-09 13:02:07 +02:00
|
|
|
nav.children.forEach((child, i) => {
|
2023-11-16 16:33:35 +01:00
|
|
|
if (child.fm_selected) {
|
2024-08-09 13:02:07 +02:00
|
|
|
nav.children[i].fm_selected = false
|
2023-11-16 16:33:35 +01:00
|
|
|
}
|
2020-11-17 23:39:27 +01:00
|
|
|
})
|
2020-12-01 23:01:21 +01:00
|
|
|
mode = "viewing"
|
2020-11-17 23:39:27 +01:00
|
|
|
}
|
2023-05-17 15:34:56 +02:00
|
|
|
|
|
|
|
|
const toggle_view = () => {
|
|
|
|
|
if (directory_view === "list") {
|
|
|
|
|
directory_view = "gallery"
|
2025-01-28 12:00:04 +01:00
|
|
|
} else if (directory_view === "gallery") {
|
|
|
|
|
directory_view = "compact"
|
2023-05-17 15:34:56 +02:00
|
|
|
} else {
|
|
|
|
|
directory_view = "list"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
localStorage.setItem("directory_view", directory_view)
|
|
|
|
|
}
|
2023-11-16 19:05:30 +01:00
|
|
|
const toggle_large_icons = () => {
|
|
|
|
|
large_icons = !large_icons
|
2025-03-28 14:16:20 +01:00
|
|
|
localStorage.setItem("large_icons", JSON.stringify(large_icons))
|
2023-11-16 19:05:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Moving functions
|
2023-11-16 16:33:35 +01:00
|
|
|
|
2026-06-10 23:53:03 +02:00
|
|
|
let moving_items: FSNode[] = []
|
2023-11-16 16:33:35 +01:00
|
|
|
|
2023-11-17 13:14:16 +01:00
|
|
|
// We need to detect if shift is pressed so we can select multiple items
|
|
|
|
|
let shift_pressed = false
|
|
|
|
|
let last_selected_node = -1
|
2025-03-28 14:16:20 +01:00
|
|
|
const keypress = (e: KeyboardEvent) => {
|
2025-04-17 16:16:35 +02:00
|
|
|
if (
|
|
|
|
|
(document.activeElement as any).type !== undefined &&
|
|
|
|
|
(document.activeElement as any).type === "text"
|
|
|
|
|
) {
|
|
|
|
|
return // Prevent shortcuts from interfering with input fields
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-17 13:14:16 +01:00
|
|
|
if (e.key === "Shift") {
|
|
|
|
|
shift_pressed = e.type === "keydown"
|
2025-01-28 12:00:04 +01:00
|
|
|
} else if (e.type === "keydown" && e.key === "a" && e.ctrlKey) {
|
|
|
|
|
// CTRL + A selects all files
|
|
|
|
|
selecting_mode()
|
|
|
|
|
for (let i = 0; i < nav.children.length; i++) {
|
|
|
|
|
nav.children[i].fm_selected = true
|
|
|
|
|
}
|
|
|
|
|
e.preventDefault()
|
2025-01-30 00:08:26 +01:00
|
|
|
} else if (e.type === "keydown" && e.key === "Escape" && (mode !== "viewing" || creating_dir)) {
|
2025-01-28 12:00:04 +01:00
|
|
|
// When escape is pressed we return to viewing mode
|
|
|
|
|
viewing_mode()
|
2025-01-30 00:08:26 +01:00
|
|
|
creating_dir = false
|
2025-01-28 12:00:04 +01:00
|
|
|
e.preventDefault()
|
|
|
|
|
e.stopPropagation()
|
2023-11-17 13:14:16 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-28 14:16:20 +01:00
|
|
|
const select_node = (index: number) => {
|
2025-04-30 13:21:11 +02:00
|
|
|
mode = "selecting"
|
2023-11-17 13:14:16 +01:00
|
|
|
if (shift_pressed) {
|
|
|
|
|
// If shift is pressed we do a range select. We select all files between
|
|
|
|
|
// the last selected file and the file that is being selected now
|
|
|
|
|
let id_low = Math.min(last_selected_node, index)
|
|
|
|
|
let id_high = Math.max(last_selected_node, index)
|
|
|
|
|
|
|
|
|
|
for (let i = id_low; i <= id_high; i++) {
|
|
|
|
|
if (i != last_selected_node) {
|
2024-08-09 13:02:07 +02:00
|
|
|
nav.children[i].fm_selected = !nav.children[i].fm_selected
|
2023-11-17 13:14:16 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2024-08-09 13:02:07 +02:00
|
|
|
nav.children[index].fm_selected = !nav.children[index].fm_selected
|
2023-11-17 13:14:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
last_selected_node = index
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-26 14:47:01 +01:00
|
|
|
// When the directory is reloaded we want to keep our selection, so this
|
|
|
|
|
// function watches the children array for changes and updates the selection
|
|
|
|
|
// when it changes
|
|
|
|
|
$effect.pre(() => {
|
2024-08-09 13:02:07 +02:00
|
|
|
creating_dir = false
|
|
|
|
|
|
2023-11-16 16:33:35 +01:00
|
|
|
// Highlight the files which were previously selected
|
2026-02-26 14:47:01 +01:00
|
|
|
for (let i = 0; i < $nav.children.length; i++) {
|
2023-11-16 16:33:35 +01:00
|
|
|
for (let j = 0; j < moving_items.length; j++) {
|
2026-02-26 14:47:01 +01:00
|
|
|
if (moving_items[j].path === $nav.children[i].path) {
|
|
|
|
|
$nav.children[i].fm_selected = true
|
2023-11-16 16:33:35 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-26 14:47:01 +01:00
|
|
|
})
|
2023-11-17 13:14:16 +01:00
|
|
|
|
2025-10-13 16:05:50 +02:00
|
|
|
let moving_files = $state(0)
|
|
|
|
|
let moving_directories = $state(0)
|
2023-11-16 16:33:35 +01:00
|
|
|
const move_start = () => {
|
2023-11-17 13:14:16 +01:00
|
|
|
moving_files = 0
|
|
|
|
|
moving_directories = 0
|
2024-08-09 13:02:07 +02:00
|
|
|
moving_items = nav.children.reduce((acc, child) => {
|
2023-11-16 16:33:35 +01:00
|
|
|
if (child.fm_selected) {
|
2023-11-17 13:14:16 +01:00
|
|
|
if (child.type === "file") {
|
|
|
|
|
moving_files++
|
|
|
|
|
} else if (child.type === "dir") {
|
|
|
|
|
moving_directories++
|
|
|
|
|
}
|
2023-11-16 16:33:35 +01:00
|
|
|
acc.push(child)
|
|
|
|
|
}
|
|
|
|
|
return acc
|
|
|
|
|
}, [])
|
|
|
|
|
mode = "moving"
|
|
|
|
|
}
|
2023-11-17 13:14:16 +01:00
|
|
|
|
2023-11-16 16:33:35 +01:00
|
|
|
const move_here = async () => {
|
2025-10-10 00:12:14 +02:00
|
|
|
const target_dir = nav.base.path + "/"
|
2023-11-16 16:33:35 +01:00
|
|
|
try {
|
2025-10-10 00:12:14 +02:00
|
|
|
loading_start()
|
|
|
|
|
|
2023-11-16 16:33:35 +01:00
|
|
|
let promises = []
|
|
|
|
|
moving_items.forEach(item => {
|
|
|
|
|
console.log("moving", item.path, "to", target_dir + item.name)
|
|
|
|
|
promises.push(fs_rename(item.path, target_dir + item.name))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// Wait for all the promises to finish
|
|
|
|
|
await Promise.all(promises)
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.log(err)
|
|
|
|
|
alert("Move failed: " + err.message + " ("+err.value+")")
|
|
|
|
|
} finally {
|
|
|
|
|
viewing_mode()
|
2024-08-09 13:02:07 +02:00
|
|
|
nav.reload()
|
2025-10-10 00:12:14 +02:00
|
|
|
loading_finish()
|
2023-11-16 16:33:35 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-01 11:14:34 +02:00
|
|
|
// The toolbar is shown in the bar at the top of the page, under the breadcrumbs.
|
|
|
|
|
// Other pages don't have it
|
|
|
|
|
onMount(() => {
|
|
|
|
|
toolbar_store.set(toolbar)
|
|
|
|
|
return () => toolbar_store.set(null)
|
|
|
|
|
})
|
2020-11-17 23:39:27 +01:00
|
|
|
</script>
|
|
|
|
|
|
2026-09-02 00:12:25 +02:00
|
|
|
<svelte:window
|
|
|
|
|
onkeydown={keypress}
|
|
|
|
|
onkeyup={keypress}
|
|
|
|
|
onscroll={() => scroll_positions.set(nav.base.path, window.scrollY)}
|
|
|
|
|
/>
|
2023-11-17 13:14:16 +01:00
|
|
|
|
2026-10-01 11:14:34 +02:00
|
|
|
{#snippet toolbar()}
|
|
|
|
|
{#if mode === "viewing"}
|
|
|
|
|
<div class="toolbar">
|
|
|
|
|
<div class="toolbar_left">
|
|
|
|
|
<button onclick={() => {search_bar.open()}} title="Press / to search">
|
|
|
|
|
<i class="icon">search</i>
|
|
|
|
|
</button>
|
|
|
|
|
<button onclick={navigate_back} title="Back">
|
|
|
|
|
<i class="icon">arrow_back</i>
|
|
|
|
|
</button>
|
|
|
|
|
<button onclick={() => nav.navigate_up()} disabled={$nav.path.length <= 1} title="Up">
|
|
|
|
|
<i class="icon">north</i>
|
|
|
|
|
</button>
|
|
|
|
|
<button onclick={() => nav.reload()} title="Refresh directory listing">
|
|
|
|
|
<i class="icon">refresh</i>
|
|
|
|
|
</button>
|
|
|
|
|
{#if $nav.children.some(c => c.name === ".Trash" && c.type === "dir")}
|
|
|
|
|
<button
|
|
|
|
|
onclick={() => nav.navigate($nav.children.find(c => c.name === ".Trash").path, true)}
|
|
|
|
|
title="Open trash bin"
|
|
|
|
|
>
|
|
|
|
|
<i class="icon">delete</i>
|
2025-01-28 12:00:04 +01:00
|
|
|
</button>
|
2026-10-01 11:14:34 +02:00
|
|
|
{/if}
|
|
|
|
|
</div>
|
2024-02-13 13:13:44 +01:00
|
|
|
|
2026-10-01 11:14:34 +02:00
|
|
|
<div class="toolbar_middle">
|
|
|
|
|
<button onclick={() => toggle_view()} title="Switch between gallery, list and compact view">
|
|
|
|
|
<i class="icon" class:button_highlight={directory_view === "list"}>list</i>
|
|
|
|
|
<i class="icon" class:button_highlight={directory_view === "gallery"}>collections</i>
|
|
|
|
|
<i class="icon" class:button_highlight={directory_view === "compact"}>view_compact</i>
|
|
|
|
|
</button>
|
2023-11-16 16:33:35 +01:00
|
|
|
|
2026-10-01 11:14:34 +02:00
|
|
|
<button class="button_large_icons" onclick={() => toggle_large_icons()} title="Switch between large and small icons">
|
|
|
|
|
{#if large_icons}
|
|
|
|
|
<i class="icon">zoom_out</i>
|
|
|
|
|
{:else}
|
|
|
|
|
<i class="icon">zoom_in</i>
|
|
|
|
|
{/if}
|
|
|
|
|
</button>
|
2024-02-13 13:13:44 +01:00
|
|
|
|
2026-10-01 11:14:34 +02:00
|
|
|
<button onclick={() => {show_hidden = !show_hidden}} title="Toggle hidden files">
|
|
|
|
|
{#if show_hidden}
|
|
|
|
|
<i class="icon">visibility_off</i>
|
|
|
|
|
{:else}
|
|
|
|
|
<i class="icon">visibility</i>
|
|
|
|
|
{/if}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2025-01-28 12:00:04 +01:00
|
|
|
|
2026-10-01 11:14:34 +02:00
|
|
|
<div class="toolbar_right">
|
|
|
|
|
{#if $nav.permissions.write}
|
|
|
|
|
<button onclick={() => upload_widget.pick_files()} title="Upload files to this directory">
|
|
|
|
|
<i class="icon">cloud_upload</i>
|
|
|
|
|
</button>
|
2025-01-28 12:00:04 +01:00
|
|
|
|
2026-10-01 11:14:34 +02:00
|
|
|
<Button click={() => {creating_dir = !creating_dir}} highlight={creating_dir} icon="create_new_folder" title="Make folder"/>
|
2025-01-28 12:00:04 +01:00
|
|
|
|
2026-10-01 11:14:34 +02:00
|
|
|
<button onclick={selecting_mode} title="Select and delete files">
|
|
|
|
|
<i class="icon">select_all</i>
|
|
|
|
|
</button>
|
|
|
|
|
{/if}
|
2023-11-16 16:33:35 +01:00
|
|
|
</div>
|
2026-10-01 11:14:34 +02:00
|
|
|
</div>
|
2025-09-24 15:37:57 +02:00
|
|
|
|
2026-10-01 11:14:34 +02:00
|
|
|
{:else if mode === "selecting"}
|
|
|
|
|
<div class="toolbar toolbar_edit">
|
|
|
|
|
<Button click={viewing_mode} icon="close"/>
|
|
|
|
|
<div class="toolbar_spacer">Selecting files</div>
|
|
|
|
|
<Button click={move_start} icon="drive_file_move" label="Move"/>
|
|
|
|
|
<button onclick={delete_selected} class="button_red">
|
|
|
|
|
<i class="icon">delete</i>
|
|
|
|
|
Delete
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
{:else if mode === "moving"}
|
|
|
|
|
<div class="toolbar toolbar_edit">
|
|
|
|
|
<Button click={viewing_mode} icon="close"/>
|
|
|
|
|
<Button click={() => nav.navigate_up()} disabled={$nav.path.length <= 1} icon="north"/>
|
|
|
|
|
<div class="toolbar_spacer">
|
|
|
|
|
Moving {moving_files} files and {moving_directories} directories
|
2020-11-17 23:39:27 +01:00
|
|
|
</div>
|
2026-10-01 11:14:34 +02:00
|
|
|
<Button click={() => {creating_dir = !creating_dir}} highlight={creating_dir} icon="create_new_folder" title="Make folder"/>
|
|
|
|
|
<Button click={move_here} highlight icon="done" label="Move here"/>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
2023-11-16 16:33:35 +01:00
|
|
|
|
2026-10-01 11:14:34 +02:00
|
|
|
{#if creating_dir}
|
|
|
|
|
<CreateDirectory nav={nav} />
|
|
|
|
|
{/if}
|
|
|
|
|
{/snippet}
|
2022-02-22 19:53:48 +01:00
|
|
|
|
2026-10-01 11:14:34 +02:00
|
|
|
<div
|
|
|
|
|
class="container"
|
|
|
|
|
use:drop_target={{
|
|
|
|
|
upload: (files) => upload_widget.upload_files(files),
|
|
|
|
|
shadow: "var(--accent_color) 0 0 10px 2px inset",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-08-09 13:02:07 +02:00
|
|
|
{#if $nav.base.abuse_type !== undefined}
|
2024-05-17 16:32:53 +02:00
|
|
|
<div class="highlight_red">
|
|
|
|
|
This directory has received an abuse report. It cannot be
|
|
|
|
|
shared.<br/>
|
2024-08-09 13:02:07 +02:00
|
|
|
Type of abuse: {$nav.base.abuse_type}<br/>
|
|
|
|
|
Report time: {formatDate($nav.base.abuse_report_time, true, true, true)}
|
2024-05-17 16:32:53 +02:00
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
2025-10-13 16:05:50 +02:00
|
|
|
{@render children?.()}
|
2024-02-16 14:50:34 +01:00
|
|
|
|
2022-02-22 19:53:48 +01:00
|
|
|
{#if directory_view === "list"}
|
2025-10-13 23:20:42 +02:00
|
|
|
<ListView nav={nav} file_event={file_event} show_hidden={show_hidden} large_icons={large_icons}/>
|
2022-02-22 19:53:48 +01:00
|
|
|
{:else if directory_view === "gallery"}
|
2025-10-13 23:20:42 +02:00
|
|
|
<GalleryView nav={nav} file_event={file_event} show_hidden={show_hidden} large_icons={large_icons}/>
|
2025-01-28 12:00:04 +01:00
|
|
|
{:else if directory_view === "compact"}
|
2025-10-13 23:20:42 +02:00
|
|
|
<CompactView nav={nav} file_event={file_event} show_hidden={show_hidden} large_icons={large_icons}/>
|
2022-02-22 19:53:48 +01:00
|
|
|
{/if}
|
2020-11-17 23:39:27 +01:00
|
|
|
</div>
|
|
|
|
|
|
2025-10-13 16:05:50 +02:00
|
|
|
<FileMenu bind:this={file_menu} nav={nav} edit_window={edit_window} />
|
2025-10-09 15:48:23 +02:00
|
|
|
|
2020-11-17 23:39:27 +01:00
|
|
|
<style>
|
|
|
|
|
.container {
|
|
|
|
|
padding: 0;
|
2026-10-01 11:14:34 +02:00
|
|
|
/* Keeps the margins of the views inside the container. As a normal block
|
|
|
|
|
they would collapse through it and push it out of the file preview, which
|
|
|
|
|
gives that a scrollbar */
|
|
|
|
|
display: flow-root;
|
2026-09-02 00:12:25 +02:00
|
|
|
min-height: 100%; /* Used for drop target */
|
2020-11-17 23:39:27 +01:00
|
|
|
}
|
|
|
|
|
.toolbar {
|
2023-11-16 16:33:35 +01:00
|
|
|
display: flex;
|
2026-10-01 11:14:34 +02:00
|
|
|
flex: 1 1 auto;
|
2020-11-17 23:39:27 +01:00
|
|
|
flex-direction: row;
|
2025-01-28 12:00:04 +01:00
|
|
|
flex-wrap: wrap;
|
|
|
|
|
justify-content: space-between;
|
2023-11-16 16:33:35 +01:00
|
|
|
align-items: center;
|
2026-10-01 11:14:34 +02:00
|
|
|
border-top: 1px solid var(--separator);
|
2020-11-17 23:39:27 +01:00
|
|
|
}
|
2025-01-28 12:00:04 +01:00
|
|
|
.toolbar > * {
|
|
|
|
|
flex: 0 0 content;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: row;
|
|
|
|
|
}
|
2023-11-16 16:33:35 +01:00
|
|
|
.toolbar_spacer {
|
|
|
|
|
flex: 1 1 auto;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
.toolbar_edit {
|
2026-10-01 02:06:00 +02:00
|
|
|
background-color: var(--green_tint);
|
2025-01-28 12:00:04 +01:00
|
|
|
}
|
2023-11-16 19:05:30 +01:00
|
|
|
|
|
|
|
|
/* Large icon mode only supported on wide screens. Hide the button on small screen */
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
|
.button_large_icons {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-17 23:39:27 +01:00
|
|
|
</style>
|