2026-06-27 17:02:22 -04:00
|
|
|
import type { DownloadFocus, Region, Section, SeedFocus } from "./store";
|
2026-06-27 02:03:19 -04:00
|
|
|
|
|
|
|
|
export interface Hint {
|
|
|
|
|
keys: string;
|
|
|
|
|
label: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface HelpGroup {
|
|
|
|
|
title: string;
|
|
|
|
|
hints: Hint[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const HELP_GROUPS: HelpGroup[] = [
|
|
|
|
|
{
|
|
|
|
|
title: "Navigate",
|
|
|
|
|
hints: [
|
2026-07-01 12:06:45 +05:30
|
|
|
{ keys: "↑ ↓ ← →, h j k l", label: "Navigate content and panes" },
|
2026-06-27 02:03:19 -04:00
|
|
|
{ keys: "↵", label: "Open" },
|
|
|
|
|
{ keys: "tab", label: "Switch pane" },
|
|
|
|
|
{ keys: "esc", label: "Back" },
|
2026-06-30 02:04:59 +02:00
|
|
|
{ keys: "o", label: "Download folder" },
|
2026-06-27 02:03:19 -04:00
|
|
|
{ keys: "q", label: "Quit" },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "Search",
|
|
|
|
|
hints: [
|
|
|
|
|
{ keys: "/", label: "Edit search" },
|
|
|
|
|
{ keys: "↵", label: "Run search" },
|
2026-06-29 19:40:15 -03:00
|
|
|
{ keys: "s", label: "Sort results" },
|
2026-06-29 18:55:14 +02:00
|
|
|
{ keys: "y", label: "Copy magnet" },
|
2026-06-27 02:03:19 -04:00
|
|
|
{ keys: "m", label: "Paste magnet" },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: "Downloads",
|
|
|
|
|
hints: [
|
|
|
|
|
{ keys: "p", label: "Pause/resume" },
|
2026-06-27 17:47:35 -04:00
|
|
|
{ keys: "c", label: "Cancel or remove from list" },
|
2026-06-27 02:03:19 -04:00
|
|
|
{ keys: "f", label: "Retry failed" },
|
|
|
|
|
{ keys: "d", label: "Download again" },
|
|
|
|
|
{ keys: "x", label: "Clear recent" },
|
|
|
|
|
],
|
|
|
|
|
},
|
2026-06-27 17:02:22 -04:00
|
|
|
{
|
|
|
|
|
title: "Seeding",
|
|
|
|
|
hints: [
|
|
|
|
|
{ keys: "p", label: "Pause/resume" },
|
2026-06-27 17:47:35 -04:00
|
|
|
{ keys: "c", label: "Remove from list" },
|
2026-06-27 17:02:22 -04:00
|
|
|
],
|
|
|
|
|
},
|
2026-06-27 02:03:19 -04:00
|
|
|
];
|
|
|
|
|
|
2026-06-30 00:14:05 -04:00
|
|
|
// Footer labels stay terse so the contextual hint row never wraps; the `?`
|
|
|
|
|
// overlay (HELP_GROUPS) carries the full, descriptive list.
|
2026-07-01 02:39:41 -04:00
|
|
|
const NAVIGATE: Hint = { keys: "↑↓←→", label: "Move" };
|
2026-06-29 11:22:02 +02:00
|
|
|
|
2026-06-27 02:03:19 -04:00
|
|
|
const ALWAYS: Hint = { keys: "?", label: "Keys" };
|
|
|
|
|
|
2026-06-30 00:14:05 -04:00
|
|
|
const SWITCH: Hint = { keys: "tab", label: "Switch" };
|
2026-06-30 02:04:59 +02:00
|
|
|
|
2026-06-27 02:03:19 -04:00
|
|
|
export function footerHints(
|
|
|
|
|
region: Region,
|
|
|
|
|
section: Section,
|
|
|
|
|
downloadFocus?: DownloadFocus | null,
|
2026-06-27 17:02:22 -04:00
|
|
|
seedFocus?: SeedFocus | null,
|
2026-06-27 02:03:19 -04:00
|
|
|
): Hint[] {
|
|
|
|
|
if (region === "sidebar") {
|
|
|
|
|
return [
|
2026-06-29 11:22:02 +02:00
|
|
|
NAVIGATE,
|
2026-06-27 02:03:19 -04:00
|
|
|
{ keys: "↵", label: "Open" },
|
|
|
|
|
SWITCH,
|
|
|
|
|
ALWAYS,
|
|
|
|
|
{ keys: "q", label: "Quit" },
|
|
|
|
|
];
|
|
|
|
|
}
|
2026-06-27 17:02:22 -04:00
|
|
|
if (section === "seeding") {
|
|
|
|
|
const label =
|
|
|
|
|
seedFocus === "seeding" ? "Pause" : seedFocus === "missing" ? "Retry" : "Resume";
|
|
|
|
|
return [{ keys: "p", label }, { keys: "c", label: "Remove" }, SWITCH, ALWAYS];
|
|
|
|
|
}
|
2026-06-27 02:03:19 -04:00
|
|
|
if (section === "downloads") {
|
|
|
|
|
if (downloadFocus === "paused") {
|
|
|
|
|
return [{ keys: "p", label: "Resume" }, { keys: "c", label: "Cancel" }, SWITCH, ALWAYS];
|
|
|
|
|
}
|
|
|
|
|
if (downloadFocus === "failed") {
|
|
|
|
|
return [{ keys: "f", label: "Retry" }, { keys: "c", label: "Remove" }, SWITCH, ALWAYS];
|
|
|
|
|
}
|
|
|
|
|
if (downloadFocus === "recent") {
|
|
|
|
|
return [
|
2026-06-29 11:22:02 +02:00
|
|
|
NAVIGATE,
|
2026-06-27 02:03:19 -04:00
|
|
|
{ keys: "d", label: "Download again" },
|
|
|
|
|
{ keys: "c", label: "Remove" },
|
|
|
|
|
{ keys: "x", label: "Clear" },
|
|
|
|
|
SWITCH,
|
|
|
|
|
ALWAYS,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
return [{ keys: "p", label: "Pause" }, { keys: "c", label: "Cancel" }, SWITCH, ALWAYS];
|
|
|
|
|
}
|
|
|
|
|
return [
|
2026-06-29 11:22:02 +02:00
|
|
|
NAVIGATE,
|
2026-06-27 02:03:19 -04:00
|
|
|
{ keys: "d", label: "Download" },
|
2026-06-30 00:14:05 -04:00
|
|
|
{ keys: "y", label: "Copy" },
|
2026-06-29 19:40:15 -03:00
|
|
|
{ keys: "s", label: "Sort" },
|
2026-06-27 02:03:19 -04:00
|
|
|
{ keys: "/", label: "Search" },
|
|
|
|
|
SWITCH,
|
|
|
|
|
ALWAYS,
|
|
|
|
|
];
|
|
|
|
|
}
|