@justanarthur/modo-ui-ai 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/LICENSE.fluid-functionalism +21 -0
- package/README.md +105 -2
- package/blocks/conversation/agent-prompt/examples.mdx +44 -0
- package/blocks/conversation/agent-prompt/index.tsx +114 -0
- package/blocks/conversation/composer/draft.css +25 -0
- package/blocks/conversation/composer/draft.tsx +589 -0
- package/blocks/conversation/composer/examples.mdx +114 -0
- package/blocks/conversation/composer/file-preview-tile.tsx +59 -0
- package/blocks/conversation/composer/file-thumbnail.tsx +146 -0
- package/blocks/conversation/composer/index.tsx +517 -0
- package/blocks/conversation/composer/queued-row.tsx +102 -0
- package/blocks/conversation/composer/shared.ts +38 -0
- package/blocks/conversation/composer/suggestion-row.tsx +64 -0
- package/blocks/conversation/composer/use-composer-files.ts +142 -0
- package/blocks/conversation/composer/use-history-nav.ts +60 -0
- package/blocks/conversation/composer/use-message-queue.ts +108 -0
- package/blocks/conversation/composer/use-region-height.ts +34 -0
- package/blocks/conversation/failure-states/examples.mdx +58 -0
- package/blocks/conversation/failure-states/index.tsx +274 -0
- package/blocks/conversation/transcript/examples.mdx +43 -0
- package/blocks/conversation/transcript/index.tsx +204 -0
- package/blocks/conversation/transcript-search/examples.mdx +50 -0
- package/blocks/conversation/transcript-search/index.tsx +469 -0
- package/blocks/dialogs/command-palette/examples.mdx +33 -0
- package/blocks/dialogs/command-palette/index.tsx +232 -0
- package/blocks/dialogs/hook-dialog/examples.mdx +44 -0
- package/blocks/dialogs/hook-dialog/index.tsx +286 -0
- package/blocks/dialogs/mcp-server-dialog/examples.mdx +57 -0
- package/blocks/dialogs/mcp-server-dialog/index.tsx +415 -0
- package/blocks/dialogs/shortcuts-sheet/examples.mdx +36 -0
- package/blocks/dialogs/shortcuts-sheet/index.tsx +186 -0
- package/blocks/panes/artifacts-pane/examples.mdx +23 -0
- package/blocks/panes/artifacts-pane/index.tsx +82 -0
- package/blocks/panes/changes-pane/examples.mdx +23 -0
- package/blocks/panes/changes-pane/index.tsx +248 -0
- package/blocks/panes/file-pane/examples.mdx +13 -0
- package/blocks/panes/file-pane/index.tsx +102 -0
- package/blocks/panes/pr-pane/examples.mdx +13 -0
- package/blocks/panes/pr-pane/index.tsx +191 -0
- package/blocks/panes/side-pane/examples.mdx +58 -0
- package/blocks/panes/side-pane/index.tsx +187 -0
- package/blocks/panes/tasks-pane/examples.mdx +23 -0
- package/blocks/panes/tasks-pane/index.tsx +127 -0
- package/blocks/panes/terminal-pane/examples.mdx +13 -0
- package/blocks/panes/terminal-pane/index.tsx +99 -0
- package/blocks/panes/usage-pane/examples.mdx +13 -0
- package/blocks/panes/usage-pane/index.tsx +75 -0
- package/blocks/profiles/profile-onboarding/examples.mdx +80 -0
- package/blocks/profiles/profile-onboarding/index.tsx +580 -0
- package/blocks/profiles/profile-switcher/examples.mdx +18 -0
- package/blocks/profiles/profile-switcher/index.tsx +197 -0
- package/blocks/profiles/profile-usage/examples.mdx +21 -0
- package/blocks/profiles/profile-usage/index.tsx +127 -0
- package/blocks/sessions/inbox/examples.mdx +35 -0
- package/blocks/sessions/inbox/index.tsx +372 -0
- package/blocks/sessions/session-board/examples.mdx +34 -0
- package/blocks/sessions/session-board/index.tsx +570 -0
- package/blocks/sessions/session-sidebar/examples.mdx +43 -0
- package/blocks/sessions/session-sidebar/index.tsx +442 -0
- package/blocks/settings/extensions/examples.mdx +10 -0
- package/blocks/settings/extensions/index.tsx +72 -0
- package/blocks/settings/hooks/examples.mdx +16 -0
- package/blocks/settings/hooks/index.tsx +127 -0
- package/blocks/settings/mcp-servers/examples.mdx +26 -0
- package/blocks/settings/mcp-servers/index.tsx +204 -0
- package/blocks/settings/memory/examples.mdx +22 -0
- package/blocks/settings/memory/index.tsx +113 -0
- package/blocks/settings/notifications/examples.mdx +8 -0
- package/blocks/settings/notifications/index.tsx +63 -0
- package/blocks/settings/permission-rules/examples.mdx +37 -0
- package/blocks/settings/permission-rules/index.tsx +317 -0
- package/blocks/settings/plugin-catalog/examples.mdx +52 -0
- package/blocks/settings/plugin-catalog/index.tsx +407 -0
- package/blocks/settings/plugins/examples.mdx +10 -0
- package/blocks/settings/plugins/index.tsx +72 -0
- package/blocks/settings/settings-window/examples.mdx +40 -0
- package/blocks/settings/settings-window/index.tsx +188 -0
- package/blocks/settings/worktrees/examples.mdx +17 -0
- package/blocks/settings/worktrees/index.tsx +145 -0
- package/components/conversation/agent-run/examples.mdx +30 -0
- package/components/conversation/agent-run/index.tsx +82 -0
- package/components/conversation/chapter-nav/examples.mdx +30 -0
- package/components/conversation/chapter-nav/index.tsx +123 -0
- package/components/conversation/message/examples.mdx +53 -0
- package/components/conversation/message/index.tsx +128 -0
- package/components/conversation/message/working.tsx +102 -0
- package/components/conversation/reasoning/examples.mdx +22 -0
- package/components/conversation/reasoning/index.tsx +54 -0
- package/components/conversation/recap/examples.mdx +21 -0
- package/components/conversation/recap/index.tsx +67 -0
- package/components/conversation/todo-list/examples.mdx +32 -0
- package/components/conversation/todo-list/index.tsx +106 -0
- package/components/conversation/tool-call/examples.mdx +48 -0
- package/components/conversation/tool-call/index.tsx +142 -0
- package/components/conversation/work-summary/examples.mdx +50 -0
- package/components/conversation/work-summary/index.tsx +87 -0
- package/components/prompts/permission-request/examples.mdx +32 -0
- package/components/prompts/permission-request/index.tsx +74 -0
- package/components/prompts/plan-approval/examples.mdx +37 -0
- package/components/prompts/plan-approval/index.tsx +76 -0
- package/components/prompts/prompt-card/examples.mdx +31 -0
- package/components/prompts/prompt-card/index.tsx +82 -0
- package/components/prompts/question-prompt/examples.mdx +46 -0
- package/components/prompts/question-prompt/index.tsx +118 -0
- package/dist/blocks/conversation/agent-prompt/index.d.ts +7 -0
- package/dist/blocks/conversation/agent-prompt/index.js +13 -0
- package/dist/blocks/conversation/composer/index.d.ts +4 -0
- package/dist/blocks/conversation/composer/index.js +15 -0
- package/dist/blocks/conversation/failure-states/index.d.ts +4 -0
- package/dist/blocks/conversation/failure-states/index.js +8 -0
- package/dist/blocks/conversation/transcript/index.d.ts +50 -0
- package/dist/blocks/conversation/transcript/index.js +17 -0
- package/dist/blocks/conversation/transcript-search/index.d.ts +4 -0
- package/dist/blocks/conversation/transcript-search/index.js +11 -0
- package/dist/blocks/dialogs/command-palette/index.d.ts +5 -0
- package/dist/blocks/dialogs/command-palette/index.js +20 -0
- package/dist/blocks/dialogs/hook-dialog/index.d.ts +3 -0
- package/dist/blocks/dialogs/hook-dialog/index.js +12 -0
- package/dist/blocks/dialogs/mcp-server-dialog/index.d.ts +5 -0
- package/dist/blocks/dialogs/mcp-server-dialog/index.js +12 -0
- package/dist/blocks/dialogs/shortcuts-sheet/index.d.ts +2 -0
- package/dist/blocks/dialogs/shortcuts-sheet/index.js +11 -0
- package/dist/blocks/panes/artifacts-pane/index.d.ts +3 -0
- package/dist/blocks/panes/artifacts-pane/index.js +9 -0
- package/dist/blocks/panes/changes-pane/index.d.ts +3 -0
- package/dist/blocks/panes/changes-pane/index.js +9 -0
- package/dist/blocks/panes/file-pane/index.d.ts +3 -0
- package/dist/blocks/panes/file-pane/index.js +9 -0
- package/dist/blocks/panes/pr-pane/index.d.ts +3 -0
- package/dist/blocks/panes/pr-pane/index.js +10 -0
- package/dist/blocks/panes/side-pane/index.d.ts +5 -0
- package/dist/blocks/panes/side-pane/index.js +21 -0
- package/dist/blocks/panes/tasks-pane/index.d.ts +3 -0
- package/dist/blocks/panes/tasks-pane/index.js +10 -0
- package/dist/blocks/panes/terminal-pane/index.d.ts +3 -0
- package/dist/blocks/panes/terminal-pane/index.js +9 -0
- package/dist/blocks/panes/usage-pane/index.d.ts +4 -0
- package/dist/blocks/panes/usage-pane/index.js +11 -0
- package/dist/blocks/profiles/profile-onboarding/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-onboarding/index.js +11 -0
- package/dist/blocks/profiles/profile-switcher/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-switcher/index.js +11 -0
- package/dist/blocks/profiles/profile-usage/index.d.ts +4 -0
- package/dist/blocks/profiles/profile-usage/index.js +10 -0
- package/dist/blocks/sessions/inbox/index.d.ts +2 -0
- package/dist/blocks/sessions/inbox/index.js +11 -0
- package/dist/blocks/sessions/session-board/index.d.ts +4 -0
- package/dist/blocks/sessions/session-board/index.js +26 -0
- package/dist/blocks/sessions/session-sidebar/index.d.ts +5 -0
- package/dist/blocks/sessions/session-sidebar/index.js +15 -0
- package/dist/blocks/settings/extensions/index.d.ts +2 -0
- package/dist/blocks/settings/extensions/index.js +9 -0
- package/dist/blocks/settings/hooks/index.d.ts +4 -0
- package/dist/blocks/settings/hooks/index.js +9 -0
- package/dist/blocks/settings/mcp-servers/index.d.ts +4 -0
- package/dist/blocks/settings/mcp-servers/index.js +9 -0
- package/dist/blocks/settings/memory/index.d.ts +4 -0
- package/dist/blocks/settings/memory/index.js +8 -0
- package/dist/blocks/settings/notifications/index.d.ts +2 -0
- package/dist/blocks/settings/notifications/index.js +8 -0
- package/dist/blocks/settings/permission-rules/index.d.ts +3 -0
- package/dist/blocks/settings/permission-rules/index.js +10 -0
- package/dist/blocks/settings/plugin-catalog/index.d.ts +2 -0
- package/dist/blocks/settings/plugin-catalog/index.js +11 -0
- package/dist/blocks/settings/plugins/index.d.ts +4 -0
- package/dist/blocks/settings/plugins/index.js +9 -0
- package/dist/blocks/settings/settings-window/index.d.ts +4 -0
- package/dist/blocks/settings/settings-window/index.js +8 -0
- package/dist/blocks/settings/worktrees/index.d.ts +4 -0
- package/dist/blocks/settings/worktrees/index.js +9 -0
- package/dist/components/conversation/agent-run/index.d.ts +3 -0
- package/dist/components/conversation/agent-run/index.js +10 -0
- package/dist/components/conversation/chapter-nav/index.d.ts +2 -0
- package/dist/components/conversation/chapter-nav/index.js +11 -0
- package/dist/components/conversation/message/index.d.ts +2 -0
- package/dist/components/conversation/message/index.js +15 -0
- package/dist/components/conversation/reasoning/index.d.ts +2 -0
- package/dist/components/conversation/reasoning/index.js +8 -0
- package/dist/components/conversation/recap/index.d.ts +2 -0
- package/dist/components/conversation/recap/index.js +9 -0
- package/dist/components/conversation/todo-list/index.d.ts +2 -0
- package/dist/components/conversation/todo-list/index.js +9 -0
- package/dist/components/conversation/tool-call/index.d.ts +3 -0
- package/dist/components/conversation/tool-call/index.js +13 -0
- package/dist/components/conversation/work-summary/index.d.ts +2 -0
- package/dist/components/conversation/work-summary/index.js +10 -0
- package/dist/components/prompts/permission-request/index.d.ts +2 -0
- package/dist/components/prompts/permission-request/index.js +9 -0
- package/dist/components/prompts/plan-approval/index.d.ts +2 -0
- package/dist/components/prompts/plan-approval/index.js +9 -0
- package/dist/components/prompts/prompt-card/index.d.ts +3 -0
- package/dist/components/prompts/prompt-card/index.js +8 -0
- package/dist/components/prompts/question-prompt/index.d.ts +2 -0
- package/dist/components/prompts/question-prompt/index.js +9 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +231 -0
- package/dist/lib/config-parts.d.ts +2 -0
- package/dist/lib/config-parts.js +16 -0
- package/dist/lib/icons.d.ts +2 -0
- package/dist/lib/icons.js +10 -0
- package/dist/lib/pace-bar.d.ts +11 -0
- package/dist/lib/pace-bar.js +6 -0
- package/dist/lib/pace.d.ts +4 -0
- package/dist/lib/pace.js +12 -0
- package/dist/lib/pane-parts.d.ts +25 -0
- package/dist/lib/pane-parts.js +11 -0
- package/dist/lib/row-trigger.d.ts +5 -0
- package/dist/lib/row-trigger.js +7 -0
- package/dist/lib/settings-parts.d.ts +70 -0
- package/dist/lib/settings-parts.js +24 -0
- package/dist/lib/side-pane-types.d.ts +2 -0
- package/dist/lib/side-pane-types.js +1 -0
- package/dist/lib/status-glyph.d.ts +8 -0
- package/dist/lib/status-glyph.js +12 -0
- package/dist/lib/types.d.ts +3 -0
- package/dist/lib/types.js +1 -0
- package/dist/shared/chunk-04a497rr.js +21 -0
- package/dist/shared/chunk-13yf0mza.d.ts +70 -0
- package/dist/shared/chunk-1aq2xzv5.js +558 -0
- package/dist/shared/chunk-1f96cz69.js +45 -0
- package/dist/shared/chunk-1yt061np.d.ts +64 -0
- package/dist/shared/chunk-218qabm5.js +250 -0
- package/dist/shared/chunk-2fk5aq60.js +313 -0
- package/dist/shared/chunk-4248zvmh.js +177 -0
- package/dist/shared/chunk-45rqgey6.d.ts +25 -0
- package/dist/shared/chunk-4n0v64qx.js +179 -0
- package/dist/shared/chunk-4zvhpf2x.js +55 -0
- package/dist/shared/chunk-57hzzmjd.d.ts +67 -0
- package/dist/shared/chunk-58qvny6a.d.ts +29 -0
- package/dist/shared/chunk-5fhkkn39.js +130 -0
- package/dist/shared/chunk-5hw0525a.d.ts +33 -0
- package/dist/shared/chunk-5k6xwqfj.d.ts +68 -0
- package/dist/shared/chunk-5meda998.js +238 -0
- package/dist/shared/chunk-5pqksw7z.js +91 -0
- package/dist/shared/chunk-6220dy5n.js +70 -0
- package/dist/shared/chunk-64bnh22t.d.ts +59 -0
- package/dist/shared/chunk-66sh633m.d.ts +60 -0
- package/dist/shared/chunk-6cmf27g3.d.ts +81 -0
- package/dist/shared/chunk-6g4970a6.d.ts +20 -0
- package/dist/shared/chunk-75zwypyr.d.ts +43 -0
- package/dist/shared/chunk-7rzjmcnh.d.ts +30 -0
- package/dist/shared/chunk-7zvb39cf.d.ts +26 -0
- package/dist/shared/chunk-8mecznyr.js +357 -0
- package/dist/shared/chunk-8pag6vmd.js +255 -0
- package/dist/shared/chunk-8xg5gwwy.js +38 -0
- package/dist/shared/chunk-9kw6m047.d.ts +32 -0
- package/dist/shared/chunk-a4s440b6.js +79 -0
- package/dist/shared/chunk-at0jje23.d.ts +110 -0
- package/dist/shared/chunk-awd573h9.js +34 -0
- package/dist/shared/chunk-b171wjge.d.ts +25 -0
- package/dist/shared/chunk-bh2b5d1z.js +98 -0
- package/dist/shared/chunk-bzs6amnv.js +187 -0
- package/dist/shared/chunk-c36qvrwq.d.ts +30 -0
- package/dist/shared/chunk-c8wp058j.js +153 -0
- package/dist/shared/chunk-cd4f87as.d.ts +28 -0
- package/dist/shared/chunk-cmwby8f9.js +467 -0
- package/dist/shared/chunk-d2t72h4x.d.ts +35 -0
- package/dist/shared/chunk-dh3qy5fj.js +49 -0
- package/dist/shared/chunk-e46apgve.d.ts +40 -0
- package/dist/shared/chunk-ejtknc0w.js +21 -0
- package/dist/shared/chunk-eqajdxn8.js +82 -0
- package/dist/shared/chunk-fbn0h7cr.js +123 -0
- package/dist/shared/chunk-fqhcz6ss.d.ts +29 -0
- package/dist/shared/chunk-g28hweee.d.ts +35 -0
- package/dist/shared/chunk-g88hweqh.d.ts +70 -0
- package/dist/shared/chunk-gewnsgza.js +61 -0
- package/dist/shared/chunk-gkyk663q.d.ts +53 -0
- package/dist/shared/chunk-hd4gtj5z.d.ts +23 -0
- package/dist/shared/chunk-hxjgey30.d.ts +36 -0
- package/dist/shared/chunk-jkkdq1mh.d.ts +213 -0
- package/dist/shared/chunk-jpq101w3.js +91 -0
- package/dist/shared/chunk-k3bv9k1v.d.ts +56 -0
- package/dist/shared/chunk-k5zegxje.d.ts +81 -0
- package/dist/shared/chunk-kreypnzp.d.ts +34 -0
- package/dist/shared/chunk-kw9npka5.js +224 -0
- package/dist/shared/chunk-mrb3fp2f.d.ts +30 -0
- package/dist/shared/chunk-n1qq2wp9.js +6 -0
- package/dist/shared/chunk-n4742y54.js +39 -0
- package/dist/shared/chunk-ndjvdkv7.d.ts +29 -0
- package/dist/shared/chunk-nk4578dr.js +73 -0
- package/dist/shared/chunk-paezqfg1.js +106 -0
- package/dist/shared/chunk-qemm9e3r.d.ts +21 -0
- package/dist/shared/chunk-qhxz1etk.js +96 -0
- package/dist/shared/chunk-qj5ev9ak.js +531 -0
- package/dist/shared/chunk-qnwggvjy.js +150 -0
- package/dist/shared/chunk-r5hz78pb.js +129 -0
- package/dist/shared/chunk-r6nb21kz.d.ts +102 -0
- package/dist/shared/chunk-rjfwje37.d.ts +234 -0
- package/dist/shared/chunk-rqrpvvz4.d.ts +107 -0
- package/dist/shared/chunk-rzajcn44.d.ts +49 -0
- package/dist/shared/chunk-s3r759ec.js +80 -0
- package/dist/shared/chunk-sdtjrw9w.d.ts +98 -0
- package/dist/shared/chunk-sfqvyzcs.d.ts +68 -0
- package/dist/shared/chunk-skg3m9m0.js +56 -0
- package/dist/shared/chunk-szkvrqg1.d.ts +54 -0
- package/dist/shared/chunk-t21t9x7e.js +188 -0
- package/dist/shared/chunk-tc75ng2c.js +235 -0
- package/dist/shared/chunk-tkx1krwc.js +88 -0
- package/dist/shared/chunk-tprdqtb1.d.ts +30 -0
- package/dist/shared/chunk-tv9a1sek.js +137 -0
- package/dist/shared/chunk-tvbd27hg.d.ts +43 -0
- package/dist/shared/chunk-v6yevw62.d.ts +28 -0
- package/dist/shared/chunk-v9q38p0x.js +258 -0
- package/dist/shared/chunk-vd59gzzd.js +86 -0
- package/dist/shared/chunk-vgh4f3sv.js +118 -0
- package/dist/shared/chunk-vjht1zn1.js +391 -0
- package/dist/shared/chunk-vsrkb0sp.d.ts +21 -0
- package/dist/shared/chunk-w5z8qnf8.js +175 -0
- package/dist/shared/chunk-wgvzavx1.js +1488 -0
- package/dist/shared/chunk-whsx7yp9.d.ts +37 -0
- package/dist/shared/chunk-x7az5x1y.d.ts +57 -0
- package/dist/shared/chunk-x9jf26yb.js +318 -0
- package/dist/shared/chunk-xbrrt07s.d.ts +23 -0
- package/dist/shared/chunk-xkchhs2z.js +129 -0
- package/dist/shared/chunk-xzfrskd7.js +202 -0
- package/dist/shared/chunk-y4cj4y54.js +423 -0
- package/dist/shared/chunk-y934at6m.js +7 -0
- package/dist/shared/chunk-zbpwhpjy.d.ts +75 -0
- package/dist/shared/chunk-zfhmbb7n.js +63 -0
- package/dist/shared/chunk-zk0t4vq5.js +71 -0
- package/dist/shared/chunk-znp9gna7.d.ts +23 -0
- package/dist/styles.css +467 -0
- package/index.ts +49 -0
- package/lib/config-parts.tsx +97 -0
- package/lib/icons.tsx +149 -0
- package/lib/pace-bar.tsx +24 -0
- package/lib/pace.ts +74 -0
- package/lib/pane-parts.tsx +76 -0
- package/lib/row-trigger.tsx +44 -0
- package/lib/settings-parts.tsx +232 -0
- package/lib/side-pane-types.ts +75 -0
- package/lib/status-glyph.tsx +25 -0
- package/lib/types.ts +204 -0
- package/mock/demo-reply.tsx +33 -0
- package/mock/demo-session.tsx +150 -0
- package/mock/mock-config.ts +173 -0
- package/mock/mock-extras.ts +288 -0
- package/mock/mock-panes.ts +190 -0
- package/mock/mock-settings.ts +92 -0
- package/mock/mock.ts +548 -0
- package/mock/screen-frame.tsx +49 -0
- package/package.json +114 -4
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the side pane's Artifacts — what Claude made in this
|
|
3
|
+
* session, newest first, one fluid hover along the rows.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client'
|
|
7
|
+
|
|
8
|
+
import { useSize } from '@justanarthur/modo-ui/lib/size-context'
|
|
9
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
10
|
+
import FluidHover from '@justanarthur/modo-ui/primitives/systems/fluid-hover'
|
|
11
|
+
import { type IconName, useIcon } from '../../../lib/icons'
|
|
12
|
+
import { PaneEmpty, PaneSection } from '../../../lib/pane-parts'
|
|
13
|
+
import type { ArtifactKind, PaneArtifact } from '../../../lib/side-pane-types'
|
|
14
|
+
|
|
15
|
+
const ARTIFACT_ICON: Record<ArtifactKind, IconName> = {
|
|
16
|
+
page: 'globe',
|
|
17
|
+
dashboard: 'layout-dashboard',
|
|
18
|
+
document: 'file-text',
|
|
19
|
+
diagram: 'list-tree',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ARTIFACT_KIND: Record<ArtifactKind, string> = {
|
|
23
|
+
page: 'Page',
|
|
24
|
+
dashboard: 'Dashboard',
|
|
25
|
+
document: 'Document',
|
|
26
|
+
diagram: 'Diagram',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function ArtifactRow({ artifact, index, onOpen }: { artifact: PaneArtifact; index: number; onOpen?: () => void }) {
|
|
30
|
+
const size = useSize()
|
|
31
|
+
const Icon = useIcon(ARTIFACT_ICON[artifact.kind])
|
|
32
|
+
return (
|
|
33
|
+
<FluidHover.Item index={index} onClick={onOpen} className={cn('gap-2 px-2', size.control, size.text)}>
|
|
34
|
+
<Icon size={size.icon} strokeWidth={1.5} className="shrink-0 text-muted-foreground" />
|
|
35
|
+
<span className="min-w-0 flex-1 truncate">{artifact.title}</span>
|
|
36
|
+
<span className="shrink-0 text-caption text-muted-foreground">
|
|
37
|
+
{ARTIFACT_KIND[artifact.kind]} · {artifact.updated}
|
|
38
|
+
</span>
|
|
39
|
+
</FluidHover.Item>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface ArtifactsPaneProps {
|
|
44
|
+
/** What Claude made in this session, newest first. */
|
|
45
|
+
artifacts: PaneArtifact[]
|
|
46
|
+
/** Called with the artifact a press opens. */
|
|
47
|
+
onOpen?: (artifact: PaneArtifact) => void
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The pages, documents, dashboards and diagrams Claude made in this
|
|
52
|
+
* session, newest first.
|
|
53
|
+
*
|
|
54
|
+
* Each row shows the artifact's kind as its glyph and in words, and when it
|
|
55
|
+
* last changed; one fluid hover runs along the rows and a press opens one.
|
|
56
|
+
* With none yet, the pane says what lands there.
|
|
57
|
+
*
|
|
58
|
+
* @example {@include ./examples.mdx}
|
|
59
|
+
*/
|
|
60
|
+
export default function ArtifactsPane({ artifacts, onOpen }: ArtifactsPaneProps) {
|
|
61
|
+
if (artifacts.length === 0)
|
|
62
|
+
return (
|
|
63
|
+
<PaneEmpty
|
|
64
|
+
icon="layers"
|
|
65
|
+
title="No artifacts yet"
|
|
66
|
+
detail="Pages, documents and dashboards Claude makes land here."
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
return (
|
|
70
|
+
<PaneSection title="Artifacts" meta={`${artifacts.length} · private until you share them`}>
|
|
71
|
+
<FluidHover className="gap-0">
|
|
72
|
+
{artifacts.map((artifact, i) => (
|
|
73
|
+
<ArtifactRow key={artifact.title} artifact={artifact} index={i} onOpen={() => onOpen?.(artifact)} />
|
|
74
|
+
))}
|
|
75
|
+
</FluidHover>
|
|
76
|
+
</PaneSection>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type { ArtifactsPaneProps }
|
|
81
|
+
|
|
82
|
+
export { ArtifactsPane }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SizeProvider } from '@justanarthur/modo-ui/primitives/systems/sizes'
|
|
2
|
+
import { PANE_CHANGES } from '../../../mock/mock-panes'
|
|
3
|
+
import ChangesPane from './index'
|
|
4
|
+
|
|
5
|
+
# Changes
|
|
6
|
+
|
|
7
|
+
Staged and unstaged files under a commit field; hover a row to stage, unstage or revert it. The picked file's diff wraps its long lines; the toggle above it scrolls them instead.
|
|
8
|
+
|
|
9
|
+
<div className="w-full max-w-sm overflow-hidden rounded-xl border border-border bg-background p-2">
|
|
10
|
+
<SizeProvider size="compact">
|
|
11
|
+
<ChangesPane changes={PANE_CHANGES} />
|
|
12
|
+
</SizeProvider>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
# Clean tree
|
|
16
|
+
|
|
17
|
+
With nothing changed, the pane says the tree matches the last commit.
|
|
18
|
+
|
|
19
|
+
<div className="w-full max-w-sm overflow-hidden rounded-xl border border-border bg-background p-2">
|
|
20
|
+
<SizeProvider size="compact">
|
|
21
|
+
<ChangesPane changes={[]} />
|
|
22
|
+
</SizeProvider>
|
|
23
|
+
</div>
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the side pane's Changes — the session's changed files,
|
|
3
|
+
* staged and unstaged, under a commit field, and the picked file's diff.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client'
|
|
7
|
+
|
|
8
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
9
|
+
import Diff, { parsePatch } from '@justanarthur/modo-ui/components/data-display/diff'
|
|
10
|
+
import ChoiceList from '@justanarthur/modo-ui/components/inputs/choice-list'
|
|
11
|
+
import Input from '@justanarthur/modo-ui/components/inputs/input'
|
|
12
|
+
import { useSize } from '@justanarthur/modo-ui/lib/size-context'
|
|
13
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
14
|
+
import { type ReactNode, useState } from 'react'
|
|
15
|
+
import { useIcon } from '../../../lib/icons'
|
|
16
|
+
import { IconAction, PaneEmpty, PaneSection } from '../../../lib/pane-parts'
|
|
17
|
+
import type { PaneChange } from '../../../lib/side-pane-types'
|
|
18
|
+
|
|
19
|
+
const STATUS_LETTER: Record<PaneChange['status'], string> = { added: 'A', modified: 'M', deleted: 'D' }
|
|
20
|
+
|
|
21
|
+
function countLines(patch: string) {
|
|
22
|
+
const lines = parsePatch(patch)
|
|
23
|
+
return {
|
|
24
|
+
added: lines.filter(l => l.kind === 'add').length,
|
|
25
|
+
removed: lines.filter(l => l.kind === 'remove').length,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function splitPath(path: string) {
|
|
30
|
+
const at = path.lastIndexOf('/')
|
|
31
|
+
return { dir: path.slice(0, at), name: path.slice(at + 1) }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function FileRow({ change }: { change: PaneChange }) {
|
|
35
|
+
const size = useSize()
|
|
36
|
+
const { dir, name } = splitPath(change.path)
|
|
37
|
+
const { added, removed } = countLines(change.patch)
|
|
38
|
+
return (
|
|
39
|
+
<span className="flex min-w-0 flex-1 items-center gap-2">
|
|
40
|
+
<span className="w-3 shrink-0 font-mono text-caption text-muted-foreground">{STATUS_LETTER[change.status]}</span>
|
|
41
|
+
<span className={cn('min-w-0 flex-1 truncate', size.text)}>
|
|
42
|
+
<span className={cn('text-foreground', change.status === 'deleted' && 'line-through')}>{name}</span>
|
|
43
|
+
<span className="text-caption text-muted-foreground"> {dir}</span>
|
|
44
|
+
</span>
|
|
45
|
+
{/* Gives way to the row's actions while they show. */}
|
|
46
|
+
<span className="flex shrink-0 gap-1.5 font-mono text-caption tabular-nums transition-[opacity] duration-fast group-focus-within/pick:opacity-0 group-hover/pick:opacity-0 pointer-coarse:opacity-0">
|
|
47
|
+
<span className="text-status-success">+{added}</span>
|
|
48
|
+
<span className="text-status-error">−{removed}</span>
|
|
49
|
+
</span>
|
|
50
|
+
</span>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function FileList({
|
|
55
|
+
label,
|
|
56
|
+
files,
|
|
57
|
+
value,
|
|
58
|
+
onValueChange,
|
|
59
|
+
actions,
|
|
60
|
+
}: {
|
|
61
|
+
label: string
|
|
62
|
+
files: PaneChange[]
|
|
63
|
+
value: string
|
|
64
|
+
onValueChange: (path: string) => void
|
|
65
|
+
actions: (change: PaneChange) => ReactNode
|
|
66
|
+
}) {
|
|
67
|
+
const size = useSize()
|
|
68
|
+
return (
|
|
69
|
+
<ChoiceList
|
|
70
|
+
label={label}
|
|
71
|
+
value={value}
|
|
72
|
+
onValueChange={onValueChange}
|
|
73
|
+
rowClassName={cn('items-center py-0', size.control)}
|
|
74
|
+
options={files.map(change => ({
|
|
75
|
+
value: change.path,
|
|
76
|
+
label: change.path,
|
|
77
|
+
content: <FileRow change={change} />,
|
|
78
|
+
actions: actions(change),
|
|
79
|
+
}))}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface ChangesPaneProps {
|
|
85
|
+
/** The session's changed files, each with its patch. The pane keeps its own copy as you stage, revert and commit. */
|
|
86
|
+
changes: PaneChange[]
|
|
87
|
+
/** Called with the paths staged (`true`) or unstaged (`false`). */
|
|
88
|
+
onStage?: (paths: string[], staged: boolean) => void
|
|
89
|
+
/** Called with the paths reverted. */
|
|
90
|
+
onRevert?: (paths: string[]) => void
|
|
91
|
+
/** Called by Commit with the message (empty when Claude writes one) and the staged paths. */
|
|
92
|
+
onCommit?: (message: string, paths: string[]) => void
|
|
93
|
+
/** Called by the diff's open in editor with the file's path. */
|
|
94
|
+
onOpenFile?: (path: string) => void
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The session's changes: staged and unstaged files under a commit field,
|
|
99
|
+
* and the picked file's diff.
|
|
100
|
+
*
|
|
101
|
+
* A row shows the file's status letter, its name before its folder and the
|
|
102
|
+
* lines it adds and removes; hovering it swaps the counts for its stage,
|
|
103
|
+
* unstage and revert. Each section stages, unstages or reverts all at once.
|
|
104
|
+
* Commit takes the staged files (an empty message lets Claude write one).
|
|
105
|
+
* The picked file's diff wraps its long lines; the toggle above it scrolls
|
|
106
|
+
* them instead. With nothing changed, the pane says the tree is clean.
|
|
107
|
+
*
|
|
108
|
+
* @example {@include ./examples.mdx}
|
|
109
|
+
*/
|
|
110
|
+
export default function ChangesPane({ changes, onStage, onRevert, onCommit, onOpenFile }: ChangesPaneProps) {
|
|
111
|
+
const [files, setFiles] = useState(changes)
|
|
112
|
+
const [picked, setPicked] = useState(changes[0]?.path ?? '')
|
|
113
|
+
const [message, setMessage] = useState('')
|
|
114
|
+
const [wrap, setWrap] = useState(true)
|
|
115
|
+
const Plus = useIcon('plus')
|
|
116
|
+
const Minus = useIcon('minus')
|
|
117
|
+
const Revert = useIcon('rotate-ccw')
|
|
118
|
+
const Wrap = useIcon('text-wrap')
|
|
119
|
+
const Open = useIcon('external-link')
|
|
120
|
+
|
|
121
|
+
if (files.length === 0)
|
|
122
|
+
return <PaneEmpty icon="circle-check" title="No changes" detail="The working tree matches the last commit." />
|
|
123
|
+
|
|
124
|
+
const staged = files.filter(f => f.staged)
|
|
125
|
+
const unstaged = files.filter(f => !f.staged)
|
|
126
|
+
const change = files.find(f => f.path === picked) ?? files[0]
|
|
127
|
+
|
|
128
|
+
const setStaged = (paths: string[], value: boolean) => {
|
|
129
|
+
setFiles(fs => fs.map(f => (paths.includes(f.path) ? { ...f, staged: value } : f)))
|
|
130
|
+
onStage?.(paths, value)
|
|
131
|
+
}
|
|
132
|
+
const drop = (paths: string[]) => setFiles(fs => fs.filter(f => !paths.includes(f.path)))
|
|
133
|
+
const revert = (paths: string[]) => {
|
|
134
|
+
drop(paths)
|
|
135
|
+
onRevert?.(paths)
|
|
136
|
+
}
|
|
137
|
+
const commit = () => {
|
|
138
|
+
const paths = staged.map(f => f.path)
|
|
139
|
+
drop(paths)
|
|
140
|
+
setMessage('')
|
|
141
|
+
onCommit?.(message, paths)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<div className="flex flex-col gap-2">
|
|
146
|
+
<div className="flex items-center gap-2 px-2 pb-1">
|
|
147
|
+
<Input
|
|
148
|
+
variant="bordered"
|
|
149
|
+
aria-label="Commit message"
|
|
150
|
+
placeholder={staged.length > 0 ? 'Message, or Claude writes one' : 'Stage files to commit'}
|
|
151
|
+
value={message}
|
|
152
|
+
onValueChange={setMessage}
|
|
153
|
+
disabled={staged.length === 0}
|
|
154
|
+
className="min-w-0 flex-1"
|
|
155
|
+
/>
|
|
156
|
+
<Button size="compact" disabled={staged.length === 0} onClick={commit}>
|
|
157
|
+
Commit
|
|
158
|
+
</Button>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
{staged.length > 0 && (
|
|
162
|
+
<PaneSection
|
|
163
|
+
title="Staged"
|
|
164
|
+
meta={staged.length}
|
|
165
|
+
actions={
|
|
166
|
+
<IconAction
|
|
167
|
+
icon={Minus}
|
|
168
|
+
label="Unstage all"
|
|
169
|
+
onClick={() =>
|
|
170
|
+
setStaged(
|
|
171
|
+
staged.map(f => f.path),
|
|
172
|
+
false,
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
/>
|
|
176
|
+
}
|
|
177
|
+
>
|
|
178
|
+
<FileList
|
|
179
|
+
label="Staged files"
|
|
180
|
+
files={staged}
|
|
181
|
+
value={picked}
|
|
182
|
+
onValueChange={setPicked}
|
|
183
|
+
actions={f => <IconAction icon={Minus} label="Unstage" onClick={() => setStaged([f.path], false)} />}
|
|
184
|
+
/>
|
|
185
|
+
</PaneSection>
|
|
186
|
+
)}
|
|
187
|
+
|
|
188
|
+
{unstaged.length > 0 && (
|
|
189
|
+
<PaneSection
|
|
190
|
+
title="Changes"
|
|
191
|
+
meta={unstaged.length}
|
|
192
|
+
actions={
|
|
193
|
+
<>
|
|
194
|
+
<IconAction icon={Revert} label="Revert all" onClick={() => revert(unstaged.map(f => f.path))} />
|
|
195
|
+
<IconAction
|
|
196
|
+
icon={Plus}
|
|
197
|
+
label="Stage all"
|
|
198
|
+
onClick={() =>
|
|
199
|
+
setStaged(
|
|
200
|
+
unstaged.map(f => f.path),
|
|
201
|
+
true,
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
/>
|
|
205
|
+
</>
|
|
206
|
+
}
|
|
207
|
+
>
|
|
208
|
+
<FileList
|
|
209
|
+
label="Unstaged files"
|
|
210
|
+
files={unstaged}
|
|
211
|
+
value={picked}
|
|
212
|
+
onValueChange={setPicked}
|
|
213
|
+
actions={f => (
|
|
214
|
+
<>
|
|
215
|
+
<IconAction icon={Revert} label="Revert" onClick={() => revert([f.path])} />
|
|
216
|
+
<IconAction icon={Plus} label="Stage" onClick={() => setStaged([f.path], true)} />
|
|
217
|
+
</>
|
|
218
|
+
)}
|
|
219
|
+
/>
|
|
220
|
+
</PaneSection>
|
|
221
|
+
)}
|
|
222
|
+
|
|
223
|
+
{change && (
|
|
224
|
+
<PaneSection
|
|
225
|
+
title={splitPath(change.path).name}
|
|
226
|
+
meta={splitPath(change.path).dir}
|
|
227
|
+
actions={
|
|
228
|
+
<>
|
|
229
|
+
<IconAction
|
|
230
|
+
icon={Wrap}
|
|
231
|
+
label={wrap ? 'Scroll long lines' : 'Wrap long lines'}
|
|
232
|
+
pressed={wrap}
|
|
233
|
+
onClick={() => setWrap(!wrap)}
|
|
234
|
+
/>
|
|
235
|
+
<IconAction icon={Open} label="Open in editor" onClick={() => onOpenFile?.(change.path)} />
|
|
236
|
+
</>
|
|
237
|
+
}
|
|
238
|
+
>
|
|
239
|
+
<Diff wrap={wrap} patch={change.patch} />
|
|
240
|
+
</PaneSection>
|
|
241
|
+
)}
|
|
242
|
+
</div>
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export type { ChangesPaneProps }
|
|
247
|
+
|
|
248
|
+
export { ChangesPane }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SizeProvider } from '@justanarthur/modo-ui/primitives/systems/sizes'
|
|
2
|
+
import { PANE_FILE } from '../../../mock/mock-panes'
|
|
3
|
+
import FilePane from './index'
|
|
4
|
+
|
|
5
|
+
# File
|
|
6
|
+
|
|
7
|
+
The open file under its path crumb, with copy and open in editor.
|
|
8
|
+
|
|
9
|
+
<div className="w-full max-w-sm overflow-hidden rounded-xl border border-border bg-background p-2">
|
|
10
|
+
<SizeProvider size="compact">
|
|
11
|
+
<FilePane file={PANE_FILE} />
|
|
12
|
+
</SizeProvider>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the side pane's File — the open file under its path
|
|
3
|
+
* crumb, with copy and open in editor, and the session's files as a tree
|
|
4
|
+
* to switch between.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import Breadcrumb from '@justanarthur/modo-ui/components/navigation/breadcrumb'
|
|
10
|
+
import Tree, { type TreeItem } from '@justanarthur/modo-ui/components/navigation/tree'
|
|
11
|
+
import Code from '@justanarthur/modo-ui/primitives/content/code'
|
|
12
|
+
import { useState } from 'react'
|
|
13
|
+
import { useIcon } from '../../../lib/icons'
|
|
14
|
+
import { IconAction, PaneSection } from '../../../lib/pane-parts'
|
|
15
|
+
import type { PaneFile } from '../../../lib/side-pane-types'
|
|
16
|
+
|
|
17
|
+
/** Paths to a tree whose ids are the paths: folders by their prefix, files by their full path. */
|
|
18
|
+
function toTree(paths: string[]) {
|
|
19
|
+
const root: TreeItem[] = []
|
|
20
|
+
for (const path of paths) {
|
|
21
|
+
let level = root
|
|
22
|
+
path.split('/').forEach((label, i, parts) => {
|
|
23
|
+
const id = parts.slice(0, i + 1).join('/')
|
|
24
|
+
let node = level.find(n => n.id === id)
|
|
25
|
+
if (!node) {
|
|
26
|
+
node = { id, label, ...(i < parts.length - 1 && { children: [] }) }
|
|
27
|
+
level.push(node)
|
|
28
|
+
}
|
|
29
|
+
level = node.children ?? []
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
return root
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface FilePaneProps {
|
|
36
|
+
/** The open file: its path, language and source. */
|
|
37
|
+
file: PaneFile
|
|
38
|
+
/** The session's file paths, browsed as a tree. Omit for no tree toggle. */
|
|
39
|
+
files?: string[]
|
|
40
|
+
/** Called with the path picked in the tree (a folder's path when a folder is picked). */
|
|
41
|
+
onPick?: (id: string) => void
|
|
42
|
+
/** Called by open in editor with the file's path. */
|
|
43
|
+
onOpen?: (path: string) => void
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The file the session has open, highlighted, under its path crumb.
|
|
48
|
+
*
|
|
49
|
+
* The crumb folds its middle folders into a menu when the pane is narrow,
|
|
50
|
+
* so the file name is what stays; copy puts the whole path on the
|
|
51
|
+
* clipboard, and open hands the file to your editor. With `files`, the
|
|
52
|
+
* folder button shows the session's files above the source to switch
|
|
53
|
+
* between. A line under it says the language and how long the file is.
|
|
54
|
+
*
|
|
55
|
+
* @example {@include ./examples.mdx}
|
|
56
|
+
*/
|
|
57
|
+
export default function FilePane({ file, files, onPick, onOpen }: FilePaneProps) {
|
|
58
|
+
const [browsing, setBrowsing] = useState(false)
|
|
59
|
+
const Copy = useIcon('copy')
|
|
60
|
+
const Open = useIcon('external-link')
|
|
61
|
+
const Folder = useIcon('folder')
|
|
62
|
+
const parts = file.path.split('/')
|
|
63
|
+
return (
|
|
64
|
+
<PaneSection
|
|
65
|
+
title={<Breadcrumb size="compact" items={parts.map(label => ({ label }))} />}
|
|
66
|
+
actions={
|
|
67
|
+
<>
|
|
68
|
+
{files && (
|
|
69
|
+
<IconAction
|
|
70
|
+
icon={Folder}
|
|
71
|
+
label={browsing ? 'Hide files' : 'Browse files'}
|
|
72
|
+
pressed={browsing}
|
|
73
|
+
onClick={() => setBrowsing(!browsing)}
|
|
74
|
+
/>
|
|
75
|
+
)}
|
|
76
|
+
<IconAction icon={Copy} label="Copy path" onClick={() => navigator.clipboard?.writeText(file.path)} />
|
|
77
|
+
<IconAction icon={Open} label="Open in editor" onClick={() => onOpen?.(file.path)} />
|
|
78
|
+
</>
|
|
79
|
+
}
|
|
80
|
+
>
|
|
81
|
+
{files && browsing && (
|
|
82
|
+
<Tree
|
|
83
|
+
label="Session files"
|
|
84
|
+
size="compact"
|
|
85
|
+
items={toTree(files)}
|
|
86
|
+
defaultValue={file.path}
|
|
87
|
+
defaultExpanded={parts.slice(0, -1).map((_, i) => parts.slice(0, i + 1).join('/'))}
|
|
88
|
+
onValueChange={onPick}
|
|
89
|
+
className="mb-2"
|
|
90
|
+
/>
|
|
91
|
+
)}
|
|
92
|
+
<p className="m-0 px-2 pb-2 text-caption text-muted-foreground">
|
|
93
|
+
{file.language} · {file.source.split('\n').length} lines · modified in this session
|
|
94
|
+
</p>
|
|
95
|
+
<Code language={file.language}>{file.source}</Code>
|
|
96
|
+
</PaneSection>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type { FilePaneProps }
|
|
101
|
+
|
|
102
|
+
export { FilePane }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SizeProvider } from '@justanarthur/modo-ui/primitives/systems/sizes'
|
|
2
|
+
import { PULL_REQUEST } from '../../../mock/mock-panes'
|
|
3
|
+
import PullRequestPane from './index'
|
|
4
|
+
|
|
5
|
+
# Pull request
|
|
6
|
+
|
|
7
|
+
CI checks as they run; the failed one is open on the tail of its log with Ask Claude to fix, and the merge waits for it. Auto-fix lets the session watch CI and answer reviews.
|
|
8
|
+
|
|
9
|
+
<div className="w-full max-w-sm overflow-hidden rounded-xl border border-border bg-background p-2">
|
|
10
|
+
<SizeProvider size="compact">
|
|
11
|
+
<PullRequestPane pr={PULL_REQUEST} />
|
|
12
|
+
</SizeProvider>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the side pane's Pull request — the session's PR with its
|
|
3
|
+
* CI checks, review comments, auto-fix and the merge.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client'
|
|
7
|
+
|
|
8
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
9
|
+
import Accordion from '@justanarthur/modo-ui/components/containers/accordion'
|
|
10
|
+
import Badge from '@justanarthur/modo-ui/components/data-display/badge'
|
|
11
|
+
import Switch from '@justanarthur/modo-ui/components/inputs/switch'
|
|
12
|
+
import Code from '@justanarthur/modo-ui/primitives/content/code'
|
|
13
|
+
import { useIcon } from '../../../lib/icons'
|
|
14
|
+
import { IconAction, PaneSection } from '../../../lib/pane-parts'
|
|
15
|
+
import type { PaneCheck, PanePullRequest } from '../../../lib/side-pane-types'
|
|
16
|
+
import { RunningGlyph } from '../../../lib/status-glyph'
|
|
17
|
+
|
|
18
|
+
function CheckGlyph({ status }: { status: PaneCheck['status'] }) {
|
|
19
|
+
const Done = useIcon('circle-check')
|
|
20
|
+
const Failed = useIcon('circle-x')
|
|
21
|
+
if (status === 'running') return <RunningGlyph size={14} />
|
|
22
|
+
if (status === 'success') return <Done size={14} strokeWidth={1.5} className="shrink-0 text-status-success" />
|
|
23
|
+
return <Failed size={14} strokeWidth={1.5} className="shrink-0 text-status-error" />
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function CheckItem({
|
|
27
|
+
check,
|
|
28
|
+
index,
|
|
29
|
+
onOpenLog,
|
|
30
|
+
onFix,
|
|
31
|
+
}: {
|
|
32
|
+
check: PaneCheck
|
|
33
|
+
index: number
|
|
34
|
+
onOpenLog?: (check: PaneCheck) => void
|
|
35
|
+
onFix?: (check: PaneCheck) => void
|
|
36
|
+
}) {
|
|
37
|
+
const Fix = useIcon('wrench')
|
|
38
|
+
const Open = useIcon('external-link')
|
|
39
|
+
return (
|
|
40
|
+
<Accordion.Item value={check.name} index={index}>
|
|
41
|
+
<Accordion.Trigger className="px-2">
|
|
42
|
+
<span className="flex min-w-0 items-center gap-2">
|
|
43
|
+
<CheckGlyph status={check.status} />
|
|
44
|
+
<span className="shrink-0">{check.name}</span>
|
|
45
|
+
<span className="min-w-0 flex-1 truncate text-right text-caption weight-normal text-muted-foreground">
|
|
46
|
+
{check.detail}
|
|
47
|
+
</span>
|
|
48
|
+
</span>
|
|
49
|
+
</Accordion.Trigger>
|
|
50
|
+
<Accordion.Content>
|
|
51
|
+
<div className="flex flex-col gap-2">
|
|
52
|
+
<Code language="plaintext">{check.log}</Code>
|
|
53
|
+
<div className="flex items-center justify-end gap-1">
|
|
54
|
+
<Button variant="ghost" size="compact" trailingIcon={Open} onClick={() => onOpenLog?.(check)}>
|
|
55
|
+
Full log
|
|
56
|
+
</Button>
|
|
57
|
+
{check.status === 'failed' && (
|
|
58
|
+
<Button variant="secondary" size="compact" leadingIcon={Fix} onClick={() => onFix?.(check)}>
|
|
59
|
+
Ask Claude to fix
|
|
60
|
+
</Button>
|
|
61
|
+
)}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</Accordion.Content>
|
|
65
|
+
</Accordion.Item>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface PullRequestPaneProps {
|
|
70
|
+
/** The pull request: number, title, branches, its checks and its review comments. */
|
|
71
|
+
pr: PanePullRequest
|
|
72
|
+
/** Whether auto-fix starts on. Defaults to `true`. */
|
|
73
|
+
defaultAutoFix?: boolean
|
|
74
|
+
/** Called with the new state whenever auto-fix is toggled. */
|
|
75
|
+
onAutoFixChange?: (on: boolean) => void
|
|
76
|
+
/** Called by Re-run failed. */
|
|
77
|
+
onRerun?: () => void
|
|
78
|
+
/** Called by a check's Full log. */
|
|
79
|
+
onOpenLog?: (check: PaneCheck) => void
|
|
80
|
+
/** Called by a failed check's Ask Claude to fix. */
|
|
81
|
+
onFix?: (check: PaneCheck) => void
|
|
82
|
+
/** Called by GitHub. */
|
|
83
|
+
onOpenOnGitHub?: () => void
|
|
84
|
+
/** Called by Merge, which waits while a check fails. */
|
|
85
|
+
onMerge?: () => void
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The session's pull request: its CI checks as they run, its review
|
|
90
|
+
* comments and the merge.
|
|
91
|
+
*
|
|
92
|
+
* Each check opens to the tail of its log; a failed one starts open, with
|
|
93
|
+
* Ask Claude to fix beside Full log, and the merge waits while one fails.
|
|
94
|
+
* Auto-fix lets the session watch CI, fix failures and answer reviews on
|
|
95
|
+
* its own.
|
|
96
|
+
*
|
|
97
|
+
* @example {@include ./examples.mdx}
|
|
98
|
+
*/
|
|
99
|
+
export default function PullRequestPane({
|
|
100
|
+
pr,
|
|
101
|
+
defaultAutoFix = true,
|
|
102
|
+
onAutoFixChange,
|
|
103
|
+
onRerun,
|
|
104
|
+
onOpenLog,
|
|
105
|
+
onFix,
|
|
106
|
+
onOpenOnGitHub,
|
|
107
|
+
onMerge,
|
|
108
|
+
}: PullRequestPaneProps) {
|
|
109
|
+
const Open = useIcon('external-link')
|
|
110
|
+
const Rerun = useIcon('rotate-ccw')
|
|
111
|
+
const Icon = useIcon('git-pull-request')
|
|
112
|
+
const passed = pr.checks.filter(c => c.status === 'success').length
|
|
113
|
+
const failing = pr.checks.filter(c => c.status === 'failed').length
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<div className="flex flex-col gap-2">
|
|
117
|
+
<div className="flex flex-col gap-1 px-2 pt-2">
|
|
118
|
+
<div className="flex items-start gap-2">
|
|
119
|
+
<Icon size={16} strokeWidth={1.5} className="mt-0.5 shrink-0 text-muted-foreground" />
|
|
120
|
+
<span className="min-w-0 flex-1 text-body weight-medium text-foreground">{pr.title}</span>
|
|
121
|
+
</div>
|
|
122
|
+
<div className="flex min-w-0 items-center gap-2 pl-6 text-caption text-muted-foreground">
|
|
123
|
+
<Badge size="compact" color="green" className="shrink-0">
|
|
124
|
+
Open
|
|
125
|
+
</Badge>
|
|
126
|
+
<span className="shrink-0 tabular-nums">#{pr.number}</span>
|
|
127
|
+
<span className="min-w-0 truncate font-mono">
|
|
128
|
+
{pr.branch} → {pr.base}
|
|
129
|
+
</span>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<PaneSection
|
|
134
|
+
title="Checks"
|
|
135
|
+
meta={`${passed} of ${pr.checks.length} passed`}
|
|
136
|
+
actions={<IconAction icon={Rerun} label="Re-run failed" onClick={onRerun} />}
|
|
137
|
+
>
|
|
138
|
+
<Accordion.Group
|
|
139
|
+
type="multiple"
|
|
140
|
+
highlight="trigger"
|
|
141
|
+
defaultValue={pr.checks.filter(c => c.status === 'failed').map(c => c.name)}
|
|
142
|
+
className="w-full max-w-none"
|
|
143
|
+
>
|
|
144
|
+
{pr.checks.map((check, i) => (
|
|
145
|
+
<CheckItem key={check.name} check={check} index={i} onOpenLog={onOpenLog} onFix={onFix} />
|
|
146
|
+
))}
|
|
147
|
+
</Accordion.Group>
|
|
148
|
+
</PaneSection>
|
|
149
|
+
|
|
150
|
+
<PaneSection title="Reviews" meta={`${pr.reviews.length} comments`}>
|
|
151
|
+
<ul className="m-0 flex list-none flex-col gap-2 p-0 px-2 pb-1">
|
|
152
|
+
{pr.reviews.map(review => (
|
|
153
|
+
<li key={review.where} className="flex min-w-0 flex-col">
|
|
154
|
+
<span className="flex min-w-0 gap-2 text-caption text-muted-foreground">
|
|
155
|
+
<span className="shrink-0 weight-medium text-foreground">{review.author}</span>
|
|
156
|
+
<span className="min-w-0 truncate font-mono">{review.where}</span>
|
|
157
|
+
</span>
|
|
158
|
+
<span className="text-body text-foreground">{review.body}</span>
|
|
159
|
+
</li>
|
|
160
|
+
))}
|
|
161
|
+
</ul>
|
|
162
|
+
</PaneSection>
|
|
163
|
+
|
|
164
|
+
<div>
|
|
165
|
+
<Switch
|
|
166
|
+
trackSide="end"
|
|
167
|
+
label="Auto-fix"
|
|
168
|
+
description="Watch CI, fix failures and answer review comments in this session"
|
|
169
|
+
defaultChecked={defaultAutoFix}
|
|
170
|
+
onCheckedChange={onAutoFixChange}
|
|
171
|
+
/>
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
<div className="flex items-center gap-2 px-2 pt-2">
|
|
175
|
+
<span className="min-w-0 flex-1 truncate text-caption text-muted-foreground">
|
|
176
|
+
{failing > 0 ? `${failing} failing check blocks the merge` : 'Ready to merge'}
|
|
177
|
+
</span>
|
|
178
|
+
<Button variant="tertiary" size="compact" trailingIcon={Open} onClick={onOpenOnGitHub}>
|
|
179
|
+
GitHub
|
|
180
|
+
</Button>
|
|
181
|
+
<Button size="compact" disabled={failing > 0} onClick={onMerge}>
|
|
182
|
+
Merge
|
|
183
|
+
</Button>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export type { PullRequestPaneProps }
|
|
190
|
+
|
|
191
|
+
export { PullRequestPane }
|