@deepseek-ai/dsh-experimental-client-ui-forge 0.2.2-rc.5 → 0.2.3-alpha.2
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 +12 -12
- package/README.md +47 -30
- package/README.zh.md +47 -30
- package/lib/client.js +18 -8
- package/lib/client.js.map +1 -1
- package/lib/index.js +2444 -406
- package/lib/typert.host.js +3433 -950
- package/lib/typert.remote-client.d.ts +89 -14
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +3155 -978
- package/lib/types/branch-name.d.ts +30 -0
- package/lib/types/branch-name.d.ts.map +1 -0
- package/lib/types/branch-name.js.map +1 -0
- package/lib/types/client/AttentionIndicator.d.ts +22 -0
- package/lib/types/client/AttentionIndicator.d.ts.map +1 -0
- package/lib/types/client/AttentionIndicator.js.map +1 -0
- package/lib/types/client/BaseMenu.d.ts.map +1 -1
- package/lib/types/client/BaseMenu.js.map +1 -1
- package/lib/types/client/ChangeRequestCard.d.ts +87 -9
- 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 +126 -10
- 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 +76 -0
- package/lib/types/client/ChangeRequestsSection.d.ts.map +1 -0
- package/lib/types/client/ChangeRequestsSection.js.map +1 -0
- package/lib/types/client/ChangedFiles.d.ts +6 -2
- package/lib/types/client/ChangedFiles.d.ts.map +1 -1
- package/lib/types/client/ChangedFiles.js.map +1 -1
- package/lib/types/client/ChangesLoading.d.ts +14 -0
- package/lib/types/client/ChangesLoading.d.ts.map +1 -0
- package/lib/types/client/ChangesLoading.js.map +1 -0
- package/lib/types/client/ChangesTab.d.ts +62 -14
- package/lib/types/client/ChangesTab.d.ts.map +1 -1
- package/lib/types/client/ChangesTab.js.map +1 -1
- package/lib/types/client/ChangesTabTitle.js.map +1 -1
- package/lib/types/client/DiffFile.d.ts +23 -4
- 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 +79 -0
- package/lib/types/client/EnvironmentRows.d.ts.map +1 -0
- package/lib/types/client/EnvironmentRows.js.map +1 -0
- package/lib/types/client/FileTreePane.d.ts +5 -2
- package/lib/types/client/FileTreePane.d.ts.map +1 -1
- package/lib/types/client/FileTreePane.js.map +1 -1
- package/lib/types/client/LensFilter.d.ts +50 -0
- package/lib/types/client/LensFilter.d.ts.map +1 -0
- package/lib/types/client/LensFilter.js.map +1 -0
- package/lib/types/client/ReasonButton.d.ts +15 -0
- package/lib/types/client/ReasonButton.d.ts.map +1 -0
- package/lib/types/client/ReasonButton.js.map +1 -0
- package/lib/types/client/ReviewComposer.d.ts +11 -4
- 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 +18 -7
- 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 +3 -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 +32 -2
- package/lib/types/client/ReviewThreads.d.ts.map +1 -1
- package/lib/types/client/ReviewThreads.js.map +1 -1
- package/lib/types/client/SessionHoverForge.d.ts.map +1 -1
- package/lib/types/client/SessionHoverForge.js.map +1 -1
- package/lib/types/client/SubmitReview.d.ts +4 -4
- package/lib/types/client/SubmitReview.d.ts.map +1 -1
- package/lib/types/client/SubmitReview.js.map +1 -1
- package/lib/types/client/ThreadList.js.map +1 -1
- package/lib/types/client/ViewOptionsMenu.d.ts +7 -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 +38 -0
- package/lib/types/client/WorktreeNameDialog.d.ts.map +1 -0
- package/lib/types/client/WorktreeNameDialog.js.map +1 -0
- package/lib/types/client/WorktreeProgress.d.ts +14 -3
- package/lib/types/client/WorktreeProgress.d.ts.map +1 -1
- package/lib/types/client/WorktreeProgress.js.map +1 -1
- package/lib/types/client/WorktreeToggle.d.ts +22 -15
- package/lib/types/client/WorktreeToggle.d.ts.map +1 -1
- package/lib/types/client/WorktreeToggle.js.map +1 -1
- package/lib/types/client/action-notices.d.ts +25 -0
- package/lib/types/client/action-notices.d.ts.map +1 -0
- package/lib/types/client/action-notices.js.map +1 -0
- package/lib/types/client/annotations.d.ts +41 -0
- package/lib/types/client/annotations.d.ts.map +1 -0
- package/lib/types/client/annotations.js.map +1 -0
- package/lib/types/client/branch-search.d.ts +38 -0
- package/lib/types/client/branch-search.d.ts.map +1 -0
- package/lib/types/client/branch-search.js.map +1 -0
- package/lib/types/client/change-requests-store.d.ts +25 -0
- package/lib/types/client/change-requests-store.d.ts.map +1 -0
- package/lib/types/client/change-requests-store.js.map +1 -0
- package/lib/types/client/changes-address.d.ts +3 -1
- package/lib/types/client/changes-address.d.ts.map +1 -1
- package/lib/types/client/changes-address.js.map +1 -1
- package/lib/types/client/changes-service.d.ts +119 -0
- package/lib/types/client/changes-service.d.ts.map +1 -0
- package/lib/types/client/changes-service.js.map +1 -0
- package/lib/types/client/changes-store.d.ts +6 -2
- 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/checkout.d.ts.map +1 -1
- package/lib/types/client/checkout.js.map +1 -1
- package/lib/types/client/diff-rows.d.ts +49 -7
- package/lib/types/client/diff-rows.d.ts.map +1 -1
- package/lib/types/client/diff-rows.js.map +1 -1
- package/lib/types/client/file-tree.d.ts +7 -0
- package/lib/types/client/file-tree.d.ts.map +1 -1
- package/lib/types/client/file-tree.js.map +1 -1
- package/lib/types/client/forge-copy.d.ts +29 -0
- package/lib/types/client/forge-copy.d.ts.map +1 -0
- package/lib/types/client/forge-copy.js.map +1 -0
- package/lib/types/client/format.d.ts +8 -0
- package/lib/types/client/format.d.ts.map +1 -1
- package/lib/types/client/format.js.map +1 -1
- package/lib/types/client/glyphs.d.ts +3 -3
- package/lib/types/client/glyphs.d.ts.map +1 -1
- package/lib/types/client/glyphs.js.map +1 -1
- package/lib/types/client/highlight-context.d.ts +73 -0
- package/lib/types/client/highlight-context.d.ts.map +1 -0
- package/lib/types/client/highlight-context.js.map +1 -0
- package/lib/types/client/index.d.ts +9 -5
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/lens-filter.d.ts +69 -0
- package/lib/types/client/lens-filter.d.ts.map +1 -0
- package/lib/types/client/lens-filter.js.map +1 -0
- package/lib/types/client/locales.d.ts +188 -36
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/locales.js.map +1 -1
- package/lib/types/client/mount.d.ts +0 -4
- 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/ReviewChat.d.ts +112 -0
- package/lib/types/client/review-page/ReviewChat.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewChat.js.map +1 -0
- package/lib/types/client/review-page/ReviewDetail.d.ts +56 -0
- package/lib/types/client/review-page/ReviewDetail.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewDetail.js.map +1 -0
- package/lib/types/client/review-page/ReviewLabels.d.ts +32 -0
- package/lib/types/client/review-page/ReviewLabels.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewLabels.js.map +1 -0
- package/lib/types/client/review-page/ReviewList.d.ts +68 -0
- package/lib/types/client/review-page/ReviewList.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewList.js.map +1 -0
- package/lib/types/client/review-page/ReviewNav.d.ts +28 -0
- package/lib/types/client/review-page/ReviewNav.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewNav.js.map +1 -0
- package/lib/types/client/review-page/ReviewPage.d.ts +61 -0
- package/lib/types/client/review-page/ReviewPage.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewPage.js.map +1 -0
- package/lib/types/client/review-page/ReviewStatus.d.ts +37 -0
- package/lib/types/client/review-page/ReviewStatus.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewStatus.js.map +1 -0
- package/lib/types/client/review-page/host-stream.d.ts +24 -0
- package/lib/types/client/review-page/host-stream.d.ts.map +1 -0
- package/lib/types/client/review-page/host-stream.js.map +1 -0
- package/lib/types/client/review-page/review-lists.d.ts +116 -0
- package/lib/types/client/review-page/review-lists.d.ts.map +1 -0
- package/lib/types/client/review-page/review-lists.js.map +1 -0
- package/lib/types/client/review-page/review-mount.d.ts +50 -0
- package/lib/types/client/review-page/review-mount.d.ts.map +1 -0
- package/lib/types/client/review-page/review-mount.js.map +1 -0
- package/lib/types/client/review-page/review-store.d.ts +79 -0
- package/lib/types/client/review-page/review-store.d.ts.map +1 -0
- package/lib/types/client/review-page/review-store.js.map +1 -0
- package/lib/types/client/review-queue.d.ts +19 -0
- package/lib/types/client/review-queue.d.ts.map +1 -1
- package/lib/types/client/review-queue.js.map +1 -1
- package/lib/types/client/review-threads.d.ts +0 -8
- 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/review.d.ts +18 -0
- package/lib/types/client/review.d.ts.map +1 -1
- package/lib/types/client/review.js.map +1 -1
- package/lib/types/client/slots.d.ts +114 -0
- package/lib/types/client/slots.d.ts.map +1 -0
- package/lib/types/client/slots.js.map +1 -0
- package/lib/types/client/source.d.ts +29 -23
- package/lib/types/client/source.d.ts.map +1 -1
- package/lib/types/client/source.js.map +1 -1
- package/lib/types/client/status.d.ts +13 -2
- package/lib/types/client/status.d.ts.map +1 -1
- package/lib/types/client/status.js.map +1 -1
- package/lib/types/git.d.ts +4 -15
- package/lib/types/git.d.ts.map +1 -1
- package/lib/types/git.js.map +1 -1
- package/lib/types/index.d.ts +346 -28
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/lens-version.d.ts +14 -0
- package/lib/types/lens-version.d.ts.map +1 -0
- package/lib/types/lens-version.js.map +1 -0
- package/lib/types/lenses.d.ts +122 -0
- package/lib/types/lenses.d.ts.map +1 -0
- package/lib/types/lenses.js.map +1 -0
- package/lib/types/local-diff.d.ts +16 -0
- package/lib/types/local-diff.d.ts.map +1 -1
- package/lib/types/local-diff.js.map +1 -1
- package/lib/types/panel.d.ts +59 -8
- package/lib/types/panel.d.ts.map +1 -1
- package/lib/types/panel.js.map +1 -1
- package/lib/types/parse.d.ts +24 -8
- package/lib/types/parse.d.ts.map +1 -1
- package/lib/types/parse.js.map +1 -1
- package/lib/types/review-cache.d.ts +29 -19
- package/lib/types/review-cache.d.ts.map +1 -1
- package/lib/types/review-cache.js.map +1 -1
- package/lib/types/states.d.ts +11 -7
- package/lib/types/states.d.ts.map +1 -1
- package/lib/types/states.js.map +1 -1
- package/lib/types/types.d.ts +266 -20
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/viewer-lists.d.ts +113 -0
- package/lib/types/viewer-lists.d.ts.map +1 -0
- package/lib/types/viewer-lists.js.map +1 -0
- package/lib/types/worktree.d.ts +20 -11
- package/lib/types/worktree.d.ts.map +1 -1
- package/lib/types/worktree.js.map +1 -1
- package/locale/de.json +1 -1
- package/locale/en.json +1 -1
- package/locale/es.json +1 -1
- package/locale/fr.json +1 -1
- package/locale/ja.json +1 -1
- package/locale/pt.json +1 -1
- package/locale/ru.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +61 -52
- package/src/branch-name.ts +74 -0
- package/src/client/AttentionIndicator.tsx +37 -0
- package/src/client/BaseMenu.module.css +0 -20
- package/src/client/BaseMenu.tsx +9 -52
- package/src/client/ChangeRequestCard.tsx +276 -131
- package/src/client/ChangeRequestOverview.module.css +1 -1
- package/src/client/ChangeRequestOverview.tsx +183 -67
- package/src/client/ChangeRequestsSection.tsx +234 -0
- package/src/client/ChangedFiles.module.css +5 -1
- package/src/client/ChangedFiles.tsx +72 -36
- package/src/client/ChangesLoading.module.css +110 -0
- package/src/client/ChangesLoading.tsx +69 -0
- package/src/client/ChangesTab.module.css +83 -114
- package/src/client/ChangesTab.tsx +331 -100
- package/src/client/ChangesTabTitle.tsx +3 -3
- package/src/client/DiffFile.tsx +241 -45
- package/src/client/EnvironmentRows.tsx +263 -0
- package/src/client/FileLabel.tsx +1 -1
- package/src/client/FileTreePane.tsx +11 -6
- package/src/client/{ForgeTab.module.css → Forge.module.css} +130 -275
- package/src/client/LensFilter.module.css +87 -0
- package/src/client/LensFilter.tsx +105 -0
- package/src/client/ReasonButton.tsx +23 -0
- package/src/client/ReviewComposer.module.css +2 -8
- package/src/client/ReviewComposer.tsx +27 -8
- package/src/client/ReviewControls.module.css +39 -0
- package/src/client/ReviewControls.tsx +71 -15
- package/src/client/ReviewThread.tsx +55 -30
- package/src/client/ReviewThreads.module.css +24 -0
- package/src/client/ReviewThreads.tsx +56 -21
- package/src/client/SessionHoverForge.tsx +2 -1
- package/src/client/SubmitReview.tsx +11 -8
- package/src/client/ThreadList.tsx +1 -1
- package/src/client/ViewOptionsMenu.tsx +19 -4
- package/src/client/WorktreeNameDialog.module.css +53 -0
- package/src/client/WorktreeNameDialog.tsx +93 -0
- package/src/client/WorktreeProgress.tsx +100 -35
- package/src/client/WorktreeToggle.module.css +121 -5
- package/src/client/WorktreeToggle.tsx +178 -61
- package/src/client/action-notices.ts +38 -0
- package/src/client/annotations.ts +105 -0
- package/src/client/branch-search.tsx +77 -0
- package/src/client/change-requests-store.ts +50 -0
- package/src/client/changes-address.ts +3 -1
- package/src/client/changes-service.ts +173 -0
- package/src/client/changes-store.ts +103 -91
- package/src/client/checkout.ts +2 -1
- package/src/client/diff-rows.ts +100 -16
- package/src/client/file-tree.ts +29 -0
- package/src/client/forge-copy.ts +49 -0
- package/src/client/format.ts +14 -0
- package/src/client/glyphs.tsx +12 -13
- package/src/client/highlight-context.ts +213 -0
- package/src/client/index.ts +20 -5
- package/src/client/lens-filter.ts +136 -0
- package/src/client/locales.ts +1504 -288
- package/src/client/mount.ts +228 -109
- package/src/client/review-page/ReviewChat.tsx +311 -0
- package/src/client/review-page/ReviewDetail.tsx +331 -0
- package/src/client/review-page/ReviewLabels.tsx +94 -0
- package/src/client/review-page/ReviewList.tsx +461 -0
- package/src/client/review-page/ReviewNav.tsx +47 -0
- package/src/client/review-page/ReviewPage.module.css +946 -0
- package/src/client/review-page/ReviewPage.tsx +287 -0
- package/src/client/review-page/ReviewStatus.tsx +259 -0
- package/src/client/review-page/host-stream.ts +63 -0
- package/src/client/review-page/review-lists.ts +207 -0
- package/src/client/review-page/review-mount.ts +228 -0
- package/src/client/review-page/review-store.ts +94 -0
- package/src/client/review-queue.ts +30 -0
- package/src/client/review-threads.ts +0 -12
- package/src/client/review.ts +27 -0
- package/src/client/slots.ts +92 -0
- package/src/client/source.ts +67 -43
- package/src/client/status.ts +16 -4
- package/src/git.ts +16 -38
- package/src/index.ts +900 -152
- package/src/lens-version.ts +27 -0
- package/src/lenses.ts +284 -0
- package/src/local-diff.ts +48 -1
- package/src/panel.ts +123 -28
- package/src/parse.ts +86 -10
- package/src/review-cache.ts +57 -37
- package/src/states.ts +38 -18
- package/src/types.ts +267 -21
- package/src/viewer-lists.ts +375 -0
- package/src/worktree.ts +64 -34
- package/lib/types/client/ForgeTab.d.ts +0 -65
- package/lib/types/client/ForgeTab.d.ts.map +0 -1
- package/lib/types/client/ForgeTab.js.map +0 -1
- package/lib/types/client/ForgeTabTitle.d.ts +0 -11
- package/lib/types/client/ForgeTabTitle.d.ts.map +0 -1
- package/lib/types/client/ForgeTabTitle.js.map +0 -1
- package/lib/types/client/HeaderButton.d.ts +0 -27
- package/lib/types/client/HeaderButton.d.ts.map +0 -1
- package/lib/types/client/HeaderButton.js.map +0 -1
- package/lib/types/client/LocalChangesCard.d.ts +0 -29
- package/lib/types/client/LocalChangesCard.d.ts.map +0 -1
- package/lib/types/client/LocalChangesCard.js.map +0 -1
- package/src/client/ForgeTab.tsx +0 -263
- package/src/client/ForgeTabTitle.tsx +0 -21
- package/src/client/HeaderButton.module.css +0 -29
- package/src/client/HeaderButton.tsx +0 -68
- package/src/client/LocalChangesCard.tsx +0 -83
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* One change request as a card
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* the
|
|
2
|
+
* One change request as a compact card of the Session panel: one line with
|
|
3
|
+
* the state glyph, the title, the number, and the checks outcome, which opens
|
|
4
|
+
* the changes view, and, while expanded, one row per fact (checks, review,
|
|
5
|
+
* merge state, the changed lines, which open its changes too, and the linked
|
|
6
|
+
* issues) above the merge action. Opening on the host, copying, viewing
|
|
7
|
+
* changes, marking a draft ready, and removing live in the card's actions
|
|
8
|
+
* menu, which shows on hover or focus as on the panel's other rows.
|
|
6
9
|
*/
|
|
7
10
|
|
|
8
|
-
import { useId, useState, type ReactNode } from 'react'
|
|
11
|
+
import { useId, useState, type MouseEvent, type ReactNode } from 'react'
|
|
9
12
|
import clsx from 'clsx'
|
|
10
13
|
import {
|
|
11
|
-
Button, IconChevronDownOutlineRegular, IconCloseOutlineRegular, IconCopyOutlineRegular,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
Button, HoverCard, IconCheckCircleOutlineRegular, IconChevronDownOutlineRegular, IconCloseOutlineRegular, IconCopyOutlineRegular,
|
|
15
|
+
IconEllipsisOutlineRegular, IconFilesDiffOutlineRegular, IconRightUpOutlineRegular, IconTriangleRightFillRegular, Menu,
|
|
16
|
+
MenuItemButton, StateDot, Tooltip,
|
|
17
|
+
type MenuEntry, type MenuItem, type StateDotState,
|
|
14
18
|
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
19
|
+
import type { PanelDetailsProps } from '@deepseek-ai/dsh-client-ui-session-panel/client'
|
|
15
20
|
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
|
|
16
21
|
import type {
|
|
17
22
|
ChangeRequestSnapshot, CheckState, ChecksRollup, ForgeFailure, MergeMethod, MergeRequest,
|
|
@@ -21,8 +26,9 @@ import { ChecksRow, IssuesRow, MergeRow, ReviewRow, RowParts, ThreadGlyph, type
|
|
|
21
26
|
import { formatAgo } from './format.ts'
|
|
22
27
|
import { ChangeRequestGlyph, CheckGlyph } from './glyphs.tsx'
|
|
23
28
|
import type { ForgePanelKey, NS } from './locales.ts'
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
29
|
+
import type { ForgeChangeRequestCardActionsProps } from './slots.ts'
|
|
30
|
+
import { ciSummary, flagOf, numberOf, TONE_LABEL, toneOf, type ChangeRequestEntry, type ChangeRequestTone } from './status.ts'
|
|
31
|
+
import css from './Forge.module.css'
|
|
26
32
|
|
|
27
33
|
type Translate = PropsLocale<typeof NS>['t']
|
|
28
34
|
|
|
@@ -38,15 +44,21 @@ export interface ChangeRequestActions extends OverviewActions {
|
|
|
38
44
|
/** Read the status again after a failed read. */
|
|
39
45
|
readonly retry: () => void
|
|
40
46
|
/** Remove the change request from its Session. */
|
|
41
|
-
readonly remove?: ((entry:
|
|
47
|
+
readonly remove?: ((entry: ChangeRequestEntry) => void) | undefined
|
|
42
48
|
/** Mark a draft ready for review; settles once the outcome is reported. */
|
|
43
|
-
readonly markReady?: ((entry:
|
|
49
|
+
readonly markReady?: ((entry: ChangeRequestEntry) => Promise<void>) | undefined
|
|
44
50
|
/** Merge the change request as `request` describes; settles once the outcome is reported. */
|
|
45
|
-
readonly merge?: ((entry:
|
|
51
|
+
readonly merge?: ((entry: ChangeRequestEntry, request: MergeRequest) => Promise<void>) | undefined
|
|
46
52
|
/** Load complete check details independently of polling; cancellation follows the open list. */
|
|
47
53
|
readonly readChecks?: ((url: string, headSha: string, signal: AbortSignal) => Promise<ChangeRequestSnapshot>) | undefined
|
|
48
54
|
/** Open the changes view of the change request. */
|
|
49
|
-
readonly viewChanges?: ((entry:
|
|
55
|
+
readonly viewChanges?: ((entry: ChangeRequestEntry) => void) | undefined
|
|
56
|
+
/** Draw the icon buttons plugins add to the card's head through `forge.change-request.card.actions`. */
|
|
57
|
+
readonly renderActions?: ((owner: ForgeChangeRequestCardActionsProps) => ReactNode) | undefined
|
|
58
|
+
/**
|
|
59
|
+
* Draw the content of the card's hover card, as the Session panel's rows do. A surface without it shows none.
|
|
60
|
+
*/
|
|
61
|
+
readonly renderDetails?: ((details: PanelDetailsProps) => ReactNode) | undefined
|
|
50
62
|
}
|
|
51
63
|
|
|
52
64
|
/** Props of one change request card. */
|
|
@@ -77,6 +89,7 @@ const REVIEW: Record<ChangeRequestSnapshot['reviewDecision'], ForgePanelKey> = {
|
|
|
77
89
|
const FAILURE: Record<ForgeFailure['code'], ForgePanelKey> = {
|
|
78
90
|
'not-found': 'change.failure.notFound',
|
|
79
91
|
'unauthenticated': 'change.failure.unauthenticated',
|
|
92
|
+
'rate-limited': 'change.failure.rateLimited',
|
|
80
93
|
'too-large': 'change.failure.unavailable',
|
|
81
94
|
'stale': 'change.failure.unavailable',
|
|
82
95
|
'unsupported': 'change.failure.unavailable',
|
|
@@ -110,11 +123,13 @@ function DiffSize({ snapshot, locale }: { readonly snapshot: ChangeRequestSnapsh
|
|
|
110
123
|
}
|
|
111
124
|
|
|
112
125
|
/**
|
|
113
|
-
*
|
|
114
|
-
* serves the change request.
|
|
126
|
+
* Render the changed lines with the unresolved review thread count, as a row that opens the changes view when the
|
|
127
|
+
* provider serves the change request.
|
|
128
|
+
* @param props - the change request, its snapshot, how the row names it, the actions, the number locale, and copy.
|
|
129
|
+
* @returns the row.
|
|
115
130
|
*/
|
|
116
|
-
function ChangesRow({ entry, snapshot, name, actions, locale, t }: {
|
|
117
|
-
readonly entry:
|
|
131
|
+
export function ChangesRow({ entry, snapshot, name, actions, locale, t }: {
|
|
132
|
+
readonly entry: ChangeRequestEntry
|
|
118
133
|
readonly snapshot: ChangeRequestSnapshot
|
|
119
134
|
readonly name: string
|
|
120
135
|
readonly actions: ChangeRequestActions
|
|
@@ -126,7 +141,7 @@ function ChangesRow({ entry, snapshot, name, actions, locale, t }: {
|
|
|
126
141
|
const threads = snapshot.unresolvedThreads > 0 || snapshot.threadsTruncated ? threadCount(snapshot, locale) : undefined
|
|
127
142
|
const threadsText = threads === undefined ? undefined : t('change.threads', { count: threads })
|
|
128
143
|
const trailing = threadsText === undefined ? undefined : (
|
|
129
|
-
<Tooltip label={threadsText} side="top">
|
|
144
|
+
<Tooltip label={threadsText} side="top" delayMs={500}>
|
|
130
145
|
<span className={css.threads} data-forge-threads={threads} aria-hidden="true"><ThreadGlyph size={14} />{threads}</span>
|
|
131
146
|
</Tooltip>
|
|
132
147
|
)
|
|
@@ -134,7 +149,7 @@ function ChangesRow({ entry, snapshot, name, actions, locale, t }: {
|
|
|
134
149
|
// The count shows only a number, so the threads are named in full for assistive technology.
|
|
135
150
|
const parts = (
|
|
136
151
|
<>
|
|
137
|
-
<RowParts label={t('change.row.changes')} icon={<
|
|
152
|
+
<RowParts label={t('change.row.changes')} icon={<IconFilesDiffOutlineRegular size={16} />}
|
|
138
153
|
value={<DiffSize snapshot={snapshot} locale={locale} />} trailing={trailing} opens={opens} />
|
|
139
154
|
{threadsText !== undefined && <span id={described} className={css.visuallyHidden}>{threadsText}</span>}
|
|
140
155
|
</>
|
|
@@ -164,39 +179,51 @@ function finished(snapshot: ChangeRequestSnapshot, now: number, t: Translate): s
|
|
|
164
179
|
return ago === undefined ? state : t('time.finished', { state, time: ago })
|
|
165
180
|
}
|
|
166
181
|
|
|
167
|
-
/**
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (snapshot
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
182
|
+
/**
|
|
183
|
+
* The checks outcome after the number: a spinner before the first read, the combined outcome of an open change
|
|
184
|
+
* request that has checks, and nothing for a finished one, whose glyph already says how it ended.
|
|
185
|
+
*/
|
|
186
|
+
function Mark({ snapshot }: { readonly snapshot: ChangeRequestSnapshot | null }): ReactNode {
|
|
187
|
+
if (snapshot === null) return <StateDot state="ongoing" size={12} />
|
|
188
|
+
if (snapshot.state !== 'open') return null
|
|
189
|
+
const ci = ciSummary(snapshot)
|
|
190
|
+
if (ci.kind === 'none') return null
|
|
191
|
+
return <CheckGlyph state={ci.kind === 'cancelled' ? 'cancelled' : ROLLUP[snapshot.checksRollup]} size={12} />
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The status in words: the checks and the most urgent flag of an open change request, or the merge or close time.
|
|
196
|
+
* The card's line shows it as glyphs, so assistive technology and the hover card read it here.
|
|
197
|
+
* @param snapshot - change request status.
|
|
198
|
+
* @param now - current epoch milliseconds for the relative time.
|
|
199
|
+
* @param t - copy.
|
|
200
|
+
* @returns the status text.
|
|
201
|
+
*/
|
|
202
|
+
function statusText(snapshot: ChangeRequestSnapshot, now: number, t: Translate): string {
|
|
203
|
+
if (snapshot.state !== 'open') return finished(snapshot, now, t)
|
|
177
204
|
const ci = ciSummary(snapshot)
|
|
205
|
+
const checks = ci.kind === 'failed'
|
|
206
|
+
? ci.count > 0 ? t('change.ci.failed', { count: ci.count }) : t('change.ci.failedUnlisted')
|
|
207
|
+
: ci.kind === 'cancelled' ? t('change.ci.cancelled', { count: ci.count }) : t(`change.ci.${ci.kind}`)
|
|
178
208
|
const flag = flagOf(snapshot)
|
|
179
|
-
return (
|
|
180
|
-
<>
|
|
181
|
-
<span className={css.ci} data-tone={ci.kind === 'failed' ? 'error' : undefined}>
|
|
182
|
-
{ci.kind !== 'none' && <CheckGlyph state={ci.kind === 'cancelled' ? 'cancelled' : ROLLUP[snapshot.checksRollup]} size={12} />}
|
|
183
|
-
{ci.kind === 'failed'
|
|
184
|
-
? ci.count > 0 ? t('change.ci.failed', { count: ci.count }) : t('change.ci.failedUnlisted')
|
|
185
|
-
: ci.kind === 'cancelled' ? t('change.ci.cancelled', { count: ci.count }) : t(`change.ci.${ci.kind}`)}
|
|
186
|
-
</span>
|
|
187
|
-
{flag !== undefined && <span className={css.flag} data-flag={flag}>{t(`change.flag.${flag}`)}</span>}
|
|
188
|
-
</>
|
|
189
|
-
)
|
|
209
|
+
return flag === undefined ? checks : `${checks} · ${t(`change.flag.${flag}`)}`
|
|
190
210
|
}
|
|
191
211
|
|
|
192
|
-
/**
|
|
193
|
-
function
|
|
194
|
-
return
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
212
|
+
/** The state dot of the hover card: red for what needs the user, and a spinner while the checks run. */
|
|
213
|
+
function dotOf(tone: ChangeRequestTone, snapshot: ChangeRequestSnapshot): StateDotState {
|
|
214
|
+
if (tone === 'blocked') return 'error'
|
|
215
|
+
if (snapshot.state !== 'open') return snapshot.state === 'merged' ? 'done' : 'idle'
|
|
216
|
+
return snapshot.checksRollup === 'pending' ? 'ongoing' : snapshot.checksRollup === 'success' ? 'done' : 'idle'
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** The hover card's line under the title: the number, draft state, and the head and base branches. */
|
|
220
|
+
function identity(number: number | null, snapshot: ChangeRequestSnapshot | null, t: Translate): string[] {
|
|
221
|
+
const parts = [
|
|
222
|
+
...number === null ? [] : [t('change.number', { number })],
|
|
223
|
+
...snapshot?.state === 'open' && snapshot.draft ? [t('change.state.draft')] : [],
|
|
224
|
+
...snapshot === null ? [] : [`${snapshot.headBranch} → ${snapshot.baseBranch}`],
|
|
225
|
+
]
|
|
226
|
+
return parts.length === 0 ? [] : [parts.join(' · ')]
|
|
200
227
|
}
|
|
201
228
|
|
|
202
229
|
/** The merge button and its menu: a title row, one row per method with the chosen one checked, and the confirmation. */
|
|
@@ -269,12 +296,22 @@ function MergeMenu({ snapshot, name, usual, busy, onMerge, t }: {
|
|
|
269
296
|
)
|
|
270
297
|
}
|
|
271
298
|
|
|
272
|
-
/**
|
|
273
|
-
|
|
274
|
-
|
|
299
|
+
/**
|
|
300
|
+
* Render the merge action of an open change request the host would merge now.
|
|
301
|
+
* @param props.entry - the change request.
|
|
302
|
+
* @param props.snapshot - its latest snapshot.
|
|
303
|
+
* @param props.name - how menus name it.
|
|
304
|
+
* @param props.actions - the actions the surface offers.
|
|
305
|
+
* @param props.className - class of the wrapper, the card footer's by default.
|
|
306
|
+
* @param props.t - forge panel copy.
|
|
307
|
+
* @returns the action, or null when the host would not merge now or the surface does not offer it.
|
|
308
|
+
*/
|
|
309
|
+
export function ChangeRequestPrimary({ entry, snapshot, name, actions, className = css.footer, t }: {
|
|
310
|
+
readonly entry: ChangeRequestEntry
|
|
275
311
|
readonly snapshot: ChangeRequestSnapshot
|
|
276
312
|
readonly name: string
|
|
277
313
|
readonly actions: ChangeRequestActions
|
|
314
|
+
readonly className?: string | undefined
|
|
278
315
|
readonly t: Translate
|
|
279
316
|
}): ReactNode {
|
|
280
317
|
// One request at a time: the action stays disabled until the previous one settles.
|
|
@@ -283,22 +320,12 @@ function Primary({ entry, snapshot, name, actions, t }: {
|
|
|
283
320
|
setBusy(true)
|
|
284
321
|
void action().finally(() => { setBusy(false) })
|
|
285
322
|
}
|
|
286
|
-
const {
|
|
287
|
-
if (snapshot.state !== 'open') return null
|
|
288
|
-
if (snapshot.draft) {
|
|
289
|
-
if (markReady === undefined) return null
|
|
290
|
-
return (
|
|
291
|
-
<div className={css.footer}>
|
|
292
|
-
<Button size="sm" variant="outline" className={css.primaryAction} disabled={busy} onClick={() => { run(() => markReady(entry)) }}>
|
|
293
|
-
{t('change.markReady')}
|
|
294
|
-
</Button>
|
|
295
|
-
</div>
|
|
296
|
-
)
|
|
297
|
-
}
|
|
323
|
+
const { merge } = actions
|
|
324
|
+
if (snapshot.state !== 'open' || snapshot.draft) return null
|
|
298
325
|
const [usual] = snapshot.mergeMethods
|
|
299
326
|
if (!snapshot.mergeReady || usual === undefined || merge === undefined) return null
|
|
300
327
|
return (
|
|
301
|
-
<div className={
|
|
328
|
+
<div className={className}>
|
|
302
329
|
<MergeMenu
|
|
303
330
|
snapshot={snapshot}
|
|
304
331
|
name={name}
|
|
@@ -311,8 +338,135 @@ function Primary({ entry, snapshot, name, actions, t }: {
|
|
|
311
338
|
)
|
|
312
339
|
}
|
|
313
340
|
|
|
314
|
-
|
|
341
|
+
/**
|
|
342
|
+
* The card's actions menu: view the changes of a served change request, open
|
|
343
|
+
* on the host, copy the link, mark an open draft ready, and remove the binding.
|
|
344
|
+
*/
|
|
345
|
+
function CardMenu({ entry, snapshot, name, url, actions, t }: {
|
|
315
346
|
readonly entry: ForgePanelChangeRequest
|
|
347
|
+
readonly snapshot: ChangeRequestSnapshot | null
|
|
348
|
+
readonly name: string
|
|
349
|
+
readonly url: string
|
|
350
|
+
readonly actions: ChangeRequestActions
|
|
351
|
+
readonly t: Translate
|
|
352
|
+
}): ReactNode {
|
|
353
|
+
const [open, setOpen] = useState(false)
|
|
354
|
+
// One ready request at a time: the item stays disabled until the previous one settles.
|
|
355
|
+
const [busy, setBusy] = useState(false)
|
|
356
|
+
const { remove, markReady, viewChanges } = actions
|
|
357
|
+
const ready = markReady !== undefined && snapshot?.state === 'open' && snapshot.draft
|
|
358
|
+
? () => {
|
|
359
|
+
setBusy(true)
|
|
360
|
+
void markReady(entry).finally(() => { setBusy(false) })
|
|
361
|
+
}
|
|
362
|
+
: undefined
|
|
363
|
+
// Each item carries the action it runs, so a selection never reaches another item's action.
|
|
364
|
+
const choices: { readonly item: MenuItem; readonly run: () => void }[] = [
|
|
365
|
+
...viewChanges !== undefined && snapshot !== null && entry.ref !== null ? [{
|
|
366
|
+
item: { id: 'changes', label: t('change.viewChanges'), icon: <IconFilesDiffOutlineRegular size={14} /> },
|
|
367
|
+
run: () => { viewChanges(entry) },
|
|
368
|
+
}] : [],
|
|
369
|
+
{ item: { id: 'open', label: t('change.view'), icon: <IconRightUpOutlineRegular size={14} /> }, run: () => { actions.openLink(url) } },
|
|
370
|
+
{ item: { id: 'copy', label: t('change.copy'), icon: <IconCopyOutlineRegular size={14} /> }, run: () => { actions.copyLink(url) } },
|
|
371
|
+
...ready === undefined ? [] : [{
|
|
372
|
+
item: { id: 'ready', label: t('change.markReady'), icon: <IconCheckCircleOutlineRegular size={14} />, disabled: busy },
|
|
373
|
+
run: ready,
|
|
374
|
+
}],
|
|
375
|
+
...remove === undefined ? [] : [{
|
|
376
|
+
item: { id: 'remove', label: t('change.remove'), icon: <IconCloseOutlineRegular size={14} />, danger: true },
|
|
377
|
+
run: () => { remove(entry) },
|
|
378
|
+
}],
|
|
379
|
+
]
|
|
380
|
+
// Removing sits apart from the other actions.
|
|
381
|
+
const items: MenuEntry[] = choices.flatMap(({ item }) => item.id === 'remove'
|
|
382
|
+
? [{ type: 'separator' as const, id: 'remove-separator' }, item] : [item])
|
|
383
|
+
const select = (id: string): void => {
|
|
384
|
+
setOpen(false)
|
|
385
|
+
for (const choice of choices) if (choice.item.id === id) choice.run()
|
|
386
|
+
}
|
|
387
|
+
return (
|
|
388
|
+
<Menu
|
|
389
|
+
open={open}
|
|
390
|
+
onClose={() => { setOpen(false) }}
|
|
391
|
+
portal
|
|
392
|
+
align="end"
|
|
393
|
+
anchor={(
|
|
394
|
+
<button
|
|
395
|
+
type="button"
|
|
396
|
+
aria-label={t('change.actions', { name })}
|
|
397
|
+
aria-haspopup="menu"
|
|
398
|
+
aria-expanded={open}
|
|
399
|
+
onClick={() => { setOpen(!open) }}
|
|
400
|
+
>
|
|
401
|
+
<IconEllipsisOutlineRegular size={16} />
|
|
402
|
+
</button>
|
|
403
|
+
)}
|
|
404
|
+
items={items}
|
|
405
|
+
onSelect={select}
|
|
406
|
+
/>
|
|
407
|
+
)
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Render the merged or closed fact of a finished change request with its time.
|
|
412
|
+
* @param props - the snapshot, current epoch milliseconds for the relative time, and copy.
|
|
413
|
+
* @returns the row.
|
|
414
|
+
*/
|
|
415
|
+
export function FinishedRow({ snapshot, now, t }: {
|
|
416
|
+
readonly snapshot: ChangeRequestSnapshot
|
|
417
|
+
readonly now: number
|
|
418
|
+
readonly t: Translate
|
|
419
|
+
}): ReactNode {
|
|
420
|
+
return (
|
|
421
|
+
<div className={css.row}>
|
|
422
|
+
<RowParts label={undefined} icon={<ChangeRequestGlyph tone={snapshot.state} tinted={false} size={16} />}
|
|
423
|
+
value={finished(snapshot, now, t)} tone={snapshot.state} opens={false} />
|
|
424
|
+
</div>
|
|
425
|
+
)
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* The aggregate review outcome of an open change request in words, with its tone.
|
|
430
|
+
* @param snapshot - the snapshot.
|
|
431
|
+
* @param t - forge panel copy.
|
|
432
|
+
* @returns the outcome and its tone.
|
|
433
|
+
*/
|
|
434
|
+
export function reviewOutcome(
|
|
435
|
+
snapshot: ChangeRequestSnapshot, t: Translate,
|
|
436
|
+
): { readonly value: string; readonly tone: string | undefined } {
|
|
437
|
+
return {
|
|
438
|
+
value: t(REVIEW[snapshot.reviewDecision]),
|
|
439
|
+
tone: snapshot.reviewDecision === 'changes-requested' ? 'error' : snapshot.reviewDecision === 'approved' ? 'success' : undefined,
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Render the merge state of an open change request: whether it conflicts with its base, and the branch update.
|
|
445
|
+
* @param props - the change request, its snapshot, the update action, and copy.
|
|
446
|
+
* @returns the row.
|
|
447
|
+
*/
|
|
448
|
+
export function MergeStateRow({ entry, snapshot, updateBranch, t }: {
|
|
449
|
+
readonly entry: ChangeRequestEntry
|
|
450
|
+
readonly snapshot: ChangeRequestSnapshot
|
|
451
|
+
readonly updateBranch: ChangeRequestActions['updateBranch']
|
|
452
|
+
readonly t: Translate
|
|
453
|
+
}): ReactNode {
|
|
454
|
+
const merge = snapshot.mergeability === 'mergeable'
|
|
455
|
+
? t('change.merge.mergeable')
|
|
456
|
+
: snapshot.mergeability === 'conflicting' ? t('change.merge.conflicting', { base: snapshot.baseBranch }) : t('change.merge.unknown')
|
|
457
|
+
return (
|
|
458
|
+
<MergeRow entry={entry} snapshot={snapshot} value={merge} updateBranch={updateBranch}
|
|
459
|
+
icon={<ChangeRequestGlyph tone="merged" tinted={false} size={16} />}
|
|
460
|
+
tone={snapshot.mergeability === 'conflicting' ? 'error' : undefined} t={t} />
|
|
461
|
+
)
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* The facts of a change request one row each: the merged or closed state, or the checks, review, and merge state;
|
|
466
|
+
* the changed lines; and the linked issues.
|
|
467
|
+
*/
|
|
468
|
+
function Details({ entry, snapshot, name, now, actions, locale, t }: {
|
|
469
|
+
readonly entry: ChangeRequestEntry
|
|
316
470
|
readonly snapshot: ChangeRequestSnapshot
|
|
317
471
|
readonly name: string
|
|
318
472
|
readonly now: number
|
|
@@ -324,28 +478,19 @@ function Details({ entry, snapshot, name, now, actions, locale, t }: {
|
|
|
324
478
|
if (snapshot.state !== 'open') {
|
|
325
479
|
return (
|
|
326
480
|
<div className={css.rows}>
|
|
327
|
-
<
|
|
328
|
-
<RowParts label={undefined} icon={<ChangeRequestGlyph tone={snapshot.state} tinted={false} size={16} />}
|
|
329
|
-
value={finished(snapshot, now, t)} tone={snapshot.state} opens={false} />
|
|
330
|
-
</div>
|
|
481
|
+
<FinishedRow snapshot={snapshot} now={now} t={t} />
|
|
331
482
|
{changes}
|
|
332
483
|
</div>
|
|
333
484
|
)
|
|
334
485
|
}
|
|
335
|
-
const review =
|
|
336
|
-
const reviewTone = snapshot.reviewDecision === 'changes-requested' ? 'error' : snapshot.reviewDecision === 'approved' ? 'success' : undefined
|
|
337
|
-
const merge = snapshot.mergeability === 'mergeable'
|
|
338
|
-
? t('change.merge.mergeable')
|
|
339
|
-
: snapshot.mergeability === 'conflicting' ? t('change.merge.conflicting', { base: snapshot.baseBranch }) : t('change.merge.unknown')
|
|
486
|
+
const review = reviewOutcome(snapshot, t)
|
|
340
487
|
return (
|
|
341
488
|
<div className={css.rows}>
|
|
342
489
|
<ChecksRow key={snapshot.headSha} entry={entry} snapshot={snapshot} openLink={actions.openLink} readChecks={actions.readChecks}
|
|
343
490
|
rerunChecks={actions.rerunChecks} t={t} />
|
|
344
|
-
<ReviewRow entry={entry} snapshot={snapshot} tone={
|
|
491
|
+
<ReviewRow entry={entry} snapshot={snapshot} tone={review.tone} openLink={actions.openLink} value={review.value}
|
|
345
492
|
requestReviews={actions.requestReviews} reviewerCandidates={actions.reviewerCandidates} t={t} />
|
|
346
|
-
<
|
|
347
|
-
icon={<ChangeRequestGlyph tone="merged" tinted={false} size={16} />}
|
|
348
|
-
tone={snapshot.mergeability === 'conflicting' ? 'error' : undefined} t={t} />
|
|
493
|
+
<MergeStateRow entry={entry} snapshot={snapshot} updateBranch={actions.updateBranch} t={t} />
|
|
349
494
|
{changes}
|
|
350
495
|
<IssuesRow snapshot={snapshot} openLink={actions.openLink} t={t} />
|
|
351
496
|
</div>
|
|
@@ -353,7 +498,10 @@ function Details({ entry, snapshot, name, now, actions, locale, t }: {
|
|
|
353
498
|
}
|
|
354
499
|
|
|
355
500
|
/**
|
|
356
|
-
* Render one change request.
|
|
501
|
+
* Render one change request. A press on the card's line opens the changes view of a change request a provider serves
|
|
502
|
+
* and has read; with the platform's modifier key or the middle button, and for any other change request, it opens
|
|
503
|
+
* the host's page. The line shows its status as glyphs and, while collapsed, reads it in words to assistive
|
|
504
|
+
* technology, which the expanded rows do otherwise; the hover card names the full title, the branches, and that status.
|
|
357
505
|
* @param props - change request, expansion, current time, actions, and copy.
|
|
358
506
|
* @returns the card.
|
|
359
507
|
*/
|
|
@@ -365,63 +513,60 @@ export function ChangeRequestCard({ entry, expanded, onToggle, now, actions, loc
|
|
|
365
513
|
const notice = entry.ref === null ? 'change.unserved' : failure === undefined ? undefined : FAILURE[failure.code]
|
|
366
514
|
const tone = toneOf(snapshot)
|
|
367
515
|
const name = number === null ? snapshot?.title ?? url : t('change.number', { number })
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
</Tooltip>
|
|
403
|
-
<Tooltip label={t('change.copy')} side="top">
|
|
404
|
-
<button type="button" className={css.iconButton} aria-label={t('change.copy')} onClick={() => { actions.copyLink(url) }}>
|
|
405
|
-
<IconCopyOutlineRegular size={14} />
|
|
406
|
-
</button>
|
|
407
|
-
</Tooltip>
|
|
408
|
-
{remove !== undefined && (
|
|
409
|
-
<Tooltip label={t('change.remove')} side="top">
|
|
410
|
-
<button type="button" className={css.iconButton} aria-label={t('change.removeAria', { name })} onClick={() => { remove(entry) }}>
|
|
411
|
-
<IconCloseOutlineRegular size={14} />
|
|
412
|
-
</button>
|
|
413
|
-
</Tooltip>
|
|
414
|
-
)}
|
|
516
|
+
const title = snapshot?.title ?? url.replace(/^https?:\/\//i, '')
|
|
517
|
+
// A notice replaces the status, so a failed read never reads its stale status beside it.
|
|
518
|
+
const status: PanelDetailsProps['status'] = notice !== undefined
|
|
519
|
+
? { state: 'warning', label: t(notice) }
|
|
520
|
+
: snapshot === null ? undefined : { state: dotOf(tone, snapshot), label: statusText(snapshot, now, t) }
|
|
521
|
+
const viewChanges = snapshot !== null && entry.ref !== null ? actions.viewChanges : undefined
|
|
522
|
+
const open = (event: MouseEvent): void => {
|
|
523
|
+
if (viewChanges === undefined || event.metaKey || event.ctrlKey) actions.openLink(url)
|
|
524
|
+
else viewChanges(entry)
|
|
525
|
+
}
|
|
526
|
+
const head = (
|
|
527
|
+
<div className={css.changeHead} data-session-panel-row="">
|
|
528
|
+
<button
|
|
529
|
+
type="button"
|
|
530
|
+
data-row-part="body"
|
|
531
|
+
data-forge-opens={viewChanges === undefined ? 'link' : 'changes'}
|
|
532
|
+
onClick={open}
|
|
533
|
+
onAuxClick={(event) => { if (event.button === 1) actions.openLink(url) }}
|
|
534
|
+
>
|
|
535
|
+
<span data-row-part="icon">
|
|
536
|
+
<ChangeRequestGlyph tone={tone} size={16} label={t('change.stateAria', { state: t(TONE_LABEL[tone]) })} />
|
|
537
|
+
</span>
|
|
538
|
+
<span data-row-part="content">{title}</span>
|
|
539
|
+
</button>
|
|
540
|
+
<span data-row-part="trailing" className={css.status}>
|
|
541
|
+
{number !== null && <span className={css.number}>{t('change.number', { number })}</span>}
|
|
542
|
+
{notice === undefined && <Mark snapshot={snapshot} />}
|
|
543
|
+
{!expanded && notice === undefined && status !== undefined && <span className={css.visuallyHidden}>{status.label}</span>}
|
|
544
|
+
{actions.renderActions?.({ url: entry.url, ref: entry.ref, headSha: snapshot?.headSha ?? null, state: snapshot?.state ?? null })}
|
|
545
|
+
</span>
|
|
546
|
+
<span data-row-part="menu">
|
|
547
|
+
<CardMenu entry={entry} snapshot={snapshot} name={name} url={url} actions={actions} t={t} />
|
|
548
|
+
</span>
|
|
549
|
+
<span data-row-part="trailing" className={css.end}>
|
|
415
550
|
<button
|
|
416
551
|
type="button"
|
|
417
|
-
className={css.
|
|
552
|
+
className={css.expand}
|
|
418
553
|
aria-expanded={expanded}
|
|
419
554
|
aria-label={t(expanded ? 'change.collapse' : 'change.expand', { name })}
|
|
420
555
|
onClick={onToggle}
|
|
421
556
|
>
|
|
422
|
-
<IconChevronDownOutlineRegular size={
|
|
557
|
+
<IconChevronDownOutlineRegular size={14} className={clsx(css.chevron, expanded && css.chevronOpen)} />
|
|
423
558
|
</button>
|
|
424
|
-
</
|
|
559
|
+
</span>
|
|
560
|
+
</div>
|
|
561
|
+
)
|
|
562
|
+
const details = actions.renderDetails?.({
|
|
563
|
+
title,
|
|
564
|
+
lines: identity(number, snapshot, t),
|
|
565
|
+
...status === undefined ? {} : { status },
|
|
566
|
+
})
|
|
567
|
+
return (
|
|
568
|
+
<li className={css.change} data-forge-change={entry.url} data-expanded={expanded ? '' : undefined}>
|
|
569
|
+
{details === undefined ? head : <HoverCard grouped anchor={head} content={details} />}
|
|
425
570
|
{notice !== undefined && (
|
|
426
571
|
<div className={css.notice}>
|
|
427
572
|
<span>{t(notice)}</span>
|
|
@@ -433,7 +578,7 @@ export function ChangeRequestCard({ entry, expanded, onToggle, now, actions, loc
|
|
|
433
578
|
{expanded && snapshot !== null && (
|
|
434
579
|
<Details entry={entry} snapshot={snapshot} name={name} now={now} actions={actions} locale={locale} t={t} />
|
|
435
580
|
)}
|
|
436
|
-
{expanded && snapshot !== null && <
|
|
581
|
+
{expanded && snapshot !== null && <ChangeRequestPrimary entry={entry} snapshot={snapshot} name={name} actions={actions} t={t} />}
|
|
437
582
|
</li>
|
|
438
583
|
)
|
|
439
584
|
}
|