@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,372 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Local addition: the AI app's inbox. Everything across sessions that needs
|
|
3
|
+
* the user (a permission, a question or a plan waiting, a finished turn, a
|
|
4
|
+
* failed CI run, a limit running out) in one list grouped by recency, each
|
|
5
|
+
* row answered in place. The trigger is a bell with the unread count; the
|
|
6
|
+
* list opens in a Popover that grows out of it.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use client'
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
FluidHoverHighlight,
|
|
13
|
+
type UseFluidHoverReturn,
|
|
14
|
+
useFluidHover,
|
|
15
|
+
useRegisterFluidHoverItem,
|
|
16
|
+
} from '@justanarthur/modo-ui'
|
|
17
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
18
|
+
import StatusDot from '@justanarthur/modo-ui/components/feedback/status-dot'
|
|
19
|
+
import Popover from '@justanarthur/modo-ui/components/overlays/popover'
|
|
20
|
+
import { useShape } from '@justanarthur/modo-ui/lib/shape-context'
|
|
21
|
+
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
22
|
+
import ScrollArea from '@justanarthur/modo-ui/primitives/layout/scroll-area'
|
|
23
|
+
import { SizeProvider } from '@justanarthur/modo-ui/primitives/systems/sizes'
|
|
24
|
+
import { type ReactElement, type ReactNode, useRef, useState } from 'react'
|
|
25
|
+
import { type IconName, useIcon } from '../../../lib/icons'
|
|
26
|
+
|
|
27
|
+
export type InboxKind = 'permission' | 'question' | 'plan' | 'finished' | 'ci-failed' | 'rate-limit'
|
|
28
|
+
|
|
29
|
+
/** What a row's buttons do: answer a permission, open the session, or move to a profile with room. */
|
|
30
|
+
export type InboxAction = 'allow' | 'deny' | 'open' | 'switch-profile'
|
|
31
|
+
|
|
32
|
+
export interface InboxItem {
|
|
33
|
+
id: string
|
|
34
|
+
kind: InboxKind
|
|
35
|
+
/** What it is about: the command, the question, the PR's check. */
|
|
36
|
+
title: string
|
|
37
|
+
/** The session it came from. */
|
|
38
|
+
sessionId: string
|
|
39
|
+
session: string
|
|
40
|
+
project?: string
|
|
41
|
+
/** The profile it ran under; for a rate limit, the one running out. */
|
|
42
|
+
profile?: string
|
|
43
|
+
/** One more line: the tool, the reply's first line, the failing step. */
|
|
44
|
+
detail?: string
|
|
45
|
+
/** Minutes since it arrived; groups the list and reads as "3m", "2h", "1d". */
|
|
46
|
+
ago: number
|
|
47
|
+
read?: boolean
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const KIND: Record<InboxKind, { icon: IconName; label: string; tone: string }> = {
|
|
51
|
+
permission: { icon: 'shield', label: 'Permission', tone: 'text-status-warning' },
|
|
52
|
+
question: { icon: 'message-circle', label: 'Question', tone: 'text-status-warning' },
|
|
53
|
+
plan: { icon: 'list-checks', label: 'Plan to review', tone: 'text-status-warning' },
|
|
54
|
+
finished: { icon: 'circle-check', label: 'Finished', tone: 'text-muted-foreground' },
|
|
55
|
+
'ci-failed': { icon: 'circle-x', label: 'CI failed', tone: 'text-status-error' },
|
|
56
|
+
'rate-limit': { icon: 'gauge', label: 'Limit', tone: 'text-status-warning' },
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const GROUPS: { label: string; until: number }[] = [
|
|
60
|
+
{ label: 'Last hour', until: 60 },
|
|
61
|
+
{ label: 'Today', until: 60 * 24 },
|
|
62
|
+
{ label: 'Earlier', until: Number.POSITIVE_INFINITY },
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
function ago(minutes: number) {
|
|
66
|
+
if (minutes < 1) return 'now'
|
|
67
|
+
if (minutes < 60) return `${Math.round(minutes)}m`
|
|
68
|
+
if (minutes < 60 * 24) return `${Math.round(minutes / 60)}h`
|
|
69
|
+
return `${Math.round(minutes / 60 / 24)}d`
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function Actions({ item, onAction }: { item: InboxItem; onAction: (action: InboxAction) => void }) {
|
|
73
|
+
const button = (action: InboxAction, label: string, variant: 'secondary' | 'ghost' = 'ghost') => (
|
|
74
|
+
<Button key={action} variant={variant} size="compact" onClick={() => onAction(action)}>
|
|
75
|
+
{label}
|
|
76
|
+
</Button>
|
|
77
|
+
)
|
|
78
|
+
if (item.kind === 'permission')
|
|
79
|
+
return (
|
|
80
|
+
<>
|
|
81
|
+
{button('deny', 'Deny')}
|
|
82
|
+
{button('allow', 'Allow', 'secondary')}
|
|
83
|
+
</>
|
|
84
|
+
)
|
|
85
|
+
if (item.kind === 'rate-limit') return button('switch-profile', 'Switch profile', 'secondary')
|
|
86
|
+
if (item.kind === 'question') return button('open', 'Answer', 'secondary')
|
|
87
|
+
if (item.kind === 'plan') return button('open', 'Review', 'secondary')
|
|
88
|
+
if (item.kind === 'ci-failed') return button('open', 'Open', 'secondary')
|
|
89
|
+
return null
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function Row({
|
|
93
|
+
item,
|
|
94
|
+
index,
|
|
95
|
+
read,
|
|
96
|
+
resolved,
|
|
97
|
+
register,
|
|
98
|
+
onAction,
|
|
99
|
+
}: {
|
|
100
|
+
item: InboxItem
|
|
101
|
+
index: number
|
|
102
|
+
read: boolean
|
|
103
|
+
resolved?: string
|
|
104
|
+
register: UseFluidHoverReturn['registerItem']
|
|
105
|
+
onAction: (action: InboxAction) => void
|
|
106
|
+
}) {
|
|
107
|
+
const ref = useRef<HTMLDivElement | null>(null)
|
|
108
|
+
const shape = useShape()
|
|
109
|
+
const kind = KIND[item.kind]
|
|
110
|
+
const Icon = useIcon(kind.icon)
|
|
111
|
+
useRegisterFluidHoverItem(register, index, ref)
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<div
|
|
115
|
+
ref={ref}
|
|
116
|
+
className={cn(
|
|
117
|
+
'relative z-10 flex items-start gap-[var(--space-3)] px-[var(--space-2)] py-[var(--space-2)]',
|
|
118
|
+
shape.item,
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
<Icon size={16} strokeWidth={1.5} className={cn('mt-0.5 shrink-0', kind.tone)} />
|
|
122
|
+
<div className="flex min-w-0 flex-1 flex-col gap-[var(--space-1)]">
|
|
123
|
+
{/* The row opens its session; the buttons sit above this stretched target. */}
|
|
124
|
+
<button
|
|
125
|
+
type="button"
|
|
126
|
+
onClick={() => onAction('open')}
|
|
127
|
+
className='flex min-w-0 cursor-pointer flex-col text-left outline-none after:absolute after:inset-0 after:rounded-box after:content-[""] focus-visible:after:ring-1 focus-visible:after:ring-focus-ring'
|
|
128
|
+
>
|
|
129
|
+
<span className="flex min-w-0 items-baseline gap-[var(--space-2)]">
|
|
130
|
+
<span
|
|
131
|
+
className={cn('min-w-0 flex-1 truncate text-body', read ? 'text-muted-foreground' : 'text-foreground')}
|
|
132
|
+
>
|
|
133
|
+
{item.title}
|
|
134
|
+
</span>
|
|
135
|
+
<span className="shrink-0 text-caption tabular-nums text-muted-foreground">{ago(item.ago)}</span>
|
|
136
|
+
</span>
|
|
137
|
+
<span className="min-w-0 truncate text-caption text-muted-foreground">
|
|
138
|
+
{[kind.label, item.session, item.project, item.profile].filter(Boolean).join(' · ')}
|
|
139
|
+
</span>
|
|
140
|
+
{item.detail && (
|
|
141
|
+
<span className="min-w-0 truncate font-mono text-caption text-muted-foreground">{item.detail}</span>
|
|
142
|
+
)}
|
|
143
|
+
</button>
|
|
144
|
+
{resolved ? (
|
|
145
|
+
<span className="text-caption text-muted-foreground">{resolved}</span>
|
|
146
|
+
) : (
|
|
147
|
+
<span className="relative z-20 flex items-center gap-[var(--space-1)] empty:hidden">
|
|
148
|
+
<Actions item={item} onAction={onAction} />
|
|
149
|
+
</span>
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
152
|
+
{!read && <StatusDot status="unread" label="Unread" size="compact" className="mt-0.5" />}
|
|
153
|
+
</div>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface InboxListProps {
|
|
158
|
+
/** Everything waiting on the user, newest first or in any order: rows sort by `ago`. */
|
|
159
|
+
items: InboxItem[]
|
|
160
|
+
/** Called when a row is answered or opened: allow / deny a permission, open its session, switch profile on a limit. */
|
|
161
|
+
onAction?: (item: InboxItem, action: InboxAction) => void
|
|
162
|
+
/** Called when Mark all read is pressed. */
|
|
163
|
+
onMarkAllRead?: () => void
|
|
164
|
+
/** Show the header with the title and Mark all read; turn it off in a pane that has its own. Defaults to `true`. */
|
|
165
|
+
header?: boolean
|
|
166
|
+
/** Classes for the root. */
|
|
167
|
+
className?: string
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** The inbox's rows, grouped by recency, with the header's Mark all read. */
|
|
171
|
+
function InboxList({ items, onAction, onMarkAllRead, header = true, className }: InboxListProps) {
|
|
172
|
+
const containerRef = useRef<HTMLDivElement | null>(null)
|
|
173
|
+
const hover = useFluidHover(containerRef, { axis: 'y' })
|
|
174
|
+
const shape = useShape()
|
|
175
|
+
const Inbox = useIcon('inbox')
|
|
176
|
+
const [allRead, setAllRead] = useState(false)
|
|
177
|
+
const [readIds, setReadIds] = useState<string[]>([])
|
|
178
|
+
const [resolved, setResolved] = useState<Record<string, string>>({})
|
|
179
|
+
|
|
180
|
+
const sorted = [...items].sort((a, b) => a.ago - b.ago)
|
|
181
|
+
const isRead = (item: InboxItem) => allRead || item.read || readIds.includes(item.id)
|
|
182
|
+
const unread = sorted.filter(i => !isRead(i)).length
|
|
183
|
+
|
|
184
|
+
const act = (item: InboxItem, action: InboxAction) => {
|
|
185
|
+
setReadIds(ids => [...ids, item.id])
|
|
186
|
+
if (action === 'allow') setResolved(r => ({ ...r, [item.id]: 'Allowed' }))
|
|
187
|
+
if (action === 'deny') setResolved(r => ({ ...r, [item.id]: 'Denied' }))
|
|
188
|
+
onAction?.(item, action)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
let index = 0
|
|
192
|
+
let lower = 0
|
|
193
|
+
const groups: { label: string; rows: ReactNode[] }[] = []
|
|
194
|
+
for (const group of GROUPS) {
|
|
195
|
+
const rows = sorted
|
|
196
|
+
.filter(i => i.ago >= lower && i.ago < group.until)
|
|
197
|
+
.map(item => (
|
|
198
|
+
<Row
|
|
199
|
+
key={item.id}
|
|
200
|
+
item={item}
|
|
201
|
+
index={index++}
|
|
202
|
+
read={isRead(item)}
|
|
203
|
+
resolved={resolved[item.id]}
|
|
204
|
+
register={hover.registerItem}
|
|
205
|
+
onAction={action => act(item, action)}
|
|
206
|
+
/>
|
|
207
|
+
))
|
|
208
|
+
lower = group.until
|
|
209
|
+
if (rows.length > 0) groups.push({ label: group.label, rows })
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<div className={cn('flex min-h-0 flex-1 flex-col gap-[var(--space-2)]', className)}>
|
|
214
|
+
{header && (
|
|
215
|
+
<div className="flex items-center gap-[var(--space-2)] pl-[var(--space-2)]">
|
|
216
|
+
<span className="text-subtitle text-foreground">Inbox</span>
|
|
217
|
+
{unread > 0 && <span className="text-caption tabular-nums text-muted-foreground">{unread} unread</span>}
|
|
218
|
+
<Button
|
|
219
|
+
variant="ghost"
|
|
220
|
+
size="compact"
|
|
221
|
+
className="ml-auto"
|
|
222
|
+
disabled={unread === 0}
|
|
223
|
+
onClick={() => {
|
|
224
|
+
setAllRead(true)
|
|
225
|
+
onMarkAllRead?.()
|
|
226
|
+
}}
|
|
227
|
+
>
|
|
228
|
+
Mark all read
|
|
229
|
+
</Button>
|
|
230
|
+
</div>
|
|
231
|
+
)}
|
|
232
|
+
{sorted.length === 0 ? (
|
|
233
|
+
<div className="flex flex-col items-center gap-[var(--space-1)] px-[var(--space-4)] py-[var(--space-6)] text-center">
|
|
234
|
+
<Inbox size={20} strokeWidth={1.5} className="text-muted-foreground" />
|
|
235
|
+
<span className="text-body text-foreground">Nothing needs you</span>
|
|
236
|
+
<span className="text-caption text-muted-foreground">
|
|
237
|
+
Waiting sessions, finished turns and failed checks land here.
|
|
238
|
+
</span>
|
|
239
|
+
</div>
|
|
240
|
+
) : (
|
|
241
|
+
<ScrollArea className="min-h-0 flex-1" viewportClassName="scroll-fade">
|
|
242
|
+
{/* Inline-size containment: the scroll content takes the pane's width, so long lines truncate instead of widening it. */}
|
|
243
|
+
<div
|
|
244
|
+
ref={containerRef}
|
|
245
|
+
{...hover.handlers}
|
|
246
|
+
className="@container relative flex flex-col gap-[var(--space-2)]"
|
|
247
|
+
>
|
|
248
|
+
<FluidHoverHighlight hover={hover} className={shape.bg} />
|
|
249
|
+
{groups.map(group => (
|
|
250
|
+
<section key={group.label} aria-label={group.label} className="flex flex-col">
|
|
251
|
+
<span className="px-[var(--space-2)] pb-[var(--space-1)] text-caption text-muted-foreground">
|
|
252
|
+
{group.label}
|
|
253
|
+
</span>
|
|
254
|
+
{group.rows}
|
|
255
|
+
</section>
|
|
256
|
+
))}
|
|
257
|
+
</div>
|
|
258
|
+
</ScrollArea>
|
|
259
|
+
)}
|
|
260
|
+
</div>
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
interface InboxProps {
|
|
265
|
+
/** Everything waiting on the user. */
|
|
266
|
+
items: InboxItem[]
|
|
267
|
+
/** Called when a row is answered or opened: allow / deny a permission, open its session, switch profile on a limit. */
|
|
268
|
+
onAction?: (item: InboxItem, action: InboxAction) => void
|
|
269
|
+
/** Called when Mark all read is pressed. */
|
|
270
|
+
onMarkAllRead?: () => void
|
|
271
|
+
/** Controlled open state. */
|
|
272
|
+
open?: boolean
|
|
273
|
+
/** Initial open state. Defaults to `false`. */
|
|
274
|
+
defaultOpen?: boolean
|
|
275
|
+
/** Called when the panel opens or closes. */
|
|
276
|
+
onOpenChange?: (open: boolean) => void
|
|
277
|
+
/** Which side of the bell the panel opens on. Defaults to `'bottom'`. */
|
|
278
|
+
side?: 'top' | 'right' | 'bottom' | 'left'
|
|
279
|
+
/** Where the panel lines up along that side. Defaults to `'end'`. */
|
|
280
|
+
align?: 'start' | 'center' | 'end'
|
|
281
|
+
/** Replaces the bell (a sidebar row, say); it gets the unread count's label. */
|
|
282
|
+
trigger?: ReactElement
|
|
283
|
+
/** Classes for the bell. */
|
|
284
|
+
className?: string
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Everything across sessions that needs you, behind a bell: permissions,
|
|
289
|
+
* questions and plans waiting, finished turns, failed CI runs and limits
|
|
290
|
+
* running out.
|
|
291
|
+
*
|
|
292
|
+
* The bell carries the unread count. Its panel grows out of it and lists the
|
|
293
|
+
* items by recency (the last hour, today, earlier), each with where it came
|
|
294
|
+
* from (the session, its project and profile) and what to do about it, in
|
|
295
|
+
* place: allow or deny a permission, answer a question, review a plan, open
|
|
296
|
+
* a failed check, switch to a profile with room. A press anywhere else on a
|
|
297
|
+
* row opens its session. Mark all read clears the count. `InboxList` is the
|
|
298
|
+
* list without the bell, for a pane or a page.
|
|
299
|
+
*
|
|
300
|
+
* Statics:
|
|
301
|
+
* - `Inbox.List` — the list on its own: `items`, `onAction`, `onMarkAllRead`, `header`.
|
|
302
|
+
*
|
|
303
|
+
* @example {@include ./examples.mdx}
|
|
304
|
+
*/
|
|
305
|
+
const Inbox = Object.assign(
|
|
306
|
+
function Inbox({
|
|
307
|
+
items,
|
|
308
|
+
onAction,
|
|
309
|
+
onMarkAllRead,
|
|
310
|
+
open,
|
|
311
|
+
defaultOpen = false,
|
|
312
|
+
onOpenChange,
|
|
313
|
+
side = 'bottom',
|
|
314
|
+
align = 'end',
|
|
315
|
+
trigger,
|
|
316
|
+
className,
|
|
317
|
+
}: InboxProps) {
|
|
318
|
+
const Bell = useIcon('bell')
|
|
319
|
+
const [cleared, setCleared] = useState(false)
|
|
320
|
+
const unread = cleared ? 0 : items.filter(i => !i.read).length
|
|
321
|
+
|
|
322
|
+
return (
|
|
323
|
+
<Popover open={open} defaultOpen={defaultOpen} onOpenChange={onOpenChange}>
|
|
324
|
+
<Popover.Trigger
|
|
325
|
+
render={
|
|
326
|
+
trigger ?? (
|
|
327
|
+
<Button
|
|
328
|
+
variant="ghost"
|
|
329
|
+
size="icon-sm"
|
|
330
|
+
aria-label={unread > 0 ? `Inbox, ${unread} unread` : 'Inbox'}
|
|
331
|
+
className={cn('relative', className)}
|
|
332
|
+
>
|
|
333
|
+
<Bell />
|
|
334
|
+
{unread > 0 && (
|
|
335
|
+
<span
|
|
336
|
+
aria-hidden="true"
|
|
337
|
+
className="absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-brand px-1 text-micro tabular-nums text-background"
|
|
338
|
+
>
|
|
339
|
+
{unread > 9 ? '9+' : unread}
|
|
340
|
+
</span>
|
|
341
|
+
)}
|
|
342
|
+
</Button>
|
|
343
|
+
)
|
|
344
|
+
}
|
|
345
|
+
/>
|
|
346
|
+
<Popover.Content
|
|
347
|
+
side={side}
|
|
348
|
+
align={align}
|
|
349
|
+
sideOffset={8}
|
|
350
|
+
className="flex max-h-[520px] w-96 flex-col p-[var(--space-2)]"
|
|
351
|
+
>
|
|
352
|
+
<SizeProvider size="default">
|
|
353
|
+
<InboxList
|
|
354
|
+
items={items}
|
|
355
|
+
onAction={onAction}
|
|
356
|
+
onMarkAllRead={() => {
|
|
357
|
+
setCleared(true)
|
|
358
|
+
onMarkAllRead?.()
|
|
359
|
+
}}
|
|
360
|
+
/>
|
|
361
|
+
</SizeProvider>
|
|
362
|
+
</Popover.Content>
|
|
363
|
+
</Popover>
|
|
364
|
+
)
|
|
365
|
+
},
|
|
366
|
+
{ List: InboxList },
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
export type { InboxListProps, InboxProps }
|
|
370
|
+
export { Inbox, InboxList }
|
|
371
|
+
|
|
372
|
+
export default Inbox
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import SessionBoard from './index'
|
|
2
|
+
import { SESSIONS } from '../../../mock/mock'
|
|
3
|
+
|
|
4
|
+
# By project
|
|
5
|
+
|
|
6
|
+
The sidebar's groups and order, widened: each row names its profile and project, what it waits on or where its tasks stand, and its last activity. The canvas session waits on a permission: allow or deny it from the row, or answer it in its open card. Open the Meter session too: each open row is its own card.
|
|
7
|
+
|
|
8
|
+
<div className="w-full">
|
|
9
|
+
<SessionBoard {...SESSIONS} defaultOpen={['canvas', 'meter']} />
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
# By state
|
|
13
|
+
|
|
14
|
+
The same rows by what each session needs from you. The Postgres question opens with its options, answerable in place.
|
|
15
|
+
|
|
16
|
+
<div className="w-full">
|
|
17
|
+
<SessionBoard {...SESSIONS} defaultView="state" defaultOpen={['pg']} />
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
# Filtered
|
|
21
|
+
|
|
22
|
+
`defaultFilter="profile:work"` shows only the work profile's sessions; "Show all" clears it.
|
|
23
|
+
|
|
24
|
+
<div className="w-full">
|
|
25
|
+
<SessionBoard {...SESSIONS} defaultFilter="profile:work" />
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
# Narrow
|
|
29
|
+
|
|
30
|
+
Below the wide breakpoints the project and status columns fold away and Allow / Deny shrink to icons.
|
|
31
|
+
|
|
32
|
+
<div className="w-full max-w-[420px]">
|
|
33
|
+
<SessionBoard {...SESSIONS} defaultOpen={['canvas']} />
|
|
34
|
+
</div>
|