2022-02-22 19:53:48 +01:00
|
|
|
<script>
|
|
|
|
import { createEventDispatcher } from "svelte";
|
|
|
|
import { formatDataVolume } from "../../util/Formatting.svelte";
|
2023-05-30 16:59:11 +02:00
|
|
|
import { fs_encode_path, fs_node_icon } from "../FilesystemUtil";
|
2022-02-22 19:53:48 +01:00
|
|
|
|
|
|
|
let dispatch = createEventDispatcher()
|
|
|
|
|
|
|
|
export let state
|
2023-04-19 18:26:50 +02:00
|
|
|
export let show_hidden = false
|
2023-11-16 19:05:30 +01:00
|
|
|
export let large_icons = false
|
2022-02-22 19:53:48 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="directory">
|
|
|
|
<tr>
|
|
|
|
<td></td>
|
2023-05-11 15:01:29 +02:00
|
|
|
<td>Name</td>
|
|
|
|
<td>Size</td>
|
|
|
|
<td></td>
|
2022-02-22 19:53:48 +01:00
|
|
|
</tr>
|
|
|
|
{#each state.children as child, index (child.path)}
|
|
|
|
<a
|
2023-05-30 16:59:11 +02:00
|
|
|
href={"/d"+fs_encode_path(child.path)}
|
2022-02-22 19:53:48 +01:00
|
|
|
on:click|preventDefault={() => {dispatch("node_click", index)}}
|
2023-11-16 19:05:30 +01:00
|
|
|
on:contextmenu={e => {dispatch("node_context", {event: e, index: index})}}
|
2022-02-22 19:53:48 +01:00
|
|
|
class="node"
|
2023-04-19 18:26:50 +02:00
|
|
|
class:node_selected={child.fm_selected}
|
|
|
|
class:hidden={child.name.startsWith(".") && !show_hidden}
|
|
|
|
>
|
2022-02-22 19:53:48 +01:00
|
|
|
<td>
|
2023-11-16 19:05:30 +01:00
|
|
|
<img src={fs_node_icon(child, 64, 64)} class="node_icon" class:large_icons alt="icon"/>
|
2022-02-22 19:53:48 +01:00
|
|
|
</td>
|
|
|
|
<td class="node_name">
|
|
|
|
{child.name}
|
|
|
|
</td>
|
|
|
|
<td class="node_size">
|
|
|
|
{#if child.type === "file"}
|
|
|
|
{formatDataVolume(child.file_size, 3)}
|
|
|
|
{/if}
|
|
|
|
</td>
|
2023-05-11 19:07:29 +02:00
|
|
|
<td class="node_icons">
|
2023-05-11 15:01:29 +02:00
|
|
|
{#if child.id}
|
2023-05-30 16:59:11 +02:00
|
|
|
<a
|
|
|
|
href="/d/{child.id}"
|
|
|
|
on:click|preventDefault|stopPropagation={() => {dispatch("node_share_click", index)}}
|
2023-11-15 15:50:54 +01:00
|
|
|
class="button action_button"
|
2023-05-30 16:59:11 +02:00
|
|
|
>
|
2023-05-11 15:01:29 +02:00
|
|
|
<i class="icon" title="This file / directory is shared. Click to open public link">share</i>
|
|
|
|
</a>
|
|
|
|
{/if}
|
2024-02-16 14:50:34 +01:00
|
|
|
{#if child.properties && child.properties.branding_enabled}
|
|
|
|
<button class="action_button" on:click|preventDefault|stopPropagation={() => dispatch("node_branding", index)}>
|
|
|
|
<i class="icon">palette</i>
|
|
|
|
</button>
|
|
|
|
{/if}
|
2023-05-11 19:07:29 +02:00
|
|
|
{#if state.permissions.update}
|
2024-02-16 14:50:34 +01:00
|
|
|
<button class="action_button" on:click|preventDefault|stopPropagation={() => dispatch("node_settings", index)}>
|
2023-05-16 14:18:44 +02:00
|
|
|
<i class="icon">edit</i>
|
2023-05-11 19:07:29 +02:00
|
|
|
</button>
|
|
|
|
{/if}
|
2023-05-11 15:01:29 +02:00
|
|
|
</td>
|
2022-02-22 19:53:48 +01:00
|
|
|
</a>
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
.directory {
|
|
|
|
display: table;
|
|
|
|
margin: 8px auto 16px auto;
|
2022-03-29 21:41:46 +02:00
|
|
|
background: var(--body_color);
|
2022-02-22 19:53:48 +01:00
|
|
|
border-collapse: collapse;
|
|
|
|
border-radius: 8px;
|
|
|
|
|
2022-11-07 17:10:17 +01:00
|
|
|
max-width: 100%;
|
2022-02-22 19:53:48 +01:00
|
|
|
width: 1000px;
|
|
|
|
}
|
|
|
|
.directory > * {
|
|
|
|
display: table-row;
|
|
|
|
}
|
|
|
|
.directory > * > * {
|
|
|
|
display: table-cell;
|
|
|
|
}
|
|
|
|
.node {
|
|
|
|
display: table-row;
|
|
|
|
text-decoration: none;
|
2024-03-15 13:59:34 +01:00
|
|
|
color: var(--body_text-color);
|
2022-02-22 19:53:48 +01:00
|
|
|
padding: 6px;
|
|
|
|
}
|
|
|
|
.node:not(:last-child) {
|
2022-03-29 21:41:46 +02:00
|
|
|
border-bottom: 1px solid var(--separator);
|
2022-02-22 19:53:48 +01:00
|
|
|
}
|
|
|
|
.node:hover:not(.node_selected) {
|
2022-03-29 21:41:46 +02:00
|
|
|
background: var(--input_background);
|
|
|
|
color: var(--input_text);
|
2022-02-22 19:53:48 +01:00
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
.node.node_selected {
|
|
|
|
background-color: var(--highlight_color) !important;
|
|
|
|
color: var(--highlight_text_color);
|
|
|
|
}
|
|
|
|
td {
|
|
|
|
padding: 4px;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
.node_icon {
|
|
|
|
height: 32px;
|
|
|
|
width: 32px;
|
|
|
|
vertical-align: middle;
|
2023-05-17 19:27:46 +02:00
|
|
|
border-radius: 4px;
|
2022-02-22 19:53:48 +01:00
|
|
|
}
|
|
|
|
.node_name {
|
|
|
|
width: 100%;
|
|
|
|
line-height: 1.2em;
|
|
|
|
word-break: break-all;
|
|
|
|
}
|
|
|
|
.node_size {
|
|
|
|
min-width: 50px;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
2023-05-11 19:07:29 +02:00
|
|
|
.node_icons {
|
|
|
|
white-space: nowrap;
|
|
|
|
text-align: right;
|
2023-11-15 15:50:54 +01:00
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
.action_button {
|
|
|
|
margin: 0;
|
|
|
|
background: none;
|
2024-02-15 18:52:46 +01:00
|
|
|
color: var(--body_text_color);
|
2024-02-16 11:49:38 +01:00
|
|
|
box-shadow: none;
|
2023-05-11 19:07:29 +02:00
|
|
|
}
|
2023-04-19 18:26:50 +02:00
|
|
|
.hidden {
|
|
|
|
display: none;
|
|
|
|
}
|
2023-11-16 19:05:30 +01:00
|
|
|
|
|
|
|
/* Large icon mode only supported on wide screens */
|
|
|
|
@media (min-width: 500px) {
|
|
|
|
.node_icon.large_icons {
|
|
|
|
height: 64px;
|
|
|
|
width: 64px;
|
|
|
|
}
|
|
|
|
}
|
2022-02-22 19:53:48 +01:00
|
|
|
</style>
|