@andrioid/paseo-attention-span 0.4.9 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OVERVIEW.md +3 -1
- package/client/attention-screen.tsx +164 -49
- package/client/card.tsx +25 -9
- package/client/coverage-settings.tsx +36 -1
- package/client/entity.tsx +118 -0
- package/client/feedback.tsx +2 -2
- package/client/icons.ts +5 -0
- package/client/next-up.tsx +148 -76
- package/client/session-menu.ts +2 -1
- package/client/sheet.tsx +141 -23
- package/client/ui.tsx +104 -6
- package/docs/architecture.md +17 -11
- package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
- package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
- package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
- package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing.png +0 -0
- package/docs/screenshots/desktop-dark-history-reviewed.png +0 -0
- package/docs/screenshots/desktop-dark-history.png +0 -0
- package/docs/screenshots/desktop-dark-next-up.png +0 -0
- package/docs/screenshots/desktop-dark-settings.png +0 -0
- package/docs/screenshots/desktop-dark-waiting-too-long.png +0 -0
- package/docs/screenshots/desktop-dark-waiting.png +0 -0
- package/docs/screenshots/phone-dark-doing.png +0 -0
- package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
- package/index.server.ts +2 -0
- package/package.json +1 -1
- package/requirements.yaml +4 -2
- package/server/classify.ts +56 -12
- package/server/details.ts +3 -2
- package/server/fixture.ts +50 -10
- package/server/gh.ts +29 -12
- package/server/github-types.ts +19 -2
- package/server/projects.ts +47 -0
- package/server/queries.ts +41 -6
- package/server/service.ts +138 -22
- package/server/store.ts +2 -0
- package/server/view.ts +2 -0
- package/shared/attention.ts +57 -0
- package/shared/checks.ts +66 -0
- package/shared/rpc.ts +5 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Text, View } from "react-native";
|
|
2
|
+
import type { GithubColor, IssueProject, NextUpIssue } from "../shared/attention";
|
|
3
|
+
import type { FieldRole } from "../shared/config";
|
|
4
|
+
import { repoLabel, shortValue } from "../shared/format";
|
|
5
|
+
import type { IconName } from "./icons";
|
|
6
|
+
import { Pill, type Styles, useStrongText, useStyles } from "./ui";
|
|
7
|
+
|
|
8
|
+
// How an issue or PR is presented wherever it shows, on a card or in its sheet: which one it is, and the facts that help
|
|
9
|
+
// pick it up. Tabs and sheets compose these rather than format their own.
|
|
10
|
+
|
|
11
|
+
// ---- Which item [ATT-20] ----
|
|
12
|
+
|
|
13
|
+
// An item's number and repo. My own repos go without their owner where `login` is given; a sheet passes none, so it always
|
|
14
|
+
// names the owner.
|
|
15
|
+
export interface Place {
|
|
16
|
+
repo: string;
|
|
17
|
+
number: number;
|
|
18
|
+
login: string | null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// "#160", standing out a little from the quiet text it leads, like a stack's rows in a sheet.
|
|
22
|
+
export function NumberText({ number }: { number: number }) {
|
|
23
|
+
return <Text style={useStrongText()}>#{number}</Text>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// "#160 · acme/shop", to lead a Meta line: the number on its own first, then the repo with its name standing out from its
|
|
27
|
+
// owner, so cards from several repos scan.
|
|
28
|
+
export function PlaceText({ place }: { place: Place }) {
|
|
29
|
+
const strong = useStrongText();
|
|
30
|
+
const label = repoLabel(place.repo, place.login);
|
|
31
|
+
const cut = label.lastIndexOf("/") + 1;
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
<NumberText number={place.number} />
|
|
35
|
+
{" · "}
|
|
36
|
+
{label.slice(0, cut)}
|
|
37
|
+
<Text style={strong}>{label.slice(cut)}</Text>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ---- GitHub's option colors [NXT-10] ----
|
|
43
|
+
|
|
44
|
+
// The colors GitHub offers for issue field and project options, as GitHub draws them on dark and on light.
|
|
45
|
+
const GITHUB_COLORS: Record<GithubColor, { dark: string; light: string }> = {
|
|
46
|
+
GRAY: { dark: "#8b949e", light: "#6e7781" },
|
|
47
|
+
BLUE: { dark: "#4493f8", light: "#0969da" },
|
|
48
|
+
GREEN: { dark: "#3fb950", light: "#1a7f37" },
|
|
49
|
+
YELLOW: { dark: "#d29922", light: "#9a6700" },
|
|
50
|
+
ORANGE: { dark: "#db6d28", light: "#bc4c00" },
|
|
51
|
+
RED: { dark: "#f85149", light: "#cf222e" },
|
|
52
|
+
PINK: { dark: "#db61a2", light: "#bf3989" },
|
|
53
|
+
PURPLE: { dark: "#ab7df8", light: "#8250df" },
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// An option's color for this theme. GRAY is what an option looks like when nobody chose a color, so it tints nothing.
|
|
57
|
+
export function githubColor(styles: Styles, color: GithubColor | undefined): string | undefined {
|
|
58
|
+
return color && color !== "GRAY" ? GITHUB_COLORS[color]?.[styles.dark ? "dark" : "light"] : undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ---- An issue to pick up [NXT-10, NXT-12] ----
|
|
62
|
+
|
|
63
|
+
// Each field's pill: its icon says which field the value is.
|
|
64
|
+
const FIELDS = [
|
|
65
|
+
{ role: "priority", label: "Priority", icon: "flag" },
|
|
66
|
+
{ role: "effort", label: "Effort", icon: "weight" },
|
|
67
|
+
{ role: "scope", label: "Scope", icon: "layers" },
|
|
68
|
+
] as const satisfies { role: FieldRole; label: string; icon: IconName }[];
|
|
69
|
+
|
|
70
|
+
// Priority in the color the org gave it; where it colored none, the top priority is warm, the next accent, the rest quiet.
|
|
71
|
+
function priorityColor(styles: Styles, issue: NextUpIssue): string | undefined {
|
|
72
|
+
if (issue.priorityColor) return githubColor(styles, issue.priorityColor);
|
|
73
|
+
return issue.priorityRank === 0 ? styles.c.statusWarning : issue.priorityRank === 1 ? styles.action : undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// A board it's on, and its column there in the board's color.
|
|
77
|
+
export function ProjectPill({ project }: { project: IssueProject }) {
|
|
78
|
+
const styles = useStyles();
|
|
79
|
+
return (
|
|
80
|
+
<Pill
|
|
81
|
+
icon="kanban"
|
|
82
|
+
label={project.title}
|
|
83
|
+
value={project.status}
|
|
84
|
+
color={githubColor(styles, project.color)}
|
|
85
|
+
hint={`Project ${project.title}: ${project.status ?? "no status"}`}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// One of its fields. `full` (the sheet) names the field and keeps the value whole, as phones can't show a pill's hint;
|
|
91
|
+
// the card trims the value's emoji and notes in brackets.
|
|
92
|
+
export function FieldPill({ issue, role, full = false }: { issue: NextUpIssue; role: FieldRole; full?: boolean }) {
|
|
93
|
+
const styles = useStyles();
|
|
94
|
+
const field = FIELDS.find((f) => f.role === role)!;
|
|
95
|
+
const raw = issue[role];
|
|
96
|
+
if (!raw) return null;
|
|
97
|
+
const value = full ? raw : shortValue(raw);
|
|
98
|
+
const color = role === "priority" ? priorityColor(styles, issue) : undefined;
|
|
99
|
+
return <Pill icon={field.icon} label={full ? field.label : undefined} value={value} color={color} hint={`${field.label}: ${value}`} />;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// What helps decide whether to pick it up: the boards it's on, then priority, effort and scope. Nothing when it has none.
|
|
103
|
+
export function IssuePills({ issue, full = false }: { issue: NextUpIssue; full?: boolean }) {
|
|
104
|
+
const styles = useStyles();
|
|
105
|
+
const projects = issue.projects ?? [];
|
|
106
|
+
const fields = FIELDS.filter(({ role }) => issue[role]);
|
|
107
|
+
if (projects.length === 0 && fields.length === 0) return null;
|
|
108
|
+
return (
|
|
109
|
+
<View style={[styles.wrap, { gap: 4, marginTop: 2 }]}>
|
|
110
|
+
{projects.map((project) => (
|
|
111
|
+
<ProjectPill key={project.id} project={project} />
|
|
112
|
+
))}
|
|
113
|
+
{fields.map(({ role }) => (
|
|
114
|
+
<FieldPill key={role} issue={issue} role={role} full={full} />
|
|
115
|
+
))}
|
|
116
|
+
</View>
|
|
117
|
+
);
|
|
118
|
+
}
|
package/client/feedback.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { openExternalUrl, type PluginClientContext, usePaseo, useRpc } from "@getpaseo/plugin/client";
|
|
2
|
-
import {
|
|
2
|
+
import { TextInput, useToast } from "@getpaseo/plugin/client/ui";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { Pressable, Text, View } from "react-native";
|
|
5
5
|
import type { AgentSummary } from "../shared/attention";
|
|
6
6
|
import type { AttentionConfig } from "../shared/config";
|
|
7
7
|
import { FEEDBACK_REPO, type FeedbackContext, type FeedbackKind, feedbackItemKey, feedbackPrompt } from "../shared/feedback";
|
|
8
8
|
import * as rpc from "../shared/rpc";
|
|
9
|
-
import { ActionSheet, type SheetEntry } from "./sheet";
|
|
9
|
+
import { ActionSheet, Modal, type SheetEntry } from "./sheet";
|
|
10
10
|
import { sessionEntry } from "./session-menu";
|
|
11
11
|
import { ITEM_LABEL, KIND_LABEL, LABEL, resolveAgentConfig } from "./sessions";
|
|
12
12
|
import { Button, KeepStyles, TablerIcon, useStyles } from "./ui";
|
package/client/icons.ts
CHANGED
|
@@ -41,6 +41,11 @@ export const ICONS = {
|
|
|
41
41
|
filter: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227z\"/></svg>" },
|
|
42
42
|
square: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"/></svg>" },
|
|
43
43
|
squareCheck: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zm6 7l2 2l4-4\"/></svg>" },
|
|
44
|
+
squareMinus: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M9 12h6M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"/></svg>" },
|
|
45
|
+
flag: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M5 5a5 5 0 0 1 7 0a5 5 0 0 0 7 0v9a5 5 0 0 1-7 0a5 5 0 0 0-7 0zm0 16v-7\"/></svg>" },
|
|
46
|
+
weight: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M9 6a3 3 0 1 0 6 0a3 3 0 1 0-6 0\"/><path d=\"M6.835 9h10.33a1 1 0 0 1 .984.821l1.637 9A1 1 0 0 1 18.802 20H5.198a1 1 0 0 1-.984-1.179l1.637-9A1 1 0 0 1 6.835 9\"/></g></svg>" },
|
|
47
|
+
layers: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 4L4 8l8 4l8-4zm-8 8l8 4l8-4M4 16l8 4l8-4\"/></svg>" },
|
|
48
|
+
kanban: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 4h6m4 0h6M4 10a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm10 0a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2z\"/></svg>" },
|
|
44
49
|
chevronRight: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m9 6l6 6l-6 6\"/></svg>" },
|
|
45
50
|
plus: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 5v14m-7-7h14\"/></svg>" },
|
|
46
51
|
check: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m5 12l5 5L20 7\"/></svg>" },
|
package/client/next-up.tsx
CHANGED
|
@@ -2,15 +2,26 @@ import { openExternalUrl } from "@getpaseo/plugin/client";
|
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
4
|
import { Pressable, Text, View } from "react-native";
|
|
5
|
-
import { ago
|
|
6
|
-
import {
|
|
5
|
+
import { ago } from "../shared/format";
|
|
6
|
+
import {
|
|
7
|
+
type AgentSummary,
|
|
8
|
+
type Chip,
|
|
9
|
+
type GithubColor,
|
|
10
|
+
type IssueCloseReason,
|
|
11
|
+
matchSessions,
|
|
12
|
+
type NextUpIssue,
|
|
13
|
+
type ProjectInfo,
|
|
14
|
+
projectFilterId,
|
|
15
|
+
projectFilterIds,
|
|
16
|
+
type UnclaimedSource,
|
|
17
|
+
} from "../shared/attention";
|
|
7
18
|
import type { NextUpSource } from "../shared/config";
|
|
8
19
|
import type { IconName } from "./icons";
|
|
9
20
|
import type { FetchDetails } from "./attention-screen";
|
|
10
21
|
import { CardList, CardRow, type Tone } from "./card";
|
|
11
22
|
import { sessionEntry, startAnotherEntry } from "./session-menu";
|
|
12
|
-
import { ActionSheet, DetailLines, type SheetEntry } from "./sheet";
|
|
13
|
-
import {
|
|
23
|
+
import { ActionSheet, DETAILS_STALE_MS, DetailLines, type DetailsQuery, detailsKey, Modal, type SheetEntry, usePrefetchOnRest } from "./sheet";
|
|
24
|
+
import { githubColor, IssuePills, PlaceText } from "./entity";
|
|
14
25
|
import { Button, KeepStyles, Meta, SectionHeader, TablerIcon, useHover, useStyles } from "./ui";
|
|
15
26
|
|
|
16
27
|
const TYPE_ICONS: Record<string, IconName> = { bug: "bug", feature: "feature", debt: "debt", task: "task", epic: "epic" };
|
|
@@ -24,8 +35,11 @@ interface Props {
|
|
|
24
35
|
// Where Next up looks, and the sources I ticked; none means all [NXT-09].
|
|
25
36
|
sources: NextUpSource[];
|
|
26
37
|
selectedSources: string[];
|
|
27
|
-
//
|
|
28
|
-
|
|
38
|
+
// The projects Next up's issues are on, and the statuses I ticked; none means all [NXT-03, NXT-12].
|
|
39
|
+
projects: ProjectInfo[];
|
|
40
|
+
selectedProjects: string[];
|
|
41
|
+
// Change any filter or all at once, so Clear empties them in one go.
|
|
42
|
+
onFilter: (change: FilterChange) => void;
|
|
29
43
|
agents: AgentSummary[];
|
|
30
44
|
// Mine, so my repos show without the owner.
|
|
31
45
|
login: string | null;
|
|
@@ -41,26 +55,57 @@ interface Props {
|
|
|
41
55
|
onOpenAgent: (agentId: string) => void;
|
|
42
56
|
}
|
|
43
57
|
|
|
44
|
-
type
|
|
58
|
+
type FilterChange = { scopes?: string[]; sources?: string[]; projectFilter?: string[] };
|
|
59
|
+
|
|
60
|
+
type RowProps = Omit<Props, "assigned" | "unclaimed" | "unclaimedFrom" | "selected" | "sources" | "selectedSources" | "projects" | "selectedProjects" | "onFilter">;
|
|
45
61
|
|
|
46
62
|
// Assigned issues first [NXT-06], then unclaimed ones [NXT-01]; both already ranked by the server [NXT-02].
|
|
47
|
-
export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, sources, selectedSources, onFilter, ...rowProps }: Props) {
|
|
63
|
+
export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, sources, selectedSources, projects, selectedProjects, onFilter, ...rowProps }: Props) {
|
|
48
64
|
const styles = useStyles();
|
|
49
65
|
const scopes = useMemo(() => [...new Set(unclaimed.map((issue) => issue.scope).filter((scope): scope is string => !!scope))].sort(), [unclaimed]);
|
|
50
66
|
// Filter by the scopes I picked last time [NXT-03]; a picked scope with no issues left is ignored.
|
|
51
67
|
const active = selected.filter((scope) => scopes.includes(scope));
|
|
52
68
|
// And by source, when there's more than one [NXT-09]; a picked source no longer in settings is ignored.
|
|
53
69
|
const activeSources = sources.length > 1 ? selectedSources.filter((id) => sources.some((source) => source.id === id)) : [];
|
|
70
|
+
// And by project and status [NXT-03, NXT-12]; a picked status no longer offered is ignored.
|
|
71
|
+
const tree = useMemo(() => projectTree(unclaimed, projects), [unclaimed, projects]);
|
|
72
|
+
const leaves = tree.flatMap((node) => node.children.map((child) => child.id));
|
|
73
|
+
const activeProjects = selectedProjects.filter((id) => leaves.includes(id));
|
|
54
74
|
const shown = unclaimed.filter(
|
|
55
|
-
(issue) =>
|
|
75
|
+
(issue) =>
|
|
76
|
+
(active.length === 0 || (issue.scope && active.includes(issue.scope))) &&
|
|
77
|
+
(activeSources.length === 0 || issue.sources.some((id) => activeSources.includes(id))) &&
|
|
78
|
+
(activeProjects.length === 0 || projectFilterIds(issue).some((id) => activeProjects.includes(id))),
|
|
56
79
|
);
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
80
|
+
const flip = (list: string[], id: string) => (list.includes(id) ? list.filter((other) => other !== id) : [...list, id]);
|
|
81
|
+
const toggle = (scope: string) => onFilter({ scopes: flip(active, scope) });
|
|
82
|
+
const toggleSource = (id: string) => onFilter({ sources: flip(activeSources, id) });
|
|
83
|
+
// A project ticks or clears all its statuses at once; partly ticked, it clears them.
|
|
84
|
+
const toggleProject = (id: string) => {
|
|
85
|
+
const children = tree.find((node) => node.id === id)?.children.map((child) => child.id);
|
|
86
|
+
if (!children) return onFilter({ projectFilter: flip(activeProjects, id) });
|
|
87
|
+
const any = children.some((child) => activeProjects.includes(child));
|
|
88
|
+
onFilter({ projectFilter: any ? activeProjects.filter((other) => !children.includes(other)) : [...activeProjects, ...children] });
|
|
89
|
+
};
|
|
90
|
+
const narrowedBy = [activeSources.length ? "sources" : null, activeProjects.length ? "projects" : null, active.length ? "scopes" : null].filter(Boolean);
|
|
60
91
|
const [filtering, setFiltering] = useState(false);
|
|
61
|
-
|
|
92
|
+
// A project ticked whole counts once.
|
|
93
|
+
const projectsPicked = tree.reduce((sum, node) => {
|
|
94
|
+
const on = node.children.filter((child) => activeProjects.includes(child.id)).length;
|
|
95
|
+
return sum + (on === node.children.length ? 1 : on);
|
|
96
|
+
}, 0);
|
|
97
|
+
const picked = active.length + activeSources.length + projectsPicked;
|
|
98
|
+
const projectOptions: FilterOption[] = tree.flatMap((node) => {
|
|
99
|
+
if (node.children.length === 1 && node.children[0].id === node.id) return [{ id: node.id, label: node.title }];
|
|
100
|
+
const on = node.children.filter((child) => activeProjects.includes(child.id)).length;
|
|
101
|
+
return [
|
|
102
|
+
{ id: node.id, label: node.title, strong: true, state: on === 0 ? "off" : on === node.children.length ? "on" : "partial" },
|
|
103
|
+
...node.children.map((child) => ({ ...child, indent: true })),
|
|
104
|
+
];
|
|
105
|
+
});
|
|
62
106
|
const groups: FilterGroup[] = [
|
|
63
107
|
...(sources.length > 1 ? [{ title: "Source", options: sources, active: activeSources, onToggle: toggleSource }] : []),
|
|
108
|
+
...(projectOptions.length > 0 ? [{ title: "Project", options: projectOptions, active: activeProjects, onToggle: toggleProject }] : []),
|
|
64
109
|
...(scopes.length > 0 ? [{ title: "Scope", options: scopes.map((scope) => ({ id: scope, label: scope })), active, onToggle: toggle }] : []),
|
|
65
110
|
];
|
|
66
111
|
|
|
@@ -92,14 +137,14 @@ export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, sourc
|
|
|
92
137
|
{filtering ? (
|
|
93
138
|
<FilterSheet
|
|
94
139
|
groups={groups}
|
|
95
|
-
onClear={() => onFilter({ scopes: [], sources: [] })}
|
|
140
|
+
onClear={() => onFilter({ scopes: [], sources: [], projectFilter: [] })}
|
|
96
141
|
onClose={() => setFiltering(false)}
|
|
97
142
|
/>
|
|
98
143
|
) : null}
|
|
99
144
|
{unclaimedFrom === "none" ? (
|
|
100
145
|
<Text style={styles.text}>No repos to look in. Register a project in Paseo, or choose where Next up looks in Settings.</Text>
|
|
101
146
|
) : shown.length === 0 ? (
|
|
102
|
-
<Text style={styles.text}>No unclaimed issues{narrowedBy ? ` in these ${narrowedBy}` : ""}.</Text>
|
|
147
|
+
<Text style={styles.text}>No unclaimed issues{narrowedBy.length ? ` in these ${narrowedBy.join(" and ")}` : ""}.</Text>
|
|
103
148
|
) : (
|
|
104
149
|
<IssueList issues={shown} claim {...rowProps} />
|
|
105
150
|
)}
|
|
@@ -108,7 +153,38 @@ export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, sourc
|
|
|
108
153
|
);
|
|
109
154
|
}
|
|
110
155
|
|
|
111
|
-
//
|
|
156
|
+
// A project in the filter with its statuses under it, all of them in the board's order, dimmed where no unclaimed issue has
|
|
157
|
+
// one; "No status" where some issue on it has none, and "No project" last, where some issue is on none [NXT-03, NXT-12].
|
|
158
|
+
// Only projects the unclaimed issues are on; none at all when projects can't be read.
|
|
159
|
+
interface ProjectNode {
|
|
160
|
+
id: string;
|
|
161
|
+
title: string;
|
|
162
|
+
children: FilterOption[];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function projectTree(unclaimed: NextUpIssue[], projects: ProjectInfo[]): ProjectNode[] {
|
|
166
|
+
if (!unclaimed.some((issue) => issue.projects)) return [];
|
|
167
|
+
const on = (project: ProjectInfo) => unclaimed.flatMap((issue) => (issue.projects ?? []).filter((p) => p.id === project.id));
|
|
168
|
+
const nodes: ProjectNode[] = projects.flatMap((project) => {
|
|
169
|
+
const items = on(project);
|
|
170
|
+
if (items.length === 0) return [];
|
|
171
|
+
const statuses = project.statuses.map((status) => ({
|
|
172
|
+
id: projectFilterId(project, status.name),
|
|
173
|
+
label: status.name,
|
|
174
|
+
color: status.color,
|
|
175
|
+
dim: !items.some((item) => item.status === status.name),
|
|
176
|
+
}));
|
|
177
|
+
// A status the board no longer offers still filters, after the board's own.
|
|
178
|
+
const gone = [...new Set(items.map((item) => item.status).filter((name): name is string => !!name && !project.statuses.some((s) => s.name === name)))];
|
|
179
|
+
const none = items.some((item) => !item.status) ? [{ id: projectFilterId(project, null), label: "No status" }] : [];
|
|
180
|
+
return [{ id: project.id, title: project.title, children: [...statuses, ...gone.map((name) => ({ id: projectFilterId(project, name), label: name })), ...none] }];
|
|
181
|
+
});
|
|
182
|
+
const loose = unclaimed.some((issue) => issue.projects && issue.projects.length === 0);
|
|
183
|
+
const noProject = projectFilterId(null);
|
|
184
|
+
return loose ? [...nodes, { id: noProject, title: "No project", children: [{ id: noProject, label: "No project" }] }] : nodes;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Source, project and scope filters behind one button, so they take no room above the list [NXT-03, NXT-09].
|
|
112
188
|
// Ticks apply right away; a bottom sheet on phones, a dialog on desktop.
|
|
113
189
|
function FilterSheet({ groups, onClear, onClose }: { groups: FilterGroup[]; onClear: () => void; onClose: () => void }) {
|
|
114
190
|
const styles = useStyles();
|
|
@@ -122,7 +198,13 @@ function FilterSheet({ groups, onClear, onClose }: { groups: FilterGroup[]; onCl
|
|
|
122
198
|
<Text style={styles.muted}>{group.title}</Text>
|
|
123
199
|
<View style={[styles.card, { backgroundColor: styles.c.surface2 }]}>
|
|
124
200
|
{group.options.map((option, index) => (
|
|
125
|
-
<
|
|
201
|
+
<FilterRow
|
|
202
|
+
key={`${option.id}:${option.strong ? "project" : "leaf"}`}
|
|
203
|
+
option={option}
|
|
204
|
+
state={option.state ?? (group.active.includes(option.id) ? "on" : "off")}
|
|
205
|
+
first={index === 0}
|
|
206
|
+
onPress={() => group.onToggle(option.id)}
|
|
207
|
+
/>
|
|
126
208
|
))}
|
|
127
209
|
</View>
|
|
128
210
|
</View>
|
|
@@ -139,30 +221,50 @@ function FilterSheet({ groups, onClear, onClose }: { groups: FilterGroup[]; onCl
|
|
|
139
221
|
|
|
140
222
|
interface FilterGroup {
|
|
141
223
|
title: string;
|
|
142
|
-
options:
|
|
224
|
+
options: FilterOption[];
|
|
143
225
|
active: string[];
|
|
144
226
|
onToggle: (id: string) => void;
|
|
145
227
|
}
|
|
146
228
|
|
|
147
|
-
|
|
229
|
+
interface FilterOption {
|
|
230
|
+
id: string;
|
|
231
|
+
label: string;
|
|
232
|
+
// A project's statuses sit under it, each with its board color.
|
|
233
|
+
indent?: boolean;
|
|
234
|
+
color?: GithubColor;
|
|
235
|
+
// A status no unclaimed issue has right now.
|
|
236
|
+
dim?: boolean;
|
|
237
|
+
// A project, ticked as a whole, partly, or not, by its statuses.
|
|
238
|
+
strong?: boolean;
|
|
239
|
+
state?: "on" | "partial" | "off";
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function FilterRow({ option, state, first, onPress }: { option: FilterOption; state: "on" | "partial" | "off"; first: boolean; onPress: () => void }) {
|
|
148
243
|
const styles = useStyles();
|
|
149
244
|
const { hovered, hover } = useHover();
|
|
245
|
+
const checked = state === "on";
|
|
246
|
+
const color = githubColor(styles, option.color);
|
|
150
247
|
return (
|
|
151
248
|
<Pressable
|
|
152
249
|
accessibilityRole="checkbox"
|
|
153
|
-
accessibilityState={{ checked }}
|
|
154
|
-
aria-checked={checked}
|
|
155
|
-
accessibilityLabel={label}
|
|
250
|
+
accessibilityState={{ checked: state === "partial" ? "mixed" : checked }}
|
|
251
|
+
aria-checked={state === "partial" ? "mixed" : checked}
|
|
252
|
+
accessibilityLabel={option.label}
|
|
156
253
|
onPress={onPress}
|
|
157
254
|
{...hover}
|
|
158
255
|
style={({ pressed }) => [
|
|
159
256
|
styles.row,
|
|
160
|
-
{ paddingVertical: 10,
|
|
257
|
+
{ paddingVertical: 10, paddingRight: 12, paddingLeft: option.indent ? 40 : 12, backgroundColor: pressed || hovered ? styles.c.border : "transparent" },
|
|
161
258
|
first ? null : { borderTopWidth: 1, borderTopColor: styles.c.surface1 },
|
|
162
259
|
]}
|
|
163
260
|
>
|
|
164
|
-
<TablerIcon name={
|
|
165
|
-
|
|
261
|
+
<TablerIcon name={state === "on" ? "squareCheck" : state === "partial" ? "squareMinus" : "square"} size={18} color={state === "off" ? styles.c.foregroundMuted : styles.action} />
|
|
262
|
+
{option.indent ? (
|
|
263
|
+
<View
|
|
264
|
+
style={{ width: 8, height: 8, borderRadius: 4, ...(option.color ? { backgroundColor: color ?? styles.c.foregroundMuted } : { borderWidth: 1.5, borderColor: styles.c.foregroundMuted }) }}
|
|
265
|
+
/>
|
|
266
|
+
) : null}
|
|
267
|
+
<Text style={[styles.text, option.strong ? { fontWeight: "600" } : null, option.dim ? { opacity: 0.45 } : null]}>{option.label}</Text>
|
|
166
268
|
</Pressable>
|
|
167
269
|
);
|
|
168
270
|
}
|
|
@@ -177,14 +279,6 @@ function IssueList({ issues, claim, ...rowProps }: RowProps & { issues: NextUpIs
|
|
|
177
279
|
);
|
|
178
280
|
}
|
|
179
281
|
|
|
180
|
-
// What tells me whether to pick it up: where it lives and how old it is, then priority, effort and scope as tags [NXT-10].
|
|
181
|
-
// The type is the mark. The sheet has the full values.
|
|
182
|
-
const fullFacts = (issue: NextUpIssue) => [
|
|
183
|
-
`${issue.repo}#${issue.number}`,
|
|
184
|
-
`${ago(issue.createdAt)} old`,
|
|
185
|
-
...[issue.type, issue.priority, issue.effort, issue.scope].filter((v): v is string => !!v),
|
|
186
|
-
];
|
|
187
|
-
|
|
188
282
|
// An open PR that closes it means someone may already be on it [NXT-10].
|
|
189
283
|
function prSignal(issue: NextUpIssue): Chip[] {
|
|
190
284
|
const [first, ...more] = issue.openPrs;
|
|
@@ -192,36 +286,10 @@ function prSignal(issue: NextUpIssue): Chip[] {
|
|
|
192
286
|
return [{ text: `PR by ${first.author ?? "someone"}${more.length ? ` +${more.length}` : ""}`, tone: "warn" }];
|
|
193
287
|
}
|
|
194
288
|
|
|
195
|
-
//
|
|
196
|
-
function
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
const tags = [
|
|
200
|
-
issue.priority ? { key: "priority", text: shortValue(issue.priority), color: priorityColor } : null,
|
|
201
|
-
issue.effort ? { key: "effort", text: shortValue(issue.effort) } : null,
|
|
202
|
-
issue.scope ? { key: "scope", text: shortValue(issue.scope) } : null,
|
|
203
|
-
].filter((tag): tag is { key: string; text: string; color?: string } => !!tag);
|
|
204
|
-
if (tags.length === 0) return null;
|
|
205
|
-
return (
|
|
206
|
-
<View style={[styles.wrap, { gap: 4, marginTop: 2 }]}>
|
|
207
|
-
{tags.map((tag) => (
|
|
208
|
-
<Text
|
|
209
|
-
key={tag.key}
|
|
210
|
-
style={{
|
|
211
|
-
fontSize: 11,
|
|
212
|
-
color: tag.color ?? styles.c.foregroundMuted,
|
|
213
|
-
borderWidth: 1,
|
|
214
|
-
borderColor: tag.color ?? styles.c.border,
|
|
215
|
-
borderRadius: 4,
|
|
216
|
-
paddingHorizontal: 5,
|
|
217
|
-
paddingVertical: 1,
|
|
218
|
-
}}
|
|
219
|
-
>
|
|
220
|
-
{tag.text}
|
|
221
|
-
</Text>
|
|
222
|
-
))}
|
|
223
|
-
</View>
|
|
224
|
-
);
|
|
289
|
+
// What an issue's sheet fetches when it opens; resting the pointer on its card fetches the same ahead [ATT-06].
|
|
290
|
+
function issueDetailsQuery(issue: NextUpIssue, fetchDetails: FetchDetails): DetailsQuery {
|
|
291
|
+
const subject = { kind: "issue" as const, repo: issue.repo, number: issue.number };
|
|
292
|
+
return { queryKey: detailsKey(subject, undefined, false), queryFn: () => fetchDetails({ subject, checks: false }) };
|
|
225
293
|
}
|
|
226
294
|
|
|
227
295
|
// The type as the card's mark: red bugs, green features and epics, amber debt, the rest quiet.
|
|
@@ -230,6 +298,9 @@ const TYPE_TONES: Record<string, Tone> = { bug: "bad", feature: "good", epic: "g
|
|
|
230
298
|
// Its main action and ›; tapping it opens the sheet with the description, Claim or Unclaim [ATT-06, NXT-07].
|
|
231
299
|
function IssueRow({ issue, claim, first, agents, login, busy, fetchDetails, onStart, onOptions, onClaim, onCloseIssue, onOpenAgent }: RowProps & { issue: NextUpIssue; claim: boolean; first: boolean }) {
|
|
232
300
|
const [sheet, setSheet] = useState(false);
|
|
301
|
+
// The sheet opens at once; what it fetches fills in [ATT-06].
|
|
302
|
+
const open = () => setSheet(true);
|
|
303
|
+
const prefetch = usePrefetchOnRest(issueDetailsQuery(issue, fetchDetails));
|
|
233
304
|
// Closing asks first, with the reason and an optional comment [NXT-11, SAFE-01].
|
|
234
305
|
const [closing, setClosing] = useState(false);
|
|
235
306
|
// An open session leads; without one, Start does [SES-03].
|
|
@@ -243,9 +314,10 @@ function IssueRow({ issue, claim, first, agents, login, busy, fetchDetails, onSt
|
|
|
243
314
|
mark={{ icon: TYPE_ICONS[type] ?? "issue", tone: TYPE_TONES[type] ?? "neutral" }}
|
|
244
315
|
title={issue.title}
|
|
245
316
|
accessibilityLabel={`${issue.type ? `${issue.type}: ` : ""}${issue.title}, more`}
|
|
246
|
-
meta={{ place:
|
|
247
|
-
extra={<
|
|
248
|
-
onOpen={
|
|
317
|
+
meta={{ place: { repo: issue.repo, number: issue.number, login }, when: `${ago(issue.createdAt)} old`, signals: prSignal(issue) }}
|
|
318
|
+
extra={<IssuePills issue={issue} />}
|
|
319
|
+
onOpen={open}
|
|
320
|
+
hover={prefetch}
|
|
249
321
|
busy={busy.has(issue.key)}
|
|
250
322
|
primary={
|
|
251
323
|
sessions[0]
|
|
@@ -253,7 +325,7 @@ function IssueRow({ issue, claim, first, agents, login, busy, fetchDetails, onSt
|
|
|
253
325
|
: // Claim first so teammates see it's taken [NXT-05].
|
|
254
326
|
{ label: startLabel, accessibilityLabel: `${startLabel} ${issue.title}`, icon: "agent", onPress: () => onStart(issue, claim) }
|
|
255
327
|
}
|
|
256
|
-
secondary={[{ label: `Details for #${issue.number}`, icon: "chevronRight", onPress:
|
|
328
|
+
secondary={[{ label: `Details for #${issue.number}`, icon: "chevronRight", onPress: open }]}
|
|
257
329
|
confirm={
|
|
258
330
|
closing
|
|
259
331
|
? {
|
|
@@ -303,11 +375,7 @@ function IssueSheet({
|
|
|
303
375
|
onCloseIssue: () => void;
|
|
304
376
|
onClose: () => void;
|
|
305
377
|
}) {
|
|
306
|
-
const details = useQuery({
|
|
307
|
-
queryKey: ["attention-span", "details", issue.key, false],
|
|
308
|
-
queryFn: () => fetchDetails({ subject: { kind: "issue", repo: issue.repo, number: issue.number }, checks: false }),
|
|
309
|
-
staleTime: 60_000,
|
|
310
|
-
});
|
|
378
|
+
const details = useQuery({ ...issueDetailsQuery(issue, fetchDetails), staleTime: DETAILS_STALE_MS });
|
|
311
379
|
const close = (then: () => void) => () => (onClose(), then());
|
|
312
380
|
const startLabel = claim ? "Claim & start" : "Start";
|
|
313
381
|
const withOptions = close(() => onOptions(issue, claim, startLabel));
|
|
@@ -326,10 +394,11 @@ function IssueSheet({
|
|
|
326
394
|
]),
|
|
327
395
|
claim
|
|
328
396
|
? { key: "claim", icon: "claim", label: "Claim", detail: "Assigns you, without starting a session", onPress: close(() => onClaim(issue, true)) }
|
|
329
|
-
: { key: "unclaim", icon: "unclaim", label: "Unclaim", detail: "Removes you as assignee, so it goes back to Unclaimed", onPress: close(() => onClaim(issue, false)) },
|
|
397
|
+
: { key: "unclaim", icon: "unclaim", label: "Unclaim", detail: "Removes you as assignee, so it goes back to Unclaimed", housekeeping: true, onPress: close(() => onClaim(issue, false)) },
|
|
330
398
|
{ key: "github", icon: "github", label: "Open issue on GitHub", detail: `${issue.repo}#${issue.number}`, onPress: close(() => void openExternalUrl(issue.url)) },
|
|
331
399
|
...(sessions.length ? [startAnotherEntry(true, withOptions)] : []),
|
|
332
|
-
|
|
400
|
+
// Giving it up or closing it sits apart, below the work [ATT-06].
|
|
401
|
+
{ key: "close", icon: "issueClosed", label: "Close issue", detail: "Asks first: as completed or not planned, with an optional comment", housekeeping: true, onPress: close(onCloseIssue) },
|
|
333
402
|
];
|
|
334
403
|
return (
|
|
335
404
|
<ActionSheet
|
|
@@ -337,11 +406,14 @@ function IssueSheet({
|
|
|
337
406
|
onClose={onClose}
|
|
338
407
|
top={
|
|
339
408
|
<>
|
|
340
|
-
|
|
409
|
+
{/* The sheet always names the owner, even of my own repos. */}
|
|
410
|
+
<Meta lead={<PlaceText place={{ repo: issue.repo, number: issue.number, login: null }} />} facts={[`${ago(issue.createdAt)} old`, ...(issue.type ? [issue.type] : [])]} chips={prSignal(issue)} />
|
|
411
|
+
<IssuePills issue={issue} full />
|
|
341
412
|
</>
|
|
342
413
|
}
|
|
343
414
|
entries={entries}
|
|
344
|
-
|
|
415
|
+
// One line per open PR the card already knows closes it [ATT-06].
|
|
416
|
+
bottom={<DetailLines details={details.data} loading={details.isLoading} error={details.error} linkedLabel="PR" expected={issue.openPrs.length} />}
|
|
345
417
|
/>
|
|
346
418
|
);
|
|
347
419
|
}
|
package/client/session-menu.ts
CHANGED
|
@@ -13,7 +13,8 @@ export function agentSignal(agent: AgentSummary): Chip {
|
|
|
13
13
|
// A session as a sheet line, under the name of what started it: it opens the session, its state at the end [SES-03, ATT-07].
|
|
14
14
|
export function sessionEntry(agent: AgentSummary, label: string, onOpen: (agentId: string) => void): SheetEntry {
|
|
15
15
|
const signal = agentSignal(agent);
|
|
16
|
-
|
|
16
|
+
// Non-breaking, so "2h ago" doesn't split across lines beside a badge on phones.
|
|
17
|
+
const when = agent.lastActivityAt ? `${ago(agent.lastActivityAt)} ago`.replace(/ /g, "\u00a0") : null;
|
|
17
18
|
return {
|
|
18
19
|
key: agent.id,
|
|
19
20
|
icon: "agent",
|