@andrioid/paseo-attention-span 0.4.1 → 0.4.2
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/client/attention-screen.tsx +6 -7
- package/client/next-up.tsx +8 -10
- package/package.json +1 -1
|
@@ -428,15 +428,14 @@ function AttentionList({
|
|
|
428
428
|
unclaimed={view.unclaimed}
|
|
429
429
|
unclaimedFrom={view.unclaimedFrom}
|
|
430
430
|
selected={view.scopes}
|
|
431
|
-
onSelect={(scopes) => {
|
|
432
|
-
attention.setView({ ...view, scopes });
|
|
433
|
-
saveScopes({ scopes }).catch((error) => toast.error(`Saving the filter failed: ${(error as Error).message}`));
|
|
434
|
-
}}
|
|
435
431
|
sources={nextUpSources(view.config)}
|
|
436
432
|
selectedSources={view.sources}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
433
|
+
// One setView for both, so clearing scopes and sources together can't put either back.
|
|
434
|
+
onFilter={(change) => {
|
|
435
|
+
attention.setView({ ...view, ...change });
|
|
436
|
+
const failed = (error: Error) => toast.error(`Saving the filter failed: ${error.message}`);
|
|
437
|
+
if (change.scopes) saveScopes({ scopes: change.scopes }).catch(failed);
|
|
438
|
+
if (change.sources) saveSources({ sources: change.sources }).catch(failed);
|
|
440
439
|
}}
|
|
441
440
|
agents={actions.agents}
|
|
442
441
|
login={view.login}
|
package/client/next-up.tsx
CHANGED
|
@@ -21,11 +21,11 @@ interface Props {
|
|
|
21
21
|
unclaimedFrom: UnclaimedSource;
|
|
22
22
|
// Scopes I ticked in the filter; none means all [NXT-03].
|
|
23
23
|
selected: string[];
|
|
24
|
-
onSelect: (scopes: string[]) => void;
|
|
25
24
|
// Where Next up looks, and the sources I ticked; none means all [NXT-09].
|
|
26
25
|
sources: NextUpSource[];
|
|
27
26
|
selectedSources: string[];
|
|
28
|
-
|
|
27
|
+
// Change either filter or both at once, so Clear empties both in one go.
|
|
28
|
+
onFilter: (change: { scopes?: string[]; sources?: string[] }) => void;
|
|
29
29
|
agents: AgentSummary[];
|
|
30
30
|
// Mine, so my repos show without the owner.
|
|
31
31
|
login: string | null;
|
|
@@ -41,10 +41,10 @@ interface Props {
|
|
|
41
41
|
onOpenAgent: (agentId: string) => void;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
type RowProps = Omit<Props, "assigned" | "unclaimed" | "unclaimedFrom" | "selected" | "
|
|
44
|
+
type RowProps = Omit<Props, "assigned" | "unclaimed" | "unclaimedFrom" | "selected" | "sources" | "selectedSources" | "onFilter">;
|
|
45
45
|
|
|
46
46
|
// 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,
|
|
47
|
+
export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, sources, selectedSources, onFilter, ...rowProps }: Props) {
|
|
48
48
|
const styles = useStyles();
|
|
49
49
|
const scopes = useMemo(() => [...new Set(unclaimed.map((issue) => issue.scope).filter((scope): scope is string => !!scope))].sort(), [unclaimed]);
|
|
50
50
|
// Filter by the scopes I picked last time [NXT-03]; a picked scope with no issues left is ignored.
|
|
@@ -54,8 +54,8 @@ export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, onSel
|
|
|
54
54
|
const shown = unclaimed.filter(
|
|
55
55
|
(issue) => (active.length === 0 || (issue.scope && active.includes(issue.scope))) && (activeSources.length === 0 || issue.sources.some((id) => activeSources.includes(id))),
|
|
56
56
|
);
|
|
57
|
-
const toggle = (scope: string) =>
|
|
58
|
-
const toggleSource = (id: string) =>
|
|
57
|
+
const toggle = (scope: string) => onFilter({ scopes: active.includes(scope) ? active.filter((s) => s !== scope) : [...active, scope] });
|
|
58
|
+
const toggleSource = (id: string) => onFilter({ sources: activeSources.includes(id) ? activeSources.filter((s) => s !== id) : [...activeSources, id] });
|
|
59
59
|
const narrowedBy = [activeSources.length ? "sources" : null, active.length ? "scopes" : null].filter(Boolean).join(" and ");
|
|
60
60
|
const [filtering, setFiltering] = useState(false);
|
|
61
61
|
const picked = active.length + activeSources.length;
|
|
@@ -92,10 +92,7 @@ export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, onSel
|
|
|
92
92
|
{filtering ? (
|
|
93
93
|
<FilterSheet
|
|
94
94
|
groups={groups}
|
|
95
|
-
onClear={() => {
|
|
96
|
-
onSelect([]);
|
|
97
|
-
onSelectSources([]);
|
|
98
|
-
}}
|
|
95
|
+
onClear={() => onFilter({ scopes: [], sources: [] })}
|
|
99
96
|
onClose={() => setFiltering(false)}
|
|
100
97
|
/>
|
|
101
98
|
) : null}
|
|
@@ -154,6 +151,7 @@ function FilterOption({ label, checked, first, onPress }: { label: string; check
|
|
|
154
151
|
<Pressable
|
|
155
152
|
accessibilityRole="checkbox"
|
|
156
153
|
accessibilityState={{ checked }}
|
|
154
|
+
aria-checked={checked}
|
|
157
155
|
accessibilityLabel={label}
|
|
158
156
|
onPress={onPress}
|
|
159
157
|
{...hover}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrioid/paseo-attention-span",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "For when your attention is spread thin: the GitHub issues and pull requests waiting on you, grouped by why, with one-tap Paseo sessions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|