Compare commits

..

11 Commits

Author SHA1 Message Date
E44 fab846d843 fix(control): check for main button 2026-06-15 21:20:22 +02:00
E44 2dc46c186e chore(control): update files only of online displays when changing file path 2026-06-14 20:34:38 +02:00
E44 2dd390e815 chore(control): add select all files button
closes #25
2026-06-14 20:26:21 +02:00
E44 87eaf90c12 fix(control): use correct colors and include edge cases in select all displays button 2026-06-14 20:25:45 +02:00
E44 3174010e83 chore(control): improve startup behavoir
closes #22
2026-06-14 19:19:15 +02:00
E44 ec7c3b407c chore(control): improve error handling 2026-06-14 19:11:27 +02:00
E44 2dcf5a7758 fix(control): add error handler for shutdown
closes: #53
2026-06-14 19:09:20 +02:00
E44 5ecf2da8a9 feat(control): add File Drag and Drop
closes #51
2026-06-14 00:22:29 +02:00
E44 a49b842a4c feat(control): bind arrow keys to arrow buttons 2026-06-13 22:00:09 +02:00
E44 a3d444df20 fix: disable chrome translate
closes #56
2026-06-13 20:38:28 +02:00
E44 fb31f732af fix(control): ping response was wrong 2026-06-12 23:04:50 +02:00
11 changed files with 407 additions and 90 deletions
@@ -0,0 +1,176 @@
<script lang="ts">
import { add_upload } from '$lib/ts/file_transfer_handler';
import { selected_online_display_ids } from '$lib/ts/stores/displays';
import { current_file_path } from '$lib/ts/stores/files';
import HighlightedText from './HighlightedText.svelte';
let { className } = $props();
let drop_zone: HTMLDivElement | undefined;
let is_dragging = $state(false);
let is_dragging_over_drop_zone = $state(false);
let is_dragging_multiple_files = $state(false);
let drag_counter = 0;
function contains_files(event: DragEvent): boolean {
return Array.from(event.dataTransfer?.types ?? []).includes('Files');
}
function reset_drag_vars(): void {
drag_counter = 0;
is_dragging = false;
is_dragging_over_drop_zone = false;
is_dragging_multiple_files = false;
}
function is_inside_drop_zone(event: DragEvent): boolean {
if (!drop_zone) return false;
const rect = drop_zone.getBoundingClientRect();
return (
event.clientX >= rect.left &&
event.clientX <= rect.right &&
event.clientY >= rect.top &&
event.clientY <= rect.bottom
);
}
function handle_window_drag_enter(event: DragEvent): void {
if (!contains_files(event)) return;
event.preventDefault();
drag_counter += 1;
is_dragging = true;
is_dragging_multiple_files =
(event.dataTransfer?.items.length ?? 0) > 1;
if (event.dataTransfer) {
event.dataTransfer.dropEffect = 'copy';
}
}
function handle_window_drag_over(event: DragEvent): void {
if (!contains_files(event)) return;
event.preventDefault();
is_dragging = true;
is_dragging_multiple_files =
(event.dataTransfer?.items.length ?? 0) > 1;
is_dragging_over_drop_zone =
$selected_online_display_ids.length > 0 &&
is_inside_drop_zone(event);
if (event.dataTransfer) {
event.dataTransfer.dropEffect = 'copy';
}
}
function handle_window_drag_leave(event: DragEvent): void {
if (!contains_files(event) && !is_dragging) return;
drag_counter = Math.max(0, drag_counter - 1);
if (drag_counter === 0) {
reset_drag_vars();
}
}
function handle_window_drop_capture(event: DragEvent): void {
if (!contains_files(event)) return;
event.preventDefault();
}
function handle_window_drop(event: DragEvent): void {
if (!contains_files(event)) return;
event.preventDefault();
reset_drag_vars();
}
async function handle_drop_zone_drop(
event: DragEvent
): Promise<void> {
if (!contains_files(event)) return;
event.preventDefault();
event.stopPropagation();
const may_import =
$selected_online_display_ids.length > 0 &&
is_inside_drop_zone(event);
const items = Array.from(event.dataTransfer?.items ?? []);
reset_drag_vars();
if (!may_import) return;
const transfer = new DataTransfer();
for (const item of items) {
if (item.kind !== 'file') continue;
const file = item.getAsFile();
const entry = item.webkitGetAsEntry?.();
if (file && (!entry || entry.isFile)) {
transfer.items.add(file);
}
}
if (transfer.files.length === 0) return;
await add_upload(
transfer.files,
$selected_online_display_ids,
$current_file_path
);
}
</script>
<svelte:window
ondragenter={handle_window_drag_enter}
ondragover={handle_window_drag_over}
ondragleave={handle_window_drag_leave}
ondrop={handle_window_drop}
ondropcapture={handle_window_drop_capture}
/>
<div
class="fixed {is_dragging
? 'bg-black/50 opacity-100'
: 'opacity-0'} pointer-events-none p-10 z-1000 inset-0 transition-all duration-100 flex items-center justify-center text-xl text-white font-bold select-none"
>
{$selected_online_display_ids.length === 0
? 'Für das Hochladen von Dateien müssen erreichbare Displays ausgewählt werden!'
: ''}
</div>
<div
bind:this={drop_zone}
aria-hidden="true"
ondrop={handle_drop_zone_drop}
class="{className} absolute p-6 inset-0 flex z-1001 justify-center items-center transition-all duration-200 {$selected_online_display_ids.length >
0 && is_dragging
? 'opacity-100'
: 'opacity-0 pointer-events-none'} {is_dragging_over_drop_zone
? 'bg-stone-500'
: 'bg-stone-700'}"
>
<p class="text-lg pointer-events-none">
Hier {is_dragging_multiple_files ? 'Dateien' : 'Datei'} ablegen, um sie auf {$selected_online_display_ids.length ===
1
? 'dem ausgewählten Display'
: 'den ausgewählten Displays'} in den Pfad <HighlightedText
className="transition-colors duration-200"
bg={is_dragging_over_drop_zone ? 'bg-stone-550' : 'bg-stone-750'}
>{$current_file_path}</HighlightedText
> hochzuladen
</p>
</div>
@@ -36,7 +36,7 @@
{#if content.open} {#if content.open}
<div <div
class="absolute inset-0 backdrop-blur flex justify-center items-center z-50 {className}" class="popup absolute inset-0 backdrop-blur flex justify-center items-center z-50 {className}"
transition:fade={{ duration: 100 }} transition:fade={{ duration: 100 }}
> >
<div <div
+30 -19
View File
@@ -84,9 +84,10 @@ export async function get_file_data(
`; `;
const raw_response = await run_shell_command(ip, command); const raw_response = await run_shell_command(ip, command);
if (!raw_response.ok || !raw_response.json) return null; if (!raw_response.ok || !raw_response.json) return null;
if (!raw_response.ok) return null;
if (handle_shell_error(ip, raw_response, command, true)) return null;
const json_response = raw_response.json as ShellCommandResponse; const json_response = raw_response.json as ShellCommandResponse;
if (json_response.exitCode === 0 && json_response.stdout.trim() === '') return [];
if (handle_shell_error(ip, json_response, command, true)) return null;
if (json_response.stdout.trim() === '') return null; if (json_response.stdout.trim() === '') return null;
const response: FileInfo[] = json_response.stdout const response: FileInfo[] = json_response.stdout
@@ -116,11 +117,10 @@ export async function get_file_data(
export async function get_file_tree_data(ip: string, path: string): Promise<TreeElement[] | null> { export async function get_file_tree_data(ip: string, path: string): Promise<TreeElement[] | null> {
const command = `cd ".${path}" && tree -Js`; const command = `cd ".${path}" && tree -Js`;
const raw_response = await run_shell_command(ip, command); const raw_response = await run_shell_command(ip, command);
if (!raw_response.ok) return null;
if (handle_shell_error(ip, raw_response, command, true)) return null;
if (!raw_response.ok || !raw_response.json) return null;
const json_response = raw_response.json as ShellCommandResponse; const json_response = raw_response.json as ShellCommandResponse;
if (handle_shell_error(ip, json_response, command, true)) return null;
const tree_element: TreeElement | null = JSON.parse(json_response.stdout.trim())[0] || null; const tree_element: TreeElement | null = JSON.parse(json_response.stdout.trim())[0] || null;
return tree_element?.contents || null; return tree_element?.contents || null;
@@ -130,9 +130,8 @@ export async function create_path(ip: string, path: string): Promise<void> {
const command = `mkdir -p ".${path}"`; const command = `mkdir -p ".${path}"`;
const raw_response = await run_shell_command(ip, command); const raw_response = await run_shell_command(ip, command);
if (!raw_response.ok || !raw_response.json) return; if (!raw_response.ok) return;
const json_response = raw_response.json as ShellCommandResponse; handle_shell_error(ip, raw_response, command, true);
handle_shell_error(ip, json_response, command, true);
} }
export async function rename_file( export async function rename_file(
@@ -144,9 +143,8 @@ export async function rename_file(
const command: string = `cd ".${path}" && mv "${old_file_name}" "${new_file_name}"`; const command: string = `cd ".${path}" && mv "${old_file_name}" "${new_file_name}"`;
const raw_response = await run_shell_command(ip, command); const raw_response = await run_shell_command(ip, command);
if (!raw_response.ok || !raw_response.json) return; if (!raw_response.ok) return;
const json_response = raw_response.json as ShellCommandResponse; handle_shell_error(ip, raw_response, command, true);
handle_shell_error(ip, json_response, command, true);
} }
export async function delete_files( export async function delete_files(
@@ -159,9 +157,8 @@ export async function delete_files(
command += ` && rm -r "${file_name}"`; command += ` && rm -r "${file_name}"`;
} }
const raw_response = await run_shell_command(ip, command); const raw_response = await run_shell_command(ip, command);
if (!raw_response.ok || !raw_response.json) return; if (!raw_response.ok) return;
const json_response = raw_response.json as ShellCommandResponse; handle_shell_error(ip, raw_response, command, true);
handle_shell_error(ip, json_response, command, true);
} }
export async function show_blackscreen(ip: string): Promise<void> { export async function show_blackscreen(ip: string): Promise<void> {
@@ -288,11 +285,21 @@ async function request(
function handle_shell_error( function handle_shell_error(
ip: string, ip: string,
shell_response: ShellCommandResponse, response: RequestResponse,
shell_command: string, shell_command: string,
command_includs_cd: boolean command_includs_cd: boolean,
response_type: 'json' | 'blob' = 'json'
): boolean { ): boolean {
if (shell_response.exitCode !== 0) { if (
(response_type === 'json' && !response.json) ||
(response_type === 'blob' && !response.blob)
) {
const error_string = `Did not receive ${response_type}: ${JSON.stringify(response)}`;
console.error(error_string);
notifications.push('error', `Fehler in API-Shell`, `${ip}\n${shell_command}\n${error_string}`);
return true;
} else if (response.json && response.json.exitCode !== 0) {
const shell_response = response.json as ShellCommandResponse;
if ( if (
command_includs_cd && command_includs_cd &&
shell_response.stderr && shell_response.stderr &&
@@ -325,8 +332,12 @@ async function run_shell_command(ip: string, command: string): Promise<RequestRe
return await request_display(ip, '/shellCommand', options); return await request_display(ip, '/shellCommand', options);
} }
export async function shutdown(ip: string): Promise<RequestResponse> { export async function shutdown(ip: string): Promise<boolean> {
return await run_shell_command(ip, 'xfce4-session-logout --halt'); const command = 'xfce4-session-logout --halt';
const raw_response = await run_shell_command(ip, command);
if (!raw_response.ok) return false;
if (handle_shell_error(ip, raw_response, command, true)) return false;
return true;
} }
export async function startup(mac: string): Promise<RequestResponse> { export async function startup(mac: string): Promise<RequestResponse> {
+5 -5
View File
@@ -1,8 +1,8 @@
import { screenshot_loop } from './stores/displays'; import { screenshot_loop } from './stores/displays';
import { ping_ip } from './api_handler'; import { ping_ip } from './api_handler';
import type { Display, DisplayStatus } from './types'; import type { Display, DisplayStatus } from './types';
import { update_folder_elements_recursively } from './stores/files';
import { db } from './database'; import { db } from './database';
import { update_changed_directories } from './stores/files';
const update_display_status_interval_seconds = 20; const update_display_status_interval_seconds = 20;
const update_display_loading_status_interval_seconds = 2; const update_display_loading_status_interval_seconds = 2;
@@ -10,8 +10,6 @@ const update_display_loading_status_interval_seconds = 2;
const loading_display_ids: string[] = []; const loading_display_ids: string[] = [];
export async function on_app_start() { export async function on_app_start() {
await db.files.clear();
await db.files_on_display.clear();
await db.displays await db.displays
.toCollection() .toCollection()
.modify({ status: null, preview: { currently_updating: false, url: null } }); .modify({ status: null, preview: { currently_updating: false, url: null } });
@@ -47,17 +45,19 @@ export async function update_display_status(display: Display): Promise<DisplaySt
} }
if (resp.status === null && display.status !== null) return null; if (resp.status === null && display.status !== null) return null;
if (resp.status !== display.status) { if (resp.status !== display.status) {
let run_on_display_start = false;
// status change // status change
if (resp.status === 'app_offline') { if (resp.status === 'app_offline') {
loading_display_ids.push(display.id); loading_display_ids.push(display.id);
} else { } else {
remove_display_from_loading_displays(display.id); remove_display_from_loading_displays(display.id);
if (resp.status === 'app_online') { if (resp.status === 'app_online') {
on_display_start(display); run_on_display_start = true;
} }
} }
display.status = resp.status; display.status = resp.status;
await db.displays.put(display); // save await db.displays.put(display); // save
if (run_on_display_start) await on_display_start(display);
} }
return resp.status; return resp.status;
} }
@@ -70,6 +70,6 @@ export function remove_display_from_loading_displays(display_id: string) {
} }
async function on_display_start(display: Display) { async function on_display_start(display: Display) {
await update_folder_elements_recursively(display, '/'); await update_changed_directories(display);
screenshot_loop(display.id); screenshot_loop(display.id);
} }
+4 -6
View File
@@ -7,7 +7,7 @@ import {
type Inode, type Inode,
type TreeElement type TreeElement
} from '../types'; } from '../types';
import { get_display_by_id, selected_online_display_ids } from './displays'; import { get_display_by_id, online_displays, selected_online_display_ids } from './displays';
import { is_selected, select, selected_display_ids, selected_file_ids } from './select'; import { is_selected, select, selected_display_ids, selected_file_ids } from './select';
import { create_path, get_file_data, get_file_tree_data } from '../api_handler'; import { create_path, get_file_data, get_file_tree_data } from '../api_handler';
import { deactivate_old_thumbnail_urls, generate_thumbnail } from './thumbnails'; import { deactivate_old_thumbnail_urls, generate_thumbnail } from './thumbnails';
@@ -26,14 +26,12 @@ export async function change_file_path(new_path: string) {
deactivate_old_thumbnail_urls(); deactivate_old_thumbnail_urls();
const displays = await db.displays.toArray(); for (const display of get(online_displays)) {
for (const display of displays) {
await update_changed_directories(display, new_path); await update_changed_directories(display, new_path);
} }
} }
async function update_changed_directories(display: Display, path: string = '/') { export async function update_changed_directories(display: Display, path: string = '/') {
const changed_paths = await get_changed_directory_paths(display, path); const changed_paths = await get_changed_directory_paths(display, path);
if (!changed_paths) return; if (!changed_paths) return;
console.debug('Update file system from', display.name, ':', changed_paths); console.debug('Update file system from', display.name, ':', changed_paths);
@@ -239,7 +237,7 @@ async function get_recursive_changed_directory_paths(
return has_changed; return has_changed;
} }
export async function update_folder_elements_recursively( async function update_folder_elements_recursively(
display: Display, display: Display,
file_path: string = '/' file_path: string = '/'
): Promise<void> { ): Promise<void> {
+4 -4
View File
@@ -74,8 +74,8 @@
if (existing_display_id) { if (existing_display_id) {
display = await edit_display_data(existing_display_id, ip, mac, name); display = await edit_display_data(existing_display_id, ip, mac, name);
} else { } else {
const status = await ping_ip(text_inputs_valid.ip.value); const resp = await ping_ip(text_inputs_valid.ip.value);
display = await add_display(ip, mac, name, status); display = await add_display(ip, mac, name, resp.status);
} }
if (display) { if (display) {
await update_display_status(display); await update_display_status(display);
@@ -282,11 +282,11 @@
className="px-4 gap-2" className="px-4 gap-2"
bg="bg-stone-750" bg="bg-stone-750"
click_function={async () => { click_function={async () => {
const status = await ping_ip(text_inputs_valid.ip.value); const resp = await ping_ip(text_inputs_valid.ip.value);
notifications.push( notifications.push(
'info', 'info',
`Ping '${text_inputs_valid.ip.value}'`, `Ping '${text_inputs_valid.ip.value}'`,
`Aktueller Zustand: ${display_status_to_info(status)}` `Aktueller Zustand: ${display_status_to_info(resp.status)}`
); );
}}><Radio /> Ping</Button }}><Radio /> Ping</Button
> >
+92 -24
View File
@@ -34,6 +34,7 @@
import { liveQuery, type Observable } from 'dexie'; import { liveQuery, type Observable } from 'dexie';
import TextInput from '$lib/components/TextInput.svelte'; import TextInput from '$lib/components/TextInput.svelte';
import { add_to_keyboard_queue } from '$lib/ts/utils'; import { add_to_keyboard_queue } from '$lib/ts/utils';
import { onMount } from 'svelte';
let all_display_states: Observable<'on' | 'off' | 'mixed'> | undefined = $state(); let all_display_states: Observable<'on' | 'off' | 'mixed'> | undefined = $state();
$effect(() => { $effect(() => {
@@ -44,11 +45,16 @@
let popup_content: PopupContent = $state({ let popup_content: PopupContent = $state({
open: false, open: false,
snippet: null, snippet: null,
title: '', title: ''
}); });
let current_text = $state(''); let current_text = $state('');
const key_pressed = $state({
ArrowRight: false,
ArrowLeft: false
});
function popup_close_function() { function popup_close_function() {
popup_content.open = false; popup_content.open = false;
} }
@@ -79,7 +85,7 @@
snippet: website_popup, snippet: website_popup,
title: 'Webseite Anzeigen', title: 'Webseite Anzeigen',
window_class: 'w-xl', window_class: 'w-xl',
title_icon: Globe, title_icon: Globe
}; };
}; };
@@ -102,15 +108,19 @@
open: true, open: true,
snippet: ask_shutdown_popup, snippet: ask_shutdown_popup,
title: 'Bildschirm Herunterfahren', title: 'Bildschirm Herunterfahren',
title_icon: PowerOff, title_icon: PowerOff
}; };
} }
async function shutdown_action() { async function shutdown_action() {
popup_content.open = false; popup_content.open = false;
await run_on_all_selected_displays((d) => { await run_on_all_selected_displays(async (d) => {
shutdown(d.ip); // no await here because we want to be fast if (await shutdown(d.ip)) {
db.displays.update(d.id, { status: 'app_offline', preview: { currently_updating: false, url: null} }); db.displays.update(d.id, {
status: 'app_offline',
preview: { currently_updating: false, url: null }
});
}
}, false); }, false);
} }
@@ -143,10 +153,58 @@
async function send_website() { async function send_website() {
popup_content.open = false; popup_content.open = false;
await run_on_all_selected_displays((d) => await run_on_all_selected_displays((d) => open_website(d.ip, website_url));
open_website(d.ip, website_url)
);
} }
function has_open_popup(): boolean {
return document.querySelector('.popup') !== null;
}
function handle_key(
event: KeyboardEvent,
key: 'ArrowRight' | 'ArrowLeft',
action: 'press' | 'release'
) {
if (event.key === key) {
const current_press_state: boolean = key_pressed[key];
if (
(action === 'press' && (current_press_state === true || has_open_popup())) ||
(action === 'release' && current_press_state === false)
)
return;
key_pressed[key] = !current_press_state;
add_to_keyboard_queue(async () => {
await run_on_all_selected_displays(
(d) => send_keyboard_input(d.ip, [{ key, action }]),
true
);
});
}
}
function add_remove_event_listeners(
add_remove_function: (type: string, listener: (e: KeyboardEvent) => void) => void
) {
const actions = {
keydown: 'press',
keyup: 'release'
} as const;
const keys = ['ArrowRight', 'ArrowLeft'] as const;
for (const [action_type, action_value] of Object.entries(actions)) {
for (const key of keys) {
add_remove_function(action_type, (e: KeyboardEvent) => handle_key(e, key, action_value));
}
}
}
onMount(() => {
add_remove_event_listeners(window.addEventListener);
return () => {
add_remove_event_listeners(window.removeEventListener);
};
});
</script> </script>
{#snippet website_popup()} {#snippet website_popup()}
@@ -185,11 +243,11 @@
{/snippet} {/snippet}
{#snippet send_keys_popup()} {#snippet send_keys_popup()}
<KeyInput {popup_close_function}/> <KeyInput {popup_close_function} />
{/snippet} {/snippet}
{#snippet text_popup()} {#snippet text_popup()}
<TipTapInput bind:text={current_text}/> <TipTapInput bind:text={current_text} />
{/snippet} {/snippet}
<div class="grid grid-rows-[2.5rem_auto] bg-stone-800 rounded-2xl min-w-0"> <div class="grid grid-rows-[2.5rem_auto] bg-stone-800 rounded-2xl min-w-0">
@@ -202,15 +260,21 @@
<div class="flex flex-row gap-2 w-75 justify-normal"> <div class="flex flex-row gap-2 w-75 justify-normal">
<button <button
title="Vorherige Folie (Pfeil nach Links) [gedrückt halten möglich]" title="Vorherige Folie (Pfeil nach Links) [gedrückt halten möglich]"
class="px-9 bg-stone-700 {$selected_online_display_ids.length === 0 class="px-9 {key_pressed.ArrowLeft
? 'bg-stone-500'
: 'bg-stone-700'} {$selected_online_display_ids.length === 0
? 'text-stone-500 cursor-not-allowed' ? 'text-stone-500 cursor-not-allowed'
: 'hover:bg-stone-600 active:bg-stone-500 cursor-pointer'} py-2 rounded-xl flex justify-center items-center transition-colors duration-200" : 'hover:bg-stone-600 active:bg-stone-500 cursor-pointer'} py-2 rounded-xl flex justify-center items-center transition-colors duration-200"
disabled={$selected_online_display_ids.length === 0} disabled={$selected_online_display_ids.length === 0 || key_pressed.ArrowLeft}
onmousedown={() => { onmousedown={(e: MouseEvent) => {
if (e.button !== 0) return;
add_to_keyboard_queue(async () => await send_single_key_press('ArrowLeft', 'press')); add_to_keyboard_queue(async () => await send_single_key_press('ArrowLeft', 'press'));
}} }}
onmouseup={() => { onmouseup={(e: MouseEvent) => {
add_to_keyboard_queue(async () => await send_single_key_press('ArrowLeft', 'release')); if (e.button !== 0) return;
add_to_keyboard_queue(
async () => await send_single_key_press('ArrowLeft', 'release')
);
}} }}
> >
<ArrowBigLeft /> <ArrowBigLeft />
@@ -218,15 +282,21 @@
<button <button
title="Nächste Folie (Pfeil nach Rechts) [gedrückt halten möglich]" title="Nächste Folie (Pfeil nach Rechts) [gedrückt halten möglich]"
class="px-9 bg-stone-700 {$selected_online_display_ids.length === 0 class="px-9 {key_pressed.ArrowRight
? 'bg-stone-500 cursor-not-allowed'
: `bg-stone-700 ${
$selected_online_display_ids.length === 0
? 'text-stone-500 cursor-not-allowed' ? 'text-stone-500 cursor-not-allowed'
: 'hover:bg-stone-600 active:bg-stone-500 cursor-pointer'} py-2 rounded-xl flex justify-center items-center transition-colors duration-200" : 'hover:bg-stone-600 active:bg-stone-500 cursor-pointer'
disabled={$selected_online_display_ids.length === 0} }`} py-2 rounded-xl flex justify-center items-center transition-colors duration-200"
disabled={$selected_online_display_ids.length === 0 || key_pressed.ArrowRight}
onmousedown={() => { onmousedown={() => {
add_to_keyboard_queue(async () => await send_single_key_press('ArrowRight', 'press')); add_to_keyboard_queue(async () => await send_single_key_press('ArrowRight', 'press'));
}} }}
onmouseup={() => { onmouseup={() => {
add_to_keyboard_queue(async () => await send_single_key_press('ArrowRight', 'release')); add_to_keyboard_queue(
async () => await send_single_key_press('ArrowRight', 'release')
);
}} }}
> >
<ArrowBigRight /> <ArrowBigRight />
@@ -271,8 +341,7 @@
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<Button <Button
className="px-3 flex gap-3 w-full xl:w-75 justify-normal" className="px-3 flex gap-3 w-full xl:w-75 justify-normal"
disabled={$all_display_states === 'on' || disabled={$all_display_states === 'on' || $selected_display_ids.length === 0}
$selected_display_ids.length === 0}
click_function={startup_action} click_function={startup_action}
> >
<Power /> Bildschirm Hochfahren <Power /> Bildschirm Hochfahren
@@ -280,8 +349,7 @@
<Button <Button
className="px-3 flex gap-3 w-full xl:w-75 justify-normal" className="px-3 flex gap-3 w-full xl:w-75 justify-normal"
disabled={$all_display_states === 'off' || disabled={$all_display_states === 'off' || $selected_online_display_ids.length === 0}
$selected_online_display_ids.length === 0}
click_function={ask_shutdown} click_function={ask_shutdown}
> >
<PowerOff /> Bildschirm Herunterfahren</Button <PowerOff /> Bildschirm Herunterfahren</Button
+14 -2
View File
@@ -13,6 +13,7 @@
change_height, change_height,
current_height, current_height,
dnd_flip_duration_ms, dnd_flip_duration_ms,
get_selectable_color_classes,
is_display_drag, is_display_drag,
is_group_drag, is_group_drag,
next_height_step_size, next_height_step_size,
@@ -57,7 +58,7 @@
$effect(() => { $effect(() => {
const d = $display_groups; const d = $display_groups;
const sdi = $selected_display_ids; const sdi = $selected_display_ids;
all_groups_selected = liveQuery(() => all_selected(d || [], sdi)); all_groups_selected = liveQuery(() => d.length !== 0 && all_selected(d || [], sdi));
}); });
let last_pinned_pane_size: number = 45; let last_pinned_pane_size: number = 45;
@@ -217,11 +218,22 @@
</span> </span>
<div class="flex flex-row gap-1"> <div class="flex flex-row gap-1">
<button <button
class="min-w-40 px-4 rounded-xl cursor-pointer duration-200 transition-colors bg-stone-600" disabled={$display_groups?.length === 0}
class="min-w-40 px-4 rounded-xl duration-200 transition-colors {$display_groups?.length ===
0
? 'text-stone-500 cursor-not-allowed'
: 'cursor-pointer'} {get_selectable_color_classes($all_groups_selected || false, {
bg: true,
hover: $display_groups?.length !== 0,
active: $display_groups?.length !== 0,
text: true
})}"
onclick={async () => await toggle_all_selected_displays($display_groups)} onclick={async () => await toggle_all_selected_displays($display_groups)}
> >
<span>{$all_groups_selected || false ? 'Alle Abwählen' : 'Alle Auswählen'}</span> <span>{$all_groups_selected || false ? 'Alle Abwählen' : 'Alle Auswählen'}</span>
</button> </button>
<div class="flex flex-row"> <div class="flex flex-row">
<Button <Button
title="Bildschirme größer darstellen" title="Bildschirme größer darstellen"
+53 -4
View File
@@ -11,7 +11,12 @@
ZoomIn, ZoomIn,
ZoomOut ZoomOut
} from 'lucide-svelte'; } from 'lucide-svelte';
import { change_height, current_height, next_height_step_size } from '$lib/ts/stores/ui_behavior'; import {
change_height,
current_height,
get_selectable_color_classes,
next_height_step_size
} from '$lib/ts/stores/ui_behavior';
import Button from '$lib/components/Button.svelte'; import Button from '$lib/components/Button.svelte';
import PathBar from './PathBar.svelte'; import PathBar from './PathBar.svelte';
import { select, selected_display_ids, selected_file_ids } from '$lib/ts/stores/select'; import { select, selected_display_ids, selected_file_ids } from '$lib/ts/stores/select';
@@ -39,6 +44,7 @@
import { liveQuery, type Observable } from 'dexie'; import { liveQuery, type Observable } from 'dexie';
import { download_file, add_upload, add_sync_recursively } from '$lib/ts/file_transfer_handler'; import { download_file, add_upload, add_sync_recursively } from '$lib/ts/file_transfer_handler';
import { selected_online_display_ids } from '$lib/ts/stores/displays'; import { selected_online_display_ids } from '$lib/ts/stores/displays';
import FileDropZone from '$lib/components/FileDropZone.svelte';
let current_name: string = $state(''); let current_name: string = $state('');
let current_valid: boolean = $state(false); let current_valid: boolean = $state(false);
@@ -49,6 +55,16 @@
const s = $selected_file_ids; const s = $selected_file_ids;
selected_files = liveQuery(() => get_selected_files(s)); selected_files = liveQuery(() => get_selected_files(s));
}); });
let all_files_selected: boolean = $state(false);
$effect(() => {
const fe = $current_folder_elements;
const sfe_id = $selected_file_ids;
if (fe && sfe_id && fe.length !== 0) {
all_files_selected =
fe.length === sfe_id.length &&
!fe.find((inode) => !sfe_id.includes(get_file_primary_key(inode)));
}
});
let current_folder_elements: Observable<Inode[]> | undefined = $state(); let current_folder_elements: Observable<Inode[]> | undefined = $state();
$effect(() => { $effect(() => {
const path = $current_file_path, const path = $current_file_path,
@@ -59,7 +75,7 @@
$effect(() => { $effect(() => {
const s = $selected_file_ids; const s = $selected_file_ids;
one_file_selected = liveQuery(async () => { one_file_selected = liveQuery(async () => {
if (s.length !== 1) return false if (s.length !== 1) return false;
const inode = await get_file_by_id(s[0]); const inode = await get_file_by_id(s[0]);
if (!inode) return false; if (!inode) return false;
return !is_folder(inode); return !is_folder(inode);
@@ -146,6 +162,18 @@
}; };
}; };
async function toggle_all_selected_files(current_files: Inode[]) {
let action: 'select' | 'deselect';
if (all_files_selected === false) {
action = 'select';
} else {
action = 'deselect';
}
for (const file of current_files) {
await select(selected_file_ids, get_file_primary_key(file), action);
}
}
async function sync_selected_files( async function sync_selected_files(
current_selected_file_ids: string[], current_selected_file_ids: string[],
selected_display_ids: string[], selected_display_ids: string[],
@@ -285,11 +313,27 @@
}} }}
/> />
<div class="bg-stone-800 h-full rounded-2xl grid grid-rows-[2.5rem_1fr] min-h-0"> <div class="bg-stone-800 size-full rounded-2xl grid grid-rows-[2.5rem_1fr] min-h-0">
<div class="bg-stone-700 flex justify-between w-full p-1 rounded-t-2xl min-w-0 gap-2"> <div class="bg-stone-700 flex justify-between w-full p-1 rounded-t-2xl min-w-0 gap-2">
<span class="text-xl font-bold pl-2 content-center truncate min-w-0"> <span class="text-xl font-bold pl-2 content-center truncate min-w-0">
Dateien Anzeigen und Verwalten Dateien Anzeigen und Verwalten
</span> </span>
<div class="flex flex-row gap-1">
<button
disabled={$current_folder_elements?.length === 0}
class="min-w-40 px-4 rounded-xl duration-200 transition-colors {$current_folder_elements?.length ===
0
? 'text-stone-500 cursor-not-allowed'
: 'cursor-pointer'} {get_selectable_color_classes(all_files_selected, {
bg: true,
hover: $current_folder_elements?.length !== 0,
active: $current_folder_elements?.length !== 0,
text: true
})}"
onclick={async () => await toggle_all_selected_files($current_folder_elements ?? [])}
>
<span>{all_files_selected ? 'Alle Abwählen' : 'Alle Auswählen'}</span>
</button>
<div class="flex flex-row"> <div class="flex flex-row">
<Button <Button
title="Dateien größer darstellen" title="Dateien größer darstellen"
@@ -315,6 +359,7 @@
</Button> </Button>
</div> </div>
</div> </div>
</div>
<div class="flex flex-col gap-2 p-2 overflow-hidden relative rounded-b-2xl"> <div class="flex flex-col gap-2 p-2 overflow-hidden relative rounded-b-2xl">
<div class="flex flex-col gap-2 p-2 bg-stone-750 rounded-xl"> <div class="flex flex-col gap-2 p-2 bg-stone-750 rounded-xl">
<PathBar /> <PathBar />
@@ -388,7 +433,11 @@
</div> </div>
</div> </div>
</div> </div>
<div class="min-h-0 h-full overflow-y-auto overflow-x-hidden bg-stone-750 rounded-xl">
<div
class="min-h-0 size-full overflow-y-auto overflow-x-hidden bg-stone-750 rounded-xl relative"
>
<FileDropZone className="rounded-xl size-full" />
<div class="flex flex-col gap-2 p-2 min-h-0 max-w-full"> <div class="flex flex-col gap-2 p-2 min-h-0 max-w-full">
{#if $selected_online_display_ids.length === 0} {#if $selected_online_display_ids.length === 0}
<span class="text-stone-450 px-10 py-6 leading-relaxed text-center"> <span class="text-stone-450 px-10 py-6 leading-relaxed text-center">
+4 -2
View File
@@ -141,11 +141,13 @@
<button <button
title="Windows-/Meta-Taste [gedrückt halten möglich]" title="Windows-/Meta-Taste [gedrückt halten möglich]"
class="px-3 bg-stone-700 py-2 gap-2 rounded-xl flex items-center transition-colors duration-200 hover:bg-stone-600 active:bg-stone-500 cursor-pointer" class="px-3 bg-stone-700 py-2 gap-2 rounded-xl flex items-center transition-colors duration-200 hover:bg-stone-600 active:bg-stone-500 cursor-pointer"
onmousedown={async (e) => { onmousedown={async (e: MouseEvent) => {
if (e.button !== 0) return;
e.preventDefault(); e.preventDefault();
await on_key('MetaLeft', true); await on_key('MetaLeft', true);
}} }}
onmouseup={async () => { onmouseup={async (e: MouseEvent) => {
if (e.button !== 0) return;
await on_key('MetaLeft', false); await on_key('MetaLeft', false);
}} }}
> >
+1
View File
@@ -24,6 +24,7 @@ func openBrowserWindow(url string) error {
args := []string{ args := []string{
fmt.Sprintf("--app=%s", url), fmt.Sprintf("--app=%s", url),
fmt.Sprintf("--user-data-dir=%s", browserProfileDirPath), fmt.Sprintf("--user-data-dir=%s", browserProfileDirPath),
"--disable-features=Translate",
} }
errs := []string{} errs := []string{}