diff --git a/packages/client/ui-primitives/src/TitleMarquee.module.css b/packages/client/ui-primitives/src/TitleMarquee.module.css new file mode 100644 index 0000000000..7fa7e1ca34 --- /dev/null +++ b/packages/client/ui-primitives/src/TitleMarquee.module.css @@ -0,0 +1,17 @@ +/* While the marquee travels, both clipping edges fade in over 12px instead of + hard-cutting a character: the left once the title has moved off its start + (data-scrolled), the right while text still remains beyond the cell + (data-clipped). At the far edge the right fade lifts so the final character + reads at full strength. The mask rides the title element itself, so cells + beside it keep their full color. */ +.marquee[data-scrolled] { + mask-image: linear-gradient(to right, transparent, #000 12px); +} + +.marquee[data-clipped] { + mask-image: linear-gradient(to left, transparent, #000 12px); +} + +.marquee[data-scrolled][data-clipped] { + mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 12px), transparent); +} diff --git a/packages/client/ui-primitives/src/index.ts b/packages/client/ui-primitives/src/index.ts index 44dbcd8871..fb081ad24d 100644 --- a/packages/client/ui-primitives/src/index.ts +++ b/packages/client/ui-primitives/src/index.ts @@ -41,6 +41,7 @@ export { useAnchoredMaxHeight } from './useAnchoredMaxHeight.ts' export { useDismissOnOutsidePointer } from './useDismissOnOutsidePointer.ts' export { HoverCard } from './HoverCard.tsx' export { HoverCardGroup } from './HoverCardGroup.tsx' +export { titleMarqueeClass, useTitleMarquee } from './title-marquee.ts' export { usePointerGrace } from './pointer-grace.ts' export { ShortcutKeys } from './ShortcutKeys.tsx' export { observeComposition } from './keyboard-composition.ts' diff --git a/packages/client/ui-primitives/src/title-marquee.ts b/packages/client/ui-primitives/src/title-marquee.ts new file mode 100644 index 0000000000..c233252088 --- /dev/null +++ b/packages/client/ui-primitives/src/title-marquee.ts @@ -0,0 +1,104 @@ +/** + * Marquee of a one-line title that clips its own text: while its row is hovered, a title wider than its cell crawls to + * its far edge, and its clipping edges fade through the `data-scrolled` and `data-clipped` hooks that + * {@link titleMarqueeClass} styles. + */ + +import { useEffect, useMemo, useRef } from 'react' +import type { PointerEvent, RefObject } from 'react' +import css from './TitleMarquee.module.css' + +/** Class that fades a marquee title's clipping edges while it travels; add it to the title element. */ +export const titleMarqueeClass: string = css.marquee ?? '' + +/* Overflow this small hides no meaningful tail; scrolling for it reads as an + accidental jitter, so the title stays put. */ +const MIN_TITLE_REVEAL_PX = 8 + +/* Marquee travel speed: slow enough to read the text as it passes. */ +const TITLE_MARQUEE_PX_PER_MS = 0.03 + +/** + * Place the title's scroll position and publish the stylesheet's fade-mask + * hooks: `data-scrolled` while the title has left its start (left fade) and + * `data-clipped` while text remains beyond the right edge (right fade). + * @param title - the clipping title element. + * @param left - scroll offset in CSS pixels. + * @param range - the title's maximum scroll offset in CSS pixels. + */ +function placeTitle(title: HTMLSpanElement, left: number, range: number): void { + // jsdom implements no scrollTo; the lane's direct assignment is instant there + // anyway, so both paths land on the same position. + if (typeof title.scrollTo === 'function') title.scrollTo({ left, behavior: 'instant' }) + else title.scrollLeft = left + if (left > 0) title.dataset.scrolled = '' + else delete title.dataset.scrolled + if (left < range) title.dataset.clipped = '' + else delete title.dataset.clipped +} + +/** + * Return the title to its resting state: scrolled to the start with both fade + * masks off, so the resting ellipsis renders at full strength. + * @param title - the clipping title element. + */ +function restTitle(title: HTMLSpanElement): void { + if (typeof title.scrollTo === 'function') title.scrollTo({ left: 0, behavior: 'instant' }) + else title.scrollLeft = 0 + delete title.dataset.scrolled + delete title.dataset.clipped +} + +/** + * Marquee a title wider than its one-line cell while its row is hovered: the + * title clips its own text, so entering crawls it at a constant speed until the + * far edge (a fork's incremented title, for example) is in view, then rests + * there under the pointer. Overflow of at most {@link MIN_TITLE_REVEAL_PX} + * stays put — a barely-clipped title moving a few pixels reads as jitter, not a + * reveal. Leaving returns the title to the start in one step, because the + * resting ellipsis and the narrowed cell would otherwise meet the text while it + * travelled back. Reduced motion jumps to the far edge instead of crawling. + * @param title - ref to the clipping title element. + * @returns stable pointer enter/leave handlers for the row. + */ +export function useTitleMarquee(title: RefObject): { + enter: (event?: PointerEvent) => void + leave: () => void +} { + const frame = useRef(0) + const revealing = useRef(false) + useEffect(() => () => { cancelAnimationFrame(frame.current) }, []) + return useMemo(() => ({ + enter: (event?: PointerEvent): void => { + if (event?.pointerType === 'touch') return + /* v8 ignore next -- defensive: the title span renders unconditionally. */ + if (title.current === null) return + if (revealing.current) return + revealing.current = true + const element = title.current + const range = element.scrollWidth - element.clientWidth + if (range <= MIN_TITLE_REVEAL_PX) return + if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) { + placeTitle(element, range, range) + return + } + cancelAnimationFrame(frame.current) + let previous: number | undefined + let position = 0 + const step = (now: DOMHighResTimeStamp): void => { + position += previous === undefined ? 0 : (now - previous) * TITLE_MARQUEE_PX_PER_MS + previous = now + placeTitle(element, Math.min(position, range), range) + if (position < range) frame.current = requestAnimationFrame(step) + } + frame.current = requestAnimationFrame(step) + }, + leave: (): void => { + revealing.current = false + cancelAnimationFrame(frame.current) + /* v8 ignore next -- defensive: the title span renders unconditionally. */ + if (title.current === null) return + restTitle(title.current) + }, + }), [title]) +} diff --git a/packages/client/ui-workspace/src/client/rows/Rows.module.css b/packages/client/ui-workspace/src/client/rows/Rows.module.css index 7f567fc707..77c15db5f9 100644 --- a/packages/client/ui-workspace/src/client/rows/Rows.module.css +++ b/packages/client/ui-workspace/src/client/rows/Rows.module.css @@ -208,24 +208,6 @@ flex: 1; } -/* While the marquee travels, both clipping edges fade in over 12px instead of - hard-cutting a character: the left once the title has moved off its start - (data-scrolled), the right while text still remains beyond the cell - (data-clipped) — at the far edge the right fade lifts so the final character - reads at full strength. The mask rides the title span itself, so the status - slot and every other leading cell keep their full color. */ -.sessionRow .title[data-scrolled] { - mask-image: linear-gradient(to right, transparent, #000 12px); -} - -.sessionRow .title[data-clipped] { - mask-image: linear-gradient(to left, transparent, #000 12px); -} - -.sessionRow .title[data-scrolled][data-clipped] { - mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 12px), transparent); -} - .meta { overflow: hidden; text-overflow: ellipsis; diff --git a/packages/client/ui-workspace/src/client/rows/Rows.tsx b/packages/client/ui-workspace/src/client/rows/Rows.tsx index 04b56cb10c..b009164ed7 100644 --- a/packages/client/ui-workspace/src/client/rows/Rows.tsx +++ b/packages/client/ui-workspace/src/client/rows/Rows.tsx @@ -9,12 +9,11 @@ * `sidebar.workspaces.session.row.action` list. Session and Workspace * hover cards are suppressed while their menu is open. */ -import { useEffect, useMemo, useRef } from 'react' -import type { PointerEvent, RefObject } from 'react' +import { useEffect, useRef } from 'react' import clsx from 'clsx' import type { PropsRenderSlots } from '@deepseek-ai/dsh-client-ui-slots' import { - HoverCard, IconArchiveOutlineRegular, + HoverCard, titleMarqueeClass, useTitleMarquee, IconArchiveOutlineRegular, IconFolderCloseRegular, IconFolderOpenRegular, IconNewChatOutlineRegular, IconPinFillRegular, IconTriangleRightFillRegular, IconUnarchiveOutlineRegular, relativeTime, StateDot, Tooltip, useRowDragPreview, @@ -56,97 +55,6 @@ function displayTitle(node: SessionNode, t: RowTranslate): string { return node.blank ? t('session.new') : (node.title || t('session.untitled')) } -/* Overflow this small hides no meaningful tail; scrolling for it reads as an - accidental jitter, so the title stays put. */ -const MIN_TITLE_REVEAL_PX = 8 - -/* Marquee travel speed: slow enough to read the text as it passes. */ -const TITLE_MARQUEE_PX_PER_MS = 0.03 - -/** - * Place the title's scroll position and publish the stylesheet's fade-mask - * hooks: `data-scrolled` while the title has left its start (left fade) and - * `data-clipped` while text remains beyond the right edge (right fade). - * @param title - the row's clipping title element. - * @param left - scroll offset in CSS pixels. - * @param range - the title's maximum scroll offset in CSS pixels. - */ -function placeTitle(title: HTMLSpanElement, left: number, range: number): void { - // jsdom implements no scrollTo; the lane's direct assignment is instant there - // anyway, so both paths land on the same position. - if (typeof title.scrollTo === 'function') title.scrollTo({ left, behavior: 'instant' }) - else title.scrollLeft = left - if (left > 0) title.dataset.scrolled = '' - else delete title.dataset.scrolled - if (left < range) title.dataset.clipped = '' - else delete title.dataset.clipped -} - -/** - * Return the title to its resting state: scrolled to the start with both fade - * masks off, so the resting ellipsis renders at full strength. - * @param title - the row's clipping title element. - */ -function restTitle(title: HTMLSpanElement): void { - if (typeof title.scrollTo === 'function') title.scrollTo({ left: 0, behavior: 'instant' }) - else title.scrollLeft = 0 - delete title.dataset.scrolled - delete title.dataset.clipped -} - -/** - * Marquee a title wider than its one-line cell while its row is hovered: the - * title clips its own text, so entering crawls it at a constant speed until the - * far edge (a fork's incremented title, for example) is in view, then rests - * there under the pointer. Overflow of at most {@link MIN_TITLE_REVEAL_PX} - * stays put — a barely-clipped title moving a few pixels reads as jitter, not a - * reveal. Leaving returns the title to the start in one step, because the - * resting ellipsis and the narrowed cell would otherwise meet the text while it - * travelled back. Reduced motion jumps to the far edge instead of crawling. - * @param title - ref to the row's clipping title element. - * @returns stable pointer enter/leave handlers for the row. - */ -function useTitleMarquee(title: RefObject): { - enter: (event?: PointerEvent) => void - leave: () => void -} { - const frame = useRef(0) - const revealing = useRef(false) - useEffect(() => () => { cancelAnimationFrame(frame.current) }, []) - return useMemo(() => ({ - enter: (event?: PointerEvent): void => { - if (event?.pointerType === 'touch') return - /* v8 ignore next -- defensive: the title span renders unconditionally. */ - if (title.current === null) return - if (revealing.current) return - revealing.current = true - const element = title.current - const range = element.scrollWidth - element.clientWidth - if (range <= MIN_TITLE_REVEAL_PX) return - if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) { - placeTitle(element, range, range) - return - } - cancelAnimationFrame(frame.current) - let previous: number | undefined - let position = 0 - const step = (now: DOMHighResTimeStamp): void => { - position += previous === undefined ? 0 : (now - previous) * TITLE_MARQUEE_PX_PER_MS - previous = now - placeTitle(element, Math.min(position, range), range) - if (position < range) frame.current = requestAnimationFrame(step) - } - frame.current = requestAnimationFrame(step) - }, - leave: (): void => { - revealing.current = false - cancelAnimationFrame(frame.current) - /* v8 ignore next -- defensive: the title span renders unconditionally. */ - if (title.current === null) return - restTitle(title.current) - }, - }), [title]) -} /** Localized compact relative time ("刚刚"/"5分钟" in zh, "now"/"5min" in en). */ function timeLabel(updatedAt: number, now: number, t: RowTranslate): string { @@ -712,7 +620,7 @@ export function SessionNodeItem({ { if (e.detail !== 1) return renameArmed.current = true diff --git a/packages/experimental/client-ui-forge/src/client/ChangesTab.tsx b/packages/experimental/client-ui-forge/src/client/ChangesTab.tsx index 7ac02328ef..366331513d 100644 --- a/packages/experimental/client-ui-forge/src/client/ChangesTab.tsx +++ b/packages/experimental/client-ui-forge/src/client/ChangesTab.tsx @@ -40,7 +40,7 @@ import { sameReviewSource, type ReviewQueue } from './review-queue.ts' import { ReviewThread, useFileReview } from './ReviewThread.tsx' import type { ReviewActions } from './ReviewComposer.tsx' import { SubmitReview } from './SubmitReview.tsx' -import type { ReviewSelection, ReviewSource } from './review.ts' +import type { QuoteCopy, ReviewSelection, ReviewSource } from './review.ts' import { BaseMenu } from './BaseMenu.tsx' import { parseChangesAddress, type ChangesSource, type ChangesTarget } from './changes-address.ts' import type { ChangesLens, createChangesStore } from './changes-store.ts' @@ -86,7 +86,7 @@ interface Wanted { /** Business face of the changes tab body. */ export interface ChangesTabInjected { /** Append a frozen comment to the main input without submitting it. */ - readonly addReviewToInput: (selection: ReviewSelection) => boolean + readonly addReviewToInput: (selection: ReviewSelection) => boolean | Promise /** Records retained across Session switches and cleared when this tab occurrence closes. */ readonly reviewQueue: (tab: Pick) => ReviewQueue /** Publish one comment or a completed review; never retries mutations. */ @@ -140,7 +140,7 @@ export interface ChangesTabInjected { /** Write to the review threads or the pending review of a change request; never retries a write. */ readonly changeRequestReviewWrite: (url: string, write: ForgeReviewWrite) => Promise> /** Quote a whole review thread of the change request at `url` in the main input without submitting it. */ - readonly addThreadToInput: (thread: ForgeReviewThread, url: string, range: string | null) => boolean + readonly addThreadToInput: (thread: ForgeReviewThread, url: string, range: string | null) => boolean | Promise /** Open a URL outside the app. */ readonly openLink: (url: string) => void /** Copy a path to the clipboard and report the outcome. */ @@ -182,6 +182,8 @@ export type ChangesViewProps = Omit void) | undefined + /** Copy of the quote actions where they quote somewhere other than the Session's input. */ + readonly quoteCopy?: QuoteCopy | undefined } /** Changes of either source as the view draws them. */ @@ -559,7 +561,8 @@ export function ChangesTab({ useTabInfo, sessionId, usePanel, useAnnotations, .. * @returns the view body. */ export function ChangesView({ - tab, source, target, snapshot, annotations: viewAnnotations, openFile, useStore, actions, reconnect, localDiff, diffBases, localText, + tab, source, target, snapshot, annotations: viewAnnotations, openFile, quoteCopy, useStore, actions, reconnect, localDiff, diffBases, + localText, localCommits, changeRequestDiff, changeRequestText, changeRequestCommits, changeRequestReview, changeRequestReviewWrite, viewedFiles, changeRequestViewed, setFileViewed, openLink, copyPath, createChangeRequest, addReviewToInput, addThreadToInput, reviewQueue, submitReview, report, useLenses, useExtensions, changesLens, renderSlot, t, @@ -1009,7 +1012,7 @@ export function ChangesView({ source: shownSource ?? (source.kind === 'local' ? { kind: 'local', scope, base: null, baseRef: baseRefOf(localScope), commits: commitsOf(localScope) } : { kind: 'change', url: source.url, headSha: '', commits: changeCommits }), - records: queue, addToInput: addReviewToInput, openLink, + records: queue, addToInput: addReviewToInput, openLink, quoteCopy, } const absentPaths = [...new Set([...reviewState.comments, ...reviewState.records.map(item => item.selection)] .filter(item => sameReviewSource(item.source, recordActions.source)).map(item => item.comment.path))] @@ -1022,16 +1025,17 @@ export function ChangesView({ const threadActions = useMemo((): ThreadActions | null => review === null || url === null ? null : { author: prAuthor, addToInput: (thread, range) => addThreadToInput(thread, url, range), + quoteCopy, openLink, readText: (commit, path) => changeRequestText(url, commit, path), - inputFailed: () => { live.current.report('thread.inputFailed') }, + inputFailed: () => { live.current.report(quoteCopy?.failed ?? 'thread.inputFailed') }, focused: focus, writes: { write: (write: ThreadWrite) => live.current.writeReview(url, { ...write, headSha: review.headSha }), reviewStarted: review.pendingReview !== null, canReview: review.viewerCanReview, }, - }, [review, url, prAuthor, addThreadToInput, openLink, changeRequestText, focus]) + }, [review, url, prAuthor, addThreadToInput, quoteCopy, openLink, changeRequestText, focus]) const fileThreads = useMemo(() => new Map(threadActions === null ? [] : [...placed.files].map(([path, group]) => [path, { ...group, actions: threadActions }])), [placed.files, threadActions]) /** Show a file's next unresolved thread in display order after the one last shown, or its first. */ @@ -1196,6 +1200,7 @@ export function ChangesView({ const fileReview = useMemo((): ReviewActions | undefined => shownSource === null ? undefined : { source: shownSource, addToInput: addReviewToInput, + quoteCopy, renderActions: owner => target === null ? null : live.current.renderSlot('forge.diff.comment.actions', { target, ...owner }), records: queue, openLink, reviewStarted, onQuoted: (selection) => { if (!queue.recordAgent(selection)) live.current.report('review.saveFailed') }, @@ -1207,7 +1212,7 @@ export function ChangesView({ url => queue.published(selection, url)) : Promise.resolve(live.current.t('review.stale')), } : {}, - }, [shownSource, addReviewToInput, queue, openLink, reviewStarted, publishingBlocked, queueable, single, target]) + }, [shownSource, addReviewToInput, quoteCopy, queue, openLink, reviewStarted, publishingBlocked, queueable, single, target]) let body: ReactNode if (data === null) { diff --git a/packages/experimental/client-ui-forge/src/client/ReviewChat.tsx b/packages/experimental/client-ui-forge/src/client/ReviewChat.tsx index 74d29d497e..4976e8923e 100644 --- a/packages/experimental/client-ui-forge/src/client/ReviewChat.tsx +++ b/packages/experimental/client-ui-forge/src/client/ReviewChat.tsx @@ -38,8 +38,8 @@ export interface ReviewChatFace { readonly retain: (sessionId: SessionId, signal: AbortSignal) => SessionReference /** Bind the change request to the Session at its next message, or forget the choice for null. */ readonly stage: (sessionId: SessionId, url: string | null) => void - /** Fill the draft of a retained Session once it opens. */ - readonly fill: (reference: SessionReference, draft: ReviewDraft) => void + /** Fill the draft of a retained Session once it opens; settles once the draft is filled or the Session failed to open. */ + readonly fill: (reference: SessionReference, draft: ReviewDraft) => Promise /** Show the Session in the main conversation view. */ readonly openInMain: (sessionId: SessionId) => void /** Ask for a worktree for the Session before its first step. */ @@ -84,12 +84,122 @@ export function ReviewConversation({ ) } +/** The conversation the review page keeps for the change request it shows, held while the page shows it. */ +export interface ReviewConversation { + /** Whether no conversation could start, because no Workspace exists or connecting failed. */ + readonly failed: boolean + /** The retained conversation, or null before one. */ + readonly reference: SessionReference | null + /** Retain a conversation at once, releasing the one held before. */ + readonly hold: (sessionId: SessionId) => void + /** Record that a conversation's draft already names the change request. */ + readonly markFilled: (sessionId: SessionId) => void + /** + * Start the conversation when there is none, retain it, bind the change request at its next message, and quote the + * change request in its draft. + * @returns the opened conversation once its draft names the change request, or undefined when none could start. + */ + readonly start: () => Promise +} + +/** The conversation the page retains, with the controller that releases it. */ +interface Held { + readonly sessionId: SessionId + readonly controller: AbortController + readonly reference: SessionReference +} + +/** + * Keep the conversation of the shown change request: retain it while the page shows the change request, so its draft + * takes quotes from any tab, and quote the change request in its draft once. + * @param frame - the shown change request, or undefined before its first frame. + * @param sessionId - the conversation recorded for the change request, or undefined before one. + * @param onConversation - records the conversation of the change request, or forgets it for null. + * @param chat - what the chat asks of the forge panel. + * @returns the conversation state and its actions. + */ +export function useReviewConversation( + frame: ForgeReviewChangeRequest | undefined, sessionId: SessionId | undefined, onConversation: (sessionId: SessionId | null) => void, + chat: ReviewChatFace, +): ReviewConversation { + const [failed, setFailed] = useState(false) + const [reference, setReference] = useState<{ readonly sessionId: SessionId; readonly reference: SessionReference } | null>(null) + const held = useRef(null) + const filled = useRef(new Map>()) + const connecting = useRef | null>(null) + const latest = useRef({ frame, onConversation }) + latest.current = { frame, onConversation } + // Retains synchronously: a Workspace the reader picks moves the draft to its blank as soon as the handler returns. + const hold = useCallback((id: SessionId): void => { + if (held.current?.sessionId === id) return + held.current?.controller.abort() + const controller = new AbortController() + const retained = chat.retain(id, controller.signal) + held.current = { sessionId: id, controller, reference: retained } + setReference({ sessionId: id, reference: retained }) + }, [chat]) + useEffect(() => () => { + held.current?.controller.abort() + held.current = null + }, []) + const fillOnce = useCallback(async (retained: SessionReference, shown: ForgeReviewChangeRequest): Promise => { + let filling = filled.current.get(retained.sessionId) + if (filling === undefined) { + filling = chat.fill(retained, { kind: 'reference', frame: shown }) + filled.current.set(retained.sessionId, filling) + } + await filling + }, [chat]) + const markFilled = useCallback((id: SessionId) => { filled.current.set(id, Promise.resolve()) }, []) + const url = frame?.url + useEffect(() => { + if (sessionId === undefined || url === undefined) return + hold(sessionId) + chat.stage(sessionId, url) + }, [sessionId, url, chat, hold]) + useEffect(() => { + if (frame === undefined || reference === null || reference.sessionId !== sessionId) return + void fillOnce(reference.reference, frame) + }, [frame, reference, sessionId, fillOnce]) + const start = useCallback(async (): Promise => { + const shown = latest.current.frame + if (shown === undefined) return undefined + let id = sessionId + if (id === undefined) { + connecting.current ??= chat.connect(shown).catch(() => undefined) + id = await connecting.current + connecting.current = null + if (id === undefined) { + setFailed(true) + return undefined + } + hold(id) + chat.stage(id, shown.url) + latest.current.onConversation(id) + } + hold(id) + const retained = held.current?.reference + if (retained === undefined) return undefined + await fillOnce(retained, shown) + return retained + }, [sessionId, chat, hold, fillOnce]) + return { + failed, + reference: reference !== null && reference.sessionId === sessionId ? reference.reference : null, + hold, + markFilled, + start, + } +} + /** Props of the chat tab. */ export interface ReviewChatProps extends Pick, 'renderSlot' | 'SessionProvider'> { /** The change request. */ readonly frame: ForgeReviewChangeRequest /** The conversation the page started for the change request, or undefined before one. */ readonly sessionId: SessionId | undefined + /** The conversation the page keeps for the change request. */ + readonly conversation: ReviewConversation /** Record the conversation of the change request, or forget it for null. */ readonly onConversation: (sessionId: SessionId | null) => void /** What the tab asks of the forge panel. */ @@ -103,49 +213,17 @@ export interface ReviewChatProps extends Pick(null) - const held = useRef<{ readonly sessionId: SessionId; readonly controller: AbortController } | null>(null) - // Retains synchronously: a Workspace the reader picks moves the draft to its blank as soon as the handler returns. - const hold = useCallback((id: SessionId): void => { - if (held.current?.sessionId === id) return - held.current?.controller.abort() - const controller = new AbortController() - held.current = { sessionId: id, controller } - setReference({ sessionId: id, reference: chat.retain(id, controller.signal) }) - }, [chat]) - useEffect(() => () => { - held.current?.controller.abort() - held.current = null - }, []) +export function ReviewChat({ + frame, sessionId, conversation, onConversation, chat, renderSlot, SessionProvider, t, +}: ReviewChatProps): ReactNode { + const { failed, reference, start } = conversation useEffect(() => { - if (sessionId !== undefined) return - let cancelled = false - void chat.connect(frame).then((connected) => { - if (cancelled) return - if (connected === undefined) { setFailed(true); return } - onConversation(connected) - }, () => { if (!cancelled) setFailed(true) }) - return () => { cancelled = true } - }, [sessionId, frame, chat, onConversation]) - const url = frame.url - const [filled, setFilled] = useState(null) - useEffect(() => { - if (sessionId === undefined) return - hold(sessionId) - chat.stage(sessionId, url) - }, [sessionId, url, chat, hold]) - // The reference goes in once per conversation; later frames of the same change request do not refill it. - useEffect(() => { - if (sessionId === undefined || filled === sessionId || reference?.sessionId !== sessionId) return - setFilled(sessionId) - chat.fill(reference.reference, { kind: 'reference', frame }) - }, [sessionId, filled, reference, frame, chat]) + if (sessionId === undefined && !failed) void start() + }, [sessionId, failed, start]) if (failed) { return

{t('reviewPage.chat.unavailable')}

} - if (sessionId === undefined || reference?.sessionId !== sessionId) return
+ if (sessionId === undefined || reference === null) return
const name = t('change.number', { number: frame.ref.number }) const repository = frame.ref.repository return ( @@ -155,7 +233,7 @@ export function ReviewChat({ frame, sessionId, onConversation, chat, renderSlot, {PROMPTS.map(prompt => ( ))} @@ -167,14 +245,14 @@ export function ReviewChat({ frame, sessionId, onConversation, chat, renderSlot,
- + {renderSlot('forge.review.conversation', { headline: t('reviewPage.chat.headline', { name: `${repository.name} ${name}` }), onWorkspaceSession: (next) => { if (next === sessionId) return - hold(next) + conversation.hold(next) // The moved draft already names the change request. - setFilled(next) + conversation.markFilled(next) chat.stage(sessionId, null) onConversation(next) }, diff --git a/packages/experimental/client-ui-forge/src/client/ReviewComposer.tsx b/packages/experimental/client-ui-forge/src/client/ReviewComposer.tsx index bb9589f05d..89b0c3c16e 100644 --- a/packages/experimental/client-ui-forge/src/client/ReviewComposer.tsx +++ b/packages/experimental/client-ui-forge/src/client/ReviewComposer.tsx @@ -5,7 +5,7 @@ import clsx from 'clsx' import { Button, IconChevronDownOutlineRegular, Menu, MenuItemButton } from '@deepseek-ai/dsh-client-ui-primitives' import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots' import type { ReviewQueue } from './review-queue.ts' -import { reviewRange, type ReviewSelection, type ReviewSource } from './review.ts' +import { INPUT_QUOTE_COPY, reviewRange, settleQuote, type QuoteCopy, type ReviewSelection, type ReviewSource } from './review.ts' import type { NS } from './locales.ts' import type { ForgeCommentActionsProps } from './slots.ts' import css from './ReviewComposer.module.css' @@ -22,8 +22,10 @@ export interface ReviewActions { readonly openLink?: (url: string) => void /** A write is running or its outcome still needs confirmation. */ readonly publishingBlocked?: boolean - /** Append an atomic quote without sending the Agent a message. */ - readonly addToInput: (selection: ReviewSelection) => boolean + /** Append an atomic quote without sending the Agent a message; resolves to whether it was accepted. */ + readonly addToInput: (selection: ReviewSelection) => boolean | Promise + /** Copy of the quote button, the quoted tag, and the refusal; the input's copy by default. */ + readonly quoteCopy?: QuoteCopy | undefined /** Retain a new comment after its quote was accepted. */ readonly onQuoted?: (selection: ReviewSelection) => void /** Publish one comment; an error string preserves the editor. */ @@ -76,6 +78,7 @@ export function ReviewComposer({ selection, actions, close, visible = true, t }: const [empty, setEmpty] = useState(body.current.trim() === '') const [busy, setBusy] = useState(false) const [error, setError] = useState(null) + const copy = actions.quoteCopy ?? INPUT_QUOTE_COPY const running = useRef(false) const input = useRef(null) useEffect(() => { input.current?.focus() }, []) @@ -115,9 +118,11 @@ export function ReviewComposer({ selection, actions, close, visible = true, t }: + settleQuote(actions.addToInput(selected), (accepted) => { + if (accepted) { actions.onQuoted?.(selected); close() } + else setError(t(copy.failed)) + }) + }}>{t(copy.add)} {actions.renderActions?.({ selection: { path: selection.comment.path, side: selection.comment.side, diff --git a/packages/experimental/client-ui-forge/src/client/ReviewDetail.tsx b/packages/experimental/client-ui-forge/src/client/ReviewDetail.tsx index bb87737e4b..15e0f17d4c 100644 --- a/packages/experimental/client-ui-forge/src/client/ReviewDetail.tsx +++ b/packages/experimental/client-ui-forge/src/client/ReviewDetail.tsx @@ -7,7 +7,7 @@ import { useEffect, useMemo, useState, type ReactNode } from 'react' import clsx from 'clsx' import { - Button, IconChevronLeftOutlineRegular, IconEllipsisOutlineRegular, IconPanelLeftOutlineRegular, IconSparkleRegular, MarkdownText, Menu, + Button, IconChevronLeftOutlineRegular, IconEllipsisOutlineRegular, IconPanelLeftOutlineRegular, MarkdownText, Menu, StateDot, Tooltip, type MenuEntry, } from '@deepseek-ai/dsh-client-ui-primitives' import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots' @@ -70,8 +70,8 @@ export interface ReviewDetailProps { readonly renderChanges: (frame: ForgeReviewChangeRequest) => ReactNode /** The chat tab's content. */ readonly renderChat: (frame: ForgeReviewChangeRequest) => ReactNode - /** Start a review conversation about the change request in the chat tab. */ - readonly askAgent: () => void + /** Quotes added to the conversation while the chat tab was not shown. */ + readonly unseenQuotes: number /** Forge panel copy. */ readonly t: Translate } @@ -198,7 +198,8 @@ function Summary({ frame, snapshot, description, now, locale, actions, t }: { * @returns the detail. */ export function ReviewDetail({ - url, read, tab, onTab, listHidden, onToggleList, onBack, now, locale, actions, readDescription, renderChanges, renderChat, askAgent, t, + url, read, tab, onTab, listHidden, onToggleList, onBack, now, locale, actions, readDescription, renderChanges, renderChat, unseenQuotes, + t, }: ReviewDetailProps): ReactNode { const frame = read.frame const snapshot = frame?.snapshot ?? null @@ -248,7 +249,10 @@ export function ReviewDetail({ const tabLabel = (value: ReviewTab): ReactNode => value === 'changes' ? <>{t('reviewPage.tab.changes')}{`+${snapshot.additions.toLocaleString(locale)}`} {`−${snapshot.deletions.toLocaleString(locale)}`} - : t(value === 'summary' ? 'reviewPage.tab.summary' : 'reviewPage.tab.chat') + : value === 'summary' ? t('reviewPage.tab.summary') + : <>{t('reviewPage.tab.chat')}{unseenQuotes > 0 && ( + {unseenQuotes} + )} return (
@@ -268,7 +272,6 @@ export function ReviewDetail({ )} - diff --git a/packages/experimental/client-ui-forge/src/client/ReviewList.tsx b/packages/experimental/client-ui-forge/src/client/ReviewList.tsx index ba39472cdb..535e4f3ca3 100644 --- a/packages/experimental/client-ui-forge/src/client/ReviewList.tsx +++ b/packages/experimental/client-ui-forge/src/client/ReviewList.tsx @@ -3,23 +3,25 @@ * and one foldable section per list with its items, empty state, and failure. */ -import { useState, type ReactNode } from 'react' +import { useRef, useState, type ReactNode } from 'react' import clsx from 'clsx' import { - Button, IconCheckOutlineRegular, IconChevronDownOutlineRegular, IconSearchOutlineRegular, IconSlidersTwoOutlineRegular, Input, Menu, - MenuItemButton, Tooltip, + Button, HoverCard, IconChevronDownOutlineRegular, IconFlatListOutlineRegular, IconFolderCloseRegular, IconLayersOutlineRegular, + IconSearchOutlineRegular, IconSlidersTwoOutlineRegular, IconUserOutlineRegular, IconUsersOutlineRegular, Input, Menu, titleMarqueeClass, + Tooltip, useTitleMarquee, type MenuEntry, } from '@deepseek-ai/dsh-client-ui-primitives' import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots' import type { ChecksRollup, ForgeViewerFilter } from '@deepseek-ai/dsh-experimental-forge/types' import type { ForgeReviewFrame } from '../types.ts' -import { formatAgo } from './format.ts' +import { formatAgo, formatShortAgo } from './format.ts' import { ChangeRequestGlyph } from './glyphs.tsx' import type { ForgePanelKey, NS } from './locales.ts' import { RefreshGlyph } from './RefreshGlyph.tsx' import { pastedUrl, reviewHint, reviewRepositories, reviewSections, summaryTone, type ReviewItem, type ReviewRepository, type ReviewSection, } from './review-lists.ts' +import type { ReviewView } from './review-store.ts' import css from './ReviewPage.module.css' type Translate = PropsLocale['t'] @@ -58,6 +60,10 @@ export interface ReviewListProps { readonly onScope: (repository: ReviewRepository | null) => void /** Toggle whether the review-requested list leaves out team requests. */ readonly onToggleDirect: () => void + /** How list items show: two lines each, or one line each with the rest on hover. */ + readonly view: ReviewView + /** Choose how list items show. */ + readonly onView: (view: ReviewView) => void /** Fold or unfold a section. */ readonly onFold: (filter: ForgeViewerFilter) => void /** Read every list again. */ @@ -70,9 +76,9 @@ export interface ReviewListProps { readonly t: Translate } -/** The filter menu: the repository the lists are read in, and whether team requests show. */ -function FilterMenu({ frame, repository, directOnly, onScope, onToggleDirect, t }: Pick): ReactNode { +/** The view menu, laid out like the Session list's: the list view, the repository the lists are read in, and whether team requests show. */ +function FilterMenu({ frame, repository, directOnly, view, onScope, onToggleDirect, onView, t }: Pick): ReactNode { const [open, setOpen] = useState(false) const repositories = reviewRepositories(frame) const chosen = repository === null ? null : `${repository.owner}/${repository.name}` @@ -80,9 +86,30 @@ function FilterMenu({ frame, repository, directOnly, onScope, onToggleDirect, t const offered = repository !== null && !repositories.some(item => `${item.owner}/${item.name}` === chosen) ? [repository, ...repositories] : repositories const items: MenuEntry[] = [ - { type: 'label', id: 'repository', text: t('reviewPage.filter.repository') }, - { id: '', label: t('reviewPage.filter.allRepositories') }, - ...offered.map(item => ({ id: `${item.owner}/${item.name}`, label: `${item.owner}/${item.name}` })), + { type: 'label', id: 'view', text: t('reviewPage.filter.view') }, + { id: 'view:detailed', label: t('reviewPage.filter.detailed'), icon: }, + { id: 'view:compact', label: t('reviewPage.filter.compact'), icon: }, + { type: 'separator', id: 'repository-separator' }, + { type: 'label', id: 'repository-label', text: t('reviewPage.filter.repository') }, + { + id: 'repository', + icon: , + label: ( + + {t('reviewPage.filter.repository')} + {chosen ?? t('reviewPage.filter.allRepositories')} + + ), + submenu: [ + { id: 'repo:', label: t('reviewPage.filter.allRepositories') }, + { type: 'separator', id: 'repo-separator' }, + ...offered.map(item => ({ id: `repo:${item.owner}/${item.name}`, label: `${item.owner}/${item.name}` })), + ], + }, + { type: 'separator', id: 'requests-separator' }, + { type: 'label', id: 'requests', text: t('reviewPage.filter.requests') }, + { id: 'requests:all', label: t('reviewPage.filter.teamRequests'), icon: }, + { id: 'requests:direct', label: t('reviewPage.filter.directOnly'), icon: }, ] const active = repository !== null || directOnly return ( @@ -90,7 +117,9 @@ function FilterMenu({ frame, repository, directOnly, onScope, onToggleDirect, t open={open} onClose={() => { setOpen(false) }} portal + dense align="end" + submenuBackLabel={t('reviewPage.filter.back')} anchor={( + )} + /> + + ) +} + /** One listed change request. */ function Item({ item, filter, selected, qualified, now, onSelect, t }: { readonly item: ReviewItem @@ -157,8 +252,8 @@ function Item({ item, filter, selected, qualified, now, onSelect, t }: { {summary.author !== null && <>{summary.author.login}} {ago !== undefined && <>{ago}} + {hint !== undefined && <>{t(hint.key, hint.params)}} - {hint !== undefined && {t(hint.key, hint.params)}} @@ -197,7 +292,8 @@ function SectionFailure({ section, copyText, t }: { * @returns the column. */ export function ReviewList(props: ReviewListProps): ReactNode { - const { frame, stopped, selected, query, folded, refreshing, now, onSelect, onSearch, onFold, onRefresh, onRetry, copyText, t } = props + const { frame, stopped, selected, query, folded, refreshing, now, view } = props + const { onSelect, onSearch, onFold, onRefresh, onRetry, copyText, t } = props const sections = reviewSections(frame, query, props.directOnly) const pasted = pastedUrl(query) const qualified = reviewRepositories(frame).length > 1 @@ -241,11 +337,12 @@ export function ReviewList(props: ReviewListProps): ReactNode { : shown.length === 0 ?

{t(query.trim() === '' ? 'reviewPage.empty.section' : 'reviewPage.empty.search')}

: ( -
    - {shown.map(item => ( - + {shown.map((item) => { + const Row = view === 'compact' ? CompactItem : Item + return - ))} + })}
)} {section.truncated && query.trim() === '' && ( diff --git a/packages/experimental/client-ui-forge/src/client/ReviewPage.module.css b/packages/experimental/client-ui-forge/src/client/ReviewPage.module.css index e3c3bf7c0d..613da47d10 100644 --- a/packages/experimental/client-ui-forge/src/client/ReviewPage.module.css +++ b/packages/experimental/client-ui-forge/src/client/ReviewPage.module.css @@ -98,9 +98,20 @@ color: var(--dsw-alias-state-business-primary); } -.menuIconSpace { - display: inline-block; - width: 16px; +.menuRow { + display: flex; + gap: 12px; + align-items: center; + justify-content: space-between; + min-width: 0; +} + +.menuValue { + overflow: hidden; + color: var(--dsw-alias-label-tertiary); + font-size: 12px; + text-overflow: ellipsis; + white-space: nowrap; } .openUrl { @@ -243,6 +254,103 @@ color: var(--dsw-alias-state-success-primary); } +/* Compact view: one 32px row per change request, sized like a Session list row. */ +.compactItem { + display: flex; + align-items: center; + gap: 8px; + width: 100%; + height: 32px; + padding: 0 8px; + border: 0; + border-radius: var(--dsw-radius-sm); + background: transparent; + color: inherit; + font: inherit; + text-align: left; + cursor: pointer; +} + +.compactItem:hover { + background: var(--dsw-alias-interactive-bg-hover); +} + +.compactItem[aria-current='true'] { + background: var(--dsw-alias-interactive-bg-active); +} + +.compactItem:focus-visible { + outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); + outline-offset: 1px; +} + +.compactGlyph { + display: inline-flex; + flex: none; +} + +.compactTitle { + flex: 1; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.compactTime { + flex: none; + color: var(--dsw-alias-label-tertiary); + font-size: 10px; +} + +/* The hover card of a compact item uses the hover card's own colors over its dark fill. */ +.compactCard { + display: flex; + flex-direction: column; + gap: 4px; + max-width: 320px; + color: var(--dsw-alias-hovercard-label-secondary); + font-size: 12px; + line-height: 18px; +} + +.compactCardTitle { + color: var(--dsw-alias-hovercard-label-primary); + font-size: 13px; + font-weight: 600; + overflow-wrap: anywhere; +} + +.compactCard .itemMeta { + color: var(--dsw-alias-hovercard-label-tertiary); +} + +.compactCard .itemHint { + color: var(--dsw-alias-hovercard-label-secondary); +} + +.compactCard .itemHint[data-tone='error'] { + color: var(--dsw-alias-hovercard-state-error); +} + +.compactCard .itemHint[data-tone='success'] { + color: var(--dsw-alias-hovercard-state-done); +} + +.tabBadge { + min-width: 16px; + height: 16px; + padding: 0 4px; + box-sizing: border-box; + border-radius: 8px; + background: var(--dsw-alias-state-business-primary); + color: var(--dsw-alias-label-primary-foreground); + font-size: 10px; + font-weight: 600; + line-height: 16px; + text-align: center; +} + .ellipsis { overflow: hidden; text-overflow: ellipsis; diff --git a/packages/experimental/client-ui-forge/src/client/ReviewPage.tsx b/packages/experimental/client-ui-forge/src/client/ReviewPage.tsx index 2c53f6f904..f75206bd97 100644 --- a/packages/experimental/client-ui-forge/src/client/ReviewPage.tsx +++ b/packages/experimental/client-ui-forge/src/client/ReviewPage.tsx @@ -8,17 +8,18 @@ import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react import clsx from 'clsx' import type { HostObservable, InjectFace, PropsLocale, PropsRenderSlots, PropsStore } from '@deepseek-ai/dsh-client-ui-slots' import type { SnapshotSelectorHook } from '@deepseek-ai/dsh-client-store' -import type { ChangeRequestDescription } from '@deepseek-ai/dsh-experimental-forge/types' +import type { ChangeRequestDescription, ForgeReviewThread } from '@deepseek-ai/dsh-experimental-forge/types' import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol' import type { ForgeReviewChangeRequest, ForgeReviewFrame } from '../types.ts' import type { ChangeRequestActions } from './ChangeRequestCard.tsx' import type { ForgeLensDescription } from './changes-service.ts' import { ChangesView, type ChangesTabInjected, type ChangesViewTab } from './ChangesTab.tsx' -import { useHostStream } from './host-stream.ts' +import { useHostStream, type StreamRead } from './host-stream.ts' import type { NS } from './locales.ts' -import { ReviewChat, type ReviewChatFace } from './ReviewChat.tsx' +import { ReviewChat, useReviewConversation, type ReviewChatFace } from './ReviewChat.tsx' import { ReviewDetail } from './ReviewDetail.tsx' import { ReviewList } from './ReviewList.tsx' +import type { QuoteCopy, ReviewSelection } from './review.ts' import type { createReviewStore, ReviewTab } from './review-store.ts' import type { HostStream, StreamSnapshot } from './source.ts' import type { ChangesPanelState } from './status.ts' @@ -26,8 +27,14 @@ import type { SessionId } from '@deepseek-ai/dsh-session/types' import type { ForgeExtensionState } from '../types.ts' import css from './ReviewPage.module.css' -/** What the changes view of the review page reads and does, each naming the change request by URL. */ -export type ReviewChangesFace = Omit +/** + * What the changes view of the review page reads and does, each naming the change request by URL; the page quotes + * comments and threads into its own conversation. + */ +export type ReviewChangesFace = Omit + +/** The quote copy of the review page, which quotes into the change request's conversation. */ +const CHAT_QUOTE_COPY: QuoteCopy = { add: 'reviewPage.addToChat', added: 'reviewPage.addedToChat', failed: 'reviewPage.addToChatFailed' } /** Business face of the review page. */ export interface ReviewPageInjected { @@ -51,6 +58,10 @@ export interface ReviewPageInjected { readonly copyText: (text: string) => void /** What the chat tab asks of the forge panel. */ readonly chat: ReviewChatFace + /** Quote a comment in a retained Session's draft; returns whether the draft took it. */ + readonly quoteReview: (sessionId: SessionId, selection: ReviewSelection) => boolean + /** Quote a whole thread in a retained Session's draft; returns whether the draft took it. */ + readonly quoteThread: (sessionId: SessionId, thread: ForgeReviewThread, url: string, range: string | null) => boolean } /** Full props of the review page. */ @@ -82,7 +93,7 @@ function useMinuteClock(): number { function ReviewChanges({ frame, visible, changes, useStore, actions, t }: { readonly frame: ForgeReviewChangeRequest readonly visible: boolean - readonly changes: ReviewChangesFace + readonly changes: Omit readonly useStore: ReviewPageProps['useStore'] readonly actions: ReviewPageProps['actions'] readonly t: ReviewPageProps['t'] @@ -106,20 +117,86 @@ function ReviewChanges({ frame, visible, changes, useStore, actions, t }: { if (tab === null) return null return ( ) } +/** Props of the detail pane, keyed by the shown change request. */ +interface DetailPaneProps { + readonly url: string + readonly read: StreamRead + readonly tab: ReviewTab + readonly listHidden: boolean + readonly now: number + readonly locale: string + readonly cardActions: ChangeRequestActions + readonly conversationId: SessionId | undefined + readonly onConversation: (sessionId: SessionId | null) => void + readonly unseenQuotes: number + readonly page: ReviewPageProps +} + +/** + * The detail of the shown change request with the conversation the page keeps for it: quotes from the changes tab go + * into that conversation's draft, starting the conversation when there is none. + * @param props - the change request stream, the tab, the conversation, and the page's face. + * @returns the detail. + */ +function DetailPane({ + url, read, tab, listHidden, now, locale, cardActions, conversationId, onConversation, unseenQuotes, page, +}: DetailPaneProps): ReactNode { + const { actions, changes, chat, quoteReview, quoteThread, readDescription, renderSlot, SessionProvider, useStore, t } = page + const conversation = useReviewConversation(read.frame, conversationId, onConversation, chat) + const { start } = conversation + const quoteChanges = useMemo(() => { + const quote = async (insert: (sessionId: SessionId) => boolean): Promise => { + const retained = await start() + if (retained === undefined || !insert(retained.sessionId)) return false + actions.quoted(url) + return true + } + return { + ...changes, + addReviewToInput: async (selection: ReviewSelection) => await quote(sessionId => quoteReview(sessionId, selection)), + addThreadToInput: async (thread: ForgeReviewThread, threadUrl: string, range: string | null) => + await quote(sessionId => quoteThread(sessionId, thread, threadUrl, range)), + } + }, [changes, start, quoteReview, quoteThread, actions, url]) + return ( + { actions.tabbed(value) }} + listHidden={listHidden} + onToggleList={() => { actions.toggledList() }} + onBack={() => { actions.select(null) }} + now={now} + locale={locale} + actions={cardActions} + readDescription={readDescription} + renderChanges={frame => ( + + )} + renderChat={frame => ( + + )} + unseenQuotes={unseenQuotes} + t={t} + /> + ) +} + /** * Render the review page. * @param props - the Host streams and reads, the card actions, the page store, and copy. * @returns the page. */ -export function ReviewPage({ - useLocale, openLists, openChangeRequest, subscribeReset, refresh, readDescription, actionsFor, changes, copyText, chat, useStore, actions, - renderSlot, SessionProvider, t, -}: ReviewPageProps): ReactNode { +export function ReviewPage(props: ReviewPageProps): ReactNode { + const { useLocale, openLists, openChangeRequest, subscribeReset, refresh, actionsFor, copyText, useStore, actions, t } = props const locale = useLocale(value => value) const now = useMinuteClock() const selected = useStore(state => state.selected) @@ -129,6 +206,8 @@ export function ReviewPage({ const repository = useStore(state => state.repository) const query = useStore(state => state.query) const directOnly = useStore(state => state.directOnly) + const view = useStore(state => state.view) + const unseenQuotes = useStore(state => selected === null ? 0 : state.unseenQuotes[selected] ?? 0) const conversation = useStore(state => selected === null ? undefined : state.conversations[selected]) const onConversation = useMemo(() => selected === null ? null : (sessionId: SessionId | null) => { actions.conversed(selected, sessionId) @@ -161,6 +240,8 @@ export function ReviewPage({ onSearch={(value) => { actions.searched(value) }} onScope={(value) => { actions.scopedTo(value) }} onToggleDirect={() => { actions.toggledDirect() }} + view={view} + onView={(value) => { actions.viewed(value) }} onFold={(filter) => { actions.folded(filter) }} onRefresh={startRefresh} onRetry={lists.retry} @@ -177,28 +258,19 @@ export function ReviewPage({
) : ( - { actions.tabbed(value) }} listHidden={listHidden} - onToggleList={() => { actions.toggledList() }} - onBack={() => { actions.select(null) }} now={now} locale={locale} - actions={cardActions} - readDescription={readDescription} - renderChanges={frame => ( - - )} - renderChat={frame => ( - - )} - askAgent={() => { actions.tabbed('chat') }} - t={t} + cardActions={cardActions} + conversationId={conversation} + onConversation={onConversation} + unseenQuotes={unseenQuotes} + page={props} /> )}
diff --git a/packages/experimental/client-ui-forge/src/client/ReviewThread.tsx b/packages/experimental/client-ui-forge/src/client/ReviewThread.tsx index b7f2f818a5..b034057993 100644 --- a/packages/experimental/client-ui-forge/src/client/ReviewThread.tsx +++ b/packages/experimental/client-ui-forge/src/client/ReviewThread.tsx @@ -5,7 +5,7 @@ import { Button, Tag } from '@deepseek-ai/dsh-client-ui-primitives' import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots' import type { ReviewActions } from './ReviewComposer.tsx' import { EMPTY_FILE_REVIEW, type FileReviewState, type ReviewThread as Thread } from './review-queue.ts' -import { reviewRange } from './review.ts' +import { INPUT_QUOTE_COPY, reviewRange, settleQuote } from './review.ts' import type { NS } from './locales.ts' import css from './ReviewComposer.module.css' @@ -42,7 +42,8 @@ export function ReviewThread({ thread, actions, locked, outdated, t }: PropsLoca const comment = thread.selection.comment const quoted = editing && thread.kind === 'pending' ? { ...thread.selection, comment: { ...comment, body } } : thread.selection const range = reviewRange(comment) - const status = thread.kind === 'pending' ? 'review.browserDraft' : thread.kind === 'published' ? 'review.published' : 'review.quoted' + const copy = actions.quoteCopy ?? INPUT_QUOTE_COPY + const status = thread.kind === 'pending' ? 'review.browserDraft' : thread.kind === 'published' ? 'review.published' : copy.added const save = (): boolean => actions.records?.editThread(thread.key, body) === true const queue = actions.queue /** Add the draft to the pending review on the code host, then delete it from the browser. */ @@ -76,8 +77,8 @@ export function ReviewThread({ thread, actions, locked, outdated, t }: PropsLoca {error !== null &&
{error}
}
+ settleQuote(actions.addToInput(quoted), (accepted) => { if (!accepted) setError(t(copy.failed)) }) + }}>{t(copy.add)} {thread.kind === 'pending' && <> {editing ?
{writes !== null && thread.viewerCanReply && }
- {url !== null &&