@omercnet/paseo-pr-radar 3.0.1-next.297.1 → 3.0.1
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/pr-radar.tsx +1 -47
- package/package.json +1 -1
- package/server/viewer-scope.ts +1 -20
- package/server/changes.ts +0 -27
package/client/pr-radar.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { openExternalUrl, type PluginSurfaceProps, useRpc } from "@getpaseo/plugin/client";
|
|
2
|
-
import { copyText } from "@getpaseo/plugin/client/react-native";
|
|
3
2
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
4
3
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
4
|
import { ActivityIndicator, FlatList, Pressable, Text, TextInput, View } from "react-native";
|
|
@@ -85,13 +84,6 @@ export function PrRadar({
|
|
|
85
84
|
const [now, setNow] = useState(() => Date.now());
|
|
86
85
|
const [openError, setOpenError] = useState<string | null>(null);
|
|
87
86
|
const [actionNotice, setActionNotice] = useState<string | null>(null);
|
|
88
|
-
// A fresh object per copy re-arms the reset timer; the effect cleanup cancels it on re-copy and unmount.
|
|
89
|
-
const [copied, setCopied] = useState<{ id: string } | null>(null);
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
if (!copied) return;
|
|
92
|
-
const timer = setTimeout(() => setCopied(null), 1500);
|
|
93
|
-
return () => clearTimeout(timer);
|
|
94
|
-
}, [copied]);
|
|
95
87
|
|
|
96
88
|
const {
|
|
97
89
|
paseo,
|
|
@@ -365,7 +357,6 @@ export function PrRadar({
|
|
|
365
357
|
},
|
|
366
358
|
warningText: { color: theme.colors.foregroundMuted, fontSize: 12, lineHeight: 17 },
|
|
367
359
|
row: {
|
|
368
|
-
position: "relative" as const,
|
|
369
360
|
flexDirection: "row" as const,
|
|
370
361
|
marginHorizontal: gutter,
|
|
371
362
|
borderTopWidth: 1,
|
|
@@ -379,22 +370,7 @@ export function PrRadar({
|
|
|
379
370
|
paddingLeft: 12,
|
|
380
371
|
gap: 6,
|
|
381
372
|
},
|
|
382
|
-
rowTop: {
|
|
383
|
-
flexDirection: "row" as const,
|
|
384
|
-
alignItems: "center" as const,
|
|
385
|
-
gap: 8,
|
|
386
|
-
paddingRight: 80,
|
|
387
|
-
},
|
|
388
|
-
copyButton: {
|
|
389
|
-
position: "absolute" as const,
|
|
390
|
-
top: 10,
|
|
391
|
-
right: 0,
|
|
392
|
-
minHeight: 28,
|
|
393
|
-
justifyContent: "center" as const,
|
|
394
|
-
paddingHorizontal: 8,
|
|
395
|
-
borderRadius: 6,
|
|
396
|
-
},
|
|
397
|
-
copyText: { color: theme.colors.foregroundMuted, fontSize: 11, fontWeight: "600" as const },
|
|
373
|
+
rowTop: { flexDirection: "row" as const, alignItems: "center" as const, gap: 8 },
|
|
398
374
|
identifier: {
|
|
399
375
|
color: theme.colors.foregroundMuted,
|
|
400
376
|
fontSize: 11,
|
|
@@ -476,18 +452,6 @@ export function PrRadar({
|
|
|
476
452
|
}
|
|
477
453
|
}, []);
|
|
478
454
|
|
|
479
|
-
const copyPrLink = useCallback(async (row: RadarRow) => {
|
|
480
|
-
setOpenError(null);
|
|
481
|
-
setCopied(null);
|
|
482
|
-
try {
|
|
483
|
-
await copyText(row.url);
|
|
484
|
-
setOpenError(null);
|
|
485
|
-
setCopied({ id: row.id });
|
|
486
|
-
} catch {
|
|
487
|
-
setOpenError(`Could not copy the link for ${row.repository}#${row.number ?? "PR"}.`);
|
|
488
|
-
}
|
|
489
|
-
}, []);
|
|
490
|
-
|
|
491
455
|
const renderRow = ({ item }: { item: RadarRow }) => {
|
|
492
456
|
const color = bucketColor(item.bucket, theme.colors);
|
|
493
457
|
const age = formatAge(item.activityAt, now);
|
|
@@ -612,16 +576,6 @@ export function PrRadar({
|
|
|
612
576
|
{layout.compact ? actions : null}
|
|
613
577
|
</View>
|
|
614
578
|
{layout.compact ? null : actions}
|
|
615
|
-
<Pressable
|
|
616
|
-
accessibilityRole="button"
|
|
617
|
-
accessibilityLabel={`Copy link to pull request ${item.repository} ${item.number ?? ""}`}
|
|
618
|
-
onPress={() => void copyPrLink(item)}
|
|
619
|
-
style={({ pressed }) => [styles.copyButton, pressed && styles.refreshPressed]}
|
|
620
|
-
>
|
|
621
|
-
<Text style={styles.copyText} accessibilityLiveRegion="polite">
|
|
622
|
-
{copied?.id === item.id ? "Copied" : "Copy link"}
|
|
623
|
-
</Text>
|
|
624
|
-
</Pressable>
|
|
625
579
|
</View>
|
|
626
580
|
);
|
|
627
581
|
};
|
package/package.json
CHANGED
package/server/viewer-scope.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { dirname, join } from "node:path";
|
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
6
|
import type { z } from "zod";
|
|
7
7
|
import type { acknowledgeViewerScope, GitHubInboxItem, viewerScope } from "../shared/viewer-scope";
|
|
8
|
-
import { mergeChanges } from "./changes";
|
|
9
8
|
|
|
10
9
|
const execFileAsync = promisify(execFile);
|
|
11
10
|
const SEARCH_LIMIT = 100;
|
|
@@ -363,27 +362,9 @@ export async function resolveViewerScope({
|
|
|
363
362
|
const nextPending: Record<string, string[]> = {};
|
|
364
363
|
for (const item of inboxItems) {
|
|
365
364
|
const prior = previous.items[item.id];
|
|
366
|
-
const state = enrichment.states.get(item.id);
|
|
367
365
|
const detected =
|
|
368
366
|
initialized && (!prior || enrichment.states.has(item.id)) ? detectChanges(prior, item) : [];
|
|
369
|
-
item.changes =
|
|
370
|
-
Checks:
|
|
371
|
-
state?.statusCheckRollup === null || item.checksStatus !== "none"
|
|
372
|
-
? item.checksStatus
|
|
373
|
-
: undefined,
|
|
374
|
-
Review:
|
|
375
|
-
state?.reviewDecision === null || item.reviewDecision !== null
|
|
376
|
-
? (item.reviewDecision ?? "none")
|
|
377
|
-
: undefined,
|
|
378
|
-
Mergeable:
|
|
379
|
-
item.mergeable === "MERGEABLE" || item.mergeable === "CONFLICTING"
|
|
380
|
-
? item.mergeable.toLowerCase()
|
|
381
|
-
: undefined,
|
|
382
|
-
"Merge state":
|
|
383
|
-
item.mergeStateStatus && item.mergeStateStatus.toUpperCase() !== "UNKNOWN"
|
|
384
|
-
? item.mergeStateStatus
|
|
385
|
-
: undefined,
|
|
386
|
-
});
|
|
367
|
+
item.changes = [...new Set([...(previous.pendingChanges[item.id] ?? []), ...detected])];
|
|
387
368
|
nextItems[item.id] = prior && !enrichment.states.has(item.id) ? prior : storedItem(item);
|
|
388
369
|
if (item.changes.length > 0) nextPending[item.id] = item.changes;
|
|
389
370
|
}
|
package/server/changes.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const TRANSITION = /^(.+?): (.+) → (.+)$/;
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Reports each field's net change from its first recorded origin to its trustworthy current value.
|
|
5
|
-
* Legacy pending lists deduplicate repeated transitions, so their last entry is not the latest state.
|
|
6
|
-
*/
|
|
7
|
-
export function mergeChanges(
|
|
8
|
-
pending: string[],
|
|
9
|
-
detected: string[],
|
|
10
|
-
current: Readonly<Record<string, string | undefined>>,
|
|
11
|
-
): string[] {
|
|
12
|
-
const merged: string[] = [];
|
|
13
|
-
const seen = new Set<string>();
|
|
14
|
-
for (const change of [...pending, ...detected]) {
|
|
15
|
-
const next = TRANSITION.exec(change);
|
|
16
|
-
const to = next ? current[next[1]] : undefined;
|
|
17
|
-
if (!next || typeof to !== "string") {
|
|
18
|
-
if (!merged.includes(change)) merged.push(change);
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
const [, label, from] = next;
|
|
22
|
-
if (seen.has(label)) continue;
|
|
23
|
-
seen.add(label);
|
|
24
|
-
if (from !== to) merged.push(`${label}: ${from} → ${to}`);
|
|
25
|
-
}
|
|
26
|
-
return merged;
|
|
27
|
-
}
|