@bevel-software/platform-core-frontend 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/package.json +5 -3
  2. package/src/core/CoreAppShell.tsx +195 -56
  3. package/src/core/__tests__/AppChrome.test.tsx +125 -0
  4. package/src/core/__tests__/ShellRoutes.test.tsx +37 -2
  5. package/src/core/__tests__/bootstrap.test.ts +63 -0
  6. package/src/core/bootstrap.ts +73 -0
  7. package/src/core/events.ts +12 -0
  8. package/src/core/registry.ts +58 -9
  9. package/src/index.css +100 -11
  10. package/src/index.ts +24 -23
  11. package/src/lib/utils.ts +93 -117
  12. package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +281 -0
  13. package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +166 -1
  14. package/src/modules/access/api.ts +49 -0
  15. package/src/modules/access/components/ManageAccessDialog.tsx +786 -481
  16. package/src/modules/access/hooks/useFileAccess.ts +1 -1
  17. package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +86 -0
  18. package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +17 -1
  19. package/src/modules/admin/__tests__/admin.unread.test.tsx +61 -0
  20. package/src/modules/admin/components/AdminRolesPage.tsx +44 -38
  21. package/src/modules/admin/components/RolesCorruptedBanner.tsx +11 -10
  22. package/src/modules/admin/components/UserAccountsPage.tsx +36 -28
  23. package/src/modules/admin/state/admin.context.tsx +15 -6
  24. package/src/modules/auth/components/AccountPage.tsx +11 -11
  25. package/src/modules/auth/components/LoginScreen.tsx +12 -12
  26. package/src/modules/auth/services/sso.ts +47 -1
  27. package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +277 -0
  28. package/src/modules/change-requests/__tests__/author.test.ts +48 -0
  29. package/src/modules/change-requests/__tests__/conflict.test.ts +73 -0
  30. package/src/modules/change-requests/__tests__/diff.test.ts +134 -0
  31. package/src/modules/change-requests/__tests__/propose.test.ts +93 -0
  32. package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +72 -0
  33. package/src/modules/change-requests/change-requests.css +22 -0
  34. package/src/modules/change-requests/components/ChangeBox.tsx +277 -0
  35. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +713 -0
  36. package/src/modules/change-requests/components/ConflictHelp.tsx +47 -0
  37. package/src/modules/change-requests/components/CrFileTree.tsx +398 -0
  38. package/src/modules/change-requests/components/FileChangeBoxes.tsx +168 -0
  39. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +236 -0
  40. package/src/modules/change-requests/hooks/useCrFileDiffs.ts +79 -0
  41. package/src/modules/change-requests/hooks/useFileOnBranch.ts +80 -0
  42. package/src/modules/change-requests/services/change-requests.api.ts +45 -0
  43. package/src/modules/change-requests/services/propose.api.ts +162 -0
  44. package/src/modules/change-requests/utils/author.ts +47 -0
  45. package/src/modules/change-requests/utils/conflict.ts +38 -0
  46. package/src/modules/change-requests/utils/diff.ts +80 -0
  47. package/src/modules/git/__tests__/BranchSwitcher.test.tsx +27 -18
  48. package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +36 -83
  49. package/src/modules/git/__tests__/PullNeededBanner.test.tsx +5 -5
  50. package/src/modules/git/__tests__/PullRequestsForMe.test.tsx +147 -0
  51. package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +2 -8
  52. package/src/modules/git/components/BranchSwitcher.tsx +68 -31
  53. package/src/modules/git/components/DiffView.tsx +4 -4
  54. package/src/modules/git/components/FileComparisonPanel.tsx +20 -20
  55. package/src/modules/git/components/FileHistoryPanel.tsx +71 -107
  56. package/src/modules/git/components/PullNeededBanner.tsx +6 -13
  57. package/src/modules/git/components/PullRequestsForMe.tsx +71 -36
  58. package/src/modules/git/components/UnifiedDiffView.tsx +4 -4
  59. package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +2 -2
  60. package/src/modules/git/hooks/useGitState.ts +15 -14
  61. package/src/modules/git/services/__tests__/error-messages.test.ts +4 -4
  62. package/src/modules/git/services/error-messages.ts +7 -7
  63. package/src/modules/git/services/git.api.ts +17 -11
  64. package/src/modules/git/services/pr-prompts.ts +2 -2
  65. package/src/modules/git/state/git.context.ts +10 -1
  66. package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +224 -0
  67. package/src/modules/layout/__tests__/SidebarToggle.test.tsx +242 -0
  68. package/src/modules/layout/__tests__/breakpoints.test.ts +56 -0
  69. package/src/modules/layout/breakpoints.ts +6 -0
  70. package/src/modules/layout/components/AppLayout.tsx +17 -5
  71. package/src/modules/layout/components/DemoBanner.tsx +10 -1
  72. package/src/modules/layout/components/MaintenanceOverlay.tsx +3 -3
  73. package/src/modules/layout/components/MobileChatLayout.tsx +31 -26
  74. package/src/modules/layout/components/ResizableThreePaneLayout.tsx +59 -24
  75. package/src/modules/layout/components/SidebarFrame.tsx +317 -0
  76. package/src/modules/layout/components/SidebarToggle.tsx +86 -0
  77. package/src/modules/layout/components/SlideOverlay.tsx +1 -1
  78. package/src/modules/layout/components/__tests__/MobileChatLayout.test.tsx +40 -2
  79. package/src/modules/layout/components/__tests__/ResizableThreePaneLayout.test.tsx +19 -3
  80. package/src/modules/layout/state/sidebar.ts +200 -0
  81. package/src/modules/library/__tests__/AddToGroupDialog.test.tsx +313 -0
  82. package/src/modules/library/__tests__/ChangeRequestDock.test.tsx +84 -0
  83. package/src/modules/library/__tests__/GroupJoinRequests.test.tsx +178 -0
  84. package/src/modules/library/__tests__/GroupPage.test.tsx +479 -0
  85. package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +283 -0
  86. package/src/modules/library/__tests__/GroupsSidebar.contextmenu.test.tsx +175 -0
  87. package/src/modules/library/__tests__/GroupsSidebar.locked.test.tsx +96 -0
  88. package/src/modules/library/__tests__/GroupsSidebar.test.tsx +142 -0
  89. package/src/modules/library/__tests__/GroupsSidebarMenu.test.tsx +142 -0
  90. package/src/modules/library/__tests__/LibraryCard.test.tsx +149 -0
  91. package/src/modules/library/__tests__/LibraryRoutes.test.tsx +378 -0
  92. package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +347 -0
  93. package/src/modules/library/__tests__/LockedGroupView.test.tsx +203 -0
  94. package/src/modules/library/__tests__/NewGroupDialog.test.tsx +114 -0
  95. package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +177 -0
  96. package/src/modules/library/__tests__/SkillPage.test.tsx +1063 -0
  97. package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +259 -0
  98. package/src/modules/library/__tests__/ToolLogo.test.tsx +63 -0
  99. package/src/modules/library/__tests__/ToolPage.test.tsx +315 -0
  100. package/src/modules/library/__tests__/ToolSharePanel.test.tsx +36 -0
  101. package/src/modules/library/__tests__/ToolVarRow.test.tsx +260 -0
  102. package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +197 -0
  103. package/src/modules/library/__tests__/auth-harness.tsx +37 -0
  104. package/src/modules/library/__tests__/oauth-fragment.test.ts +48 -0
  105. package/src/modules/library/__tests__/status.test.ts +113 -20
  106. package/src/modules/library/__tests__/useSkillDetail.test.tsx +102 -0
  107. package/src/modules/library/__tests__/useToolPage.test.tsx +146 -0
  108. package/src/modules/library/components/AccessRequestsBanner.tsx +101 -0
  109. package/src/modules/library/components/AddToGroupDialog.tsx +115 -0
  110. package/src/modules/library/components/ChangeRequestDock.tsx +52 -28
  111. package/src/modules/library/components/DeleteGroupDialog.tsx +87 -0
  112. package/src/modules/library/components/GroupIndexRow.tsx +63 -0
  113. package/src/modules/library/components/GroupJoinRequests.tsx +56 -0
  114. package/src/modules/library/components/GroupPage.tsx +373 -0
  115. package/src/modules/library/components/GroupsIndexPage.tsx +222 -0
  116. package/src/modules/library/components/GroupsSidebar.tsx +338 -0
  117. package/src/modules/library/components/GroupsSidebarMenu.tsx +160 -0
  118. package/src/modules/library/components/LibraryCard.tsx +123 -102
  119. package/src/modules/library/components/LibraryLayout.tsx +344 -0
  120. package/src/modules/library/components/LibraryPage.tsx +111 -227
  121. package/src/modules/library/components/LockGlyph.tsx +31 -0
  122. package/src/modules/library/components/LockedGroupView.tsx +159 -0
  123. package/src/modules/library/components/ManagedGroupRequests.tsx +70 -0
  124. package/src/modules/library/components/NewGroupDialog.tsx +112 -0
  125. package/src/modules/library/components/NewSkillPanel.tsx +151 -0
  126. package/src/modules/library/components/PageActions.tsx +156 -0
  127. package/src/modules/library/components/PendingSkillReview.tsx +63 -0
  128. package/src/modules/library/components/PersonalAddDialog.tsx +88 -0
  129. package/src/modules/library/components/PersonalGroupPage.tsx +125 -0
  130. package/src/modules/library/components/StatusDot.tsx +25 -0
  131. package/src/modules/library/components/ToolLogo.tsx +171 -0
  132. package/src/modules/library/components/group-page-parts.tsx +419 -0
  133. package/src/modules/library/components/skill-page/SkillFileEditor.tsx +134 -0
  134. package/src/modules/library/components/skill-page/SkillFilePane.tsx +117 -0
  135. package/src/modules/library/components/skill-page/SkillFileTabs.tsx +112 -0
  136. package/src/modules/library/components/skill-page/SkillPage.tsx +673 -0
  137. package/src/modules/library/components/skill-page/tab-ids.ts +33 -0
  138. package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +175 -0
  139. package/src/modules/library/components/tool-page/ToolPage.tsx +228 -0
  140. package/src/modules/library/components/tool-page/ToolSharePanel.tsx +45 -0
  141. package/src/modules/library/components/tool-page/ToolVarRow.tsx +289 -0
  142. package/src/modules/library/hooks/useJoinRequests.ts +114 -0
  143. package/src/modules/library/hooks/useLibraryData.ts +134 -119
  144. package/src/modules/library/hooks/useSkillDetail.ts +119 -74
  145. package/src/modules/library/hooks/useToolPage.ts +145 -0
  146. package/src/modules/library/library.css +33 -245
  147. package/src/modules/library/routes/LibraryRoutes.tsx +134 -0
  148. package/src/modules/library/routes/WorkspaceItemRoute.tsx +74 -0
  149. package/src/modules/library/routes/library-paths.ts +191 -0
  150. package/src/modules/library/services/groups.api.ts +189 -0
  151. package/src/modules/library/services/library.api.ts +291 -164
  152. package/src/modules/library/services/tools.api.ts +60 -0
  153. package/src/modules/library/state/library-context.ts +22 -0
  154. package/src/modules/library/state/library-data.tsx +223 -0
  155. package/src/modules/library/state/toast.context.ts +32 -0
  156. package/src/modules/library/state/toast.tsx +84 -42
  157. package/src/modules/library/utils/clipboard.ts +33 -0
  158. package/src/modules/library/utils/group-summary.ts +68 -0
  159. package/src/modules/library/utils/names.ts +30 -0
  160. package/src/modules/library/utils/navigate-external.ts +15 -0
  161. package/src/modules/library/utils/oauth-fragment.ts +32 -0
  162. package/src/modules/library/utils/personal-group.ts +36 -0
  163. package/src/modules/library/utils/status.ts +108 -25
  164. package/src/modules/library/utils/toast-duration.ts +16 -0
  165. package/src/modules/onboarding/__tests__/onboarding.test.tsx +533 -0
  166. package/src/modules/onboarding/agent-clients.ts +48 -0
  167. package/src/modules/onboarding/components/ConnectAgentPill.tsx +133 -0
  168. package/src/modules/onboarding/components/RootLanding.tsx +54 -0
  169. package/src/modules/onboarding/components/WelcomePage.tsx +364 -0
  170. package/src/modules/onboarding/paths.ts +9 -0
  171. package/src/modules/onboarding/state/onboarding.ts +191 -0
  172. package/src/modules/pr/components/OpenChangeRequestDialog.tsx +10 -10
  173. package/src/modules/pr/services/pr-approvals.api.ts +19 -0
  174. package/src/modules/pr/services/pr-cancel.api.ts +11 -0
  175. package/src/modules/review/components/BinaryChangePlaceholder.tsx +3 -3
  176. package/src/modules/review/components/DiffViewer.tsx +4 -4
  177. package/src/modules/review/components/MarkdownDiffViewer.tsx +84 -26
  178. package/src/modules/review/components/ReviewFileRow.tsx +10 -10
  179. package/src/modules/review/components/ReviewPanel.tsx +49 -17
  180. package/src/modules/review/components/ReviewPanelSurface.tsx +1 -1
  181. package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +122 -0
  182. package/src/modules/review/hooks/__tests__/useReviewState.test.ts +1 -1
  183. package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +273 -171
  184. package/src/modules/secrets-vault/components/SecretsPage.tsx +147 -110
  185. package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +109 -92
  186. package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +35 -4
  187. package/src/modules/secrets-vault/services/connect.api.ts +24 -3
  188. package/src/modules/settings/components/DeploymentPage.tsx +90 -0
  189. package/src/modules/settings/components/SettingsLayout.tsx +135 -0
  190. package/src/modules/settings/components/SettingsNav.tsx +114 -0
  191. package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +110 -0
  192. package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +249 -0
  193. package/src/modules/settings/settings-nav-items.tsx +166 -0
  194. package/src/modules/setup/__tests__/setup.test.tsx +540 -0
  195. package/src/modules/setup/components/SetupGate.tsx +67 -0
  196. package/src/modules/setup/components/SetupScreen.tsx +573 -0
  197. package/src/modules/setup/services/setup.api.ts +106 -0
  198. package/src/modules/setup/utils/git-host.ts +34 -0
  199. package/src/modules/toolbar/components/AppSwitcher.tsx +38 -15
  200. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +50 -50
  201. package/src/modules/toolbar/components/ProfileMenu.tsx +294 -0
  202. package/src/modules/toolbar/components/Toolbar.tsx +56 -54
  203. package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +176 -122
  204. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +252 -77
  205. package/src/modules/tools/ToolsExplorerPage.tsx +45 -40
  206. package/src/modules/workspace/__tests__/design-system-parity.test.ts +133 -0
  207. package/src/modules/workspace/__tests__/testFixtures.ts +2 -0
  208. package/src/modules/workspace/components/EditorTabs.tsx +82 -50
  209. package/src/modules/workspace/components/FileExplorer.tsx +413 -189
  210. package/src/modules/workspace/components/FilePaneCard.tsx +53 -0
  211. package/src/modules/workspace/components/FileRoute.tsx +89 -84
  212. package/src/modules/workspace/components/FileViewer.tsx +700 -294
  213. package/src/modules/workspace/components/KbDocumentShell.tsx +138 -0
  214. package/src/modules/workspace/components/KbFileRail.tsx +128 -0
  215. package/src/modules/workspace/components/KbPageHeader.tsx +390 -0
  216. package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +87 -3
  217. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +293 -39
  218. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +1 -16
  219. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +462 -44
  220. package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +84 -0
  221. package/src/modules/workspace/components/__tests__/KbFileRail.test.tsx +83 -0
  222. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +192 -0
  223. package/src/modules/workspace/components/renderers/CopyAnchorButton.tsx +64 -0
  224. package/src/modules/workspace/components/renderers/CsvRenderer.tsx +8 -8
  225. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +18 -9
  226. package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +14 -14
  227. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +2 -2
  228. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +31 -165
  229. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +18 -5
  230. package/src/modules/workspace/components/renderers/MermaidDiagram.tsx +27 -10
  231. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +2 -2
  232. package/src/modules/workspace/components/renderers/TextRenderer.tsx +11 -5
  233. package/src/modules/workspace/components/renderers/ToolForm.tsx +24 -24
  234. package/src/modules/workspace/components/renderers/ToolRenderer.tsx +27 -27
  235. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -11
  236. package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +66 -0
  237. package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +17 -1
  238. package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +1 -1
  239. package/src/modules/workspace/components/renderers/__tests__/MermaidDiagram.test.tsx +58 -0
  240. package/src/modules/workspace/components/renderers/__tests__/lazyRenderer.test.tsx +68 -0
  241. package/src/modules/workspace/components/renderers/__tests__/rendererLayout.test.ts +64 -0
  242. package/src/modules/workspace/components/renderers/__tests__/sanitizeDocxHtml.test.ts +0 -0
  243. package/src/modules/workspace/components/renderers/chunk-boundary.tsx +71 -0
  244. package/src/modules/workspace/components/renderers/index.ts +78 -2
  245. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +241 -0
  246. package/src/modules/workspace/components/renderers/lazyRenderer.tsx +59 -0
  247. package/src/modules/workspace/components/renderers/sanitizeDocxHtml.ts +91 -0
  248. package/src/modules/workspace/hooks/__tests__/useLinksOut.test.ts +59 -0
  249. package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +237 -0
  250. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +185 -0
  251. package/src/modules/workspace/hooks/useAutoGrowTextarea.ts +30 -0
  252. package/src/modules/workspace/hooks/useLastCommit.ts +66 -0
  253. package/src/modules/workspace/hooks/useLinksOut.ts +56 -0
  254. package/src/modules/workspace/hooks/useOpenChangeRequests.ts +20 -0
  255. package/src/modules/workspace/hooks/useWorkspaceState.ts +123 -14
  256. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +1 -1
  257. package/src/modules/workspace/services/workspace.api.ts +9 -2
  258. package/src/modules/workspace/state/open-change-requests.context.ts +35 -0
  259. package/src/modules/workspace/state/open-change-requests.tsx +185 -0
  260. package/src/modules/workspace/state/workspace.context.ts +9 -0
  261. package/src/modules/workspace/utils/__tests__/diff.test.ts +87 -0
  262. package/src/modules/workspace/utils/diff.ts +130 -53
  263. package/src/modules/workspace/utils/fileTree.ts +7 -4
  264. package/src/modules/workspace/workspace.css +28 -0
  265. package/src/shared/components/Badge.tsx +62 -0
  266. package/src/shared/components/Banner.tsx +58 -0
  267. package/src/shared/components/Button.tsx +90 -0
  268. package/src/shared/components/Dialog.tsx +6 -6
  269. package/src/shared/components/Field.tsx +45 -0
  270. package/src/shared/components/IconButton.tsx +74 -0
  271. package/src/shared/components/ListRow.tsx +96 -0
  272. package/src/shared/components/Menu.tsx +88 -0
  273. package/src/shared/components/PageShell.tsx +8 -5
  274. package/src/shared/components/Surface.tsx +86 -0
  275. package/src/shared/components/__tests__/primitives.test.tsx +333 -0
  276. package/src/shared/components/index.ts +48 -0
  277. package/src/shared/components/useDismissableMenu.ts +71 -0
  278. package/src/shared/theme/__tests__/accent-contrast.test.ts +84 -0
  279. package/src/shared/theme/index.css +12 -0
  280. package/src/shared/theme/measure.ts +64 -0
  281. package/src/shared/theme/shadows.css +34 -0
  282. package/src/shared/theme/tokens.css +193 -0
  283. package/src/test-setup.ts +9 -0
  284. package/src/modules/access/components/AccessRestrictedBanner.tsx +0 -31
  285. package/src/modules/access/components/NodeOwnersBanner.tsx +0 -30
  286. package/src/modules/git/__tests__/ProtectedBranchBanner.test.tsx +0 -82
  287. package/src/modules/git/components/ProtectedBranchBanner.tsx +0 -42
  288. package/src/modules/library/__tests__/DetailDialog.test.tsx +0 -200
  289. package/src/modules/library/__tests__/diff.test.ts +0 -62
  290. package/src/modules/library/__tests__/loadout.test.tsx +0 -72
  291. package/src/modules/library/components/CompareView.tsx +0 -357
  292. package/src/modules/library/components/DetailDialog.tsx +0 -566
  293. package/src/modules/library/components/GearIcon.tsx +0 -12
  294. package/src/modules/library/components/LoadoutSidebar.tsx +0 -156
  295. package/src/modules/library/components/StatusGem.tsx +0 -21
  296. package/src/modules/library/components/SuggestChange.tsx +0 -171
  297. package/src/modules/library/components/particles.ts +0 -50
  298. package/src/modules/library/state/loadout.tsx +0 -129
  299. package/src/modules/library/utils/diff.ts +0 -102
  300. package/src/modules/pr/__tests__/PrApprovalBadge.test.tsx +0 -93
  301. package/src/modules/pr/__tests__/PrCancelButton.test.tsx +0 -158
  302. package/src/modules/pr/__tests__/PrCancelConfirmDialog.test.tsx +0 -44
  303. package/src/modules/pr/__tests__/PrMergeButton.test.tsx +0 -360
  304. package/src/modules/pr/__tests__/bucketize-comments.test.ts +0 -85
  305. package/src/modules/pr/__tests__/parsePatch.test.ts +0 -104
  306. package/src/modules/pr/__tests__/usePrViewerState.test.ts +0 -72
  307. package/src/modules/pr/components/PrApprovalBadge.tsx +0 -80
  308. package/src/modules/pr/components/PrCancelButton.tsx +0 -99
  309. package/src/modules/pr/components/PrCancelConfirmDialog.tsx +0 -119
  310. package/src/modules/pr/components/PrCommentComposer.tsx +0 -92
  311. package/src/modules/pr/components/PrCommentThread.tsx +0 -168
  312. package/src/modules/pr/components/PrCommentsPanel.tsx +0 -143
  313. package/src/modules/pr/components/PrDiffPane.tsx +0 -425
  314. package/src/modules/pr/components/PrFileRow.tsx +0 -164
  315. package/src/modules/pr/components/PrFilesList.tsx +0 -53
  316. package/src/modules/pr/components/PrHeader.tsx +0 -45
  317. package/src/modules/pr/components/PrHeaderOverflowMenu.tsx +0 -58
  318. package/src/modules/pr/components/PrMergeButton.tsx +0 -268
  319. package/src/modules/pr/components/PrMergeConfirmDialog.tsx +0 -112
  320. package/src/modules/pr/components/PrRefreshFromTargetButton.tsx +0 -110
  321. package/src/modules/pr/components/PrViewer.tsx +0 -364
  322. package/src/modules/pr/hooks/usePrViewerState.ts +0 -150
  323. package/src/modules/pr/state/pr-viewer.context.ts +0 -34
  324. package/src/modules/pr/utils/bucketize-comments.ts +0 -55
  325. package/src/modules/pr/utils/parsePatch.ts +0 -57
  326. package/src/modules/toolbar/components/AdminMenu.tsx +0 -271
@@ -0,0 +1,47 @@
1
+ import { useState } from 'react';
2
+ import { Button } from '../../../shared/components';
3
+
4
+ /**
5
+ * "Ask your agent" — the way out of a conflicted change request.
6
+ *
7
+ * A conflict is the one refusal the buttons on these surfaces cannot fix:
8
+ * somebody has to re-do the proposal against text that moved, and the user's
9
+ * agent is the hand that does that here. So the surface hands over the EXACT
10
+ * prompt, ready to paste — the request number and both branches filled in —
11
+ * because "ask your agent to fix it" without the words is an errand, and an
12
+ * errand is where this flow used to die.
13
+ *
14
+ * The copy MUST report failure: `navigator.clipboard` rejects outright on a
15
+ * non-secure origin, and a silent no-op is the worst possible answer to
16
+ * "copy this". The prompt is also selectable text, so a refused clipboard
17
+ * still leaves the manual route open.
18
+ */
19
+ export function ConflictHelp({ prompt }: { prompt: string }) {
20
+ const [copied, setCopied] = useState<null | 'ok' | 'fail'>(null);
21
+
22
+ async function copy() {
23
+ try {
24
+ await navigator.clipboard.writeText(prompt);
25
+ setCopied('ok');
26
+ } catch {
27
+ setCopied('fail');
28
+ }
29
+ window.setTimeout(() => setCopied(null), 1800);
30
+ }
31
+
32
+ return (
33
+ <div className="w-full">
34
+ <p className="text-meta text-ink-muted">
35
+ Fastest fix: ask your agent to resolve it. Copy this prompt.
36
+ </p>
37
+ <div className="mt-1.5 flex items-start gap-2 rounded-md border border-line bg-sunken p-2.5">
38
+ <pre className="min-w-0 flex-1 select-text whitespace-pre-wrap break-words font-mono text-meta leading-relaxed text-ink">
39
+ {prompt}
40
+ </pre>
41
+ <Button variant="outline" size="tiny" className="shrink-0" onClick={() => void copy()}>
42
+ {copied === 'ok' ? 'Copied' : copied === 'fail' ? "Couldn't copy" : 'Copy'}
43
+ </Button>
44
+ </div>
45
+ </div>
46
+ );
47
+ }
@@ -0,0 +1,398 @@
1
+ import { useEffect, useMemo, useRef, useState } from 'react';
2
+ import {
3
+ ArrowRightLeft,
4
+ Check,
5
+ ChevronRight,
6
+ Clock,
7
+ File,
8
+ FileEdit,
9
+ FilePlus2,
10
+ FileX2,
11
+ X,
12
+ } from 'lucide-react';
13
+ import type { FileApprovalState, PrFileStatus } from '@bevel-software/platform-shared';
14
+ import { cn } from '../../../lib/utils';
15
+
16
+ /**
17
+ * The change request's files as a TREE — the Knowledge sidebar's visual
18
+ * grammar (indent is the structure, caret slots, quiet rows), carrying the
19
+ * OLD change-request view's row anatomy (bevel-platform-presplit
20
+ * `PrFileRow`), which got this right:
21
+ *
22
+ * - LEFT of the name: what HAPPENED to the file (added / removed / modified
23
+ * kind icon, colour-coded), never a control.
24
+ * - INLINE after the name: the approval STATE — green ✓ confirmed, amber
25
+ * clock for outdated confirmations, grey clock waiting — with the
26
+ * eligible approvers in the tooltip.
27
+ * - RIGHT, revealed on hover: the ACTION for eligible viewers — a filled
28
+ * green check to confirm the file, turning into an ✕ (withdraw) once
29
+ * YOUR confirmation is the current one.
30
+ *
31
+ * Right-click a revertable file for the destructive verb, armed inside its
32
+ * own context menu. Selection (which file the diff shows) stays a plain
33
+ * click on the name.
34
+ */
35
+
36
+ export interface CrTreeFileState {
37
+ /** Repo-relative path. */
38
+ path: string;
39
+ /** Changed by this request (scope base files list too, unchanged). */
40
+ changed: boolean;
41
+ /** Added by this request. */
42
+ added: boolean;
43
+ /** Git status when changed (drives the kind icon). */
44
+ status?: PrFileStatus;
45
+ approval?: FileApprovalState;
46
+ }
47
+
48
+ interface CrFileTreeProps {
49
+ files: CrTreeFileState[];
50
+ selected: string;
51
+ /** The viewer — whose own current confirmation the withdraw action needs. */
52
+ currentUserEmail: string;
53
+ onSelect(path: string): void;
54
+ /** Confirm `path`, or withdraw the viewer's own confirmation of it. */
55
+ onToggleApprove(path: string, hasOwnApproval: boolean): void;
56
+ /** Revert `path` on the source branch. Only called when approvable+changed. */
57
+ onRevert(path: string): void;
58
+ /** Disables the verbs while one is in flight. */
59
+ busy: boolean;
60
+ }
61
+
62
+ interface TreeFolder {
63
+ name: string;
64
+ path: string;
65
+ folders: TreeFolder[];
66
+ files: CrTreeFileState[];
67
+ }
68
+
69
+ function buildTree(files: CrTreeFileState[]): TreeFolder {
70
+ const root: TreeFolder = { name: '', path: '', folders: [], files: [] };
71
+ for (const file of files) {
72
+ const segments = file.path.split('/');
73
+ let node = root;
74
+ for (const segment of segments.slice(0, -1)) {
75
+ let next = node.folders.find((f) => f.name === segment);
76
+ if (!next) {
77
+ next = {
78
+ name: segment,
79
+ path: node.path ? `${node.path}/${segment}` : segment,
80
+ folders: [],
81
+ files: [],
82
+ };
83
+ node.folders.push(next);
84
+ }
85
+ node = next;
86
+ }
87
+ node.files.push(file);
88
+ }
89
+ return root;
90
+ }
91
+
92
+ const indentFor = (depth: number) => 8 + depth * 13;
93
+
94
+ export function CrFileTree({
95
+ files,
96
+ selected,
97
+ currentUserEmail,
98
+ onSelect,
99
+ onToggleApprove,
100
+ onRevert,
101
+ busy,
102
+ }: CrFileTreeProps) {
103
+ const tree = useMemo(() => buildTree(files), [files]);
104
+ const [closed, setClosed] = useState<Set<string>>(new Set());
105
+ const [menu, setMenu] = useState<{ path: string; x: number; y: number } | null>(null);
106
+
107
+ return (
108
+ <div role="tree" aria-label="Files in this change request" className="py-1">
109
+ <Level
110
+ folder={tree}
111
+ depth={0}
112
+ closed={closed}
113
+ onToggleFolder={(p) =>
114
+ setClosed((prev) => {
115
+ const next = new Set(prev);
116
+ if (next.has(p)) next.delete(p);
117
+ else next.add(p);
118
+ return next;
119
+ })
120
+ }
121
+ selected={selected}
122
+ currentUserEmail={currentUserEmail}
123
+ onSelect={onSelect}
124
+ onToggleApprove={onToggleApprove}
125
+ onContextMenu={(path, e) => {
126
+ e.preventDefault();
127
+ setMenu({ path, x: e.clientX, y: e.clientY });
128
+ }}
129
+ busy={busy}
130
+ />
131
+ {menu && (
132
+ <RevertMenu
133
+ {...menu}
134
+ busy={busy}
135
+ onRevert={() => {
136
+ onRevert(menu.path);
137
+ setMenu(null);
138
+ }}
139
+ onClose={() => setMenu(null)}
140
+ />
141
+ )}
142
+ </div>
143
+ );
144
+ }
145
+
146
+ function Level({
147
+ folder,
148
+ depth,
149
+ closed,
150
+ onToggleFolder,
151
+ selected,
152
+ currentUserEmail,
153
+ onSelect,
154
+ onToggleApprove,
155
+ onContextMenu,
156
+ busy,
157
+ }: {
158
+ folder: TreeFolder;
159
+ depth: number;
160
+ closed: Set<string>;
161
+ onToggleFolder(path: string): void;
162
+ selected: string;
163
+ currentUserEmail: string;
164
+ onSelect(path: string): void;
165
+ onToggleApprove(path: string, hasOwnApproval: boolean): void;
166
+ onContextMenu(path: string, e: React.MouseEvent): void;
167
+ busy: boolean;
168
+ }) {
169
+ return (
170
+ <>
171
+ {folder.folders.map((child) => {
172
+ const isClosed = closed.has(child.path);
173
+ return (
174
+ <div key={child.path} role="group">
175
+ <button
176
+ type="button"
177
+ className="flex w-full items-center gap-1 rounded-sm py-1 pr-2 text-left text-meta font-medium text-ink-muted transition-colors hover:bg-hover"
178
+ style={{ paddingLeft: indentFor(depth) }}
179
+ onClick={() => onToggleFolder(child.path)}
180
+ aria-expanded={!isClosed}
181
+ >
182
+ <span className="flex h-3.5 w-3.5 flex-none items-center justify-center text-ink-faint">
183
+ <ChevronRight
184
+ size={13}
185
+ className={cn('transition-transform duration-150', !isClosed && 'rotate-90')}
186
+ />
187
+ </span>
188
+ <span className="truncate">{child.name}</span>
189
+ </button>
190
+ {!isClosed && (
191
+ <Level
192
+ folder={child}
193
+ depth={depth + 1}
194
+ closed={closed}
195
+ onToggleFolder={onToggleFolder}
196
+ selected={selected}
197
+ currentUserEmail={currentUserEmail}
198
+ onSelect={onSelect}
199
+ onToggleApprove={onToggleApprove}
200
+ onContextMenu={onContextMenu}
201
+ busy={busy}
202
+ />
203
+ )}
204
+ </div>
205
+ );
206
+ })}
207
+ {folder.files.map((file) => {
208
+ const name = file.path.slice(file.path.lastIndexOf('/') + 1);
209
+ const on = selected === file.path;
210
+ const eligible = file.changed && file.approval?.viewerCanApprove === true;
211
+ // The withdraw action toggles YOUR current confirmation, nobody
212
+ // else's — stale rows stay for audit without arming it (presplit
213
+ // PrFileRow's rule, kept verbatim).
214
+ const email = currentUserEmail.trim().toLowerCase();
215
+ const hasOwnApproval =
216
+ !!email &&
217
+ !!file.approval?.approvedBy.some(
218
+ (a) => a.email.toLowerCase() === email && !a.isStale,
219
+ );
220
+ return (
221
+ <div
222
+ key={file.path}
223
+ role="treeitem"
224
+ aria-selected={on}
225
+ className={cn(
226
+ 'group/row flex w-full items-center gap-1.5 rounded-sm py-1 pr-1.5 transition-colors',
227
+ on ? 'bg-hover' : 'hover:bg-hover',
228
+ )}
229
+ style={{ paddingLeft: indentFor(depth) + 17 }}
230
+ onContextMenu={(e) => {
231
+ if (eligible) onContextMenu(file.path, e);
232
+ }}
233
+ >
234
+ <KindIcon status={file.changed ? file.status : undefined} />
235
+ <button
236
+ type="button"
237
+ className={cn(
238
+ 'min-w-0 flex-1 truncate text-left font-mono text-meta transition-colors',
239
+ on ? 'font-semibold text-ink' : 'text-ink-muted',
240
+ )}
241
+ title={file.path}
242
+ onClick={() => onSelect(file.path)}
243
+ >
244
+ {name}
245
+ </button>
246
+ <ApprovalStateBadge approval={file.changed ? file.approval : undefined} />
247
+ {eligible && (
248
+ <span className="flex flex-none items-center opacity-70 group-hover/row:opacity-100">
249
+ {hasOwnApproval ? (
250
+ <button
251
+ type="button"
252
+ disabled={busy}
253
+ title="Withdraw your confirmation"
254
+ aria-label={`Withdraw your confirmation of ${file.path}`}
255
+ onClick={() => onToggleApprove(file.path, true)}
256
+ className="rounded-sm p-1 text-ok transition-colors hover:bg-danger-soft hover:text-danger disabled:cursor-not-allowed disabled:opacity-40"
257
+ >
258
+ <X size={12} />
259
+ </button>
260
+ ) : (
261
+ <button
262
+ type="button"
263
+ disabled={busy}
264
+ title="Confirm this file"
265
+ aria-label={`Confirm ${file.path}`}
266
+ onClick={() => onToggleApprove(file.path, false)}
267
+ className="rounded-sm bg-ok p-1 text-white transition-colors hover:opacity-85 disabled:cursor-not-allowed disabled:opacity-40"
268
+ >
269
+ <Check size={12} />
270
+ </button>
271
+ )}
272
+ </span>
273
+ )}
274
+ </div>
275
+ );
276
+ })}
277
+ </>
278
+ );
279
+ }
280
+
281
+ /** What happened to the file — presplit PrFileRow's kind icons, on core tokens. */
282
+ function KindIcon({ status }: { status?: PrFileStatus }) {
283
+ const size = 13;
284
+ switch (status) {
285
+ case 'added':
286
+ return <FilePlus2 size={size} className="flex-none text-ok" />;
287
+ case 'removed':
288
+ return <FileX2 size={size} className="flex-none text-danger" />;
289
+ case 'renamed':
290
+ case 'copied':
291
+ return <ArrowRightLeft size={size} className="flex-none text-ink-muted" />;
292
+ case 'modified':
293
+ case 'changed':
294
+ return <FileEdit size={size} className="flex-none text-wait" />;
295
+ default:
296
+ // A scope file this request does not touch.
297
+ return <File size={size} className="flex-none text-ink-faint" />;
298
+ }
299
+ }
300
+
301
+ /**
302
+ * The approval STATE, inline after the name — presplit PrApprovalBadge:
303
+ * green ✓ confirmed, amber clock for outdated confirmations, grey clock
304
+ * waiting; nothing at all for files outside the gate (keeps the tree quiet).
305
+ */
306
+ function ApprovalStateBadge({ approval }: { approval?: FileApprovalState }) {
307
+ if (!approval) return null;
308
+ const hasEligible =
309
+ approval.eligibleApprovers.roles.length > 0 || approval.eligibleApprovers.users.length > 0;
310
+ if (!hasEligible) return null;
311
+ const who = [
312
+ ...approval.eligibleApprovers.roles,
313
+ ...approval.eligibleApprovers.users.map((u) => u.name || u.email),
314
+ ].join(', ');
315
+ if (approval.isApproved) {
316
+ const label = `Confirmed by ${who}`;
317
+ return (
318
+ <span role="img" aria-label={label} title={label} className="flex-none text-ok">
319
+ <Check size={12} />
320
+ </span>
321
+ );
322
+ }
323
+ const stale = approval.approvedBy.some((a) => a.isStale);
324
+ const label = stale
325
+ ? 'Confirmation outdated — please re-confirm after the latest edits'
326
+ : `Waiting on ${who}`;
327
+ return (
328
+ <span
329
+ role="img"
330
+ aria-label={label}
331
+ title={label}
332
+ className={cn('flex-none', stale ? 'text-wait' : 'text-ink-faint')}
333
+ >
334
+ <Clock size={12} />
335
+ </span>
336
+ );
337
+ }
338
+
339
+ /**
340
+ * The right-click menu: one destructive verb with its confirm built in — the
341
+ * first click arms it, the second fires. Click-away and Escape close it.
342
+ */
343
+ function RevertMenu({
344
+ path,
345
+ x,
346
+ y,
347
+ busy,
348
+ onRevert,
349
+ onClose,
350
+ }: {
351
+ path: string;
352
+ x: number;
353
+ y: number;
354
+ busy: boolean;
355
+ onRevert(): void;
356
+ onClose(): void;
357
+ }) {
358
+ const [armed, setArmed] = useState(false);
359
+ const ref = useRef<HTMLDivElement>(null);
360
+ useEffect(() => {
361
+ const onDown = (e: MouseEvent) => {
362
+ if (ref.current && !ref.current.contains(e.target as Node)) onClose();
363
+ };
364
+ const onKey = (e: KeyboardEvent) => {
365
+ if (e.key === 'Escape') onClose();
366
+ };
367
+ document.addEventListener('mousedown', onDown);
368
+ document.addEventListener('keydown', onKey);
369
+ return () => {
370
+ document.removeEventListener('mousedown', onDown);
371
+ document.removeEventListener('keydown', onKey);
372
+ };
373
+ }, [onClose]);
374
+ return (
375
+ <div
376
+ ref={ref}
377
+ role="menu"
378
+ className="fixed z-[60] min-w-44 rounded-md border border-line bg-white py-1 shadow-lg"
379
+ style={{ left: x, top: y }}
380
+ >
381
+ <div className="truncate px-3 py-1 font-mono text-label text-ink-faint" title={path}>
382
+ {path.slice(path.lastIndexOf('/') + 1)}
383
+ </div>
384
+ <button
385
+ type="button"
386
+ role="menuitem"
387
+ disabled={busy}
388
+ className={cn(
389
+ 'w-full px-3 py-1.5 text-left text-detail transition-colors',
390
+ armed ? 'font-medium text-danger hover:bg-hover' : 'text-ink hover:bg-hover',
391
+ )}
392
+ onClick={() => (armed ? onRevert() : setArmed(true))}
393
+ >
394
+ {armed ? 'Really revert this file?' : 'Revert file…'}
395
+ </button>
396
+ </div>
397
+ );
398
+ }
@@ -0,0 +1,168 @@
1
+ import { useCallback, useState } from 'react';
2
+ import type { PullRequestSummary } from '@bevel-software/platform-shared';
3
+ import { Banner, Button } from '../../../shared/components';
4
+ import { cancelPullRequest } from '../../pr/services/pr-cancel.api';
5
+ import { useOpenChangeRequests } from '../../workspace/hooks/useOpenChangeRequests';
6
+ import { PR_STALE_EVENT } from '../../../core/events';
7
+ import { useApplyChangeRequest } from '../hooks/useApplyChangeRequest';
8
+ import { useCrFileDiffs } from '../hooks/useCrFileDiffs';
9
+ import { useDefaultBranchFile } from '../hooks/useFileOnBranch';
10
+ import { changeAuthorName, formatWhen } from '../utils/author';
11
+ import { conflictResolutionPrompt } from '../utils/conflict';
12
+ import { isBinaryFile } from '../../workspace/components/renderers';
13
+ import { ChangeBox } from './ChangeBox';
14
+ import { ChangeRequestDialog } from './ChangeRequestDialog';
15
+
16
+ export interface FileChangeBoxesProps {
17
+ /** Repo-root-relative path of the open file (kbDirName stripped). */
18
+ repoRelativePath: string;
19
+ /** Open requests touching this file. */
20
+ requests: PullRequestSummary[];
21
+ /** The caller may write this file — they decide. */
22
+ canDecide: boolean;
23
+ /** Who the decision waits on, for the non-owner's footer. */
24
+ ownersLabel: string;
25
+ /** The default branch just changed under this file — a request landed. */
26
+ onApplied(): void;
27
+ }
28
+
29
+ /**
30
+ * Every open proposal on one file, as boxes UNDER the file it is about —
31
+ * exactly the skill page's presentation, orchestrated once so any surface
32
+ * showing a document can mount it. The question a box asks ("should this
33
+ * text become that text?") is unanswerable without the text, which is why
34
+ * this is not a banner pointing at a review queue somewhere else.
35
+ *
36
+ * Owns the whole decision loop: per-request diffs against the default
37
+ * branch, Approve (approvals → merge → wait for the outcome event),
38
+ * Decline, the author's Withdraw, and "Read the whole change" opening the
39
+ * shared {@link ChangeRequestDialog}. Resolutions dispatch
40
+ * {@link PR_STALE_EVENT} so the tree dots, the tabs and this very list
41
+ * refetch.
42
+ */
43
+ export function FileChangeBoxes({
44
+ repoRelativePath,
45
+ requests,
46
+ canDecide,
47
+ ownersLabel,
48
+ onApplied,
49
+ }: FileChangeBoxesProps) {
50
+ const { mineNumbers } = useOpenChangeRequests();
51
+ /** Bumped after every resolution so the branch reads re-run against fresh content. */
52
+ const [revision, setRevision] = useState(0);
53
+ const [busyCr, setBusyCr] = useState<number | null>(null);
54
+ /** Conflicts discovered by a merge attempt — Approve is withdrawn for these. */
55
+ const [blockedCrs, setBlockedCrs] = useState<Set<number>>(new Set());
56
+ const [applied, setApplied] = useState(false);
57
+ const [actionError, setActionError] = useState<string | null>(null);
58
+ /** The request opened full-screen in the shared dialog, if any. */
59
+ const [openCr, setOpenCr] = useState<PullRequestSummary | null>(null);
60
+
61
+ // Binary files never diff (see the box's `binary` prop) — so never fetch
62
+ // and decode their default-branch bytes either.
63
+ const binary = isBinaryFile(repoRelativePath);
64
+ const rawOnMain = useDefaultBranchFile(binary ? null : repoRelativePath, revision);
65
+ const crDiffs = useCrFileDiffs(requests, repoRelativePath, rawOnMain, revision);
66
+
67
+ const resolved = useCallback(() => {
68
+ setApplied(true);
69
+ setRevision((r) => r + 1);
70
+ window.dispatchEvent(new Event(PR_STALE_EVENT));
71
+ onApplied();
72
+ }, [onApplied]);
73
+
74
+ const applying = useApplyChangeRequest({
75
+ onApplied: resolved,
76
+ onFailed(number, refusal) {
77
+ if (refusal.conflicts) {
78
+ setBlockedCrs((s) => (s.has(number) ? s : new Set(s).add(number)));
79
+ }
80
+ },
81
+ });
82
+
83
+ /** Decline (an owner's no) and Withdraw (the author's) are the same cancel. */
84
+ const cancel = useCallback(async (cr: PullRequestSummary) => {
85
+ setBusyCr(cr.number);
86
+ setActionError(null);
87
+ try {
88
+ await cancelPullRequest(cr.number);
89
+ window.dispatchEvent(new Event(PR_STALE_EVENT));
90
+ } catch (err) {
91
+ setActionError(err instanceof Error ? err.message : "Couldn't resolve this change.");
92
+ } finally {
93
+ setBusyCr(null);
94
+ }
95
+ }, []);
96
+
97
+ const boxes = requests.filter((c) => c.touchedNodePaths.includes(repoRelativePath));
98
+
99
+ return (
100
+ <>
101
+ {applied && (
102
+ <Banner role="status" tone="ok" aria-live="polite" className="mt-3">
103
+ <div className="flex items-center gap-2">
104
+ <span className="flex-1">Applied: the file now reads with that change.</span>
105
+ <Button variant="quiet" size="sm" title="Dismiss" onClick={() => setApplied(false)}>
106
+ Dismiss
107
+ </Button>
108
+ </div>
109
+ </Banner>
110
+ )}
111
+ {actionError && (
112
+ <Banner role="alert" tone="danger" aria-live="assertive" className="mt-3">
113
+ {actionError}
114
+ </Banner>
115
+ )}
116
+
117
+ {boxes.map((cr) => {
118
+ const mine = mineNumbers.has(cr.number);
119
+ // `[]` is the diff hook's "overtaken" answer — the proposal and the
120
+ // file now say the same thing — distinct from `null`, which only
121
+ // means a side has not arrived yet.
122
+ const fileDiff = crDiffs.get(cr.number) ?? null;
123
+ return (
124
+ <ChangeBox
125
+ key={cr.number}
126
+ file={repoRelativePath.slice(repoRelativePath.lastIndexOf('/') + 1)}
127
+ author={changeAuthorName(cr)}
128
+ when={formatWhen(cr.createdAt)}
129
+ mine={mine}
130
+ canDecide={canDecide && !mine}
131
+ diff={fileDiff}
132
+ binary={binary}
133
+ upToDate={fileDiff !== null && fileDiff.length === 0}
134
+ blocked={blockedCrs.has(cr.number)}
135
+ conflictPrompt={conflictResolutionPrompt(cr)}
136
+ // A conflict already speaks through `blocked`; repeating it as a
137
+ // refusal line would say the same thing twice in one box.
138
+ refusal={
139
+ applying.refusals.get(cr.number)?.conflicts === false
140
+ ? (applying.refusals.get(cr.number)?.reason ?? null)
141
+ : null
142
+ }
143
+ owner={ownersLabel}
144
+ busy={busyCr === cr.number || applying.activeCr === cr.number}
145
+ phase={applying.activeCr === cr.number ? applying.phase : 'idle'}
146
+ onApprove={() => applying.apply(cr)}
147
+ onDecline={() => void cancel(cr)}
148
+ onWithdraw={() => void cancel(cr)}
149
+ onOpenFull={() => setOpenCr(cr)}
150
+ />
151
+ );
152
+ })}
153
+
154
+ {openCr && (
155
+ <ChangeRequestDialog
156
+ cr={openCr}
157
+ onClose={() => setOpenCr(null)}
158
+ // Applying is the only verdict the dialog reaches now — declining
159
+ // and withdrawing live on the boxes.
160
+ onResolved={() => {
161
+ setOpenCr(null);
162
+ resolved();
163
+ }}
164
+ />
165
+ )}
166
+ </>
167
+ );
168
+ }