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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user