has W for repo picker now

This commit is contained in:
Isaac Johnson 2026-07-04 07:46:33 -05:00
parent f9e6329bc9
commit 6714d493e3
1 changed files with 35 additions and 5 deletions

View File

@ -466,7 +466,7 @@ export class TuiEngine {
if (this.activeSearchInput) {
this.handleSearchKeypress(str, key);
} else {
this.handleListKeypress(str, key);
await this.handleListKeypress(str, key);
}
} else if (this.state.screen === "details") {
this.handleDetailsKeypress(str, key);
@ -689,7 +689,8 @@ export class TuiEngine {
// Search inactive keypresses
if ((key && key.name === "escape") || str === "\u001b") {
this.state.screen = "setup";
this.state.screen =
this.state.previousScreen === "list" ? "list" : "setup";
this.render();
return;
}
@ -793,7 +794,7 @@ export class TuiEngine {
/**
* Key handling for Dashboard list
*/
private handleListKeypress(str: string, key: any) {
private async handleListKeypress(str: string, key: any) {
if (this.state.loading) return;
if (key && key.name === "tab") {
@ -1044,6 +1045,34 @@ export class TuiEngine {
return;
}
if (str === "w" || str === "W") {
// Select different repository
this.state.previousScreen = "list";
this.state.screen = "repo-picker";
if (this.state.repos.length === 0) {
this.state.loading = true;
this.render();
try {
const repos = await authenticateAndFetchRepos(
this.state.config.url || this.state.setupForm.url,
this.state.config.userid || this.state.setupForm.userid,
this.state.config.token || this.state.setupForm.token || "",
);
this.state.repos = repos;
this.state.selectedRepoIndex = 0;
this.state.repoSearchQuery = "";
this.state.repoPickerActiveSearch = false;
} catch (err: any) {
this.state.error = `Failed to fetch repositories: ${err.message}`;
this.state.screen = "list";
} finally {
this.state.loading = false;
}
}
this.render();
return;
}
if (str === "l" || str === "L") {
this.state.screen = "labels-list";
this.state.selectedLabelIndex = 0;
@ -1845,10 +1874,10 @@ export class TuiEngine {
// Keyboard controls help line
let fullHelpLine =
" [?] Help [↑/↓] Navigate [Enter] View [C] Create [/] Search [S] Sort [F] State [T] Type [L] Labels [N/P] Page [R] Reload [O] Settings [Esc] Quit";
" [?] Help [↑/↓] Navigate [Enter] View [C] Create [/] Search [S] Sort [F] State [T] Type [L] Labels [N/P] Page [R] Reload [W] Repo [O] Settings [Esc] Quit";
if (isSettings) {
fullHelpLine =
" [?] Help [Tab] Back to List [←/→] Select Setting [Enter] Select/Toggle [C] Create [R] Reload [Esc] Quit";
" [?] Help [Tab] Back to List [←/→] Select Setting [Enter] Select/Toggle [C] Create [R] Reload [W] Repo [Esc] Quit";
}
const repoStr = chalk.bold.cyan(
` repo: ${this.state.config.owner}/${this.state.config.repo} `,
@ -3973,6 +4002,7 @@ export class TuiEngine {
{ key: "N / PageDown", desc: "Next page of issues" },
{ key: "P / PageUp", desc: "Previous page of issues" },
{ key: "R", desc: "Reload issues list" },
{ key: "W", desc: "Select different repository" },
{ key: "Tab", desc: "Toggle focus (Issues List <=> Settings)" },
{ key: "O", desc: "Global Setup / Connection Settings" },
{ key: "Q / Esc", desc: "Quit application" },