bb290d4281
* feat(web): add cmd+shift+g shortcut to open the task's github pr Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix: address PR review feedback on focus contract and null task guard Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Kandev Agent <agent@kandev.dev> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
18 lines
593 B
TypeScript
18 lines
593 B
TypeScript
import type { TaskPR } from "@/lib/types/github";
|
|
|
|
export type TaskPROpenAction =
|
|
| { kind: "none" }
|
|
| { kind: "open"; pr: TaskPR }
|
|
| { kind: "pick"; prs: TaskPR[] };
|
|
|
|
/**
|
|
* Decide what the "open task PR" shortcut should do: nothing when the task has
|
|
* no linked PRs, open directly when there is exactly one, or show the picker
|
|
* dialog when there are several.
|
|
*/
|
|
export function resolveTaskPROpenAction(prs: TaskPR[]): TaskPROpenAction {
|
|
if (prs.length === 0) return { kind: "none" };
|
|
if (prs.length === 1) return { kind: "open", pr: prs[0] };
|
|
return { kind: "pick", prs };
|
|
}
|