fix scrolling when pressing space, improve download sorting

AuthorKonata <konata@posteo.jp>
Date
Commit5f1b52f856a380e6f19ed42e31a9f7d5049f297b
Parentf80d1b5
2 files changed, 9 insertions(+), 15 deletions(-)
▾Mwebclient/src/App.tsx
@@ -315,7 +315,10 @@ const App: Component = () => {
});
document.addEventListener("keydown", (e) => {
if (e.key === " ") togglePlay();
if (e.key === " ") {
togglePlay();
e.preventDefault();
}
});
});
▾Mwebclient/src/components/DownloadManager.tsx
@@ -1,21 +1,10 @@
import {
batch,
createEffect,
createMemo,
createSignal,
For,
Show,
untrack,
type Accessor,
type Setter,
} from "solid-js";
import { batch, createEffect, createMemo, createSignal, For, Show, type Accessor, type Setter } from "solid-js";
import "./DownloadManager.css";
import "./Dialog.css";
import "toastify-js/src/toastify.css";
import { formatBytes } from "../utils";
import { ClearSVG, RefreshSVG, StopSVG } from "./SVG";
import { type DownloadStatus, downloadStatusMap, setDownloadStatusMap, type Progress } from "../offline";
import { createStore } from "solid-js/store";
interface DownloadManagerProps {
showDownloadManager: Accessor<boolean>;
@@ -46,8 +35,10 @@ export default function DownloadManager(props: DownloadManagerProps) {
const statusB = downloadStatusMap[pathB] as Progress;
// 0: Running, 1: Failed, 2: Aborted
const typeA = typeof statusA.status === "number" ? 0 : statusA.status === "Failed" ? 1 : 2;
const typeB = typeof statusB.status === "number" ? 0 : statusB.status === "Failed" ? 1 : 2;
const typeA =
typeof statusA.status === "number" ? (statusA.status > 0 ? 0 : 3) : statusA.status === "Failed" ? 1 : 2;
const typeB =
typeof statusB.status === "number" ? (statusB.status > 0 ? 0 : 3) : statusB.status === "Failed" ? 1 : 2;
if (typeA !== typeB) {
return typeA - typeB; // Sort by type first