@justanarthur/modo-ui-ai 0.0.0-stage → 0.3.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 +164 -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 +651 -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 +206 -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 +50 -0
- package/blocks/dialogs/command-palette/index.tsx +239 -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 +23 -0
- package/blocks/panes/usage-pane/index.tsx +78 -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 +29 -0
- package/blocks/profiles/profile-switcher/index.tsx +212 -0
- package/blocks/profiles/profile-usage/examples.mdx +41 -0
- package/blocks/profiles/profile-usage/index.tsx +141 -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 +93 -0
- package/blocks/sessions/session-sidebar/index.tsx +497 -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 +38 -0
- package/components/conversation/agent-run/index.tsx +83 -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 +130 -0
- package/components/conversation/message/working.tsx +102 -0
- package/components/conversation/reasoning/examples.mdx +32 -0
- package/components/conversation/reasoning/index.tsx +55 -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 +16 -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 +12 -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 +27 -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 +14 -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-1hzrm8r5.d.ts +51 -0
- package/dist/shared/chunk-1qdwg7w5.d.ts +81 -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-3ps5h55t.d.ts +30 -0
- package/dist/shared/chunk-3yaftgh0.d.ts +28 -0
- package/dist/shared/chunk-4zvhpf2x.js +55 -0
- package/dist/shared/chunk-57hzzmjd.d.ts +67 -0
- package/dist/shared/chunk-58jh3mje.js +46 -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-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-6kwk9vag.js +558 -0
- package/dist/shared/chunk-6rdwkymk.js +177 -0
- package/dist/shared/chunk-71j8qzvb.d.ts +57 -0
- package/dist/shared/chunk-74bvf3tw.d.ts +21 -0
- package/dist/shared/chunk-75zwypyr.d.ts +43 -0
- package/dist/shared/chunk-7mfer3tp.js +176 -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-94grzz9f.js +187 -0
- package/dist/shared/chunk-9kw6m047.d.ts +32 -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-b4dz15em.d.ts +36 -0
- package/dist/shared/chunk-b5ccp5de.js +35 -0
- package/dist/shared/chunk-bh2b5d1z.js +98 -0
- package/dist/shared/chunk-c36qvrwq.d.ts +30 -0
- package/dist/shared/chunk-c8wp058j.js +153 -0
- package/dist/shared/chunk-d2t72h4x.d.ts +35 -0
- package/dist/shared/chunk-dh3qy5fj.js +49 -0
- package/dist/shared/chunk-dxzrtvt9.d.ts +283 -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-fapc805j.js +130 -0
- package/dist/shared/chunk-fm1qyrae.d.ts +68 -0
- package/dist/shared/chunk-fqhcz6ss.d.ts +29 -0
- package/dist/shared/chunk-g88hweqh.d.ts +70 -0
- package/dist/shared/chunk-gb5ee5dw.d.ts +88 -0
- package/dist/shared/chunk-gewnsgza.js +61 -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-kreypnzp.d.ts +34 -0
- package/dist/shared/chunk-mnzw0bav.js +80 -0
- package/dist/shared/chunk-mrb3fp2f.d.ts +30 -0
- package/dist/shared/chunk-n1qq2wp9.js +6 -0
- package/dist/shared/chunk-n31qwnj2.js +1544 -0
- package/dist/shared/chunk-n4742y54.js +39 -0
- package/dist/shared/chunk-ndjvdkv7.d.ts +29 -0
- package/dist/shared/chunk-njf851p1.js +245 -0
- package/dist/shared/chunk-nk4578dr.js +73 -0
- package/dist/shared/chunk-nkbgg7bw.d.ts +24 -0
- package/dist/shared/chunk-nvh33x9x.js +488 -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-qt31n444.js +178 -0
- package/dist/shared/chunk-r5hz78pb.js +129 -0
- package/dist/shared/chunk-r6nb21kz.d.ts +102 -0
- package/dist/shared/chunk-rqrpvvz4.d.ts +107 -0
- package/dist/shared/chunk-s3r759ec.js +80 -0
- package/dist/shared/chunk-sdtjrw9w.d.ts +98 -0
- package/dist/shared/chunk-skg3m9m0.js +56 -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-ty2ccknv.d.ts +54 -0
- package/dist/shared/chunk-v6yevw62.d.ts +28 -0
- package/dist/shared/chunk-v9q38p0x.js +258 -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-whsx7yp9.d.ts +37 -0
- package/dist/shared/chunk-wq9h37gy.js +86 -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 +78 -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,497 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the AI app's sessions sidebar, composed on Sidebar
|
|
3
|
+
* the way the SidebarApp block is: the profile switcher, a "New session" row
|
|
4
|
+
* and search in the header; pinned sessions, project groups and the user's
|
|
5
|
+
* own sections, an archive; and a settings row in the footer. A session row
|
|
6
|
+
* shows its run state (running, needs input, unread, idle), its last activity
|
|
7
|
+
* and, on hover, pin, archive and a row menu with "Open in split view".
|
|
8
|
+
* Linked child sessions fold under their parent. On the overview the list
|
|
9
|
+
* gives way to filters for its board (state, project, profile).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use client'
|
|
13
|
+
|
|
14
|
+
import { SidebarSearchField } from '@justanarthur/modo-ui/blocks/sidebar-app'
|
|
15
|
+
import Kbd from '@justanarthur/modo-ui/components/data-display/kbd'
|
|
16
|
+
import Sidebar from '@justanarthur/modo-ui/components/navigation/sidebar'
|
|
17
|
+
import {
|
|
18
|
+
DropdownContent,
|
|
19
|
+
DropdownMenu,
|
|
20
|
+
DropdownTrigger,
|
|
21
|
+
MenuItem,
|
|
22
|
+
} from '@justanarthur/modo-ui/components/overlays/dropdown'
|
|
23
|
+
import Tooltip from '@justanarthur/modo-ui/components/overlays/tooltip'
|
|
24
|
+
import Sortable, { useSortableHandle } from '@justanarthur/modo-ui/primitives/layout/sortable'
|
|
25
|
+
import { useMemo } from 'react'
|
|
26
|
+
import { type IconComponent, useIcon } from '../../../lib/icons'
|
|
27
|
+
import { STATUS_GLYPH, STATUS_LABEL } from '../../../lib/status-glyph'
|
|
28
|
+
import type { Profile, Session, SessionGroup, SessionStatus } from '../../../lib/types'
|
|
29
|
+
import { ProfileTile } from '../../profiles/profile-switcher'
|
|
30
|
+
import ProfileUsage from '../../profiles/profile-usage'
|
|
31
|
+
import Inbox, { type InboxAction, type InboxItem } from '../inbox'
|
|
32
|
+
import type { SessionFilter } from '../session-board'
|
|
33
|
+
|
|
34
|
+
const STATES: { status: SessionStatus; label: string }[] = [
|
|
35
|
+
{ status: 'waiting', label: 'Needs you' },
|
|
36
|
+
{ status: 'running', label: 'Running' },
|
|
37
|
+
{ status: 'unread', label: 'To review' },
|
|
38
|
+
{ status: 'idle', label: 'Idle' },
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
/** Every live session, children included, with the project it belongs to. */
|
|
42
|
+
function everySession(pinned: Session[], groups: SessionGroup[]) {
|
|
43
|
+
const withChildren = (s: Session, project?: string) =>
|
|
44
|
+
[s, ...(s.children ?? [])].map(c => ({ ...c, project: s.project ?? project }))
|
|
45
|
+
return [
|
|
46
|
+
...pinned.flatMap(s => withChildren(s)),
|
|
47
|
+
...groups.flatMap(g => g.sessions.flatMap(s => withChildren(s, g.label))),
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** A pinned row's grip: drag it, or focus it and press Space, to move the row among the pinned. */
|
|
52
|
+
function ReorderAction() {
|
|
53
|
+
const Grip = useIcon('grip-vertical')
|
|
54
|
+
const handle = useSortableHandle()
|
|
55
|
+
return (
|
|
56
|
+
<Sidebar.MenuAction {...handle} className="cursor-grab touch-none active:cursor-grabbing">
|
|
57
|
+
<Grip />
|
|
58
|
+
</Sidebar.MenuAction>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** What a row's hover actions and menu call. An action whose callback is absent is left out. */
|
|
63
|
+
type RowActions = Pick<
|
|
64
|
+
SessionSidebarProps,
|
|
65
|
+
'onOpenSplit' | 'onPin' | 'onArchive' | 'onRename' | 'onMarkUnread' | 'onFork'
|
|
66
|
+
>
|
|
67
|
+
|
|
68
|
+
interface SessionRowProps {
|
|
69
|
+
session: Session
|
|
70
|
+
/** Inside the pinned Sortable: the actions lead with a grip. */
|
|
71
|
+
reorder?: boolean
|
|
72
|
+
/** Inside the archive: Archive becomes Unarchive. */
|
|
73
|
+
archived?: boolean
|
|
74
|
+
actions: RowActions
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function SessionRow({ session, reorder, archived = false, actions }: SessionRowProps) {
|
|
78
|
+
const { onOpenSplit, onPin, onArchive, onRename, onMarkUnread, onFork } = actions
|
|
79
|
+
const Pin = useIcon('pin')
|
|
80
|
+
const Archive = useIcon('archive')
|
|
81
|
+
const More = useIcon('more-vertical')
|
|
82
|
+
const Pencil = useIcon('pencil')
|
|
83
|
+
const Columns = useIcon('columns-2')
|
|
84
|
+
const Dot = useIcon('circle-dot')
|
|
85
|
+
const Branch = useIcon('git-branch')
|
|
86
|
+
const glyph = STATUS_GLYPH[session.status]
|
|
87
|
+
const children = session.children ?? []
|
|
88
|
+
const pinLabel = session.pinned ? 'Unpin' : 'Pin'
|
|
89
|
+
const archiveLabel = archived ? 'Unarchive' : 'Archive'
|
|
90
|
+
|
|
91
|
+
const menu = [
|
|
92
|
+
onOpenSplit && (
|
|
93
|
+
<MenuItem key="split" icon={Columns} label="Open in split view" onSelect={() => onOpenSplit(session.id)} />
|
|
94
|
+
),
|
|
95
|
+
onRename && <MenuItem key="rename" icon={Pencil} label="Rename" onSelect={() => onRename(session.id)} />,
|
|
96
|
+
onMarkUnread && session.status !== 'unread' && (
|
|
97
|
+
<MenuItem key="unread" icon={Dot} label="Mark as unread" onSelect={() => onMarkUnread(session.id)} />
|
|
98
|
+
),
|
|
99
|
+
onFork && <MenuItem key="fork" icon={Branch} label="Fork into a new session" onSelect={() => onFork(session.id)} />,
|
|
100
|
+
reorder && onArchive && (
|
|
101
|
+
<MenuItem key="archive" icon={Archive} label={archiveLabel} onSelect={() => onArchive(session.id, !archived)} />
|
|
102
|
+
),
|
|
103
|
+
].filter(Boolean)
|
|
104
|
+
|
|
105
|
+
// Filtered: the cluster sizes the row's gutter by its child count, nulls included. A pinned row trades Archive (in its menu) for the grip.
|
|
106
|
+
const cluster = [
|
|
107
|
+
reorder && <ReorderAction key="reorder" />,
|
|
108
|
+
onPin && (
|
|
109
|
+
<Tooltip key="pin" content={pinLabel} side="top">
|
|
110
|
+
<Sidebar.MenuAction aria-label={pinLabel} onClick={() => onPin(session.id, !session.pinned)}>
|
|
111
|
+
<Pin />
|
|
112
|
+
</Sidebar.MenuAction>
|
|
113
|
+
</Tooltip>
|
|
114
|
+
),
|
|
115
|
+
!reorder && onArchive && (
|
|
116
|
+
<Tooltip key="archive" content={archiveLabel} side="top">
|
|
117
|
+
<Sidebar.MenuAction aria-label={archiveLabel} onClick={() => onArchive(session.id, !archived)}>
|
|
118
|
+
<Archive />
|
|
119
|
+
</Sidebar.MenuAction>
|
|
120
|
+
</Tooltip>
|
|
121
|
+
),
|
|
122
|
+
menu.length > 0 && (
|
|
123
|
+
<DropdownMenu key="more">
|
|
124
|
+
<DropdownTrigger
|
|
125
|
+
render={
|
|
126
|
+
<Sidebar.MenuAction aria-label="More options">
|
|
127
|
+
<More />
|
|
128
|
+
</Sidebar.MenuAction>
|
|
129
|
+
}
|
|
130
|
+
/>
|
|
131
|
+
<DropdownContent className="w-[240px] min-w-0" align="start" sideOffset={4}>
|
|
132
|
+
{menu}
|
|
133
|
+
</DropdownContent>
|
|
134
|
+
</DropdownMenu>
|
|
135
|
+
),
|
|
136
|
+
].filter(Boolean)
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<Sidebar.MenuItem
|
|
140
|
+
collapsible={children.length > 0 ? true : undefined}
|
|
141
|
+
defaultOpen={children.length > 0 ? true : undefined}
|
|
142
|
+
>
|
|
143
|
+
<Sidebar.MenuButton
|
|
144
|
+
value={session.id}
|
|
145
|
+
icon={glyph}
|
|
146
|
+
status={glyph ? undefined : session.status === 'unread' ? 'unread' : 'idle'}
|
|
147
|
+
title={`${session.title} · ${STATUS_LABEL[session.status]} · ${session.profile}`}
|
|
148
|
+
>
|
|
149
|
+
<span className="truncate">{session.title}</span>
|
|
150
|
+
</Sidebar.MenuButton>
|
|
151
|
+
<Sidebar.MenuBadge>{session.updated}</Sidebar.MenuBadge>
|
|
152
|
+
{cluster.length > 0 && <Sidebar.MenuActions showOnHover>{cluster}</Sidebar.MenuActions>}
|
|
153
|
+
{children.length > 0 && (
|
|
154
|
+
<Sidebar.MenuSub>
|
|
155
|
+
{children.map(child => (
|
|
156
|
+
<Sidebar.MenuSubItem key={child.id}>
|
|
157
|
+
<Sidebar.MenuSubButton value={child.id} icon={STATUS_GLYPH[child.status] ?? Branch}>
|
|
158
|
+
{child.title}
|
|
159
|
+
</Sidebar.MenuSubButton>
|
|
160
|
+
</Sidebar.MenuSubItem>
|
|
161
|
+
))}
|
|
162
|
+
</Sidebar.MenuSub>
|
|
163
|
+
)}
|
|
164
|
+
</Sidebar.MenuItem>
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** The overview's job for the list: narrow the board to one state, project or profile, with counts. */
|
|
169
|
+
function SessionFilters({
|
|
170
|
+
pinned,
|
|
171
|
+
groups,
|
|
172
|
+
profiles,
|
|
173
|
+
}: {
|
|
174
|
+
pinned: Session[]
|
|
175
|
+
groups: SessionGroup[]
|
|
176
|
+
profiles: Profile[]
|
|
177
|
+
}) {
|
|
178
|
+
const Folder = useIcon('folder')
|
|
179
|
+
const all = everySession(pinned, groups)
|
|
180
|
+
const count = (match: (s: Session) => boolean) => all.filter(match).length
|
|
181
|
+
const projects = groups.filter(g => g.kind === 'project')
|
|
182
|
+
const used = profiles.filter(p => all.some(s => s.profile === p.id))
|
|
183
|
+
// Built once per profile list: a component made during render would remount its row's icon every time.
|
|
184
|
+
const icons = useMemo(
|
|
185
|
+
() =>
|
|
186
|
+
Object.fromEntries(
|
|
187
|
+
profiles.map(profile => [profile.id, (() => <ProfileTile profile={profile} size="sm" />) as IconComponent]),
|
|
188
|
+
),
|
|
189
|
+
[profiles],
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<>
|
|
194
|
+
<Sidebar.Group>
|
|
195
|
+
<Sidebar.GroupLabel>State</Sidebar.GroupLabel>
|
|
196
|
+
<Sidebar.Menu>
|
|
197
|
+
{STATES.map(({ status, label }) => (
|
|
198
|
+
<Sidebar.MenuItem key={status}>
|
|
199
|
+
<Sidebar.MenuButton
|
|
200
|
+
value={`state:${status}` satisfies SessionFilter}
|
|
201
|
+
icon={STATUS_GLYPH[status]}
|
|
202
|
+
status={STATUS_GLYPH[status] ? undefined : status === 'unread' ? 'unread' : 'idle'}
|
|
203
|
+
>
|
|
204
|
+
{label}
|
|
205
|
+
</Sidebar.MenuButton>
|
|
206
|
+
<Sidebar.MenuBadge>{count(s => s.status === status)}</Sidebar.MenuBadge>
|
|
207
|
+
</Sidebar.MenuItem>
|
|
208
|
+
))}
|
|
209
|
+
</Sidebar.Menu>
|
|
210
|
+
</Sidebar.Group>
|
|
211
|
+
|
|
212
|
+
<Sidebar.Group>
|
|
213
|
+
<Sidebar.GroupLabel>Projects</Sidebar.GroupLabel>
|
|
214
|
+
<Sidebar.Menu>
|
|
215
|
+
{projects.map(({ label }) => (
|
|
216
|
+
<Sidebar.MenuItem key={label}>
|
|
217
|
+
<Sidebar.MenuButton value={`project:${label}` satisfies SessionFilter} icon={Folder}>
|
|
218
|
+
{label}
|
|
219
|
+
</Sidebar.MenuButton>
|
|
220
|
+
<Sidebar.MenuBadge>{count(s => s.project === label)}</Sidebar.MenuBadge>
|
|
221
|
+
</Sidebar.MenuItem>
|
|
222
|
+
))}
|
|
223
|
+
</Sidebar.Menu>
|
|
224
|
+
</Sidebar.Group>
|
|
225
|
+
|
|
226
|
+
<Sidebar.Group>
|
|
227
|
+
<Sidebar.GroupLabel>Profiles</Sidebar.GroupLabel>
|
|
228
|
+
<Sidebar.Menu>
|
|
229
|
+
{used.map(profile => (
|
|
230
|
+
<Sidebar.MenuItem key={profile.id}>
|
|
231
|
+
<Sidebar.MenuButton value={`profile:${profile.id}` satisfies SessionFilter} icon={icons[profile.id]}>
|
|
232
|
+
{profile.name}
|
|
233
|
+
</Sidebar.MenuButton>
|
|
234
|
+
<Sidebar.MenuBadge>{count(s => s.profile === profile.id)}</Sidebar.MenuBadge>
|
|
235
|
+
</Sidebar.MenuItem>
|
|
236
|
+
))}
|
|
237
|
+
</Sidebar.Menu>
|
|
238
|
+
</Sidebar.Group>
|
|
239
|
+
</>
|
|
240
|
+
)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
interface SessionSidebarProps {
|
|
244
|
+
/** Pinned sessions, above every group, in the order you dragged them into. */
|
|
245
|
+
pinned: Session[]
|
|
246
|
+
/** Called with the pinned sessions' ids after one is dragged to a new place. */
|
|
247
|
+
onPinnedOrderChange?: (ids: string[]) => void
|
|
248
|
+
/** Project folders and the user's own sections, in order. */
|
|
249
|
+
groups: SessionGroup[]
|
|
250
|
+
/** Archived sessions, folded at the bottom. */
|
|
251
|
+
archived: Session[]
|
|
252
|
+
/** The profiles the sessions run under, for the footer's usage and the profile filters. */
|
|
253
|
+
profiles: Profile[]
|
|
254
|
+
/** What the content lists: the sessions, or (on the overview, whose board is that list widened) filters for the board by state, project and profile, with counts. Defaults to `'sessions'`. */
|
|
255
|
+
list?: 'sessions' | 'filters'
|
|
256
|
+
/** Controlled selected session id. Pair with `onValueChange`. */
|
|
257
|
+
value?: string
|
|
258
|
+
/** Initial selected session id, for an uncontrolled sidebar. */
|
|
259
|
+
defaultValue?: string
|
|
260
|
+
/** Called with the session id when a row is picked; the header's Overview row picks `'overview'` and its New session row `'new'`. */
|
|
261
|
+
onValueChange?: (value: string) => void
|
|
262
|
+
/** Called when a row's menu asks to open its session in split view. Omit to leave the menu item out. */
|
|
263
|
+
onOpenSplit?: (id: string) => void
|
|
264
|
+
/** Called by a row's pin action with the session id and whether it should now be pinned. Omit to leave the action out. */
|
|
265
|
+
onPin?: (id: string, pinned: boolean) => void
|
|
266
|
+
/** Called by a row's archive action (in a pinned row's menu, Unarchive in the archive) with the session id and whether it should now be archived. Omit to leave the action out. */
|
|
267
|
+
onArchive?: (id: string, archived: boolean) => void
|
|
268
|
+
/** Called by a row's Rename menu item with the session id: open your rename field (the title bar's, say). Omit to leave the item out. */
|
|
269
|
+
onRename?: (id: string) => void
|
|
270
|
+
/** Called by a row's Mark as unread menu item, shown on rows not already unread. Omit to leave the item out. */
|
|
271
|
+
onMarkUnread?: (id: string) => void
|
|
272
|
+
/** Called by a row's Fork into a new session menu item with the session id. Omit to leave the item out. */
|
|
273
|
+
onFork?: (id: string) => void
|
|
274
|
+
/** Called by a project group's New session action with that group. Omit to leave the action out. */
|
|
275
|
+
onNewSessionIn?: (group: SessionGroup) => void
|
|
276
|
+
/** Called by a section's Filter action with that section. Omit to leave the action out. */
|
|
277
|
+
onFilterSection?: (group: SessionGroup) => void
|
|
278
|
+
/** What needs you across sessions: a header row opens them, with the unread count. Omit for no inbox row. */
|
|
279
|
+
inbox?: InboxItem[]
|
|
280
|
+
/** Called when an inbox row is answered or opened. */
|
|
281
|
+
onInboxAction?: (item: InboxItem, action: InboxAction) => void
|
|
282
|
+
/** Called when the search field is clicked or Enter is pressed in it: open your ⌘K palette. Omit to keep it a plain field. */
|
|
283
|
+
onSearch?: () => void
|
|
284
|
+
/** Called by the footer's Settings row and the usage's manage action. Omit to leave the Settings row out. */
|
|
285
|
+
onOpenSettings?: () => void
|
|
286
|
+
/** The sidebar's layout (see Sidebar). Defaults to `'inset'`. */
|
|
287
|
+
variant?: 'sidebar' | 'floating' | 'inset'
|
|
288
|
+
/** Classes for the sidebar. */
|
|
289
|
+
className?: string
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* The AI app's sessions rail: every session of every profile,
|
|
294
|
+
* grouped by project, with what each one is doing right now.
|
|
295
|
+
*
|
|
296
|
+
* Sessions of every profile sit side by side, so there is no profile to
|
|
297
|
+
* switch: the header opens the overview of every session (see the session
|
|
298
|
+
* board), starts a new session and searches, and the footer shows how much
|
|
299
|
+
* each profile has left (see the profile usage). Below it come the pinned sessions, which you
|
|
300
|
+
* reorder by a row's grip (drag it, or focus it, press Space and use the
|
|
301
|
+
* arrows), then one group
|
|
302
|
+
* per project folder and per section you made, then the archive, folded.
|
|
303
|
+
* A row's leading glyph is its state: an arc turning while it runs, an
|
|
304
|
+
* amber dot while it waits for you, a filled dot for an unread reply and a
|
|
305
|
+
* ring when idle; its badge is the last activity. Hover a row for pin,
|
|
306
|
+
* archive and a menu that opens the session in split view, renames it,
|
|
307
|
+
* marks it unread or forks it. Each of those actions, a group's New session
|
|
308
|
+
* or Filter action and the footer's Settings row shows only when you pass
|
|
309
|
+
* its callback (`onPin`, `onArchive`, `onOpenSplit`, `onRename`,
|
|
310
|
+
* `onMarkUnread`, `onFork`, `onNewSessionIn`, `onFilterSection`,
|
|
311
|
+
* `onOpenSettings`), so the sidebar offers only what your app does. The
|
|
312
|
+
* Overview and New session rows are picks like a session's: `onValueChange`
|
|
313
|
+
* gets `'overview'` or `'new'`. Sessions started from another one fold
|
|
314
|
+
* under it as linked children. Pick a row and the active background melts over to it.
|
|
315
|
+
*
|
|
316
|
+
* On the overview, whose board is the session list widened, `list="filters"`
|
|
317
|
+
* trades the list for filters: by state, project and profile, each with its
|
|
318
|
+
* count; a row's `value` (`'state:waiting'`, `'project:modo'`,
|
|
319
|
+
* `'profile:work'`) is the board's `filter`.
|
|
320
|
+
*
|
|
321
|
+
* Put it inside a `Sidebar.Provider`, next to the `Sidebar.Inset` that holds
|
|
322
|
+
* the session.
|
|
323
|
+
*
|
|
324
|
+
* @example {@include ./examples.mdx}
|
|
325
|
+
*/
|
|
326
|
+
export default function SessionSidebar({
|
|
327
|
+
pinned,
|
|
328
|
+
groups,
|
|
329
|
+
archived,
|
|
330
|
+
profiles,
|
|
331
|
+
onPinnedOrderChange,
|
|
332
|
+
list = 'sessions',
|
|
333
|
+
value,
|
|
334
|
+
defaultValue,
|
|
335
|
+
onValueChange,
|
|
336
|
+
onOpenSplit,
|
|
337
|
+
onPin,
|
|
338
|
+
onArchive,
|
|
339
|
+
onRename,
|
|
340
|
+
onMarkUnread,
|
|
341
|
+
onFork,
|
|
342
|
+
onNewSessionIn,
|
|
343
|
+
onFilterSection,
|
|
344
|
+
onOpenSettings,
|
|
345
|
+
inbox,
|
|
346
|
+
onInboxAction,
|
|
347
|
+
onSearch,
|
|
348
|
+
variant = 'inset',
|
|
349
|
+
className,
|
|
350
|
+
}: SessionSidebarProps) {
|
|
351
|
+
const Plus = useIcon('plus')
|
|
352
|
+
const Board = useIcon('layout-dashboard')
|
|
353
|
+
const Settings = useIcon('settings')
|
|
354
|
+
const Filter = useIcon('sliders-horizontal')
|
|
355
|
+
const Bell = useIcon('bell')
|
|
356
|
+
const unread = inbox?.filter(item => !item.read).length ?? 0
|
|
357
|
+
const waiting = everySession(pinned, groups).filter(s => s.status === 'waiting').length
|
|
358
|
+
const actions = { onOpenSplit, onPin, onArchive, onRename, onMarkUnread, onFork }
|
|
359
|
+
|
|
360
|
+
return (
|
|
361
|
+
<Sidebar
|
|
362
|
+
variant={variant}
|
|
363
|
+
className={className}
|
|
364
|
+
value={value}
|
|
365
|
+
defaultValue={value === undefined ? defaultValue : undefined}
|
|
366
|
+
onValueChange={onValueChange}
|
|
367
|
+
>
|
|
368
|
+
<Sidebar.Header>
|
|
369
|
+
<div className="flex flex-col gap-0.5">
|
|
370
|
+
<Sidebar.Menu>
|
|
371
|
+
<Sidebar.MenuItem>
|
|
372
|
+
<Sidebar.MenuButton icon={Board} value="overview">
|
|
373
|
+
Overview
|
|
374
|
+
<span className="ml-auto text-micro tabular-nums text-muted-foreground">{waiting} need you</span>
|
|
375
|
+
</Sidebar.MenuButton>
|
|
376
|
+
</Sidebar.MenuItem>
|
|
377
|
+
{inbox && (
|
|
378
|
+
<Sidebar.MenuItem>
|
|
379
|
+
<Inbox
|
|
380
|
+
items={inbox}
|
|
381
|
+
onAction={onInboxAction}
|
|
382
|
+
side="right"
|
|
383
|
+
align="start"
|
|
384
|
+
trigger={
|
|
385
|
+
<Sidebar.MenuButton icon={Bell} aria-label={unread > 0 ? `Inbox, ${unread} unread` : 'Inbox'}>
|
|
386
|
+
Inbox
|
|
387
|
+
</Sidebar.MenuButton>
|
|
388
|
+
}
|
|
389
|
+
/>
|
|
390
|
+
{unread > 0 && <Sidebar.MenuBadge>{unread}</Sidebar.MenuBadge>}
|
|
391
|
+
</Sidebar.MenuItem>
|
|
392
|
+
)}
|
|
393
|
+
<Sidebar.MenuItem>
|
|
394
|
+
<Sidebar.MenuButton icon={Plus} value="new">
|
|
395
|
+
New session
|
|
396
|
+
<Kbd variant="plain" className="ml-auto">
|
|
397
|
+
⌘N
|
|
398
|
+
</Kbd>
|
|
399
|
+
</Sidebar.MenuButton>
|
|
400
|
+
</Sidebar.MenuItem>
|
|
401
|
+
</Sidebar.Menu>
|
|
402
|
+
<SidebarSearchField
|
|
403
|
+
placeholder="Search sessions"
|
|
404
|
+
{...(onSearch && {
|
|
405
|
+
readOnly: true,
|
|
406
|
+
onClick: onSearch,
|
|
407
|
+
onKeyDown: e => {
|
|
408
|
+
if (e.key === 'Enter') onSearch()
|
|
409
|
+
},
|
|
410
|
+
})}
|
|
411
|
+
/>
|
|
412
|
+
</div>
|
|
413
|
+
</Sidebar.Header>
|
|
414
|
+
|
|
415
|
+
{/* No hairline at the scroll edges: the fade alone says the list goes on. */}
|
|
416
|
+
<Sidebar.Content className="before:!content-none after:!content-none">
|
|
417
|
+
{list === 'filters' && <SessionFilters pinned={pinned} groups={groups} profiles={profiles} />}
|
|
418
|
+
{list === 'sessions' && (
|
|
419
|
+
<>
|
|
420
|
+
<Sidebar.Group collapsible>
|
|
421
|
+
<Sidebar.GroupLabel>Pinned</Sidebar.GroupLabel>
|
|
422
|
+
<Sidebar.Menu>
|
|
423
|
+
<Sortable
|
|
424
|
+
as="none"
|
|
425
|
+
handle
|
|
426
|
+
items={pinned.map(session => ({
|
|
427
|
+
id: session.id,
|
|
428
|
+
label: session.title,
|
|
429
|
+
content: <SessionRow session={session} reorder actions={actions} />,
|
|
430
|
+
}))}
|
|
431
|
+
onOrderChange={onPinnedOrderChange}
|
|
432
|
+
/>
|
|
433
|
+
</Sidebar.Menu>
|
|
434
|
+
</Sidebar.Group>
|
|
435
|
+
|
|
436
|
+
{groups.map(group => {
|
|
437
|
+
const isProject = group.kind === 'project'
|
|
438
|
+
const onAction = isProject ? onNewSessionIn : onFilterSection
|
|
439
|
+
const label = isProject ? `New session in ${group.label}` : 'Filter'
|
|
440
|
+
return (
|
|
441
|
+
<Sidebar.Group key={group.label} collapsible>
|
|
442
|
+
<Sidebar.GroupLabel>{group.label}</Sidebar.GroupLabel>
|
|
443
|
+
{onAction && (
|
|
444
|
+
<Sidebar.GroupActions>
|
|
445
|
+
<Tooltip content={label} side="top">
|
|
446
|
+
<Sidebar.GroupAction aria-label={label} onClick={() => onAction(group)}>
|
|
447
|
+
{isProject ? <Plus /> : <Filter />}
|
|
448
|
+
</Sidebar.GroupAction>
|
|
449
|
+
</Tooltip>
|
|
450
|
+
</Sidebar.GroupActions>
|
|
451
|
+
)}
|
|
452
|
+
<Sidebar.Menu>
|
|
453
|
+
{group.sessions.map(session => (
|
|
454
|
+
<SessionRow key={session.id} session={session} actions={actions} />
|
|
455
|
+
))}
|
|
456
|
+
</Sidebar.Menu>
|
|
457
|
+
</Sidebar.Group>
|
|
458
|
+
)
|
|
459
|
+
})}
|
|
460
|
+
|
|
461
|
+
<Sidebar.Group collapsible defaultOpen={false}>
|
|
462
|
+
<Sidebar.GroupLabel>Archived</Sidebar.GroupLabel>
|
|
463
|
+
<Sidebar.Menu>
|
|
464
|
+
{archived.map(session => (
|
|
465
|
+
<SessionRow key={session.id} session={session} archived actions={actions} />
|
|
466
|
+
))}
|
|
467
|
+
</Sidebar.Menu>
|
|
468
|
+
</Sidebar.Group>
|
|
469
|
+
</>
|
|
470
|
+
)}
|
|
471
|
+
</Sidebar.Content>
|
|
472
|
+
|
|
473
|
+
<Sidebar.Footer>
|
|
474
|
+
<Sidebar.Group collapsible>
|
|
475
|
+
<Sidebar.GroupLabel>Usage</Sidebar.GroupLabel>
|
|
476
|
+
<ProfileUsage profiles={profiles} onManage={onOpenSettings} />
|
|
477
|
+
</Sidebar.Group>
|
|
478
|
+
{onOpenSettings && (
|
|
479
|
+
<Sidebar.Menu>
|
|
480
|
+
<Sidebar.MenuItem>
|
|
481
|
+
<Sidebar.MenuButton icon={Settings} onClick={onOpenSettings}>
|
|
482
|
+
Settings
|
|
483
|
+
<Kbd variant="plain" className="ml-auto">
|
|
484
|
+
⌘,
|
|
485
|
+
</Kbd>
|
|
486
|
+
</Sidebar.MenuButton>
|
|
487
|
+
</Sidebar.MenuItem>
|
|
488
|
+
</Sidebar.Menu>
|
|
489
|
+
)}
|
|
490
|
+
</Sidebar.Footer>
|
|
491
|
+
</Sidebar>
|
|
492
|
+
)
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export type { SessionSidebarProps }
|
|
496
|
+
|
|
497
|
+
export { SessionSidebar }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Extensions from './index'
|
|
2
|
+
import { EXTENSIONS } from '../../../mock/mock-settings'
|
|
3
|
+
|
|
4
|
+
# Extensions
|
|
5
|
+
|
|
6
|
+
Your own features, built as MCP servers, plugins, skills and hooks.
|
|
7
|
+
|
|
8
|
+
<div className="@container w-full max-w-3xl">
|
|
9
|
+
<Extensions extensions={EXTENSIONS} />
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the settings screen's extensions section — your own
|
|
3
|
+
* panes, commands, actions and hooks, each a switch.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client'
|
|
7
|
+
|
|
8
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
9
|
+
import Switch from '@justanarthur/modo-ui/components/inputs/switch'
|
|
10
|
+
import { useIcon } from '../../../lib/icons'
|
|
11
|
+
import { Group, Section, Toggles } from '../../../lib/settings-parts'
|
|
12
|
+
|
|
13
|
+
export interface Extension {
|
|
14
|
+
name: string
|
|
15
|
+
/** What it adds: a pane, a command, an action, a hook. */
|
|
16
|
+
kind: string
|
|
17
|
+
/** What it is built as and ships in: an MCP server, a plugin, a settings file. */
|
|
18
|
+
source: string
|
|
19
|
+
description: string
|
|
20
|
+
enabled: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface ExtensionsProps {
|
|
24
|
+
/** The installed extensions. */
|
|
25
|
+
extensions: Extension[]
|
|
26
|
+
/** Called when "New extension" is pressed. */
|
|
27
|
+
onNew?: () => void
|
|
28
|
+
/** Called when an extension's switch flips, with its new state. */
|
|
29
|
+
onToggle?: (extension: Extension, enabled: boolean) => void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Your own features in the app: panes, commands, actions and hooks.
|
|
34
|
+
*
|
|
35
|
+
* They are built as MCP servers, plugins, skills and hooks, so they work in
|
|
36
|
+
* the CLI too. Each is a switch whose description says what kind it is, what
|
|
37
|
+
* it does and where it comes from.
|
|
38
|
+
*
|
|
39
|
+
* @example {@include ./examples.mdx}
|
|
40
|
+
*/
|
|
41
|
+
export default function Extensions({ extensions, onNew, onToggle }: ExtensionsProps) {
|
|
42
|
+
const Plus = useIcon('plus')
|
|
43
|
+
return (
|
|
44
|
+
<Section
|
|
45
|
+
title="Extensions"
|
|
46
|
+
lead="Your own features: panes, commands, actions and hooks, built as MCP servers, plugins, skills and hooks, so they work in the CLI too."
|
|
47
|
+
actions={
|
|
48
|
+
<Button size="compact" leadingIcon={Plus} onClick={onNew}>
|
|
49
|
+
New extension
|
|
50
|
+
</Button>
|
|
51
|
+
}
|
|
52
|
+
>
|
|
53
|
+
<Group title="Installed" aside={<span className="tabular-nums">{extensions.length}</span>}>
|
|
54
|
+
<Toggles label="Extensions">
|
|
55
|
+
{extensions.map(extension => (
|
|
56
|
+
<Switch
|
|
57
|
+
key={extension.name}
|
|
58
|
+
label={extension.name}
|
|
59
|
+
description={`${extension.kind} · ${extension.description} · from ${extension.source}`}
|
|
60
|
+
defaultChecked={extension.enabled}
|
|
61
|
+
onCheckedChange={enabled => onToggle?.(extension, enabled)}
|
|
62
|
+
/>
|
|
63
|
+
))}
|
|
64
|
+
</Toggles>
|
|
65
|
+
</Group>
|
|
66
|
+
</Section>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type { ExtensionsProps }
|
|
71
|
+
|
|
72
|
+
export { Extensions }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Hooks from './index'
|
|
2
|
+
import { HOOKS } from '../../../mock/mock'
|
|
3
|
+
|
|
4
|
+
# Hooks
|
|
5
|
+
|
|
6
|
+
A row opens into its command, timeout and last run; one that failed says so in the row.
|
|
7
|
+
|
|
8
|
+
<div className="@container w-full max-w-3xl">
|
|
9
|
+
<Hooks hooks={HOOKS} configDir="~/.claude-jobiflow" />
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
# Open
|
|
13
|
+
|
|
14
|
+
<div className="@container w-full max-w-3xl">
|
|
15
|
+
<Hooks hooks={HOOKS} configDir="~/.claude-jobiflow" defaultOpen={[HOOKS[0].event + '-' + HOOKS[0].command]} />
|
|
16
|
+
</div>
|