@andrioid/paseo-attention-span 0.3.2 → 0.3.3
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/coverage-settings.tsx +3 -16
- package/docs/architecture.md +1 -1
- package/index.client.tsx +5 -15
- package/package.json +1 -1
- package/requirements.yaml +0 -1
- package/client/host.ts +0 -8
|
@@ -5,8 +5,7 @@ import { useState } from "react";
|
|
|
5
5
|
import { Text, View } from "react-native";
|
|
6
6
|
import * as rpc from "../shared/rpc";
|
|
7
7
|
import type { ConfigStatus, CoverageKind } from "../shared/setup";
|
|
8
|
-
import {
|
|
9
|
-
import { useHostLabel } from "./host";
|
|
8
|
+
import { VIEW_QUERY_KEY } from "./data";
|
|
10
9
|
import { Button, StylesProvider, useStyles } from "./ui";
|
|
11
10
|
|
|
12
11
|
const COVERAGE_QUERY_KEY = ["attention-span", "coverage"] as const;
|
|
@@ -16,26 +15,14 @@ const CAPTION = { marginTop: -24, marginBottom: 16 };
|
|
|
16
15
|
|
|
17
16
|
// Settings → Plugins → Attention Span: which orgs and repos the lists cover, and where Next up looks,
|
|
18
17
|
// saved to config.json [SRC-02, NXT-04].
|
|
19
|
-
export function CoverageSettings({ theme, layout
|
|
18
|
+
export function CoverageSettings({ theme, layout }: PluginSurfaceProps) {
|
|
20
19
|
return (
|
|
21
20
|
<StylesProvider theme={theme} compact={layout.compact}>
|
|
22
|
-
<
|
|
23
|
-
<HostLine host={host} />
|
|
24
|
-
<Coverage />
|
|
25
|
-
</View>
|
|
21
|
+
<Coverage />
|
|
26
22
|
</StylesProvider>
|
|
27
23
|
);
|
|
28
24
|
}
|
|
29
25
|
|
|
30
|
-
// Which host's config.json this edits, and its GitHub account, when there are several hosts [REACH-02].
|
|
31
|
-
function HostLine({ host }: Pick<PluginSurfaceProps, "host">) {
|
|
32
|
-
const styles = useStyles();
|
|
33
|
-
const label = useHostLabel(host);
|
|
34
|
-
const login = useAttention().data?.login;
|
|
35
|
-
if (!label) return null;
|
|
36
|
-
return <Text style={styles.muted}>{login ? `These settings are for ${label}, signed in to GitHub as @${login}.` : `These settings are for ${label}.`}</Text>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
26
|
function Coverage() {
|
|
40
27
|
const styles = useStyles();
|
|
41
28
|
const queryClient = useQueryClient();
|
package/docs/architecture.md
CHANGED
|
@@ -25,8 +25,8 @@ flowchart LR
|
|
|
25
25
|
|
|
26
26
|
- **Paseo plugin**, installed per daemon.
|
|
27
27
|
- Client: one screen and a sidebar header item. React Native primitives only, so it works on phone and desktop [REACH-01].
|
|
28
|
-
- With more than one host in the app, each host runs its own copy, with its own `gh` login, `config.json` and `state.json`. The sidebar row shows the host's name beside the count, and settings say which host they're for and its GitHub login. The app doesn't say which other hosts have the plugin, so any second host counts [REACH-02].
|
|
29
28
|
- Server: RPC handlers for fetching and for GitHub actions.
|
|
29
|
+
- With several hosts, each runs its own copy, with its own `gh` login, `config.json` and `state.json`. Paseo shows one sidebar row for all of them and switches hosts with the picker in the screen's header; the row follows the host in view, else the one picked last.
|
|
30
30
|
- **GitHub access** goes through the host's existing `gh` login. The plugin stores no token [SEC-01].
|
|
31
31
|
- **Setup checklist** [SET-01]: when a refresh fails, the screen asks the server what setup needs (`gh api user` for whether `gh` is there and who it's signed in as, and whether `config.json` parses). If `gh` is missing or signed out, or the file is broken, a checklist takes the tabs' place. Each line says how to fix it, and Check again refreshes. It also lists what's covered, the Paseo projects with a GitHub remote, and which profile sessions will use. Other failures, like a network error, stay a red line above the tabs.
|
|
32
32
|
- **Settings screen** [SRC-02], under Settings → Plugins → Attention Span and the gear next to ⟳: orgs and repos, one per row. Each is checked with `gh api users/<org>` (it must be an organization, since searches use `org:`) or `gh api repos/<owner>/<name>` before it's saved, and GitHub's exact name is kept. Saving rewrites only `orgs` and `repos` in `config.json`, refuses a file that doesn't parse, and refreshes the lists. A Replies section has one switch, Follow threads I've commented on, which writes only `followThreads` [ATT-17].
|
package/index.client.tsx
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import type { PluginClientContext, PluginScreenProps, PluginSidebarItemProps } from "@getpaseo/plugin/client";
|
|
2
2
|
import { SidebarRow } from "@getpaseo/plugin/client/ui";
|
|
3
|
-
import { Text
|
|
3
|
+
import { Text } from "react-native";
|
|
4
4
|
import { AttentionScreen } from "./client/attention-screen";
|
|
5
5
|
import { CoverageSettings } from "./client/coverage-settings";
|
|
6
6
|
import { useAttention } from "./client/data";
|
|
7
7
|
import { returnFromFeedback } from "./client/feedback";
|
|
8
|
-
import { useHostLabel } from "./client/host";
|
|
9
8
|
import { ICONS } from "./client/icons";
|
|
10
9
|
|
|
11
|
-
// The count, visible from anywhere in Paseo [ATT-09]
|
|
12
|
-
function SidebarItem({ theme,
|
|
10
|
+
// The count, visible from anywhere in Paseo [ATT-09].
|
|
11
|
+
function SidebarItem({ theme, currentScreen, openScreen }: PluginSidebarItemProps) {
|
|
13
12
|
const { data } = useAttention();
|
|
14
|
-
const hostLabel = useHostLabel(host);
|
|
15
13
|
const count = data?.count ?? 0;
|
|
16
|
-
const muted = { color: theme.colors.foregroundMuted, fontSize: 12 };
|
|
17
14
|
return (
|
|
18
15
|
<SidebarRow
|
|
19
16
|
icon={ICONS.logo}
|
|
@@ -21,15 +18,8 @@ function SidebarItem({ theme, host, currentScreen, openScreen }: PluginSidebarIt
|
|
|
21
18
|
active={currentScreen?.screenId === "attention"}
|
|
22
19
|
onPress={() => openScreen({ screenId: "attention" })}
|
|
23
20
|
trailing={
|
|
24
|
-
|
|
25
|
-
<
|
|
26
|
-
{hostLabel ? (
|
|
27
|
-
<Text style={[muted, { maxWidth: 120 }]} numberOfLines={1}>
|
|
28
|
-
{hostLabel}
|
|
29
|
-
</Text>
|
|
30
|
-
) : null}
|
|
31
|
-
{count > 0 ? <Text style={[muted, data?.feeds.live.error ? { color: theme.colors.statusDanger } : null]}>{count}</Text> : null}
|
|
32
|
-
</View>
|
|
21
|
+
count > 0 ? (
|
|
22
|
+
<Text style={{ color: data?.feeds.live.error ? theme.colors.statusDanger : theme.colors.foregroundMuted, fontSize: 12 }}>{count}</Text>
|
|
33
23
|
) : undefined
|
|
34
24
|
}
|
|
35
25
|
/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrioid/paseo-attention-span",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
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": {
|
package/requirements.yaml
CHANGED
|
@@ -114,7 +114,6 @@ non_functional:
|
|
|
114
114
|
PRIV-01: may keep a local copy of the GitHub data it shows; so that Attention Span shows instantly after a restart.
|
|
115
115
|
reach:
|
|
116
116
|
REACH-01: works in Paseo on both phone and desktop; so that I can triage from anywhere.
|
|
117
|
-
REACH-02: names its host in the sidebar and in settings when Paseo knows more than one host; so that I can tell which host's list and config.json I'm looking at.
|
|
118
117
|
freshness:
|
|
119
118
|
FRESH-01: stays current without me refreshing it; so that its count can be trusted.
|
|
120
119
|
FRESH-02: shows what I just did on GitHub right away, and keeps showing it until GitHub's search catches up; so that I never refresh to see it.
|
package/client/host.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type PluginHostProps, useHosts } from "@getpaseo/plugin/client";
|
|
2
|
-
|
|
3
|
-
// This host's name, once the app knows more than one host, so two copies of Attention Span can be told apart [REACH-02].
|
|
4
|
-
// Hosts without the plugin count too: the app can't say which hosts have it.
|
|
5
|
-
export function useHostLabel(host: PluginHostProps["host"]): string | null {
|
|
6
|
-
const hosts = useHosts();
|
|
7
|
-
return hosts.length > 1 ? host.label : null;
|
|
8
|
-
}
|