@deepseek-ai/dsh-experimental-client-ui-forge 0.2.3-alpha.3 → 0.2.3-alpha.4
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/README.i18n.yaml +10 -10
- package/README.md +16 -15
- package/README.zh.md +16 -15
- package/lib/client.js +18 -18
- package/lib/client.js.map +1 -1
- package/lib/index.js +67 -18
- package/lib/typert.host.js +89 -45
- package/lib/typert.remote-client.d.ts +7 -7
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +48 -36
- package/lib/types/client/BranchPicker.d.ts.map +1 -1
- package/lib/types/client/BranchPicker.js.map +1 -1
- package/lib/types/client/ChangeRequestCard.d.ts +10 -1
- package/lib/types/client/ChangeRequestCard.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestCard.js.map +1 -1
- package/lib/types/client/ChangeRequestOverview.d.ts +16 -0
- package/lib/types/client/ChangeRequestOverview.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestOverview.js.map +1 -1
- package/lib/types/client/ChangeRequestsSection.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestsSection.js.map +1 -1
- package/lib/types/client/ChangeStatus.d.ts +41 -0
- package/lib/types/client/ChangeStatus.d.ts.map +1 -0
- package/lib/types/client/ChangeStatus.js.map +1 -0
- package/lib/types/client/ChangedFiles.d.ts.map +1 -1
- package/lib/types/client/ChangedFiles.js.map +1 -1
- package/lib/types/client/ChangesTab.d.ts +23 -8
- package/lib/types/client/ChangesTab.d.ts.map +1 -1
- package/lib/types/client/ChangesTab.js.map +1 -1
- package/lib/types/client/CommitMenu.d.ts +8 -5
- package/lib/types/client/CommitMenu.d.ts.map +1 -1
- package/lib/types/client/CommitMenu.js.map +1 -1
- package/lib/types/client/CopyCommandButton.d.ts +19 -0
- package/lib/types/client/CopyCommandButton.d.ts.map +1 -0
- package/lib/types/client/CopyCommandButton.js.map +1 -0
- package/lib/types/client/DiffFile.d.ts +20 -3
- package/lib/types/client/DiffFile.d.ts.map +1 -1
- package/lib/types/client/DiffFile.js.map +1 -1
- package/lib/types/client/EnvironmentRows.d.ts.map +1 -1
- package/lib/types/client/EnvironmentRows.js.map +1 -1
- package/lib/types/client/FileLabel.d.ts +5 -5
- package/lib/types/client/FileLabel.d.ts.map +1 -1
- package/lib/types/client/FileLabel.js.map +1 -1
- package/lib/types/client/HostSettings.d.ts.map +1 -1
- package/lib/types/client/HostSettings.js.map +1 -1
- package/lib/types/client/LensFilter.d.ts.map +1 -1
- package/lib/types/client/LensFilter.js.map +1 -1
- package/lib/types/client/ReviewComposer.d.ts.map +1 -1
- package/lib/types/client/ReviewComposer.js.map +1 -1
- package/lib/types/client/ReviewControls.d.ts.map +1 -1
- package/lib/types/client/ReviewControls.js.map +1 -1
- package/lib/types/client/ReviewThread.d.ts.map +1 -1
- package/lib/types/client/ReviewThread.js.map +1 -1
- package/lib/types/client/ReviewThreads.d.ts +17 -2
- package/lib/types/client/ReviewThreads.d.ts.map +1 -1
- package/lib/types/client/ReviewThreads.js.map +1 -1
- package/lib/types/client/SubmitReview.d.ts.map +1 -1
- package/lib/types/client/SubmitReview.js.map +1 -1
- package/lib/types/client/ThreadList.d.ts.map +1 -1
- package/lib/types/client/ThreadList.js.map +1 -1
- package/lib/types/client/ViewOptionsMenu.d.ts.map +1 -1
- package/lib/types/client/ViewOptionsMenu.js.map +1 -1
- package/lib/types/client/WorktreeNameDialog.d.ts.map +1 -1
- package/lib/types/client/WorktreeNameDialog.js.map +1 -1
- package/lib/types/client/WorktreeProgress.d.ts.map +1 -1
- package/lib/types/client/WorktreeProgress.js.map +1 -1
- package/lib/types/client/WorktreeSettings.d.ts.map +1 -1
- package/lib/types/client/WorktreeSettings.js.map +1 -1
- package/lib/types/client/WorktreeToggle.d.ts.map +1 -1
- package/lib/types/client/WorktreeToggle.js.map +1 -1
- package/lib/types/client/changes-store.d.ts +7 -4
- package/lib/types/client/changes-store.d.ts.map +1 -1
- package/lib/types/client/changes-store.js.map +1 -1
- package/lib/types/client/glyphs.d.ts +14 -1
- package/lib/types/client/glyphs.d.ts.map +1 -1
- package/lib/types/client/glyphs.js.map +1 -1
- package/lib/types/client/index.d.ts +1 -2
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/locales.d.ts +5 -4
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/locales.js.map +1 -1
- package/lib/types/client/minute-clock.d.ts +7 -0
- package/lib/types/client/minute-clock.d.ts.map +1 -0
- package/lib/types/client/minute-clock.js.map +1 -0
- package/lib/types/client/mount.d.ts.map +1 -1
- package/lib/types/client/mount.js.map +1 -1
- package/lib/types/client/review-page/ReviewActivity.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewActivity.js.map +1 -1
- package/lib/types/client/review-page/ReviewChat.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewChat.js.map +1 -1
- package/lib/types/client/review-page/ReviewDetail.d.ts +4 -1
- package/lib/types/client/review-page/ReviewDetail.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewDetail.js.map +1 -1
- package/lib/types/client/review-page/ReviewList.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewList.js.map +1 -1
- package/lib/types/client/review-page/ReviewPage.d.ts +2 -2
- package/lib/types/client/review-page/ReviewPage.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewPage.js.map +1 -1
- package/lib/types/client/review-page/ReviewStatus.d.ts +17 -13
- package/lib/types/client/review-page/ReviewStatus.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewStatus.js.map +1 -1
- package/lib/types/client/review-page/review-store.d.ts +1 -1
- package/lib/types/client/review-threads.d.ts +14 -7
- package/lib/types/client/review-threads.d.ts.map +1 -1
- package/lib/types/client/review-threads.js.map +1 -1
- package/lib/types/client/status.d.ts +0 -6
- package/lib/types/client/status.d.ts.map +1 -1
- package/lib/types/client/status.js.map +1 -1
- package/lib/types/client/thread-state.d.ts +2 -2
- package/lib/types/client/thread-state.d.ts.map +1 -1
- package/lib/types/client/thread-state.js.map +1 -1
- package/lib/types/client/toolbar-fold.d.ts +16 -6
- package/lib/types/client/toolbar-fold.d.ts.map +1 -1
- package/lib/types/client/toolbar-fold.js.map +1 -1
- package/lib/types/index.d.ts +25 -12
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/panel.js.map +1 -1
- package/lib/types/types.d.ts +22 -5
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/worktree.js.map +1 -1
- package/package.json +60 -58
- package/src/client/BaseMenu.module.css +6 -3
- package/src/client/BranchPicker.tsx +28 -19
- package/src/client/ChangeRequestCard.tsx +71 -41
- package/src/client/ChangeRequestOverview.tsx +174 -74
- package/src/client/ChangeRequestsSection.tsx +33 -8
- package/src/client/ChangeStatus.module.css +70 -0
- package/src/client/ChangeStatus.tsx +104 -0
- package/src/client/ChangedFiles.tsx +20 -7
- package/src/client/ChangesTab.module.css +89 -20
- package/src/client/ChangesTab.tsx +332 -134
- package/src/client/CommitMenu.tsx +77 -38
- package/src/client/CopyCommandButton.tsx +25 -0
- package/src/client/DiffFile.tsx +83 -21
- package/src/client/EnvironmentRows.tsx +13 -11
- package/src/client/FileLabel.module.css +16 -18
- package/src/client/FileLabel.tsx +15 -31
- package/src/client/Forge.module.css +3 -10
- package/src/client/HostSettings.tsx +10 -8
- package/src/client/LensFilter.tsx +11 -9
- package/src/client/ReviewComposer.tsx +29 -17
- package/src/client/ReviewControls.tsx +8 -6
- package/src/client/ReviewThread.tsx +63 -21
- package/src/client/ReviewThreads.tsx +126 -34
- package/src/client/SubmitReview.tsx +5 -3
- package/src/client/ThreadList.module.css +4 -3
- package/src/client/ThreadList.tsx +5 -5
- package/src/client/ViewOptionsMenu.tsx +10 -8
- package/src/client/WorktreeNameDialog.tsx +15 -11
- package/src/client/WorktreeProgress.tsx +11 -9
- package/src/client/WorktreeSettings.tsx +4 -3
- package/src/client/WorktreeToggle.tsx +65 -35
- package/src/client/changes-store.ts +8 -5
- package/src/client/glyphs.tsx +23 -1
- package/src/client/index.ts +1 -2
- package/src/client/locales.ts +40 -32
- package/src/client/minute-clock.ts +19 -0
- package/src/client/mount.ts +66 -51
- package/src/client/review-page/ReviewActivity.tsx +5 -4
- package/src/client/review-page/ReviewChat.tsx +46 -17
- package/src/client/review-page/ReviewDetail.tsx +62 -31
- package/src/client/review-page/ReviewList.tsx +23 -18
- package/src/client/review-page/ReviewPage.module.css +81 -10
- package/src/client/review-page/ReviewPage.tsx +43 -35
- package/src/client/review-page/ReviewStatus.tsx +64 -39
- package/src/client/review-threads.ts +23 -11
- package/src/client/status.ts +0 -9
- package/src/client/thread-state.ts +8 -7
- package/src/client/toolbar-fold.ts +59 -14
- package/src/index.ts +78 -20
- package/src/panel.ts +1 -1
- package/src/types.ts +24 -5
- package/src/worktree.ts +1 -1
- package/lib/types/client/AttentionIndicator.d.ts +0 -22
- package/lib/types/client/AttentionIndicator.d.ts.map +0 -1
- package/lib/types/client/AttentionIndicator.js.map +0 -1
- package/src/client/AttentionIndicator.tsx +0 -37
|
@@ -236,6 +236,51 @@ export interface ReviewChatProps extends Pick<PropsRenderSlots<'forge.review.con
|
|
|
236
236
|
readonly t: Translate
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
/** A suggested prompt: it quotes the change request in the conversation's draft, asking for a worktree first. */
|
|
240
|
+
function PromptButton({ prompt, frame, sessionId, reference, chat, t }: {
|
|
241
|
+
readonly prompt: { readonly key: ForgePanelKey; readonly worktree: boolean }
|
|
242
|
+
readonly frame: ForgeReviewChangeRequest
|
|
243
|
+
readonly sessionId: SessionId
|
|
244
|
+
readonly reference: SessionReference
|
|
245
|
+
readonly chat: ReviewChatFace
|
|
246
|
+
readonly t: Translate
|
|
247
|
+
}) {
|
|
248
|
+
const fill = useCallback((): void => {
|
|
249
|
+
if (prompt.worktree) chat.requestWorktree(sessionId)
|
|
250
|
+
void chat.fill(reference, { kind: 'prompt', frame, text: t(prompt.key) })
|
|
251
|
+
}, [chat, frame, prompt, reference, sessionId, t])
|
|
252
|
+
return <Button size="sm" variant="outline" onClick={fill}>{t(prompt.key)}</Button>
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** The bar above the conversation: the suggested prompts, then starting another conversation or moving this one on. */
|
|
256
|
+
function ChatBar({ frame, sessionId, reference, chat, onConversation, t }: {
|
|
257
|
+
readonly frame: ForgeReviewChangeRequest
|
|
258
|
+
readonly sessionId: SessionId
|
|
259
|
+
readonly reference: SessionReference
|
|
260
|
+
readonly chat: ReviewChatFace
|
|
261
|
+
readonly onConversation: (sessionId: SessionId | null) => void
|
|
262
|
+
readonly t: Translate
|
|
263
|
+
}) {
|
|
264
|
+
const startNew = useCallback((): void => {
|
|
265
|
+
chat.stage(sessionId, null)
|
|
266
|
+
onConversation(null)
|
|
267
|
+
}, [chat, onConversation, sessionId])
|
|
268
|
+
const openMain = useCallback((): void => { chat.openInMain(sessionId) }, [chat, sessionId])
|
|
269
|
+
return (
|
|
270
|
+
<div className={css.chatBar}>
|
|
271
|
+
<span className={css.chatPrompts}>
|
|
272
|
+
{PROMPTS.map(prompt => (
|
|
273
|
+
<PromptButton key={prompt.key} prompt={prompt} frame={frame} sessionId={sessionId} reference={reference} chat={chat} t={t} />
|
|
274
|
+
))}
|
|
275
|
+
</span>
|
|
276
|
+
<span className={css.chatActions}>
|
|
277
|
+
<Button size="sm" variant="ghost" onClick={startNew}>{t('reviewPage.chat.new')}</Button>
|
|
278
|
+
<Button size="sm" variant="ghost" onClick={openMain}>{t('reviewPage.chat.openMain')}</Button>
|
|
279
|
+
</span>
|
|
280
|
+
</div>
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
|
|
239
284
|
/**
|
|
240
285
|
* Render the chat tab: start the conversation on first show, then embed it with the suggested prompts above it.
|
|
241
286
|
* @param props - the change request, its conversation, and the forge panel's chat actions.
|
|
@@ -283,23 +328,7 @@ export function ReviewChat({
|
|
|
283
328
|
const repository = frame.ref.repository
|
|
284
329
|
return (
|
|
285
330
|
<div className={css.chat}>
|
|
286
|
-
<
|
|
287
|
-
<span className={css.chatPrompts}>
|
|
288
|
-
{PROMPTS.map(prompt => (
|
|
289
|
-
<Button key={prompt.key} size="sm" variant="outline" onClick={() => {
|
|
290
|
-
if (prompt.worktree) chat.requestWorktree(sessionId)
|
|
291
|
-
void chat.fill(reference, { kind: 'prompt', frame, text: t(prompt.key) })
|
|
292
|
-
}}>{t(prompt.key)}</Button>
|
|
293
|
-
))}
|
|
294
|
-
</span>
|
|
295
|
-
<span className={css.chatActions}>
|
|
296
|
-
<Button size="sm" variant="ghost" onClick={() => {
|
|
297
|
-
chat.stage(sessionId, null)
|
|
298
|
-
onConversation(null)
|
|
299
|
-
}}>{t('reviewPage.chat.new')}</Button>
|
|
300
|
-
<Button size="sm" variant="ghost" onClick={() => { chat.openInMain(sessionId) }}>{t('reviewPage.chat.openMain')}</Button>
|
|
301
|
-
</span>
|
|
302
|
-
</div>
|
|
331
|
+
<ChatBar frame={frame} sessionId={sessionId} reference={reference} chat={chat} onConversation={onConversation} t={t} />
|
|
303
332
|
<SessionProvider session={reference}>
|
|
304
333
|
{renderSlot('forge.review.conversation', {
|
|
305
334
|
headline: t('reviewPage.chat.headline', { name: `${repository.name} ${name}` }),
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
* The review page's detail of one change request: its header with state, repository, labels, title, author, times, and
|
|
3
3
|
* branches; the merge action beside the actions that open the change request on its code host, copy its link, and read
|
|
4
4
|
* it again; and the summary, changes, and chat tabs. The summary shows the description and the activity beside the
|
|
5
|
-
* status column. While the change request is read, a skeleton of the same layout stands in for it.
|
|
5
|
+
* status column. While the change request is read, a skeleton of the same layout stands in for it. The header starts
|
|
6
|
+
* with the control that hides or shows the list column, or goes back to it where the page shows one column; that
|
|
7
|
+
* control names the page while the list column, whose heading names it, does not show, and its accessible name then
|
|
8
|
+
* starts with that name.
|
|
6
9
|
*/
|
|
7
10
|
|
|
8
|
-
import { useEffect, useMemo, useState, type ReactNode } from 'react'
|
|
11
|
+
import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react'
|
|
9
12
|
import clsx from 'clsx'
|
|
10
13
|
import {
|
|
11
14
|
Button, IconCheckOutlineRegular, IconChevronLeftOutlineRegular, IconCopyOutlineRegular, IconEllipsisOutlineRegular,
|
|
12
|
-
|
|
15
|
+
MarkdownText, Menu, Tooltip, type MenuEntry,
|
|
13
16
|
} from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
14
17
|
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
15
18
|
import type {
|
|
@@ -21,7 +24,7 @@ import loading from '../ChangesLoading.module.css'
|
|
|
21
24
|
import { ChangeRequestPrimary, type ChangeRequestActions } from '../ChangeRequestCard.tsx'
|
|
22
25
|
import { openOnLabel } from '../forge-copy.ts'
|
|
23
26
|
import { formatAgo } from '../format.ts'
|
|
24
|
-
import { ChangeRequestGlyph, ForgeGlyph } from '../glyphs.tsx'
|
|
27
|
+
import { ChangeRequestGlyph, ForgeGlyph, ListPanelGlyph } from '../glyphs.tsx'
|
|
25
28
|
import { RefreshGlyph } from '../RefreshGlyph.tsx'
|
|
26
29
|
import type { StreamRead } from './host-stream.ts'
|
|
27
30
|
import type { ForgePanelKey, NS } from '../locales.ts'
|
|
@@ -140,24 +143,36 @@ function useDescription(url: string, updatedAt: string | null, read: ReviewDetai
|
|
|
140
143
|
return { description: current?.description ?? null, failure: current?.failure ?? null, retry: () => { setAttempt(value => value + 1) } }
|
|
141
144
|
}
|
|
142
145
|
|
|
146
|
+
/** The button that marks a draft ready for review. */
|
|
147
|
+
function ReadyButton({ frame, markReady, t }: {
|
|
148
|
+
readonly frame: ForgeReviewChangeRequest
|
|
149
|
+
readonly markReady: NonNullable<ChangeRequestActions['markReady']>
|
|
150
|
+
readonly t: Translate
|
|
151
|
+
}) {
|
|
152
|
+
// One request at a time: the action stays disabled until the previous one settles.
|
|
153
|
+
const [busy, setBusy] = useState(false)
|
|
154
|
+
const submit = useCallback((): void => {
|
|
155
|
+
setBusy(true)
|
|
156
|
+
void markReady(frame).finally(() => { setBusy(false) })
|
|
157
|
+
}, [frame, markReady])
|
|
158
|
+
return (
|
|
159
|
+
<Button size="sm" variant="outline" className={css.readyAction} disabled={busy} onClick={submit}>
|
|
160
|
+
{t('change.markReady')}
|
|
161
|
+
</Button>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
|
|
143
165
|
/** The ready-for-review action of an open draft, when the surface offers it. */
|
|
144
166
|
function MarkReady({ frame, actions, t }: {
|
|
145
167
|
readonly frame: ForgeReviewChangeRequest
|
|
146
168
|
readonly actions: ChangeRequestActions
|
|
147
169
|
readonly t: Translate
|
|
148
170
|
}): ReactNode {
|
|
149
|
-
// One request at a time: the action stays disabled until the previous one settles.
|
|
150
|
-
const [busy, setBusy] = useState(false)
|
|
151
171
|
const { markReady } = actions
|
|
152
172
|
if (markReady === undefined) return null
|
|
153
173
|
return (
|
|
154
174
|
<div className={css.primary}>
|
|
155
|
-
<
|
|
156
|
-
setBusy(true)
|
|
157
|
-
void markReady(frame).finally(() => { setBusy(false) })
|
|
158
|
-
}}>
|
|
159
|
-
{t('change.markReady')}
|
|
160
|
-
</Button>
|
|
175
|
+
<ReadyButton frame={frame} markReady={markReady} t={t} />
|
|
161
176
|
</div>
|
|
162
177
|
)
|
|
163
178
|
}
|
|
@@ -184,14 +199,21 @@ function LinkActions({ url, forge, actions, onRefresh, t }: {
|
|
|
184
199
|
return () => { clearTimeout(timer) }
|
|
185
200
|
}, [copied])
|
|
186
201
|
const openLabel = openOnLabel(t, forge?.label ?? null)
|
|
187
|
-
const copy = (): void => {
|
|
202
|
+
const copy = useCallback((): void => {
|
|
188
203
|
actions.copyLink(url)
|
|
189
204
|
setCopied(true)
|
|
190
|
-
}
|
|
191
|
-
const refresh = (): void => {
|
|
205
|
+
}, [actions, url])
|
|
206
|
+
const refresh = useCallback((): void => {
|
|
192
207
|
setRefreshing(true)
|
|
193
208
|
void Promise.resolve(onRefresh()).finally(() => { setRefreshing(false) })
|
|
194
|
-
}
|
|
209
|
+
}, [onRefresh])
|
|
210
|
+
const close = useCallback((): void => { setOpen(false) }, [])
|
|
211
|
+
const select = useCallback((id: string): void => {
|
|
212
|
+
setOpen(false)
|
|
213
|
+
if (id === 'open') actions.openLink(url)
|
|
214
|
+
else if (id === 'copy') copy()
|
|
215
|
+
else refresh()
|
|
216
|
+
}, [actions, copy, refresh, url])
|
|
195
217
|
const items: MenuEntry[] = [
|
|
196
218
|
{ id: 'open', label: openLabel },
|
|
197
219
|
{ id: 'copy', label: t('change.copy') },
|
|
@@ -219,7 +241,7 @@ function LinkActions({ url, forge, actions, onRefresh, t }: {
|
|
|
219
241
|
<span className={css.moreAction}>
|
|
220
242
|
<Menu
|
|
221
243
|
open={open}
|
|
222
|
-
onClose={
|
|
244
|
+
onClose={close}
|
|
223
245
|
portal
|
|
224
246
|
align="end"
|
|
225
247
|
anchor={(
|
|
@@ -231,12 +253,7 @@ function LinkActions({ url, forge, actions, onRefresh, t }: {
|
|
|
231
253
|
</Tooltip>
|
|
232
254
|
)}
|
|
233
255
|
items={items}
|
|
234
|
-
onSelect={
|
|
235
|
-
setOpen(false)
|
|
236
|
-
if (id === 'open') actions.openLink(url)
|
|
237
|
-
else if (id === 'copy') copy()
|
|
238
|
-
else refresh()
|
|
239
|
-
}}
|
|
256
|
+
onSelect={select}
|
|
240
257
|
/>
|
|
241
258
|
</span>
|
|
242
259
|
</>
|
|
@@ -314,20 +331,34 @@ export function ReviewDetail({
|
|
|
314
331
|
const frame = read.frame
|
|
315
332
|
const snapshot = frame?.snapshot ?? null
|
|
316
333
|
const description = useDescription(url, snapshot?.updatedAt ?? null, readDescription)
|
|
334
|
+
// The list column's heading names the page. While that column does not show, the control that brings it back does.
|
|
335
|
+
const pageName = <span className={css.pageName}>{t('reviewPage.title')}</span>
|
|
336
|
+
// A control's accessible name is its content: the page name where it is drawn, then the action, which is never
|
|
337
|
+
// drawn. The space between them is a text node of the control itself, because a name computed from content drops
|
|
338
|
+
// the white space at the edges of each child and joins inline children without any.
|
|
339
|
+
const action = (text: string): ReactNode => <>{' '}<span className={css.visuallyHidden}>{text}</span></>
|
|
340
|
+
const toggleLabel = t(listHidden ? 'reviewPage.showList' : 'reviewPage.hideList')
|
|
317
341
|
const listToggle = (
|
|
318
342
|
<>
|
|
319
|
-
<button type="button" className={clsx(css.iconButton, css.backButton
|
|
343
|
+
<button type="button" className={clsx(css.iconButton, css.backButton, css.namedButton)} onClick={onBack}>
|
|
320
344
|
<IconChevronLeftOutlineRegular size={16} />
|
|
345
|
+
{pageName}
|
|
346
|
+
{action(t('reviewPage.back'))}
|
|
321
347
|
</button>
|
|
322
|
-
<Tooltip label={
|
|
323
|
-
<button type="button" className={clsx(css.iconButton, css.listToggle)} aria-pressed={!listHidden}
|
|
324
|
-
|
|
325
|
-
<
|
|
348
|
+
<Tooltip label={toggleLabel} side="bottom">
|
|
349
|
+
<button type="button" className={clsx(css.iconButton, css.listToggle, listHidden && css.namedButton)} aria-pressed={!listHidden}
|
|
350
|
+
onClick={onToggleList}>
|
|
351
|
+
<ListPanelGlyph />
|
|
352
|
+
{listHidden && pageName}
|
|
353
|
+
{action(toggleLabel)}
|
|
326
354
|
</button>
|
|
327
355
|
</Tooltip>
|
|
328
356
|
</>
|
|
329
357
|
)
|
|
330
358
|
const forge = frame?.forge ?? null
|
|
359
|
+
const retryDetail = useCallback((): void => { void (read.stopped !== null ? read.retry : actions.retry)() }, [actions, read])
|
|
360
|
+
const openDetail = useCallback((): void => { actions.openLink(url) }, [actions, url])
|
|
361
|
+
const openChanges = useCallback((): void => { onTab('changes') }, [onTab])
|
|
331
362
|
if (frame === undefined || snapshot === null) {
|
|
332
363
|
const failure = frame?.update !== undefined && frame.update !== null && 'failure' in frame.update ? frame.update.failure : undefined
|
|
333
364
|
const stopped = read.stopped !== null
|
|
@@ -382,8 +413,8 @@ export function ReviewDetail({
|
|
|
382
413
|
<p className={css.emptyTitle}>{failure === undefined ? t('reviewPage.loadFailed') : t(FAILURE[failure.code])}</p>
|
|
383
414
|
{failure !== undefined && failure.message !== '' && <p className={css.emptyHint}>{failure.message}</p>}
|
|
384
415
|
<div className={css.actions}>
|
|
385
|
-
<Button size="sm" variant="outline" onClick={
|
|
386
|
-
<Button size="sm" variant="outline" onClick={
|
|
416
|
+
<Button size="sm" variant="outline" onClick={retryDetail}>{t('retry')}</Button>
|
|
417
|
+
<Button size="sm" variant="outline" onClick={openDetail}>{openOnLabel(t, forge?.label ?? null)}</Button>
|
|
387
418
|
</div>
|
|
388
419
|
</>
|
|
389
420
|
)
|
|
@@ -457,7 +488,7 @@ export function ReviewDetail({
|
|
|
457
488
|
aria-labelledby={`forge-review-tab-${tab}`}>
|
|
458
489
|
{tab === 'summary' && (
|
|
459
490
|
<Summary frame={frame} snapshot={snapshot} description={description} readActivity={readActivity} addComment={addComment}
|
|
460
|
-
onOpenChanges={
|
|
491
|
+
onOpenChanges={openChanges} onOpenCommit={onOpenCommit} now={now} locale={locale} actions={actions}
|
|
461
492
|
coarsePointer={coarsePointer} t={t} />
|
|
462
493
|
)}
|
|
463
494
|
<div className={css.changes} hidden={tab !== 'changes'}>{renderChanges(frame)}</div>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* repositories, one foldable section per list with its items and empty state, and one notice per host that could not be read.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { useMemo, useRef, useState, type ReactNode } from 'react'
|
|
6
|
+
import { useCallback, useMemo, useRef, useState, type ChangeEvent, type KeyboardEvent, type ReactNode } from 'react'
|
|
7
7
|
import clsx from 'clsx'
|
|
8
8
|
import {
|
|
9
9
|
Button, HoverCard, IconCheckOutlineRegular, IconChevronDownOutlineRegular, IconFlatListOutlineRegular, IconFolderCloseRegular,
|
|
@@ -18,6 +18,7 @@ import { formatAgo, formatShortAgo } from '../format.ts'
|
|
|
18
18
|
import { ChangeRequestGlyph } from '../glyphs.tsx'
|
|
19
19
|
import type { ForgePanelKey, NS } from '../locales.ts'
|
|
20
20
|
import { RefreshGlyph } from '../RefreshGlyph.tsx'
|
|
21
|
+
import { CopyCommandButton } from '../CopyCommandButton.tsx'
|
|
21
22
|
import {
|
|
22
23
|
mergeRepositories, pastedUrl, reviewFailures, reviewHint, reviewRepositories, reviewSearchKeys, reviewSections, sameScope,
|
|
23
24
|
scopeRepository, summaryTone, type ReviewHostFailure, type ReviewItem, type ReviewRepository, type ReviewScope, type ReviewSection,
|
|
@@ -149,10 +150,21 @@ function FilterMenu({ frame, scope, repositories, directOnly, view, onScope, onT
|
|
|
149
150
|
{ id: 'requests:direct', label: t('reviewPage.filter.directOnly'), icon: <IconUserOutlineRegular /> },
|
|
150
151
|
]
|
|
151
152
|
const active = scope !== null || directOnly
|
|
153
|
+
const close = useCallback((): void => { setOpen(false) }, [])
|
|
154
|
+
const select = useCallback((id: string): void => {
|
|
155
|
+
setOpen(false)
|
|
156
|
+
if (id === 'view:detailed' || id === 'view:compact') onView(id === 'view:compact' ? 'compact' : 'detailed')
|
|
157
|
+
else if (id === 'requests:all' || id === 'requests:direct') {
|
|
158
|
+
if ((id === 'requests:direct') !== directOnly) onToggleDirect()
|
|
159
|
+
} else {
|
|
160
|
+
// Menu never selects a submenu parent, so every remaining row is a `scope:` row.
|
|
161
|
+
onScope(choices[Number(id.slice('scope:'.length) || NaN)] ?? null)
|
|
162
|
+
}
|
|
163
|
+
}, [choices, directOnly, onScope, onToggleDirect, onView])
|
|
152
164
|
return (
|
|
153
165
|
<Menu
|
|
154
166
|
open={open}
|
|
155
|
-
onClose={
|
|
167
|
+
onClose={close}
|
|
156
168
|
portal
|
|
157
169
|
dense
|
|
158
170
|
align="end"
|
|
@@ -167,16 +179,7 @@ function FilterMenu({ frame, scope, repositories, directOnly, view, onScope, onT
|
|
|
167
179
|
)}
|
|
168
180
|
items={items}
|
|
169
181
|
selectedIds={[`view:${view}`, directOnly ? 'requests:direct' : 'requests:all']}
|
|
170
|
-
onSelect={
|
|
171
|
-
setOpen(false)
|
|
172
|
-
if (id === 'view:detailed' || id === 'view:compact') onView(id === 'view:compact' ? 'compact' : 'detailed')
|
|
173
|
-
else if (id === 'requests:all' || id === 'requests:direct') {
|
|
174
|
-
if ((id === 'requests:direct') !== directOnly) onToggleDirect()
|
|
175
|
-
} else {
|
|
176
|
-
// Menu never selects a submenu parent, so every remaining row is a `scope:` row.
|
|
177
|
-
onScope(choices[Number(id.slice('scope:'.length) || NaN)] ?? null)
|
|
178
|
-
}
|
|
179
|
-
}}
|
|
182
|
+
onSelect={select}
|
|
180
183
|
/>
|
|
181
184
|
)
|
|
182
185
|
}
|
|
@@ -309,7 +312,7 @@ function HostFailures({ failures, copyText, onOpenSettings, t }: {
|
|
|
309
312
|
{command !== null && <span className={css.noticeCommand}><code>{command}</code></span>}
|
|
310
313
|
{(command !== null || onOpenSettings !== undefined) && (
|
|
311
314
|
<span className={css.noticeActions}>
|
|
312
|
-
{command !== null && <
|
|
315
|
+
{command !== null && <CopyCommandButton command={command} copyText={copyText} label={t('signin.copy')} />}
|
|
313
316
|
{onOpenSettings !== undefined && <Button size="sm" variant="outline" onClick={onOpenSettings}>{t('reviewPage.hostSettings')}</Button>}
|
|
314
317
|
</span>
|
|
315
318
|
)}
|
|
@@ -379,6 +382,11 @@ export function ReviewList(props: ReviewListProps): ReactNode {
|
|
|
379
382
|
({ section, index: new TextSearchIndex(section.items ?? [], reviewSearchKeys) })), [frame, directOnly, host])
|
|
380
383
|
const failures = useMemo(() => reviewFailures(frame, host), [frame, host])
|
|
381
384
|
const pasted = pastedUrl(query)
|
|
385
|
+
const changeSearch = useCallback((event: ChangeEvent<HTMLInputElement>): void => { onSearch(event.target.value) }, [onSearch])
|
|
386
|
+
const pressSearchKey = useCallback((event: KeyboardEvent<HTMLInputElement>): void => {
|
|
387
|
+
if (event.key === 'Enter' && pasted !== undefined) onSelect(pasted)
|
|
388
|
+
if (event.key === 'Escape' && query !== '') onSearch('')
|
|
389
|
+
}, [onSearch, onSelect, pasted, query])
|
|
382
390
|
const named = reviewRepositories(frame).filter(item => host === null || item.host === host)
|
|
383
391
|
const qualified = named.length > 1
|
|
384
392
|
const hosted = new Set(named.map(item => item.host)).size > 1
|
|
@@ -461,11 +469,8 @@ export function ReviewList(props: ReviewListProps): ReactNode {
|
|
|
461
469
|
</div>
|
|
462
470
|
<div className={css.search}>
|
|
463
471
|
<Input icon={<IconSearchOutlineRegular size={16} />} value={query} placeholder={t('reviewPage.search')} aria-label={t('reviewPage.search')}
|
|
464
|
-
onChange={
|
|
465
|
-
onKeyDown={
|
|
466
|
-
if (event.key === 'Enter' && pasted !== undefined) onSelect(pasted)
|
|
467
|
-
if (event.key === 'Escape' && query !== '') onSearch('')
|
|
468
|
-
}} />
|
|
472
|
+
onChange={changeSearch}
|
|
473
|
+
onKeyDown={pressSearchKey} />
|
|
469
474
|
</div>
|
|
470
475
|
<div className={css.listBody}>
|
|
471
476
|
{pasted !== undefined && (
|
|
@@ -883,14 +883,19 @@
|
|
|
883
883
|
font-weight: 600;
|
|
884
884
|
}
|
|
885
885
|
|
|
886
|
+
/* The case-sensitive forms of the UI font centre `+` and `−` on the digits; its default forms sit lower. */
|
|
887
|
+
.added,
|
|
888
|
+
.deleted {
|
|
889
|
+
font-feature-settings: 'case';
|
|
890
|
+
font-weight: 400;
|
|
891
|
+
}
|
|
892
|
+
|
|
886
893
|
.added {
|
|
887
894
|
color: var(--dsw-alias-state-success-primary);
|
|
888
|
-
font-weight: 400;
|
|
889
895
|
}
|
|
890
896
|
|
|
891
897
|
.deleted {
|
|
892
898
|
color: var(--dsw-alias-state-error-primary);
|
|
893
|
-
font-weight: 400;
|
|
894
899
|
}
|
|
895
900
|
|
|
896
901
|
.panel {
|
|
@@ -1192,8 +1197,8 @@ button.activityLine:focus-visible,
|
|
|
1192
1197
|
font-size: 12px;
|
|
1193
1198
|
}
|
|
1194
1199
|
|
|
1195
|
-
/* The status column: bordered blocks. A card holds rows of the Session panel's change request card on
|
|
1196
|
-
|
|
1200
|
+
/* The status column: bordered blocks. A card holds rows of the Session panel's change request card on the same four
|
|
1201
|
+
tracks, without the indent that aligns them under the card's title there; `.statusRows` sets the track widths. */
|
|
1197
1202
|
.statusCard,
|
|
1198
1203
|
.statusSection {
|
|
1199
1204
|
border: 0.5px solid var(--dsw-alias-border-l3);
|
|
@@ -1209,7 +1214,10 @@ button.activityLine:focus-visible,
|
|
|
1209
1214
|
/* Contains the visually hidden row labels. */
|
|
1210
1215
|
position: relative;
|
|
1211
1216
|
display: grid;
|
|
1212
|
-
|
|
1217
|
+
/* A row's 8px side padding lies inside the first and the last track. That leaves the icon the 20px of `.statusIcon`,
|
|
1218
|
+
so the rows start their icons and text where the lines of the other blocks do, and it leaves the chevron 12px that
|
|
1219
|
+
end where those lines end their trailing text. */
|
|
1220
|
+
grid-template-columns: 28px minmax(0, 1fr) auto 20px;
|
|
1213
1221
|
gap: 0 8px;
|
|
1214
1222
|
padding: 4px;
|
|
1215
1223
|
}
|
|
@@ -1314,6 +1322,29 @@ button.activityLine:focus-visible,
|
|
|
1314
1322
|
display: inline-flex;
|
|
1315
1323
|
}
|
|
1316
1324
|
|
|
1325
|
+
/* The list toggle and the back button name the page while the list column, whose heading names it, does not show. */
|
|
1326
|
+
.namedButton {
|
|
1327
|
+
gap: 6px;
|
|
1328
|
+
width: auto;
|
|
1329
|
+
padding: 0 8px 0 6px;
|
|
1330
|
+
color: var(--dsw-alias-label-primary);
|
|
1331
|
+
font: inherit;
|
|
1332
|
+
font-weight: 500;
|
|
1333
|
+
white-space: nowrap;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/* A bar too narrow for the name keeps the control as its icon. */
|
|
1337
|
+
@container forge-review-bar (max-width: 520px) {
|
|
1338
|
+
.namedButton {
|
|
1339
|
+
width: 28px;
|
|
1340
|
+
padding: 0;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
.pageName {
|
|
1344
|
+
display: none;
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1317
1348
|
.navCount {
|
|
1318
1349
|
color: var(--dsw-alias-label-tertiary);
|
|
1319
1350
|
font-size: 12px;
|
|
@@ -1362,11 +1393,6 @@ button.activityLine:focus-visible,
|
|
|
1362
1393
|
display: none;
|
|
1363
1394
|
}
|
|
1364
1395
|
|
|
1365
|
-
.pageListHidden.pageDetail > .detail,
|
|
1366
|
-
.pageListHidden:not(.pageDetail) > .list {
|
|
1367
|
-
display: flex;
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
1396
|
.backButton {
|
|
1371
1397
|
display: inline-flex;
|
|
1372
1398
|
}
|
|
@@ -1386,6 +1412,51 @@ button.activityLine:focus-visible,
|
|
|
1386
1412
|
}
|
|
1387
1413
|
}
|
|
1388
1414
|
|
|
1415
|
+
/* macOS desktop. While the application sidebar is folded, the frame keeps the window's traffic lights and its own two
|
|
1416
|
+
controls over the page's top-left corner and publishes the width of that band as --dsh-frame-leading-clearance; the
|
|
1417
|
+
variable is unset while the sidebar shows. The list column starts below the band's row, because its heading does not
|
|
1418
|
+
fit beside the band in every language. A detail bar at the page's left edge starts after the band.
|
|
1419
|
+
The min() below is what turns the list column's inset on and off: --dsh-frame-top-clearance is the height of the
|
|
1420
|
+
band's row at all times, and the unset leading clearance counts as 0px, so the smaller value is 0px while the
|
|
1421
|
+
sidebar shows. */
|
|
1422
|
+
:global([data-platform='darwin']) .list {
|
|
1423
|
+
padding-top: min(var(--dsh-frame-top-clearance, 0px), var(--dsh-frame-leading-clearance, 0px));
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
:global([data-platform='darwin']) .pageListHidden .detailHeader > .detailBar {
|
|
1427
|
+
padding-left: max(0px, calc(var(--dsh-frame-leading-clearance, 0px) - 20px));
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
:global([data-platform='darwin']) .pageListHidden .detail > .detailBar {
|
|
1431
|
+
padding-left: max(20px, var(--dsh-frame-leading-clearance, 0px));
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
@container forge-review (max-width: 880px) {
|
|
1435
|
+
:global([data-platform='darwin']) .pageDetail .detailHeader > .detailBar {
|
|
1436
|
+
padding-left: max(0px, calc(var(--dsh-frame-leading-clearance, 0px) - 12px));
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
:global([data-platform='darwin']) .pageDetail .detail > .detailBar {
|
|
1440
|
+
padding-left: max(12px, var(--dsh-frame-leading-clearance, 0px));
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
/* The frame's controls are centred 25px below the window's top. The page's two top rows are centred on that line and
|
|
1445
|
+
keep their heights, so what follows them stays where it is. */
|
|
1446
|
+
:global([data-platform='darwin']) .listHeader {
|
|
1447
|
+
padding-top: 11px;
|
|
1448
|
+
padding-bottom: 11px;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
:global([data-platform='darwin']) .detailHeader,
|
|
1452
|
+
:global([data-platform='darwin']) .detail > .detailBar {
|
|
1453
|
+
padding-top: 9px;
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
:global([data-platform='darwin']) .detailHeader > .detailBar {
|
|
1457
|
+
padding-bottom: 3px;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1389
1460
|
/* The chat tab: suggested prompts and conversation actions above the embedded conversation. */
|
|
1390
1461
|
.chat {
|
|
1391
1462
|
display: flex;
|
|
@@ -19,23 +19,28 @@ import type { ForgeLensDescription } from '../changes-service.ts'
|
|
|
19
19
|
import { ChangesView, type ChangesTabInjected, type ChangesViewTab } from '../ChangesTab.tsx'
|
|
20
20
|
import { useHostStream, type StreamRead } from './host-stream.ts'
|
|
21
21
|
import type { NS } from '../locales.ts'
|
|
22
|
+
import { useMinuteClock } from '../minute-clock.ts'
|
|
22
23
|
import { ReviewChat, useReviewConversation, type ReviewChatFace } from './ReviewChat.tsx'
|
|
23
24
|
import { ReviewDetail, type ReviewSummaryFace } from './ReviewDetail.tsx'
|
|
24
25
|
import { ReviewList } from './ReviewList.tsx'
|
|
25
26
|
import type { QuoteCopy, ReviewSelection } from '../review.ts'
|
|
26
|
-
import {
|
|
27
|
-
|
|
27
|
+
import {
|
|
28
|
+
reviewListsComplete, reviewRepositories, scopeRepository, type ReviewRepository, type ReviewScope,
|
|
29
|
+
} from './review-lists.ts'
|
|
30
|
+
import { changesTabOf, type createReviewStore, type ReviewTab, type ReviewView } from './review-store.ts'
|
|
28
31
|
import type { HostStream, StreamSnapshot } from '../source.ts'
|
|
29
32
|
import type { ChangesPanelState } from '../status.ts'
|
|
30
33
|
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
34
|
+
import type { ForgeViewerFilter } from '@deepseek-ai/dsh-experimental-forge/types'
|
|
31
35
|
import type { ForgeExtensionState } from '../../types.ts'
|
|
32
36
|
import css from './ReviewPage.module.css'
|
|
33
37
|
|
|
34
38
|
/**
|
|
35
39
|
* What the changes view of the review page reads and does, each naming the change request by URL; the page quotes
|
|
36
|
-
* comments and threads into its own conversation.
|
|
40
|
+
* comments and threads into its own conversation, and its summary shows the status the view's header would open.
|
|
37
41
|
*/
|
|
38
|
-
export type ReviewChangesFace = Omit<ChangesTabInjected,
|
|
42
|
+
export type ReviewChangesFace = Omit<ChangesTabInjected,
|
|
43
|
+
'keyedHooks' | 'hooks' | 'reconnect' | 'addReviewToInput' | 'addThreadToInput' | 'changeActions'>
|
|
39
44
|
|
|
40
45
|
/** The quote copy of the review page, which quotes into the change request's conversation. */
|
|
41
46
|
const CHAT_QUOTE_COPY: QuoteCopy = { add: 'reviewPage.addToChat', added: 'reviewPage.addedToChat', failed: 'reviewPage.addToChatFailed' }
|
|
@@ -88,21 +93,11 @@ const NO_BINDING = (): (() => void) => () => {}
|
|
|
88
93
|
/* v8 ignore next -- the changes view renders plugin slots only for a target, and the review page passes none */
|
|
89
94
|
const NO_SLOT = (): null => null
|
|
90
95
|
|
|
91
|
-
/** Refreshes relative times once a minute. */
|
|
92
|
-
function useMinuteClock(): number {
|
|
93
|
-
const [now, setNow] = useState(() => Date.now())
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
const timer = setInterval(() => { setNow(Date.now()) }, 60_000)
|
|
96
|
-
return () => { clearInterval(timer) }
|
|
97
|
-
}, [])
|
|
98
|
-
return now
|
|
99
|
-
}
|
|
100
|
-
|
|
101
96
|
/** The changes view of one change request, kept while its URL stays shown. */
|
|
102
97
|
function ReviewChanges({ frame, visible, changes, useStore, actions, t }: {
|
|
103
98
|
readonly frame: ForgeReviewChangeRequest
|
|
104
99
|
readonly visible: boolean
|
|
105
|
-
readonly changes: Omit<ChangesTabInjected, 'keyedHooks' | 'hooks' | 'reconnect'>
|
|
100
|
+
readonly changes: Omit<ChangesTabInjected, 'keyedHooks' | 'hooks' | 'reconnect' | 'changeActions'>
|
|
106
101
|
readonly useStore: ReviewPageProps['useStore']
|
|
107
102
|
readonly actions: ReviewPageProps['actions']
|
|
108
103
|
readonly t: ReviewPageProps['t']
|
|
@@ -176,16 +171,27 @@ function DetailPane({
|
|
|
176
171
|
await quote(sessionId => quoteThread(sessionId, thread, threadUrl, range)),
|
|
177
172
|
}
|
|
178
173
|
}, [changes, start, quoteReview, quoteThread, actions, url])
|
|
174
|
+
const tabbed = useCallback((value: ReviewTab): void => { actions.tabbed(value) }, [actions])
|
|
175
|
+
const openedCommit = useCallback((sha: string): void => { actions.openedCommit(url, sha) }, [actions, url])
|
|
176
|
+
const toggledList = useCallback((): void => { actions.toggledList() }, [actions])
|
|
177
|
+
const back = useCallback((): void => { actions.select(null) }, [actions])
|
|
178
|
+
const showChangesTab = useCallback((frame: ForgeReviewChangeRequest): ReactNode => (
|
|
179
|
+
<ReviewChanges frame={frame} visible={tab === 'changes'} changes={quoteChanges} useStore={useStore} actions={actions} t={t} />
|
|
180
|
+
), [actions, quoteChanges, t, tab, useStore])
|
|
181
|
+
const showChatTab = useCallback((frame: ForgeReviewChangeRequest): ReactNode => (
|
|
182
|
+
<ReviewChat frame={frame} sessionId={conversationId} conversation={conversation} onConversation={onConversation} chat={chat}
|
|
183
|
+
renderSlot={renderSlot} SessionProvider={SessionProvider} t={t} />
|
|
184
|
+
), [SessionProvider, chat, conversation, conversationId, onConversation, renderSlot, t])
|
|
179
185
|
return (
|
|
180
186
|
<ReviewDetail
|
|
181
187
|
url={url}
|
|
182
188
|
read={read}
|
|
183
189
|
tab={tab}
|
|
184
|
-
onTab={
|
|
185
|
-
onOpenCommit={
|
|
190
|
+
onTab={tabbed}
|
|
191
|
+
onOpenCommit={openedCommit}
|
|
186
192
|
listHidden={listHidden}
|
|
187
|
-
onToggleList={
|
|
188
|
-
onBack={
|
|
193
|
+
onToggleList={toggledList}
|
|
194
|
+
onBack={back}
|
|
189
195
|
now={now}
|
|
190
196
|
locale={locale}
|
|
191
197
|
actions={cardActions}
|
|
@@ -193,13 +199,8 @@ function DetailPane({
|
|
|
193
199
|
readActivity={readActivity}
|
|
194
200
|
addComment={addComment}
|
|
195
201
|
onAddHost={hostSettings ? page.openHostSettings : undefined}
|
|
196
|
-
renderChanges={
|
|
197
|
-
|
|
198
|
-
)}
|
|
199
|
-
renderChat={frame => (
|
|
200
|
-
<ReviewChat frame={frame} sessionId={conversationId} conversation={conversation} onConversation={onConversation} chat={chat}
|
|
201
|
-
renderSlot={renderSlot} SessionProvider={SessionProvider} t={t} />
|
|
202
|
-
)}
|
|
202
|
+
renderChanges={showChangesTab}
|
|
203
|
+
renderChat={showChatTab}
|
|
203
204
|
unseenQuotes={unseenQuotes}
|
|
204
205
|
coarsePointer={coarsePointer}
|
|
205
206
|
t={t}
|
|
@@ -244,16 +245,23 @@ export function ReviewPage(props: ReviewPageProps): ReactNode {
|
|
|
244
245
|
}, [repository, listsFrame, actions])
|
|
245
246
|
const detail = useHostStream(openChangeRequest, selected, subscribeReset)
|
|
246
247
|
const [refreshing, setRefreshing] = useState(false)
|
|
247
|
-
const startRefresh = (): void => {
|
|
248
|
+
const startRefresh = useCallback((): void => {
|
|
248
249
|
if (refreshing) return
|
|
249
250
|
setRefreshing(true)
|
|
250
251
|
void refresh().finally(() => { setRefreshing(false) })
|
|
251
|
-
}
|
|
252
|
+
}, [refresh, refreshing])
|
|
253
|
+
const selectUrl = useCallback((next: string): void => { actions.select(next) }, [actions])
|
|
254
|
+
const search = useCallback((value: string): void => { actions.searched(value) }, [actions])
|
|
255
|
+
const scopedTo = useCallback((value: ReviewScope | null): void => { actions.scopedTo(value) }, [actions])
|
|
256
|
+
const toggledDirect = useCallback((): void => { actions.toggledDirect() }, [actions])
|
|
257
|
+
const viewed = useCallback((value: ReviewView): void => { actions.viewed(value) }, [actions])
|
|
258
|
+
const foldedIn = useCallback((filter: ForgeViewerFilter): void => { actions.folded(filter) }, [actions])
|
|
252
259
|
const showChanges = useCallback(() => { actions.tabbed('changes') }, [actions])
|
|
253
260
|
const cardActions = useMemo(() => selected === null ? null : actionsFor(selected, showChanges), [actionsFor, selected, showChanges])
|
|
254
261
|
return (
|
|
255
262
|
<div className={css.root} data-forge-review-page="">
|
|
256
|
-
|
|
263
|
+
{/* The control that shows the list again is in the detail, so the list hides only while a change request shows. */}
|
|
264
|
+
<div className={clsx(css.page, listHidden && selected !== null && css.pageListHidden, selected !== null && css.pageDetail)}>
|
|
257
265
|
<ReviewList
|
|
258
266
|
frame={lists.frame}
|
|
259
267
|
stopped={lists.stopped}
|
|
@@ -265,13 +273,13 @@ export function ReviewPage(props: ReviewPageProps): ReactNode {
|
|
|
265
273
|
folded={folded}
|
|
266
274
|
refreshing={refreshing}
|
|
267
275
|
now={now}
|
|
268
|
-
onSelect={
|
|
269
|
-
onSearch={
|
|
270
|
-
onScope={
|
|
271
|
-
onToggleDirect={
|
|
276
|
+
onSelect={selectUrl}
|
|
277
|
+
onSearch={search}
|
|
278
|
+
onScope={scopedTo}
|
|
279
|
+
onToggleDirect={toggledDirect}
|
|
272
280
|
view={view}
|
|
273
|
-
onView={
|
|
274
|
-
onFold={
|
|
281
|
+
onView={viewed}
|
|
282
|
+
onFold={foldedIn}
|
|
275
283
|
onRefresh={startRefresh}
|
|
276
284
|
onRetry={lists.retry}
|
|
277
285
|
copyText={copyText}
|