rvlib-shipkit 2.9.0 → 2.10.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/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/cli/cmd_Review.ts +2 -1
- package/src/review/cells.ts +548 -0
- package/src/review/format.ts +1 -1
- package/src/review/model.ts +29 -4
- package/src/review/previews.ts +124 -0
- package/src/review/routes.ts +82 -45
- package/src/review/store.ts +6 -5
- package/src/serve/hub-app/review/kind-view.tsx +21 -22
- package/src/serve/hub-app/review/kit.tsx +11 -12
- package/src/serve/hub-app/review/review-board.tsx +15 -13
- package/src/serve/hub-app/review/review-cells.tsx +241 -0
- package/src/serve/hub-app/review/review-kit.ts +79 -0
- package/src/serve/hub-app/review/review-list.tsx +87 -122
- package/src/serve/hub-app/review/review-page.tsx +22 -79
- package/src/serve/hub-app/review/review-st.ts +268 -698
- package/src/serve/hub-app/review/review-thread.tsx +301 -0
- package/src/serve/hub-app/review/review-views.tsx +322 -253
- package/src/serve/hub-app/review/thread-st.ts +770 -0
- package/src/serve/hub-app/review.css +234 -90
- package/src/serve/hub-app/review/review-answer.tsx +0 -249
|
@@ -1,117 +1,60 @@
|
|
|
1
1
|
// a repo's review page (`#page:review`, wiki build/shipkit/review.md, The review page): the cards on the left, the open
|
|
2
|
-
// one
|
|
3
|
-
//
|
|
4
|
-
// views, then its answer), the verdicts in a bar under the thumb. Another card opens at its top. The list is read while
|
|
5
|
-
// the page shows
|
|
2
|
+
// one as a chat on the right (review-thread.tsx). On a phone one pane at a time: the cards, or the card with its answer
|
|
3
|
+
// box and the verdicts under the thumb. Everything is read while the page shows
|
|
6
4
|
import { observer } from 'mobx-react-lite'
|
|
7
|
-
import { useEffect
|
|
5
|
+
import { useEffect } from 'react'
|
|
8
6
|
import { Group, Panel, Separator } from 'react-resizable-panels'
|
|
9
7
|
import type { RepoSt } from '../repo-st.ts'
|
|
10
|
-
import { ReviewForm, VerdictBar } from './review-answer.tsx'
|
|
11
8
|
import { ReviewList } from './review-list.tsx'
|
|
12
|
-
import type {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
const PANE_LABEL: Record<PhonePane, string> = { list: 'cards', card: 'card' }
|
|
9
|
+
import type { ReviewSt } from './review-st.ts'
|
|
10
|
+
import { ThreadColumn } from './review-thread.tsx'
|
|
16
11
|
|
|
17
12
|
export const ReviewPage = observer(({ app }: { app: RepoSt }) => {
|
|
18
13
|
const rv = app.review
|
|
19
|
-
const el = useRef<HTMLDivElement | null>(null)
|
|
20
14
|
useEffect(() => {
|
|
21
15
|
rv.start()
|
|
22
16
|
return () => rv.stop()
|
|
23
17
|
}, [rv])
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const node = el.current
|
|
26
|
-
if (node == null || typeof ResizeObserver === 'undefined') return
|
|
27
|
-
// the pick lands on the next frame: a relayout inside the callback is the observer's loop error
|
|
28
|
-
let raf = 0
|
|
29
|
-
const ro = new ResizeObserver(([e]) => {
|
|
30
|
-
const w = e!.contentRect.width
|
|
31
|
-
cancelAnimationFrame(raf)
|
|
32
|
-
raf = requestAnimationFrame(() => rv.fit(w))
|
|
33
|
-
})
|
|
34
|
-
ro.observe(node)
|
|
35
|
-
return () => {
|
|
36
|
-
cancelAnimationFrame(raf)
|
|
37
|
-
ro.disconnect()
|
|
38
|
-
}
|
|
39
|
-
}, [rv, rv.phone.on])
|
|
40
18
|
if (rv.phone.on)
|
|
41
19
|
return (
|
|
42
20
|
<div className="rv-phone">
|
|
43
|
-
<PhoneTop app={app} />
|
|
44
|
-
<div className="rv-phonetabs seg">
|
|
45
|
-
{(['list', 'card'] as const).map((p) => (
|
|
46
|
-
<button key={p} className={rv.phone.pane === p ? 'on' : ''} onClick={() => rv.phone.show(p)}>
|
|
47
|
-
{PANE_LABEL[p]}{p === 'list' && rv.pendingCount > 0 ? ` · ${rv.pendingCount}` : ''}
|
|
48
|
-
</button>
|
|
49
|
-
))}
|
|
50
|
-
</div>
|
|
51
21
|
{rv.phone.pane === 'list' ? (
|
|
52
|
-
|
|
22
|
+
<>
|
|
23
|
+
<PhoneTop app={app} />
|
|
24
|
+
<div className="rv-phonepane"><ReviewList rv={rv} /></div>
|
|
25
|
+
</>
|
|
53
26
|
) : (
|
|
54
|
-
<
|
|
55
|
-
<ReviewImage rv={rv} />
|
|
56
|
-
<ReviewForm rv={rv} />
|
|
57
|
-
</CardScroll>
|
|
27
|
+
<ThreadColumn rv={rv} />
|
|
58
28
|
)}
|
|
59
|
-
{rv.phone.pane === 'list' ? null : <VerdictBar rv={rv} />}
|
|
60
29
|
<Toast rv={rv} />
|
|
61
30
|
</div>
|
|
62
31
|
)
|
|
63
32
|
return (
|
|
64
33
|
<>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<Panel id="review-stack" defaultSize="68%" minSize={300} className="rv-pane" style={PANEL}>
|
|
74
|
-
<CardScroll rv={rv} className="rv-scroll">
|
|
75
|
-
<ReviewImage rv={rv} />
|
|
76
|
-
<ReviewForm rv={rv} />
|
|
77
|
-
</CardScroll>
|
|
34
|
+
<Toast rv={rv} />
|
|
35
|
+
<Group className="rv-cols" orientation="horizontal">
|
|
36
|
+
<Panel id="review-list" defaultSize="24%" minSize={180} className="rv-pane" style={PANEL}>
|
|
37
|
+
<ReviewList rv={rv} />
|
|
38
|
+
</Panel>
|
|
39
|
+
<Separator className="rsep" />
|
|
40
|
+
<Panel id="review-thread" defaultSize="76%" minSize={360} className="rv-pane" style={PANEL}>
|
|
41
|
+
<ThreadColumn rv={rv} />
|
|
78
42
|
</Panel>
|
|
79
|
-
|
|
80
|
-
<>
|
|
81
|
-
<Panel id="review-image" defaultSize="54%" minSize={300} className="rv-pane" style={PANEL}>
|
|
82
|
-
<CardScroll rv={rv} className="rv-scroll"><ReviewImage rv={rv} /></CardScroll>
|
|
83
|
-
</Panel>
|
|
84
|
-
<Separator className="rsep" />
|
|
85
|
-
<Panel id="review-form" defaultSize="26%" minSize={260} className="rv-pane" style={PANEL}>
|
|
86
|
-
<CardScroll rv={rv} className="rv-scroll"><ReviewForm rv={rv} /></CardScroll>
|
|
87
|
-
</Panel>
|
|
88
|
-
</>
|
|
89
|
-
)}
|
|
90
|
-
</Group>
|
|
43
|
+
</Group>
|
|
91
44
|
</>
|
|
92
45
|
)
|
|
93
46
|
})
|
|
94
47
|
|
|
95
|
-
/** the phone's top line: the way back to the hub (none in another tool's frame),
|
|
96
|
-
* panes, which leave it no room */
|
|
48
|
+
/** the phone's top line over the cards: the way back to the hub (none in another tool's frame), the repo, the count
|
|
49
|
+
* that waits on him. On a phone the page covers the hub's panes, which leave it no room */
|
|
97
50
|
export const PhoneTop = observer(({ app }: { app: RepoSt }) => (
|
|
98
51
|
<div className="rv-phonetop">
|
|
99
52
|
{app.home.embedded ? null : <button className="ghost" onClick={() => app.showReadme()}>◂ hub</button>}
|
|
100
53
|
<b>{app.name}</b>
|
|
101
|
-
<span className="rv-dim">{app.sel?.t === 'trailer' ? 'trailer' :
|
|
54
|
+
<span className="rv-dim">{app.sel?.t === 'trailer' ? 'trailer' : `review${app.review.pendingCount > 0 ? ` · ${app.review.pendingCount} waiting` : ''}`}</span>
|
|
102
55
|
</div>
|
|
103
56
|
))
|
|
104
57
|
|
|
105
|
-
/** a column of the open card: another card opens at its top, never where the last one was scrolled */
|
|
106
|
-
const CardScroll = observer(({ rv, className, children }: { rv: ReviewSt; className: string; children: ReactNode }) => {
|
|
107
|
-
const el = useRef<HTMLDivElement | null>(null)
|
|
108
|
-
const id = rv.open?.item.id
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
if (el.current) el.current.scrollTop = 0
|
|
111
|
-
}, [id])
|
|
112
|
-
return <div ref={el} className={className}>{children}</div>
|
|
113
|
-
})
|
|
114
|
-
|
|
115
58
|
/** what the last copy put on the clipboard, a moment over the page */
|
|
116
59
|
const Toast = observer(({ rv }: { rv: ReviewSt }) => (rv.toast ? <div className="rv-toast" role="status">{rv.toast}</div> : null))
|
|
117
60
|
|