@asanchez-sa/abby 0.0.0-stage → 0.1.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/README.md +217 -2
- package/dist/_virtual/_rolldown/runtime.js +26 -0
- package/dist/agents/approvals.d.ts +46 -0
- package/dist/agents/approvals.js +58 -0
- package/dist/agents/changes.d.ts +21 -0
- package/dist/agents/changes.js +21 -0
- package/dist/agents/hooks.d.ts +20 -0
- package/dist/agents/hooks.js +58 -0
- package/dist/agents/index.d.ts +11 -0
- package/dist/agents/index.js +9 -0
- package/dist/agents/run-tool.d.ts +44 -0
- package/dist/agents/run-tool.js +79 -0
- package/dist/agents/ui-sdk.d.ts +5 -0
- package/dist/agents/ui-sdk.js +3 -0
- package/dist/behaviors/canvas/index.d.ts +2 -0
- package/dist/behaviors/canvas/index.js +1 -0
- package/dist/behaviors/canvas/ui-sdk.d.ts +2 -0
- package/dist/behaviors/canvas/ui-sdk.js +1 -0
- package/dist/behaviors/drag-and-drop/index.d.ts +2 -0
- package/dist/behaviors/drag-and-drop/index.js +1 -0
- package/dist/behaviors/drag-and-drop/ui-sdk.d.ts +2 -0
- package/dist/behaviors/drag-and-drop/ui-sdk.js +1 -0
- package/dist/behaviors/dragging/index.d.ts +2 -0
- package/dist/behaviors/dragging/index.js +1 -0
- package/dist/behaviors/dragging/ui-sdk.d.ts +2 -0
- package/dist/behaviors/dragging/ui-sdk.js +1 -0
- package/dist/behaviors/focus/index.d.ts +2 -0
- package/dist/behaviors/focus/index.js +1 -0
- package/dist/behaviors/focus/ui-sdk.d.ts +2 -0
- package/dist/behaviors/focus/ui-sdk.js +1 -0
- package/dist/behaviors/lists/index.d.ts +3 -0
- package/dist/behaviors/lists/index.js +3 -0
- package/dist/behaviors/lists/ui-sdk.d.ts +3 -0
- package/dist/behaviors/lists/ui-sdk.js +3 -0
- package/dist/behaviors/popups/index.d.ts +3 -0
- package/dist/behaviors/popups/index.js +3 -0
- package/dist/behaviors/popups/ui-sdk.d.ts +3 -0
- package/dist/behaviors/popups/ui-sdk.js +3 -0
- package/dist/behaviors/preferences/index.d.ts +3 -0
- package/dist/behaviors/preferences/index.js +3 -0
- package/dist/behaviors/preferences/ui-sdk.d.ts +3 -0
- package/dist/behaviors/preferences/ui-sdk.js +3 -0
- package/dist/behaviors/selection/index.d.ts +3 -0
- package/dist/behaviors/selection/index.js +3 -0
- package/dist/behaviors/selection/indicator.d.ts +13 -0
- package/dist/behaviors/selection/indicator.js +20 -0
- package/dist/behaviors/selection/ui-sdk.d.ts +2 -0
- package/dist/behaviors/selection/ui-sdk.js +1 -0
- package/dist/behaviors/transitions/index.d.ts +3 -0
- package/dist/behaviors/transitions/index.js +3 -0
- package/dist/behaviors/transitions/ui-sdk.d.ts +3 -0
- package/dist/behaviors/transitions/ui-sdk.js +3 -0
- package/dist/behaviors/trees/index.d.ts +2 -0
- package/dist/behaviors/trees/index.js +1 -0
- package/dist/behaviors/trees/ui-sdk.d.ts +2 -0
- package/dist/behaviors/trees/ui-sdk.js +1 -0
- package/dist/components/accordion/accordion.d.ts +13 -0
- package/dist/components/accordion/accordion.js +165 -0
- package/dist/components/alert/alert.d.ts +13 -0
- package/dist/components/alert/alert.js +131 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +15 -0
- package/dist/components/alert-dialog/alert-dialog.js +257 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +7 -0
- package/dist/components/aspect-ratio/aspect-ratio.js +57 -0
- package/dist/components/attachment/attachment.d.ts +48 -0
- package/dist/components/attachment/attachment.js +372 -0
- package/dist/components/autocomplete/autocomplete.d.ts +32 -0
- package/dist/components/autocomplete/autocomplete.js +466 -0
- package/dist/components/avatar/avatar.d.ts +6 -0
- package/dist/components/avatar/avatar.js +100 -0
- package/dist/components/avatar-group/avatar-group.d.ts +9 -0
- package/dist/components/avatar-group/avatar-group.js +75 -0
- package/dist/components/badge/badge.d.ts +15 -0
- package/dist/components/badge/badge.js +31 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +24 -0
- package/dist/components/breadcrumb/breadcrumb.js +279 -0
- package/dist/components/bubble/bubble.d.ts +26 -0
- package/dist/components/bubble/bubble.js +173 -0
- package/dist/components/button/button.d.ts +18 -0
- package/dist/components/button/button.js +91 -0
- package/dist/components/button-group/button-group.d.ts +15 -0
- package/dist/components/button-group/button-group.js +71 -0
- package/dist/components/calendar/calendar.d.ts +29 -0
- package/dist/components/calendar/calendar.js +453 -0
- package/dist/components/card/card.d.ts +14 -0
- package/dist/components/card/card.js +213 -0
- package/dist/components/carousel/carousel.d.ts +16 -0
- package/dist/components/carousel/carousel.js +364 -0
- package/dist/components/chain-of-thought/chain-of-thought.d.ts +72 -0
- package/dist/components/chain-of-thought/chain-of-thought.js +491 -0
- package/dist/components/chat/chat.d.ts +48 -0
- package/dist/components/chat/chat.js +207 -0
- package/dist/components/checkbox/checkbox.d.ts +10 -0
- package/dist/components/checkbox/checkbox.js +118 -0
- package/dist/components/checkpoint/checkpoint.d.ts +24 -0
- package/dist/components/checkpoint/checkpoint.js +178 -0
- package/dist/components/choice-cards/choice-cards.d.ts +38 -0
- package/dist/components/choice-cards/choice-cards.js +255 -0
- package/dist/components/code-block/code-block.d.ts +58 -0
- package/dist/components/code-block/code-block.js +506 -0
- package/dist/components/code-block/highlighter.js +96 -0
- package/dist/components/code-block/use-highlighted-code.d.ts +11 -0
- package/dist/components/code-block/use-highlighted-code.js +54 -0
- package/dist/components/collapsible/collapsible.d.ts +10 -0
- package/dist/components/collapsible/collapsible.js +92 -0
- package/dist/components/color-picker/color-picker.d.ts +17 -0
- package/dist/components/color-picker/color-picker.js +395 -0
- package/dist/components/combobox/combobox.d.ts +54 -0
- package/dist/components/combobox/combobox.js +683 -0
- package/dist/components/command/command.d.ts +23 -0
- package/dist/components/command/command.js +373 -0
- package/dist/components/command-dock/command-dock.d.ts +118 -0
- package/dist/components/command-dock/command-dock.js +944 -0
- package/dist/components/confirmation/confirmation.d.ts +58 -0
- package/dist/components/confirmation/confirmation.js +181 -0
- package/dist/components/context/context.d.ts +82 -0
- package/dist/components/context/context.js +490 -0
- package/dist/components/date-input/date-input.d.ts +16 -0
- package/dist/components/date-input/date-input.js +89 -0
- package/dist/components/date-picker/date-picker.d.ts +28 -0
- package/dist/components/date-picker/date-picker.js +361 -0
- package/dist/components/dialog/dialog.d.ts +14 -0
- package/dist/components/dialog/dialog.js +261 -0
- package/dist/components/drawer/drawer.d.ts +16 -0
- package/dist/components/drawer/drawer.js +309 -0
- package/dist/components/empty/empty.d.ts +18 -0
- package/dist/components/empty/empty.js +192 -0
- package/dist/components/field/field.d.ts +15 -0
- package/dist/components/field/field.js +261 -0
- package/dist/components/file-input/file-input.d.ts +12 -0
- package/dist/components/file-input/file-input.js +216 -0
- package/dist/components/file-tree/file-tree.d.ts +45 -0
- package/dist/components/file-tree/file-tree.js +283 -0
- package/dist/components/hover-card/hover-card.d.ts +10 -0
- package/dist/components/hover-card/hover-card.js +118 -0
- package/dist/components/icon/icon.d.ts +14 -0
- package/dist/components/icon/icon.js +60 -0
- package/dist/components/image-cropper/image-cropper.d.ts +15 -0
- package/dist/components/image-cropper/image-cropper.js +334 -0
- package/dist/components/inline-citation/inline-citation.d.ts +46 -0
- package/dist/components/inline-citation/inline-citation.js +269 -0
- package/dist/components/input/input.d.ts +9 -0
- package/dist/components/input/input.js +43 -0
- package/dist/components/input-group/input-group.d.ts +42 -0
- package/dist/components/input-group/input-group.js +192 -0
- package/dist/components/item/item.d.ts +32 -0
- package/dist/components/item/item.js +394 -0
- package/dist/components/kbd/kbd.d.ts +9 -0
- package/dist/components/kbd/kbd.js +75 -0
- package/dist/components/label/label.d.ts +6 -0
- package/dist/components/label/label.js +40 -0
- package/dist/components/link/link.d.ts +21 -0
- package/dist/components/link/link.js +126 -0
- package/dist/components/listbox/listbox.d.ts +20 -0
- package/dist/components/listbox/listbox.js +199 -0
- package/dist/components/marker/marker.d.ts +11 -0
- package/dist/components/marker/marker.js +88 -0
- package/dist/components/menu/menu.d.ts +38 -0
- package/dist/components/menu/menu.js +553 -0
- package/dist/components/menubar/menubar.d.ts +9 -0
- package/dist/components/menubar/menubar.js +47 -0
- package/dist/components/message/message.d.ts +44 -0
- package/dist/components/message/message.js +328 -0
- package/dist/components/message-scroller/message-scroller.d.ts +111 -0
- package/dist/components/message-scroller/message-scroller.js +957 -0
- package/dist/components/meter/meter.d.ts +8 -0
- package/dist/components/meter/meter.js +162 -0
- package/dist/components/model-selector/model-selector.d.ts +155 -0
- package/dist/components/model-selector/model-selector.js +905 -0
- package/dist/components/native-select/native-select.d.ts +27 -0
- package/dist/components/native-select/native-select.js +226 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +29 -0
- package/dist/components/navigation-menu/navigation-menu.js +318 -0
- package/dist/components/not-label.js +9 -0
- package/dist/components/note-editor/blocks.d.ts +22 -0
- package/dist/components/note-editor/blocks.js +245 -0
- package/dist/components/note-editor/diff.d.ts +19 -0
- package/dist/components/note-editor/diff.js +64 -0
- package/dist/components/note-editor/editor.js +249 -0
- package/dist/components/note-editor/note-editor.d.ts +109 -0
- package/dist/components/note-editor/note-editor.js +954 -0
- package/dist/components/note-editor/parts/comments.d.ts +24 -0
- package/dist/components/note-editor/parts/comments.js +336 -0
- package/dist/components/note-editor/parts/header.d.ts +25 -0
- package/dist/components/note-editor/parts/header.js +263 -0
- package/dist/components/note-editor/parts/history.d.ts +56 -0
- package/dist/components/note-editor/parts/history.js +409 -0
- package/dist/components/note-editor/parts/presence.d.ts +31 -0
- package/dist/components/note-editor/parts/presence.js +140 -0
- package/dist/components/note-editor/parts/suggestions.d.ts +45 -0
- package/dist/components/note-editor/parts/suggestions.js +316 -0
- package/dist/components/note-editor/parts/toolbar.d.ts +38 -0
- package/dist/components/note-editor/parts/toolbar.js +683 -0
- package/dist/components/note-editor/people.d.ts +84 -0
- package/dist/components/note-editor/people.js +276 -0
- package/dist/components/note-editor/person.d.ts +11 -0
- package/dist/components/note-editor/person.js +15 -0
- package/dist/components/note-place/note-place.d.ts +42 -0
- package/dist/components/note-place/note-place.js +256 -0
- package/dist/components/note-status/note-status.d.ts +59 -0
- package/dist/components/note-status/note-status.js +380 -0
- package/dist/components/number-input/number-input.d.ts +12 -0
- package/dist/components/number-input/number-input.js +252 -0
- package/dist/components/otp-input/otp-input.d.ts +12 -0
- package/dist/components/otp-input/otp-input.js +136 -0
- package/dist/components/pagination/pagination.d.ts +23 -0
- package/dist/components/pagination/pagination.js +218 -0
- package/dist/components/password-input/password-input.d.ts +11 -0
- package/dist/components/password-input/password-input.js +117 -0
- package/dist/components/plan/plan.d.ts +51 -0
- package/dist/components/plan/plan.js +320 -0
- package/dist/components/popover/popover.d.ts +16 -0
- package/dist/components/popover/popover.js +268 -0
- package/dist/components/preferences/preferences.d.ts +5 -0
- package/dist/components/preferences/preferences.js +18 -0
- package/dist/components/progress/progress.d.ts +8 -0
- package/dist/components/progress/progress.js +162 -0
- package/dist/components/prompt-input/prompt-input.d.ts +247 -0
- package/dist/components/prompt-input/prompt-input.js +1367 -0
- package/dist/components/questionnaire/questionnaire.d.ts +174 -0
- package/dist/components/questionnaire/questionnaire.js +1628 -0
- package/dist/components/queue/queue.d.ts +82 -0
- package/dist/components/queue/queue.js +471 -0
- package/dist/components/radio/radio.d.ts +7 -0
- package/dist/components/radio/radio.js +101 -0
- package/dist/components/rating/rating.d.ts +10 -0
- package/dist/components/rating/rating.js +95 -0
- package/dist/components/reasoning/reasoning.d.ts +50 -0
- package/dist/components/reasoning/reasoning.js +233 -0
- package/dist/components/resizable/resizable.d.ts +6 -0
- package/dist/components/resizable/resizable.js +100 -0
- package/dist/components/scroll-area/scroll-area.d.ts +17 -0
- package/dist/components/scroll-area/scroll-area.js +211 -0
- package/dist/components/segmented-control/segmented-control.d.ts +16 -0
- package/dist/components/segmented-control/segmented-control.js +142 -0
- package/dist/components/select/select.d.ts +43 -0
- package/dist/components/select/select.js +577 -0
- package/dist/components/separator/separator.d.ts +4 -0
- package/dist/components/separator/separator.js +38 -0
- package/dist/components/sheet/sheet.d.ts +24 -0
- package/dist/components/sheet/sheet.js +330 -0
- package/dist/components/sidebar/sidebar.d.ts +138 -0
- package/dist/components/sidebar/sidebar.js +1374 -0
- package/dist/components/skeleton/skeleton.d.ts +4 -0
- package/dist/components/skeleton/skeleton.js +40 -0
- package/dist/components/slider/slider.d.ts +9 -0
- package/dist/components/slider/slider.js +193 -0
- package/dist/components/sources/sources.d.ts +35 -0
- package/dist/components/sources/sources.js +209 -0
- package/dist/components/spinner/spinner.d.ts +11 -0
- package/dist/components/spinner/spinner.js +59 -0
- package/dist/components/stack-trace/parse-stack-trace.d.ts +21 -0
- package/dist/components/stack-trace/parse-stack-trace.js +61 -0
- package/dist/components/stack-trace/stack-trace.d.ts +79 -0
- package/dist/components/stack-trace/stack-trace.js +434 -0
- package/dist/components/subagent/subagent.d.ts +71 -0
- package/dist/components/subagent/subagent.js +450 -0
- package/dist/components/suggestion/suggestion.d.ts +21 -0
- package/dist/components/suggestion/suggestion.js +130 -0
- package/dist/components/switch/switch.d.ts +6 -0
- package/dist/components/switch/switch.js +70 -0
- package/dist/components/table/table.d.ts +19 -0
- package/dist/components/table/table.js +284 -0
- package/dist/components/table-of-contents/spy.js +84 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +92 -0
- package/dist/components/table-of-contents/table-of-contents.js +787 -0
- package/dist/components/tabs/tabs.d.ts +25 -0
- package/dist/components/tabs/tabs.js +273 -0
- package/dist/components/task/task.d.ts +40 -0
- package/dist/components/task/task.js +262 -0
- package/dist/components/terminal/terminal.d.ts +82 -0
- package/dist/components/terminal/terminal.js +457 -0
- package/dist/components/test-results/test-results.d.ts +127 -0
- package/dist/components/test-results/test-results.js +687 -0
- package/dist/components/textarea/textarea.d.ts +8 -0
- package/dist/components/textarea/textarea.js +43 -0
- package/dist/components/time-input/time-input.d.ts +7 -0
- package/dist/components/time-input/time-input.js +82 -0
- package/dist/components/timeline/timeline.d.ts +19 -0
- package/dist/components/timeline/timeline.js +247 -0
- package/dist/components/toast/toast.d.ts +12 -0
- package/dist/components/toast/toast.js +285 -0
- package/dist/components/toggle/toggle.d.ts +15 -0
- package/dist/components/toggle/toggle.js +137 -0
- package/dist/components/token-input/token-input.d.ts +7 -0
- package/dist/components/token-input/token-input.js +117 -0
- package/dist/components/tool/tool.d.ts +66 -0
- package/dist/components/tool/tool.js +413 -0
- package/dist/components/toolbar/toolbar.d.ts +91 -0
- package/dist/components/toolbar/toolbar.js +655 -0
- package/dist/components/tooltip/tooltip.d.ts +8 -0
- package/dist/components/tooltip/tooltip.js +97 -0
- package/dist/components/trace/trace.d.ts +31 -0
- package/dist/components/trace/trace.js +309 -0
- package/dist/components/tree/tree.d.ts +13 -0
- package/dist/components/tree/tree.js +258 -0
- package/dist/components/trigger-menu/trigger-menu.d.ts +30 -0
- package/dist/components/trigger-menu/trigger-menu.js +352 -0
- package/dist/components/usage/usage.d.ts +132 -0
- package/dist/components/usage/usage.js +1368 -0
- package/dist/components/waterfall/waterfall.d.ts +20 -0
- package/dist/components/waterfall/waterfall.js +360 -0
- package/dist/components/week-strip/week-strip.d.ts +177 -0
- package/dist/components/week-strip/week-strip.js +1081 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.js +27 -0
- package/dist/core/ui-sdk.d.ts +3 -0
- package/dist/core/ui-sdk.js +3 -0
- package/dist/core/use-primitive-state.d.ts +14 -0
- package/dist/core/use-primitive-state.js +25 -0
- package/dist/styles/LICENSE-shadcn.md +21 -0
- package/dist/styles/color-scheme.css +32 -0
- package/dist/styles/components.css +303 -0
- package/dist/styles/index.css +41 -0
- package/dist/styles/tokens.css +474 -0
- package/dist/styles/typeset/shadcn.css +506 -0
- package/dist/styles/typeset.css +70 -0
- package/dist/styles/utilities.css +555 -0
- package/dist/tools/observe/index.d.ts +2 -0
- package/dist/tools/observe/index.js +3 -0
- package/dist/tools/observe/ui-sdk.d.ts +1 -0
- package/dist/tools/observe/ui-sdk.js +2 -0
- package/dist/tools/testing/check-agent.d.ts +28 -0
- package/dist/tools/testing/check-agent.js +42 -0
- package/dist/tools/testing/index.d.ts +4 -0
- package/dist/tools/testing/index.js +4 -0
- package/dist/tools/testing/ui-sdk.d.ts +1 -0
- package/dist/tools/testing/ui-sdk.js +2 -0
- package/dist/utilities/cn/index.d.ts +12 -0
- package/dist/utilities/cn/index.js +47 -0
- package/dist/utilities/color/index.d.ts +2 -0
- package/dist/utilities/color/index.js +3 -0
- package/dist/utilities/color/ui-sdk.d.ts +1 -0
- package/dist/utilities/color/ui-sdk.js +2 -0
- package/dist/utilities/date/index.d.ts +2 -0
- package/dist/utilities/date/index.js +6 -0
- package/dist/utilities/date/ui-sdk.d.ts +1 -0
- package/dist/utilities/date/ui-sdk.js +2 -0
- package/dist/utilities/image/index.d.ts +2 -0
- package/dist/utilities/image/index.js +3 -0
- package/dist/utilities/image/ui-sdk.d.ts +1 -0
- package/dist/utilities/image/ui-sdk.js +2 -0
- package/dist/utilities/mobile/index.d.ts +2 -0
- package/dist/utilities/mobile/index.js +1 -0
- package/dist/utilities/mobile/ui-sdk.d.ts +2 -0
- package/dist/utilities/mobile/ui-sdk.js +1 -0
- package/dist/utilities/number/index.d.ts +2 -0
- package/dist/utilities/number/index.js +3 -0
- package/dist/utilities/number/ui-sdk.d.ts +1 -0
- package/dist/utilities/number/ui-sdk.js +2 -0
- package/dist/utilities/platform/index.d.ts +3 -0
- package/dist/utilities/platform/index.js +14 -0
- package/dist/utilities/platform/ui-sdk.d.ts +3 -0
- package/dist/utilities/platform/ui-sdk.js +3 -0
- package/dist/utilities/storage/index.d.ts +2 -0
- package/dist/utilities/storage/index.js +1 -0
- package/dist/utilities/storage/ui-sdk.d.ts +2 -0
- package/dist/utilities/storage/ui-sdk.js +1 -0
- package/dist/utilities/text/index.d.ts +3 -0
- package/dist/utilities/text/index.js +3 -0
- package/dist/utilities/text/ui-sdk.d.ts +3 -0
- package/dist/utilities/text/ui-sdk.js +3 -0
- package/package.json +192 -4
- package/skills/agent-ready-ui/SKILL.md +229 -0
- package/skills/blocks/SKILL.md +262 -0
- package/skills/compose-screens/SKILL.md +354 -0
- package/skills/note-editor/SKILL.md +493 -0
- package/skills/note-status/SKILL.md +295 -0
- package/skills/setup/SKILL.md +136 -0
- package/skills/theming/SKILL.md +216 -0
- package/src/blocks/notes/adapters.ts +77 -0
- package/src/blocks/notes/data.ts +508 -0
- package/src/blocks/notes/notes-block.tsx +244 -0
- package/src/blocks/notes/parts/home.tsx +219 -0
- package/src/blocks/notes/parts/no-access.tsx +84 -0
- package/src/blocks/notes/parts/note-screen.tsx +412 -0
- package/src/blocks/notes/parts/notes-sidebar.tsx +277 -0
- package/src/blocks/notes/parts/panels.tsx +393 -0
- package/src/blocks/notes/parts/place.ts +15 -0
- package/src/blocks/notes/parts/review-dialog.tsx +159 -0
- package/src/blocks/notes/parts/share.tsx +172 -0
- package/src/blocks/notes/texts.ts +135 -0
- package/src/blocks/shell/adapters.ts +69 -0
- package/src/blocks/shell/data.ts +281 -0
- package/src/blocks/shell/parts/compose.tsx +292 -0
- package/src/blocks/shell/parts/home.tsx +203 -0
- package/src/blocks/shell/parts/marks.tsx +144 -0
- package/src/blocks/shell/parts/rail.tsx +166 -0
- package/src/blocks/shell/parts/rooms-column.tsx +326 -0
- package/src/blocks/shell/shell-block.tsx +210 -0
- package/src/blocks/shell/texts.ts +80 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Cancel01Icon,
|
|
5
|
+
CheckmarkCircle02Icon,
|
|
6
|
+
DashedLineCircleIcon,
|
|
7
|
+
File01Icon,
|
|
8
|
+
SquareLock02Icon,
|
|
9
|
+
Message01Icon,
|
|
10
|
+
PencilEdit02Icon,
|
|
11
|
+
ProgressIcon,
|
|
12
|
+
UserGroupIcon,
|
|
13
|
+
} from "@hugeicons/core-free-icons";
|
|
14
|
+
import { AvatarGroup } from "abby/avatar-group";
|
|
15
|
+
import { Avatar, AvatarFallback } from "abby/avatar";
|
|
16
|
+
import { Bubble, BubbleContent } from "abby/bubble";
|
|
17
|
+
import { Button } from "abby/button";
|
|
18
|
+
import { Icon } from "abby/icon";
|
|
19
|
+
import { InputGroupAddon } from "abby/input-group";
|
|
20
|
+
import { Message, MessageContent } from "abby/message";
|
|
21
|
+
import {
|
|
22
|
+
NoteEditorAssistantMark,
|
|
23
|
+
NoteEditorHistory,
|
|
24
|
+
NoteEditorHistoryDay,
|
|
25
|
+
NoteEditorHistoryEvent,
|
|
26
|
+
NoteEditorHistoryEventAction,
|
|
27
|
+
NoteEditorHistoryEventDetail,
|
|
28
|
+
NoteEditorHistoryEventQuote,
|
|
29
|
+
NoteEditorHistoryEventTitle,
|
|
30
|
+
} from "abby/note-editor";
|
|
31
|
+
import { NoteLiveDots, NoteStatusIcon } from "abby/note-status";
|
|
32
|
+
import { PromptInput, PromptInputSubmit, PromptInputTextarea } from "abby/prompt-input";
|
|
33
|
+
import { SegmentedControl, SegmentedControlItem } from "abby/segmented-control";
|
|
34
|
+
import { cn } from "abby/utilities/cn";
|
|
35
|
+
import { Fragment, useState, type ReactNode } from "react";
|
|
36
|
+
import type { NotesHistoryEvent, NotesNote } from "../data.ts";
|
|
37
|
+
import type { NotesTexts } from "../texts.ts";
|
|
38
|
+
|
|
39
|
+
// The column beside the note: the assistant, the note's history, or what a
|
|
40
|
+
// note in Memory saved. One at a time, and closed in focus mode.
|
|
41
|
+
|
|
42
|
+
/** A panel's frame: its title, a close button and what scrolls under them. */
|
|
43
|
+
function Panel({
|
|
44
|
+
label,
|
|
45
|
+
title,
|
|
46
|
+
end,
|
|
47
|
+
texts,
|
|
48
|
+
onClose,
|
|
49
|
+
footer,
|
|
50
|
+
children,
|
|
51
|
+
}: {
|
|
52
|
+
label: string;
|
|
53
|
+
/** The panel's heading. Without it, the content has its own. */
|
|
54
|
+
title?: ReactNode;
|
|
55
|
+
end?: ReactNode;
|
|
56
|
+
texts: NotesTexts;
|
|
57
|
+
onClose?: () => void;
|
|
58
|
+
footer?: ReactNode;
|
|
59
|
+
children: ReactNode;
|
|
60
|
+
}) {
|
|
61
|
+
const close = onClose && (
|
|
62
|
+
<Button variant="ghost" size="icon-xs" aria-label={texts.closePanel} onClick={onClose}>
|
|
63
|
+
<Icon icon={Cancel01Icon} />
|
|
64
|
+
</Button>
|
|
65
|
+
);
|
|
66
|
+
return (
|
|
67
|
+
<aside
|
|
68
|
+
aria-label={label}
|
|
69
|
+
data-slot="notes-panel"
|
|
70
|
+
className="relative hidden w-85 shrink-0 flex-col border-s border-border lg:flex"
|
|
71
|
+
>
|
|
72
|
+
{title ? (
|
|
73
|
+
<div className="flex h-12 shrink-0 items-center gap-2 px-4">
|
|
74
|
+
<h2 className="flex min-w-0 flex-1 items-center gap-2 text-label">{title}</h2>
|
|
75
|
+
{end}
|
|
76
|
+
{close}
|
|
77
|
+
</div>
|
|
78
|
+
) : (
|
|
79
|
+
// The content's own heading takes the first row; the close button sits at its end.
|
|
80
|
+
<div className="absolute end-4 top-3.5 z-10">{close}</div>
|
|
81
|
+
)}
|
|
82
|
+
<div
|
|
83
|
+
className={cn(
|
|
84
|
+
"flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto px-4 pb-4",
|
|
85
|
+
!title && "pt-3",
|
|
86
|
+
)}
|
|
87
|
+
>
|
|
88
|
+
{children}
|
|
89
|
+
</div>
|
|
90
|
+
{footer && <div className="shrink-0 p-3">{footer}</div>}
|
|
91
|
+
</aside>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Bold where the data says `**…**`, as the history's lines write their people. */
|
|
96
|
+
function strong(text: string) {
|
|
97
|
+
return text
|
|
98
|
+
.split(/\*\*(.+?)\*\*/)
|
|
99
|
+
.map((part, index) =>
|
|
100
|
+
index % 2 ? <strong key={index}>{part}</strong> : <Fragment key={index}>{part}</Fragment>,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
type AssistantPanelProps = {
|
|
105
|
+
note: NotesNote;
|
|
106
|
+
area: string;
|
|
107
|
+
texts: NotesTexts;
|
|
108
|
+
onClose: () => void;
|
|
109
|
+
onOpenTo: () => void;
|
|
110
|
+
onAsk: (question: string) => Promise<string>;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export function AssistantPanel({
|
|
114
|
+
note,
|
|
115
|
+
area,
|
|
116
|
+
texts,
|
|
117
|
+
onClose,
|
|
118
|
+
onOpenTo,
|
|
119
|
+
onAsk,
|
|
120
|
+
}: AssistantPanelProps) {
|
|
121
|
+
const [messages, setMessages] = useState(note.assistant?.messages ?? []);
|
|
122
|
+
const [busy, setBusy] = useState(false);
|
|
123
|
+
const related = note.assistant?.related ?? [];
|
|
124
|
+
const shared = note.access !== "private";
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<Panel
|
|
128
|
+
label={texts.assistant}
|
|
129
|
+
title={
|
|
130
|
+
<>
|
|
131
|
+
<NoteEditorAssistantMark />
|
|
132
|
+
{texts.assistant}
|
|
133
|
+
</>
|
|
134
|
+
}
|
|
135
|
+
texts={texts}
|
|
136
|
+
onClose={onClose}
|
|
137
|
+
footer={
|
|
138
|
+
shared && (
|
|
139
|
+
<PromptInput
|
|
140
|
+
status={busy ? "submitted" : "ready"}
|
|
141
|
+
onSubmit={async ({ text }) => {
|
|
142
|
+
setMessages((all) => [...all, { from: "person", text }]);
|
|
143
|
+
setBusy(true);
|
|
144
|
+
const answer = await onAsk(text).catch((error: Error) => error.message);
|
|
145
|
+
setMessages((all) => [...all, { from: "assistant", text: answer }]);
|
|
146
|
+
setBusy(false);
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
<PromptInputTextarea aria-label={texts.question} placeholder={texts.askPlaceholder} />
|
|
150
|
+
<InputGroupAddon align="inline-end">
|
|
151
|
+
<PromptInputSubmit />
|
|
152
|
+
</InputGroupAddon>
|
|
153
|
+
</PromptInput>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
>
|
|
157
|
+
{!shared ? (
|
|
158
|
+
// The assistant doesn't read a note only its author can: a line, and a way to share it.
|
|
159
|
+
<div className="flex flex-col items-start gap-3">
|
|
160
|
+
<p className="flex gap-2 text-sm text-muted-foreground">
|
|
161
|
+
<Icon icon={SquareLock02Icon} className="mt-0.5 size-3.5 shrink-0 text-subtle" />
|
|
162
|
+
{texts.privateNote}
|
|
163
|
+
</p>
|
|
164
|
+
<Button variant="outline" size="sm" onClick={onOpenTo}>
|
|
165
|
+
{texts.openTo(area)}
|
|
166
|
+
</Button>
|
|
167
|
+
</div>
|
|
168
|
+
) : (
|
|
169
|
+
<>
|
|
170
|
+
{related.length > 0 && (
|
|
171
|
+
<section className="flex flex-col gap-3">
|
|
172
|
+
<h3 className="text-xs text-subtle">{texts.touches(related.length)}</h3>
|
|
173
|
+
<ul className="flex flex-col gap-3">
|
|
174
|
+
{related.map((each) => (
|
|
175
|
+
<li key={each.title} className="flex gap-2">
|
|
176
|
+
<span
|
|
177
|
+
aria-hidden="true"
|
|
178
|
+
className="mt-1.5 size-2 shrink-0 rounded-2xs bg-chart-1"
|
|
179
|
+
/>
|
|
180
|
+
<div className="min-w-0 flex-1">
|
|
181
|
+
<p className="text-sm font-medium">{each.title}</p>
|
|
182
|
+
<p className="text-xs text-muted-foreground">{each.line}</p>
|
|
183
|
+
</div>
|
|
184
|
+
<NoteStatusIcon status={each.status} className="mt-1" />
|
|
185
|
+
</li>
|
|
186
|
+
))}
|
|
187
|
+
</ul>
|
|
188
|
+
{note.assistant?.conflict && (
|
|
189
|
+
<p className="flex gap-2 text-xs text-muted-foreground">
|
|
190
|
+
<span
|
|
191
|
+
aria-hidden="true"
|
|
192
|
+
className="mt-1.5 size-1.5 shrink-0 rounded-full bg-warning"
|
|
193
|
+
/>
|
|
194
|
+
{note.assistant.conflict}
|
|
195
|
+
</p>
|
|
196
|
+
)}
|
|
197
|
+
</section>
|
|
198
|
+
)}
|
|
199
|
+
<div role="log" aria-label={texts.assistant} className="flex flex-col gap-4">
|
|
200
|
+
{messages.map((message, index) =>
|
|
201
|
+
message.from === "person" ? (
|
|
202
|
+
<Message key={index} align="end">
|
|
203
|
+
<MessageContent>
|
|
204
|
+
<Bubble variant="muted">
|
|
205
|
+
<BubbleContent className="text-sm">{message.text}</BubbleContent>
|
|
206
|
+
</Bubble>
|
|
207
|
+
</MessageContent>
|
|
208
|
+
</Message>
|
|
209
|
+
) : (
|
|
210
|
+
<Message key={index}>
|
|
211
|
+
<MessageContent className="flex-row gap-2 text-sm">
|
|
212
|
+
<NoteEditorAssistantMark className="mt-1 shrink-0" />
|
|
213
|
+
<p>{message.text}</p>
|
|
214
|
+
</MessageContent>
|
|
215
|
+
</Message>
|
|
216
|
+
),
|
|
217
|
+
)}
|
|
218
|
+
{busy && (
|
|
219
|
+
<p role="status" className="shimmer text-sm text-muted-foreground">
|
|
220
|
+
{texts.thinking}
|
|
221
|
+
</p>
|
|
222
|
+
)}
|
|
223
|
+
</div>
|
|
224
|
+
</>
|
|
225
|
+
)}
|
|
226
|
+
</Panel>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const historyIcons = {
|
|
231
|
+
edit: PencilEdit02Icon,
|
|
232
|
+
share: UserGroupIcon,
|
|
233
|
+
status: ProgressIcon,
|
|
234
|
+
create: DashedLineCircleIcon,
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
type HistoryPanelProps = {
|
|
238
|
+
note: NotesNote;
|
|
239
|
+
texts: NotesTexts;
|
|
240
|
+
/** The version on screen, if one is. */
|
|
241
|
+
viewing?: string;
|
|
242
|
+
onView: (version: string) => void;
|
|
243
|
+
onClose: () => void;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
type HistoryFilter = "all" | "people" | "suggestions" | "statuses";
|
|
247
|
+
|
|
248
|
+
const kinds: Record<Exclude<HistoryFilter, "all">, NotesHistoryEvent["kind"][]> = {
|
|
249
|
+
people: ["edit", "share", "create"],
|
|
250
|
+
suggestions: ["assistant"],
|
|
251
|
+
statuses: ["status"],
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export function HistoryPanel({ note, texts, viewing, onView, onClose }: HistoryPanelProps) {
|
|
255
|
+
const [show, setShow] = useState<HistoryFilter>("all");
|
|
256
|
+
const events = (note.history ?? []).filter(
|
|
257
|
+
(event) => show === "all" || kinds[show].includes(event.kind),
|
|
258
|
+
);
|
|
259
|
+
const days = [...new Set(events.map((event) => event.day))];
|
|
260
|
+
|
|
261
|
+
return (
|
|
262
|
+
// The history column draws its own heading.
|
|
263
|
+
<Panel label={texts.history} texts={texts} onClose={onClose}>
|
|
264
|
+
<NoteEditorHistory
|
|
265
|
+
title={texts.history}
|
|
266
|
+
// Room for the panel's close button at the end of the heading's row.
|
|
267
|
+
description={<span className="me-8">{texts.everyChange}</span>}
|
|
268
|
+
>
|
|
269
|
+
<SegmentedControl
|
|
270
|
+
aria-label={texts.show}
|
|
271
|
+
value={show}
|
|
272
|
+
onValueChange={(value) => setShow(value as HistoryFilter)}
|
|
273
|
+
>
|
|
274
|
+
<SegmentedControlItem value="all">{texts.all}</SegmentedControlItem>
|
|
275
|
+
<SegmentedControlItem value="people">{texts.people}</SegmentedControlItem>
|
|
276
|
+
<SegmentedControlItem value="suggestions">{texts.suggestions}</SegmentedControlItem>
|
|
277
|
+
<SegmentedControlItem value="statuses">{texts.statuses}</SegmentedControlItem>
|
|
278
|
+
</SegmentedControl>
|
|
279
|
+
{days.map((day) => (
|
|
280
|
+
<NoteEditorHistoryDay key={day} label={day}>
|
|
281
|
+
{events
|
|
282
|
+
.filter((event) => event.day === day)
|
|
283
|
+
.map((event) => (
|
|
284
|
+
<NoteEditorHistoryEvent
|
|
285
|
+
key={event.id}
|
|
286
|
+
icon={event.kind === "assistant" ? undefined : historyIcons[event.kind]}
|
|
287
|
+
media={event.kind === "assistant" ? <NoteEditorAssistantMark /> : undefined}
|
|
288
|
+
viewing={event.version !== undefined && event.version === viewing}
|
|
289
|
+
>
|
|
290
|
+
<NoteEditorHistoryEventTitle time={event.time}>
|
|
291
|
+
{strong(event.title)}
|
|
292
|
+
</NoteEditorHistoryEventTitle>
|
|
293
|
+
{(event.detail || event.version) && (
|
|
294
|
+
<NoteEditorHistoryEventDetail className="flex flex-wrap items-center gap-1.5">
|
|
295
|
+
{event.live && <NoteLiveDots people={[event.live]} />}
|
|
296
|
+
{event.detail}
|
|
297
|
+
{event.version && event.version !== viewing && (
|
|
298
|
+
<>
|
|
299
|
+
{" · "}
|
|
300
|
+
<NoteEditorHistoryEventAction
|
|
301
|
+
aria-label={texts.seeChangesOf(
|
|
302
|
+
event.title.replace(/\*\*/g, ""),
|
|
303
|
+
event.time,
|
|
304
|
+
)}
|
|
305
|
+
onClick={() => onView(event.version!)}
|
|
306
|
+
>
|
|
307
|
+
{texts.seeChanges}
|
|
308
|
+
</NoteEditorHistoryEventAction>
|
|
309
|
+
</>
|
|
310
|
+
)}
|
|
311
|
+
</NoteEditorHistoryEventDetail>
|
|
312
|
+
)}
|
|
313
|
+
{event.quote && (
|
|
314
|
+
<NoteEditorHistoryEventQuote>{event.quote}</NoteEditorHistoryEventQuote>
|
|
315
|
+
)}
|
|
316
|
+
</NoteEditorHistoryEvent>
|
|
317
|
+
))}
|
|
318
|
+
</NoteEditorHistoryDay>
|
|
319
|
+
))}
|
|
320
|
+
</NoteEditorHistory>
|
|
321
|
+
</Panel>
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const initials = (name: string) =>
|
|
326
|
+
name
|
|
327
|
+
.split(/\s+/)
|
|
328
|
+
.map((word) => word[0])
|
|
329
|
+
.join("")
|
|
330
|
+
.slice(0, 2)
|
|
331
|
+
.toUpperCase();
|
|
332
|
+
|
|
333
|
+
export function MemoryPanel({ note, texts }: { note: NotesNote; texts: NotesTexts }) {
|
|
334
|
+
const memory = note.memory;
|
|
335
|
+
if (!memory) return null;
|
|
336
|
+
return (
|
|
337
|
+
<Panel label={texts.savedInMemory} title={texts.savedInMemory} texts={texts}>
|
|
338
|
+
<section className="flex flex-col gap-3">
|
|
339
|
+
{memory.saved.map((each) => (
|
|
340
|
+
<div key={each.title} className="flex gap-3 rounded-xl border border-border p-3">
|
|
341
|
+
<Icon icon={File01Icon} className="mt-0.5 text-muted-foreground" />
|
|
342
|
+
<div className="min-w-0">
|
|
343
|
+
<p className="text-xs text-subtle uppercase">{each.kind}</p>
|
|
344
|
+
<p className="text-sm font-medium">{each.title}</p>
|
|
345
|
+
<p className="text-xs text-muted-foreground">{each.detail}</p>
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
))}
|
|
349
|
+
<ul className="flex flex-col gap-3">
|
|
350
|
+
{memory.facts.map((fact) => (
|
|
351
|
+
<li key={fact.text} className="flex gap-2">
|
|
352
|
+
<Icon icon={CheckmarkCircle02Icon} className="mt-0.5 size-3.5 text-success" />
|
|
353
|
+
<div>
|
|
354
|
+
<p className="text-xs text-subtle uppercase">{fact.kind}</p>
|
|
355
|
+
<p className="text-sm">{fact.text}</p>
|
|
356
|
+
</div>
|
|
357
|
+
</li>
|
|
358
|
+
))}
|
|
359
|
+
</ul>
|
|
360
|
+
</section>
|
|
361
|
+
<section className="flex flex-col gap-2 border-t border-border pt-4">
|
|
362
|
+
<h3 className="text-xs text-subtle uppercase">{texts.where}</h3>
|
|
363
|
+
<p className="flex items-center gap-2 text-sm">
|
|
364
|
+
<Icon icon={Message01Icon} className="size-3.5 text-muted-foreground" />
|
|
365
|
+
{memory.origin}
|
|
366
|
+
</p>
|
|
367
|
+
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
|
368
|
+
<AvatarGroup className="-space-x-1">
|
|
369
|
+
{memory.writtenBy.map((person) => (
|
|
370
|
+
<Avatar key={person.id} aria-hidden="true" className="size-6">
|
|
371
|
+
<AvatarFallback className="text-xs">{initials(person.name)}</AvatarFallback>
|
|
372
|
+
</Avatar>
|
|
373
|
+
))}
|
|
374
|
+
</AvatarGroup>
|
|
375
|
+
{texts.writtenBy(memory.writtenBy.map((person) => person.name.split(" ")[0]!))}
|
|
376
|
+
</div>
|
|
377
|
+
</section>
|
|
378
|
+
<section className="flex flex-col gap-2 border-t border-border pt-4">
|
|
379
|
+
<h3 className="text-xs text-subtle uppercase">{texts.timeline}</h3>
|
|
380
|
+
<ol className="flex flex-col gap-2">
|
|
381
|
+
{memory.timeline.map((entry) => (
|
|
382
|
+
<li key={entry.date} className="flex gap-3 text-sm">
|
|
383
|
+
<span className="w-10 shrink-0 font-mono text-xs leading-5 text-subtle">
|
|
384
|
+
{entry.date}
|
|
385
|
+
</span>
|
|
386
|
+
<span className="text-muted-foreground">{entry.text}</span>
|
|
387
|
+
</li>
|
|
388
|
+
))}
|
|
389
|
+
</ol>
|
|
390
|
+
</section>
|
|
391
|
+
</Panel>
|
|
392
|
+
);
|
|
393
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { NotePlaceArea, NotePlaceFolder } from "abby/note-place";
|
|
2
|
+
import type { NotesWorkspace } from "../data.ts";
|
|
3
|
+
|
|
4
|
+
/** The area and, if any, the folder a place value names. */
|
|
5
|
+
export function placeOf(
|
|
6
|
+
workspace: NotesWorkspace,
|
|
7
|
+
place: string,
|
|
8
|
+
): { area?: NotePlaceArea; folder?: NotePlaceFolder } {
|
|
9
|
+
for (const area of workspace.areas) {
|
|
10
|
+
if (area.value === place) return { area };
|
|
11
|
+
const folder = area.folders?.find((each) => each.value === place);
|
|
12
|
+
if (folder) return { area, folder };
|
|
13
|
+
}
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { CheckmarkCircle02Icon } from "@hugeicons/core-free-icons";
|
|
4
|
+
import { Avatar, AvatarFallback } from "abby/avatar";
|
|
5
|
+
import { Button } from "abby/button";
|
|
6
|
+
import { Checkbox, CheckboxGroup, CheckboxIndicator } from "abby/checkbox";
|
|
7
|
+
import {
|
|
8
|
+
Dialog,
|
|
9
|
+
DialogBackdrop,
|
|
10
|
+
DialogClose,
|
|
11
|
+
DialogContent,
|
|
12
|
+
DialogDescription,
|
|
13
|
+
DialogTitle,
|
|
14
|
+
DialogTrigger,
|
|
15
|
+
} from "abby/dialog";
|
|
16
|
+
import { Icon } from "abby/icon";
|
|
17
|
+
import { Kbd } from "abby/kbd";
|
|
18
|
+
import { Label } from "abby/label";
|
|
19
|
+
import type { NotePerson } from "abby/note-status";
|
|
20
|
+
import { Textarea } from "abby/textarea";
|
|
21
|
+
import { useState } from "react";
|
|
22
|
+
import type { NotesNote } from "../data.ts";
|
|
23
|
+
import type { NotesTexts } from "../texts.ts";
|
|
24
|
+
|
|
25
|
+
// Asking for a review: who reviews (the area's people, the ones in the note
|
|
26
|
+
// already chosen), a message, and the note moves to In review once it's sent.
|
|
27
|
+
|
|
28
|
+
const initials = (name: string) =>
|
|
29
|
+
name
|
|
30
|
+
.split(/\s+/)
|
|
31
|
+
.map((word) => word[0])
|
|
32
|
+
.join("")
|
|
33
|
+
.slice(0, 2)
|
|
34
|
+
.toUpperCase();
|
|
35
|
+
|
|
36
|
+
type ReviewDialogProps = {
|
|
37
|
+
note: NotesNote;
|
|
38
|
+
people: NotePerson[];
|
|
39
|
+
texts: NotesTexts;
|
|
40
|
+
defaultOpen?: boolean;
|
|
41
|
+
onSend: (input: { reviewers: string[]; message: string }) => Promise<void>;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export function ReviewDialog({ note, people, texts, defaultOpen, onSend }: ReviewDialogProps) {
|
|
45
|
+
const [open, setOpen] = useState(defaultOpen ?? false);
|
|
46
|
+
// Whoever is writing in the note already knows it best: chosen to start with.
|
|
47
|
+
const [reviewers, setReviewers] = useState<string[]>(() =>
|
|
48
|
+
people
|
|
49
|
+
.filter((person) => note.presence?.some((each) => each.id === person.id))
|
|
50
|
+
.map((person) => person.id),
|
|
51
|
+
);
|
|
52
|
+
const [message, setMessage] = useState("");
|
|
53
|
+
const [failed, setFailed] = useState(false);
|
|
54
|
+
const [sending, setSending] = useState(false);
|
|
55
|
+
|
|
56
|
+
const send = async () => {
|
|
57
|
+
if (reviewers.length === 0 || sending) return;
|
|
58
|
+
setSending(true);
|
|
59
|
+
setFailed(false);
|
|
60
|
+
try {
|
|
61
|
+
await onSend({ reviewers, message });
|
|
62
|
+
setOpen(false);
|
|
63
|
+
} catch {
|
|
64
|
+
setFailed(true);
|
|
65
|
+
} finally {
|
|
66
|
+
setSending(false);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
72
|
+
<DialogTrigger size="sm">{texts.requestReview}</DialogTrigger>
|
|
73
|
+
<DialogBackdrop />
|
|
74
|
+
<DialogContent
|
|
75
|
+
className="gap-5 sm:max-w-lg data-[presentation=dialog]:sm:max-w-lg"
|
|
76
|
+
onKeyDown={(event) => {
|
|
77
|
+
// ⌘↵ sends from anywhere in the dialog, the message included.
|
|
78
|
+
if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
void send();
|
|
81
|
+
}
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<div className="flex flex-col gap-1">
|
|
85
|
+
<DialogTitle>{texts.reviewTitle}</DialogTitle>
|
|
86
|
+
<DialogDescription>
|
|
87
|
+
{texts.reviewMoves(note.title, texts.doing, texts.inReview)}
|
|
88
|
+
</DialogDescription>
|
|
89
|
+
</div>
|
|
90
|
+
<div className="flex flex-col gap-2">
|
|
91
|
+
<div className="flex items-center text-sm">
|
|
92
|
+
<span id="notes-reviewers" className="flex-1 font-medium">
|
|
93
|
+
{texts.reviewers}
|
|
94
|
+
</span>
|
|
95
|
+
<span className="text-xs text-subtle">{texts.chosen(reviewers.length)}</span>
|
|
96
|
+
</div>
|
|
97
|
+
<CheckboxGroup
|
|
98
|
+
aria-labelledby="notes-reviewers"
|
|
99
|
+
value={reviewers}
|
|
100
|
+
onValueChange={setReviewers}
|
|
101
|
+
className="flex flex-col gap-1"
|
|
102
|
+
>
|
|
103
|
+
{people.map((person) => (
|
|
104
|
+
<Label
|
|
105
|
+
key={person.id}
|
|
106
|
+
className="flex items-center gap-3 rounded-lg px-2 py-1.5 font-normal has-data-checked:bg-accent"
|
|
107
|
+
>
|
|
108
|
+
<Avatar aria-hidden="true" className="size-8">
|
|
109
|
+
<AvatarFallback className="text-xs">{initials(person.name)}</AvatarFallback>
|
|
110
|
+
</Avatar>
|
|
111
|
+
<span className="min-w-0 flex-1 text-sm">{person.name}</span>
|
|
112
|
+
<Checkbox value={person.id}>
|
|
113
|
+
<CheckboxIndicator />
|
|
114
|
+
</Checkbox>
|
|
115
|
+
</Label>
|
|
116
|
+
))}
|
|
117
|
+
</CheckboxGroup>
|
|
118
|
+
</div>
|
|
119
|
+
<div className="flex flex-col gap-1.5">
|
|
120
|
+
<Label htmlFor="notes-review-message" className="text-sm">
|
|
121
|
+
{texts.message} <span className="font-normal text-subtle">· {texts.optional}</span>
|
|
122
|
+
</Label>
|
|
123
|
+
<Textarea
|
|
124
|
+
id="notes-review-message"
|
|
125
|
+
value={message}
|
|
126
|
+
onValueChange={setMessage}
|
|
127
|
+
placeholder={texts.messagePlaceholder}
|
|
128
|
+
rows={3}
|
|
129
|
+
/>
|
|
130
|
+
<p className="text-xs text-subtle">{texts.messageHint}</p>
|
|
131
|
+
</div>
|
|
132
|
+
{failed && (
|
|
133
|
+
<p role="alert" className="text-sm text-destructive">
|
|
134
|
+
{texts.reviewFailed}
|
|
135
|
+
</p>
|
|
136
|
+
)}
|
|
137
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
138
|
+
<p className="flex min-w-0 flex-1 items-center gap-1.5 text-xs text-muted-foreground">
|
|
139
|
+
<Icon icon={CheckmarkCircle02Icon} className="size-3.5 text-success" />
|
|
140
|
+
{texts.memoryWhenAll}
|
|
141
|
+
</p>
|
|
142
|
+
<DialogClose variant="outline" size="sm">
|
|
143
|
+
{texts.cancel}
|
|
144
|
+
</DialogClose>
|
|
145
|
+
<Button
|
|
146
|
+
size="sm"
|
|
147
|
+
disabled={reviewers.length === 0 || sending}
|
|
148
|
+
onClick={() => void send()}
|
|
149
|
+
>
|
|
150
|
+
{texts.sendReview}
|
|
151
|
+
<Kbd aria-hidden="true" className="bg-primary-foreground/15 text-primary-foreground">
|
|
152
|
+
⌘↵
|
|
153
|
+
</Kbd>
|
|
154
|
+
</Button>
|
|
155
|
+
</div>
|
|
156
|
+
</DialogContent>
|
|
157
|
+
</Dialog>
|
|
158
|
+
);
|
|
159
|
+
}
|