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",
|
"name": "torlnk",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "torlnk",
|
"name": "torlnk",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"env-paths": "^4.0.0",
|
"env-paths": "^4.0.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "torlnk",
|
"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.",
|
"description": "A sleek, zero-setup torrent finder and downloader that lives right in your terminal.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
+1
-2
@@ -155,7 +155,6 @@ export function App({
|
|||||||
|
|
||||||
const closeFolderPrompt = useCallback(() => {
|
const closeFolderPrompt = useCallback(() => {
|
||||||
setEditingFolder(false);
|
setEditingFolder(false);
|
||||||
setCaptureMode("none");
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const setDownloadDir = useCallback(
|
const setDownloadDir = useCallback(
|
||||||
@@ -329,6 +328,7 @@ export function App({
|
|||||||
quitAll();
|
quitAll();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (editingFolder) return; // the folder prompt owns input (its own esc + enter)
|
||||||
if (captureMode === "text") return;
|
if (captureMode === "text") return;
|
||||||
if (showHelp) {
|
if (showHelp) {
|
||||||
setShowHelp(false);
|
setShowHelp(false);
|
||||||
@@ -341,7 +341,6 @@ export function App({
|
|||||||
if (input === "o") {
|
if (input === "o") {
|
||||||
setShowHelp(false);
|
setShowHelp(false);
|
||||||
setEditingFolder(true);
|
setEditingFolder(true);
|
||||||
setCaptureMode("text");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (input === "m") {
|
if (input === "m") {
|
||||||
|
|||||||
@@ -42,6 +42,15 @@ function dedupe(list: TorrentResult[]): TorrentResult[] {
|
|||||||
return [...byHash.values()];
|
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 {
|
function idleState(): ConcurrentSearchState {
|
||||||
return {
|
return {
|
||||||
results: [],
|
results: [],
|
||||||
@@ -98,7 +107,7 @@ export function useConcurrentSearch(query: string): ConcurrentSearchState {
|
|||||||
if (!alive) return;
|
if (!alive) return;
|
||||||
done += 1;
|
done += 1;
|
||||||
setState({
|
setState({
|
||||||
results: dedupe(collected.slice()),
|
results: defaultOrder(dedupe(collected.slice())),
|
||||||
perSource: { ...per },
|
perSource: { ...per },
|
||||||
loading: done < SOURCES.length,
|
loading: done < SOURCES.length,
|
||||||
done,
|
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 ALWAYS: Hint = { keys: "?", label: "Keys" };
|
||||||
|
|
||||||
const SWITCH: Hint = { keys: "tab", label: "Switch pane" };
|
const SWITCH: Hint = { keys: "tab", label: "Switch" };
|
||||||
|
|
||||||
const FOLDER: Hint = { keys: "o", label: "Folder" };
|
|
||||||
|
|
||||||
export function footerHints(
|
export function footerHints(
|
||||||
region: Region,
|
region: Region,
|
||||||
@@ -70,7 +70,6 @@ export function footerHints(
|
|||||||
NAVIGATE,
|
NAVIGATE,
|
||||||
{ keys: "↵", label: "Open" },
|
{ keys: "↵", label: "Open" },
|
||||||
SWITCH,
|
SWITCH,
|
||||||
FOLDER,
|
|
||||||
ALWAYS,
|
ALWAYS,
|
||||||
{ keys: "q", label: "Quit" },
|
{ keys: "q", label: "Quit" },
|
||||||
];
|
];
|
||||||
@@ -102,10 +101,9 @@ export function footerHints(
|
|||||||
return [
|
return [
|
||||||
NAVIGATE,
|
NAVIGATE,
|
||||||
{ keys: "d", label: "Download" },
|
{ keys: "d", label: "Download" },
|
||||||
|
{ keys: "y", label: "Copy" },
|
||||||
{ keys: "s", label: "Sort" },
|
{ keys: "s", label: "Sort" },
|
||||||
{ keys: "y", label: "Copy magnet" },
|
|
||||||
{ keys: "/", label: "Search" },
|
{ keys: "/", label: "Search" },
|
||||||
{ keys: "m", label: "Paste magnet" },
|
|
||||||
SWITCH,
|
SWITCH,
|
||||||
ALWAYS,
|
ALWAYS,
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user