Fully rename Pixeldrain to Nova
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { fs_delete_all, fs_rename } from "lib/FilesystemAPI.svelte"
|
||||
import { fs_rename, fs_trash, FSNode } from "lib/FilesystemAPI.svelte"
|
||||
import { onMount } from "svelte"
|
||||
import CreateDirectory from "./CreateDirectory.svelte"
|
||||
import ListView from "./ListView.svelte"
|
||||
@@ -15,6 +15,7 @@ import { FileAction, type FileActionHandler } from "./FileManagerLib";
|
||||
import FileMenu from "./FileMenu.svelte";
|
||||
import { loading_finish, loading_start } from "lib/Loading";
|
||||
import SearchBar from "../SearchBar.svelte";
|
||||
import type { GenericResponse } from "lib/NovaAPI";
|
||||
|
||||
let {
|
||||
nav = $bindable(),
|
||||
@@ -33,11 +34,11 @@ let {
|
||||
} = $props();
|
||||
|
||||
let large_icons = $state(false)
|
||||
let uploader: FsUploadWidget
|
||||
let uploader!: FsUploadWidget
|
||||
let mode = $state("viewing")
|
||||
let creating_dir = $state(false)
|
||||
let show_hidden = $state(false)
|
||||
let file_menu: FileMenu = $state()
|
||||
let file_menu!: FileMenu
|
||||
|
||||
export const upload = (files: File[]) => {
|
||||
return uploader.upload_files(files)
|
||||
@@ -119,12 +120,12 @@ const delete_selected = async () => {
|
||||
loading_start()
|
||||
|
||||
// Save all promises with deletion requests in an array
|
||||
let promises = []
|
||||
let promises: Promise<GenericResponse>[] = []
|
||||
nav.children.forEach(child => {
|
||||
if (!child.fm_selected) {
|
||||
return
|
||||
}
|
||||
promises.push(fs_delete_all(child.path))
|
||||
promises.push(fs_trash(child.path))
|
||||
})
|
||||
|
||||
// Wait for all the promises to finish
|
||||
@@ -175,7 +176,7 @@ const toggle_large_icons = () => {
|
||||
|
||||
// Moving functions
|
||||
|
||||
let moving_items = []
|
||||
let moving_items: FSNode[] = []
|
||||
|
||||
// We need to detect if shift is pressed so we can select multiple items
|
||||
let shift_pressed = false
|
||||
@@ -320,6 +321,14 @@ onMount(() => {
|
||||
<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>
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="toolbar_middle">
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { FSNavigator } from "filesystem/FSNavigator";
|
||||
import Button from "layout/Button.svelte";
|
||||
import Dialog from "layout/Dialog.svelte";
|
||||
import { bookmark_add, bookmark_del, bookmarks_store, is_bookmark } from "lib/Bookmarks";
|
||||
import { fs_delete, type FSNode } from "lib/FilesystemAPI.svelte";
|
||||
import { fs_trash, type FSNode } from "lib/FilesystemAPI.svelte";
|
||||
import { loading_finish, loading_start } from "lib/Loading";
|
||||
import { tick } from "svelte";
|
||||
|
||||
@@ -44,7 +44,7 @@ export const open = async (n: FSNode, target: EventTarget, event: Event) => {
|
||||
const delete_node = async () => {
|
||||
try {
|
||||
loading_start()
|
||||
await fs_delete(node.path)
|
||||
await fs_trash(node.path)
|
||||
nav.reload()
|
||||
} catch (err) {
|
||||
alert(JSON.stringify(err))
|
||||
|
||||
@@ -26,8 +26,16 @@ let {
|
||||
<thead>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><SortButton active_field={$nav.sort_last_field} asc={$nav.sort_asc} sort_func={nav.sort_children} field="name">Name</SortButton></td>
|
||||
<td class="hide_small"><SortButton active_field={$nav.sort_last_field} asc={$nav.sort_asc} sort_func={nav.sort_children} field="file_size">Size</SortButton></td>
|
||||
<td>
|
||||
<SortButton active_field={$nav.sort_last_field} asc={$nav.sort_asc} sort_func={nav.sort_children} field="name">
|
||||
Name
|
||||
</SortButton>
|
||||
</td>
|
||||
<td class="hide_small">
|
||||
<SortButton active_field={$nav.sort_last_field} asc={$nav.sort_asc} sort_func={nav.sort_children} field="file_size">
|
||||
Size
|
||||
</SortButton>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Reference in New Issue
Block a user