@reviewflow/ui 6.25.0 → 6.27.0
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/package.json +6 -2
- package/src/board/pull-request-row.tsx +57 -18
- package/src/components/branch-diff/diff-change-mark.tsx +86 -0
- package/src/components/branch-diff/use-collapsed-files.ts +3 -0
- package/src/components/checkout-sync-buttons.tsx +76 -0
- package/src/components/checkout-view.tsx +789 -0
- package/src/components/commit-list.tsx +172 -0
- package/src/components/diff-viewer.tsx +1 -0
- package/src/components/omitted-files.tsx +32 -0
- package/src/components/pull-request-commits.tsx +4 -91
- package/src/components/pull-request-diff-view.tsx +1 -25
- package/src/components/pull-request-diff-viewer.tsx +145 -37
- package/src/components/pull-request-panel.tsx +46 -23
- package/src/components/pull-request-repo-name.tsx +27 -0
- package/src/components/pull-request-screen.tsx +34 -26
- package/src/components/remove-worktree-button.tsx +233 -0
- package/src/components/repo-overview.tsx +615 -0
- package/src/index.ts +44 -0
- package/src/prStatus.ts +8 -1
- package/src/services/checkoutSummary.ts +32 -0
- package/src/slots.tsx +8 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CheckoutBranch, CheckoutStatus } from "@reviewflow/sdk";
|
|
2
|
+
|
|
3
|
+
const trackParts = (ahead: number | null, behind: number | null): string[] => [
|
|
4
|
+
...(ahead === null || ahead === 0 ? [] : [`${String(ahead)} to push`]),
|
|
5
|
+
...(behind === null || behind === 0 ? [] : [`${String(behind)} to pull`]),
|
|
6
|
+
];
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* What a checkout holds that its remote does not, and the reverse, as short
|
|
10
|
+
* phrases; empty when it is clean and in sync. Push and pull are as of the
|
|
11
|
+
* last fetch.
|
|
12
|
+
*/
|
|
13
|
+
export const checkoutSummaryParts = (status: CheckoutStatus): string[] => {
|
|
14
|
+
const uncommitted = status.modified + status.untracked;
|
|
15
|
+
const upstreamParts = ((): string[] => {
|
|
16
|
+
if (status.branch === null) return [];
|
|
17
|
+
if (status.upstream === null) return ["not published"];
|
|
18
|
+
if (status.ahead === null) return ["upstream gone"];
|
|
19
|
+
return trackParts(status.ahead, status.behind);
|
|
20
|
+
})();
|
|
21
|
+
return [
|
|
22
|
+
...(uncommitted === 0 ? [] : [`${String(uncommitted)} uncommitted`]),
|
|
23
|
+
...upstreamParts,
|
|
24
|
+
];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** Where a branch stands against the remote branch it tracks; gone is a badge of its own. */
|
|
28
|
+
export const branchTrackParts = (branch: CheckoutBranch): string[] => {
|
|
29
|
+
if (branch.upstreamGone) return [];
|
|
30
|
+
if (branch.upstream === null) return ["not published"];
|
|
31
|
+
return trackParts(branch.ahead, branch.behind);
|
|
32
|
+
};
|
package/src/slots.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { PrStatus } from "@reviewflow/sdk";
|
|
2
|
+
import type { Accent } from "alouette";
|
|
1
3
|
import type { ReactNode } from "react";
|
|
2
4
|
import { createContext, use } from "react";
|
|
3
5
|
|
|
@@ -25,6 +27,12 @@ export interface PullRequestSlots {
|
|
|
25
27
|
* checkout is configured. Absent: the message stands alone.
|
|
26
28
|
*/
|
|
27
29
|
renderRepositoryAction?: (ownerRepo: string) => ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* The status badge's accent, per status, over `prStatusAccents`: an app with
|
|
32
|
+
* an accent of its own for one (a theme it generates beside alouette's, cast
|
|
33
|
+
* to `Accent`) passes it here.
|
|
34
|
+
*/
|
|
35
|
+
prStatusAccents?: Partial<Record<PrStatus, Accent | undefined>>;
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
const SlotsContext = createContext<PullRequestSlots>({});
|