refactor(control): implement ESLint -> remove unnecessary imports, improve general code quality

This commit is contained in:
E44
2026-06-09 22:00:36 +02:00
parent 64b8fcffe2
commit 919bba7c2e
14 changed files with 41 additions and 51 deletions
@@ -1,5 +1,5 @@
<script lang="ts">
import { ArrowRight, Ban, FileIcon, Folder, Play, Triangle, TriangleAlert } from 'lucide-svelte';
import { ArrowRight, Ban, FileIcon, Folder, Play, TriangleAlert } from 'lucide-svelte';
import {
current_height,
get_selectable_color_classes,
@@ -10,7 +10,6 @@
supported_file_type_icon,
type Inode,
get_file_primary_key,
type FileOnDisplay,
type FileTransferTask,
is_folder
} from '$lib/ts/types';
@@ -18,7 +17,6 @@
import {
is_selected,
select,
selected_display_ids,
selected_file_ids
} from '$lib/ts/stores/select';
import {
@@ -32,13 +30,11 @@
import { get_file_size_display_string, get_file_type } from '$lib/ts/utils';
import { open_file } from '$lib/ts/api_handler';
import {
get_display_by_id,
run_on_all_selected_displays,
selected_online_display_ids
} from '$lib/ts/stores/displays';
import { get_thumbnail_url } from '$lib/ts/stores/thumbnails';
import { liveQuery, type Observable } from 'dexie';
import { db } from '$lib/ts/database';
import { add_sync_recursively, file_transfer_tasks } from '$lib/ts/file_transfer_handler';
let { file, not_interactable = false }: { file: Inode; not_interactable?: boolean } = $props();
@@ -65,7 +61,7 @@
});
let file_transfer_task: FileTransferTask | null = $derived(
$file_transfer_tasks.hasOwnProperty(file_primary_key)
Object.hasOwn($file_transfer_tasks, file_primary_key)
? $file_transfer_tasks[file_primary_key]
: null
);
@@ -145,7 +141,7 @@
function get_grayed_out_text_color_strings(is_selected: boolean): string {
if (not_interactable) return 'text-stone-400';
if (!!file_transfer_task) return 'text-white/20';
if (file_transfer_task) return 'text-white/20';
const color = is_selected ? 'text-stone-600' : 'text-stone-400';
const factor = is_selected ? -1 : 1;
return `${color} group-hover:${get_shifted_color(color, factor * 100)} group-active:${get_shifted_color(color, factor * 150)}`;
@@ -153,14 +149,14 @@
function get_grayed_out_border_color_strings(is_selected: boolean): string {
if (not_interactable) return 'border-stone-550';
if (!!file_transfer_task) return 'border-white/10';
if (file_transfer_task) return 'border-white/10';
const color = is_selected ? 'border-stone-450' : 'border-stone-550';
const factor = is_selected ? 1 : 1;
return `${color} group-hover:${get_shifted_color(color, factor * 100)} group-active:${get_shifted_color(color, factor * 150)}`;
}
function onclick(e: Event) {
if (not_interactable || !!file_transfer_task) return;
if (not_interactable || file_transfer_task) return;
select(selected_file_ids, file_primary_key, 'toggle');
e.stopPropagation();
}
@@ -184,7 +180,7 @@
if (loading_finished) {
out += 'bg-stone-500 text-white/30';
} else if (!!file_transfer_task) {
} else if (file_transfer_task) {
out += 'bg-stone-700 text-white/30';
} else {
out += get_selectable_color_classes(
@@ -200,7 +196,7 @@
if (not_interactable) {
out += ' rounded-lg';
} else if (!!file_transfer_task) {
} else if (file_transfer_task) {
out += ' rounded-r-lg';
} else {
out += ' rounded-r-lg cursor-pointer';