mirror of
https://github.com/baairon/torlink.git
synced 2026-07-08 18:28:22 +02:00
fix: seeders-first default, compact footer, and folder-editor input isolation
Restore the seeders-desc default ordering that the new sort feature dropped, so the healthiest torrents stay on top until `s` is pressed. Trim the contextual footer (terse labels, folder key in the `?` overlay only) so the added sort and folder keys never wrap it past one line. Gate the download-folder editor on its own `editingFolder` flag instead of the shared capture state, fixing the leak where `?`, `q`, and `m` fired through while typing a path.
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "torlnk",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "torlnk",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"env-paths": "^4.0.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "torlnk",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "A sleek, zero-setup torrent finder and downloader that lives right in your terminal.",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
||||
+1
-2
@@ -155,7 +155,6 @@ export function App({
|
||||
|
||||
const closeFolderPrompt = useCallback(() => {
|
||||
setEditingFolder(false);
|
||||
setCaptureMode("none");
|
||||
}, []);
|
||||
|
||||
const setDownloadDir = useCallback(
|
||||
@@ -329,6 +328,7 @@ export function App({
|
||||
quitAll();
|
||||
return;
|
||||
}
|
||||
if (editingFolder) return; // the folder prompt owns input (its own esc + enter)
|
||||
if (captureMode === "text") return;
|
||||
if (showHelp) {
|
||||
setShowHelp(false);
|
||||
@@ -341,7 +341,6 @@ export function App({
|
||||
if (input === "o") {
|
||||
setShowHelp(false);
|
||||
setEditingFolder(true);
|
||||
setCaptureMode("text");
|
||||
return;
|
||||
}
|
||||
if (input === "m") {
|
||||
|
||||
@@ -42,6 +42,15 @@ function dedupe(list: TorrentResult[]): TorrentResult[] {
|
||||
return [...byHash.values()];
|
||||
}
|
||||
|
||||
// torlink's default ordering: healthiest first. The results view can re-sort
|
||||
// on demand (the `s` key), and its "none"/default state preserves this order.
|
||||
function defaultOrder(list: TorrentResult[]): TorrentResult[] {
|
||||
return list.sort((a, b) => {
|
||||
if (b.seeders !== a.seeders) return b.seeders - a.seeders;
|
||||
return (b.added ?? 0) - (a.added ?? 0);
|
||||
});
|
||||
}
|
||||
|
||||
function idleState(): ConcurrentSearchState {
|
||||
return {
|
||||
results: [],
|
||||
@@ -98,7 +107,7 @@ export function useConcurrentSearch(query: string): ConcurrentSearchState {
|
||||
if (!alive) return;
|
||||
done += 1;
|
||||
setState({
|
||||
results: dedupe(collected.slice()),
|
||||
results: defaultOrder(dedupe(collected.slice())),
|
||||
perSource: { ...per },
|
||||
loading: done < SOURCES.length,
|
||||
done,
|
||||
|
||||
+5
-7
@@ -51,13 +51,13 @@ export const HELP_GROUPS: HelpGroup[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const NAVIGATE: Hint = { keys: "↑ ↓ ← →", label: "Navigate content and panes" };
|
||||
// Footer labels stay terse so the contextual hint row never wraps; the `?`
|
||||
// overlay (HELP_GROUPS) carries the full, descriptive list.
|
||||
const NAVIGATE: Hint = { keys: "↑↓←→", label: "Move" };
|
||||
|
||||
const ALWAYS: Hint = { keys: "?", label: "Keys" };
|
||||
|
||||
const SWITCH: Hint = { keys: "tab", label: "Switch pane" };
|
||||
|
||||
const FOLDER: Hint = { keys: "o", label: "Folder" };
|
||||
const SWITCH: Hint = { keys: "tab", label: "Switch" };
|
||||
|
||||
export function footerHints(
|
||||
region: Region,
|
||||
@@ -70,7 +70,6 @@ export function footerHints(
|
||||
NAVIGATE,
|
||||
{ keys: "↵", label: "Open" },
|
||||
SWITCH,
|
||||
FOLDER,
|
||||
ALWAYS,
|
||||
{ keys: "q", label: "Quit" },
|
||||
];
|
||||
@@ -102,10 +101,9 @@ export function footerHints(
|
||||
return [
|
||||
NAVIGATE,
|
||||
{ keys: "d", label: "Download" },
|
||||
{ keys: "y", label: "Copy" },
|
||||
{ keys: "s", label: "Sort" },
|
||||
{ keys: "y", label: "Copy magnet" },
|
||||
{ keys: "/", label: "Search" },
|
||||
{ keys: "m", label: "Paste magnet" },
|
||||
SWITCH,
|
||||
ALWAYS,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user