@asanchez-sa/abby 0.0.0-stage → 0.1.1
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 +245 -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 +337 -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 +687 -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,412 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { SquareLock02Icon, RefreshIcon, WifiDisconnected01Icon } from "@hugeicons/core-free-icons";
|
|
4
|
+
import {
|
|
5
|
+
Breadcrumb,
|
|
6
|
+
BreadcrumbItem,
|
|
7
|
+
BreadcrumbList,
|
|
8
|
+
BreadcrumbPage,
|
|
9
|
+
BreadcrumbSeparator,
|
|
10
|
+
} from "abby/breadcrumb";
|
|
11
|
+
import { Button } from "abby/button";
|
|
12
|
+
import { Link } from "abby/link";
|
|
13
|
+
import {
|
|
14
|
+
NoteEditor,
|
|
15
|
+
NoteEditorAssistantMark,
|
|
16
|
+
NoteEditorBanner,
|
|
17
|
+
NoteEditorComments,
|
|
18
|
+
NoteEditorContent,
|
|
19
|
+
NoteEditorHeader,
|
|
20
|
+
NoteEditorMenu,
|
|
21
|
+
NoteEditorMeta,
|
|
22
|
+
NoteEditorMetaMark,
|
|
23
|
+
NoteEditorPresence,
|
|
24
|
+
NoteEditorSuggestions,
|
|
25
|
+
NoteEditorTemplate,
|
|
26
|
+
NoteEditorTemplates,
|
|
27
|
+
NoteEditorTitle,
|
|
28
|
+
NoteEditorToolbar,
|
|
29
|
+
diffNotes,
|
|
30
|
+
type NoteBlock,
|
|
31
|
+
type NoteBlockInput,
|
|
32
|
+
type NoteComment,
|
|
33
|
+
type NoteSuggestion,
|
|
34
|
+
} from "abby/note-editor";
|
|
35
|
+
import { NoteStatusSelect, type NoteStatus } from "abby/note-status";
|
|
36
|
+
import { SidebarTrigger } from "abby/sidebar";
|
|
37
|
+
import {
|
|
38
|
+
TableOfContents,
|
|
39
|
+
TableOfContentsItem,
|
|
40
|
+
TableOfContentsLink,
|
|
41
|
+
TableOfContentsList,
|
|
42
|
+
TableOfContentsTitle,
|
|
43
|
+
} from "abby/table-of-contents";
|
|
44
|
+
import { Toggle } from "abby/toggle";
|
|
45
|
+
import type { NoteAccess, NotesNote, NotesWorkspace } from "../data.ts";
|
|
46
|
+
import type { NotesTexts } from "../texts.ts";
|
|
47
|
+
import { AssistantPanel, HistoryPanel, MemoryPanel } from "./panels.tsx";
|
|
48
|
+
import { placeOf } from "./place.ts";
|
|
49
|
+
import { ReviewDialog } from "./review-dialog.tsx";
|
|
50
|
+
import { Share } from "./share.tsx";
|
|
51
|
+
|
|
52
|
+
export type NotesPanel = "assistant" | "history" | null;
|
|
53
|
+
|
|
54
|
+
type NoteScreenProps = {
|
|
55
|
+
note: NotesNote;
|
|
56
|
+
workspace: NotesWorkspace;
|
|
57
|
+
texts: NotesTexts;
|
|
58
|
+
templates: readonly { name: string; blocks: NoteBlockInput[] }[];
|
|
59
|
+
panel: NotesPanel;
|
|
60
|
+
focus: boolean;
|
|
61
|
+
/** A past version on screen, read-only. */
|
|
62
|
+
version?: string;
|
|
63
|
+
offline?: boolean;
|
|
64
|
+
saveFailed?: boolean;
|
|
65
|
+
/** Opens the share popover or the review dialog at first, for a story or a deep link. */
|
|
66
|
+
open?: "share" | "review";
|
|
67
|
+
onPanel: (panel: NotesPanel) => void;
|
|
68
|
+
onVersion: (version: string | undefined) => void;
|
|
69
|
+
onBlocks: (blocks: NoteBlock[]) => void;
|
|
70
|
+
onTitle: (title: string) => void;
|
|
71
|
+
onStatus: (status: NoteStatus) => void;
|
|
72
|
+
onAccess: (access: NoteAccess) => void;
|
|
73
|
+
onComments: (comments: NoteComment[]) => void;
|
|
74
|
+
onSuggestions: (suggestions: NoteSuggestion[]) => void;
|
|
75
|
+
onReview: (input: { reviewers: string[]; message: string }) => Promise<void>;
|
|
76
|
+
onRestore: (version: string) => void;
|
|
77
|
+
onRetry: () => void;
|
|
78
|
+
onAsk: (question: string) => Promise<string>;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export function NoteScreen({
|
|
82
|
+
note,
|
|
83
|
+
workspace,
|
|
84
|
+
texts,
|
|
85
|
+
templates,
|
|
86
|
+
panel,
|
|
87
|
+
focus,
|
|
88
|
+
version: versionId,
|
|
89
|
+
offline,
|
|
90
|
+
saveFailed,
|
|
91
|
+
open,
|
|
92
|
+
onPanel,
|
|
93
|
+
onVersion,
|
|
94
|
+
onBlocks,
|
|
95
|
+
onTitle,
|
|
96
|
+
onStatus,
|
|
97
|
+
onAccess,
|
|
98
|
+
onComments,
|
|
99
|
+
onSuggestions,
|
|
100
|
+
onReview,
|
|
101
|
+
onRestore,
|
|
102
|
+
onRetry,
|
|
103
|
+
onAsk,
|
|
104
|
+
}: NoteScreenProps) {
|
|
105
|
+
const { area, folder } = placeOf(workspace, note.place);
|
|
106
|
+
const version = note.versions?.find((each) => each.id === versionId);
|
|
107
|
+
const diff = version ? diffNotes(version.before, version.after) : undefined;
|
|
108
|
+
const done = note.status === "done";
|
|
109
|
+
const readOnly = done || Boolean(version);
|
|
110
|
+
const headings = note.blocks.filter(
|
|
111
|
+
(block) => String(block.type).startsWith("heading") && block.id,
|
|
112
|
+
);
|
|
113
|
+
// The others come from presence; you're among them in the count.
|
|
114
|
+
const here = note.presence?.length ? [...note.presence, workspace.me] : [];
|
|
115
|
+
const statusLabels = {
|
|
116
|
+
status: texts.status,
|
|
117
|
+
draft: texts.draft,
|
|
118
|
+
doing: texts.doing,
|
|
119
|
+
review: texts.inReview,
|
|
120
|
+
done: texts.done,
|
|
121
|
+
};
|
|
122
|
+
const reviewers = workspace.people.filter((person) => person.id !== workspace.me.id);
|
|
123
|
+
|
|
124
|
+
// A version opens the history beside it, a note in Memory what it saved, and focus mode nothing.
|
|
125
|
+
const column = focus ? null : version ? "history" : (panel ?? (done ? "memory" : null));
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<div className="flex h-full min-h-0 flex-col">
|
|
129
|
+
<header className="flex h-12 shrink-0 items-center gap-2 border-b border-border px-3">
|
|
130
|
+
<SidebarTrigger aria-label={texts.sidebar} />
|
|
131
|
+
<Breadcrumb className="min-w-0">
|
|
132
|
+
<BreadcrumbList className="flex-nowrap">
|
|
133
|
+
{area && (
|
|
134
|
+
<BreadcrumbItem className="shrink-0">
|
|
135
|
+
<span aria-hidden="true" className={`size-2 rounded-2xs ${area.mark ?? ""}`} />
|
|
136
|
+
{area.label}
|
|
137
|
+
</BreadcrumbItem>
|
|
138
|
+
)}
|
|
139
|
+
{folder && (
|
|
140
|
+
<>
|
|
141
|
+
<BreadcrumbSeparator />
|
|
142
|
+
<BreadcrumbItem className="shrink-0">{folder.label}</BreadcrumbItem>
|
|
143
|
+
</>
|
|
144
|
+
)}
|
|
145
|
+
<BreadcrumbSeparator />
|
|
146
|
+
<BreadcrumbItem className="min-w-0">
|
|
147
|
+
<BreadcrumbPage className="truncate">{note.title || texts.title}</BreadcrumbPage>
|
|
148
|
+
</BreadcrumbItem>
|
|
149
|
+
</BreadcrumbList>
|
|
150
|
+
</Breadcrumb>
|
|
151
|
+
{version ? (
|
|
152
|
+
<p className="ms-2 truncate text-xs text-subtle">{texts.viewing(version.label)}</p>
|
|
153
|
+
) : (
|
|
154
|
+
<NoteStatusSelect
|
|
155
|
+
className="ms-1"
|
|
156
|
+
value={note.status}
|
|
157
|
+
readOnly={done}
|
|
158
|
+
statuses={["draft", "doing", "review"]}
|
|
159
|
+
labels={statusLabels}
|
|
160
|
+
onValueChange={(status) => status && onStatus(status)}
|
|
161
|
+
/>
|
|
162
|
+
)}
|
|
163
|
+
<div className="ms-auto flex shrink-0 items-center gap-2">
|
|
164
|
+
{version ? (
|
|
165
|
+
<>
|
|
166
|
+
<Button variant="outline" size="sm" onClick={() => onVersion(undefined)}>
|
|
167
|
+
{texts.backToNote}
|
|
168
|
+
</Button>
|
|
169
|
+
<Button size="sm" onClick={() => onRestore(version.id)}>
|
|
170
|
+
{texts.restore}
|
|
171
|
+
</Button>
|
|
172
|
+
</>
|
|
173
|
+
) : (
|
|
174
|
+
<>
|
|
175
|
+
{here.length > 0 && <NoteEditorPresence people={here} label={texts.here} />}
|
|
176
|
+
{!done && (
|
|
177
|
+
<Share
|
|
178
|
+
note={note}
|
|
179
|
+
workspace={workspace}
|
|
180
|
+
texts={texts}
|
|
181
|
+
defaultOpen={open === "share"}
|
|
182
|
+
onAccessChange={onAccess}
|
|
183
|
+
/>
|
|
184
|
+
)}
|
|
185
|
+
<Toggle
|
|
186
|
+
variant="outline"
|
|
187
|
+
size="sm"
|
|
188
|
+
pressed={panel === "history" || column === "history"}
|
|
189
|
+
onPressedChange={(pressed) => onPanel(pressed ? "history" : null)}
|
|
190
|
+
>
|
|
191
|
+
{texts.history}
|
|
192
|
+
</Toggle>
|
|
193
|
+
{done ? (
|
|
194
|
+
<Button size="sm" onClick={() => onStatus("doing")}>
|
|
195
|
+
{texts.openNext}
|
|
196
|
+
</Button>
|
|
197
|
+
) : (
|
|
198
|
+
note.status !== "review" && (
|
|
199
|
+
<ReviewDialog
|
|
200
|
+
note={note}
|
|
201
|
+
people={reviewers}
|
|
202
|
+
texts={texts}
|
|
203
|
+
defaultOpen={open === "review"}
|
|
204
|
+
onSend={onReview}
|
|
205
|
+
/>
|
|
206
|
+
)
|
|
207
|
+
)}
|
|
208
|
+
{!done && (
|
|
209
|
+
<Toggle
|
|
210
|
+
variant="outline"
|
|
211
|
+
size="sm"
|
|
212
|
+
pressed={panel === "assistant"}
|
|
213
|
+
onPressedChange={(pressed) => onPanel(pressed ? "assistant" : null)}
|
|
214
|
+
>
|
|
215
|
+
{/* The mark is the foreground's color: on a pressed toggle it turns light. */}
|
|
216
|
+
<NoteEditorAssistantMark className="in-data-pressed:bg-primary-foreground" />
|
|
217
|
+
{texts.assistant}
|
|
218
|
+
</Toggle>
|
|
219
|
+
)}
|
|
220
|
+
</>
|
|
221
|
+
)}
|
|
222
|
+
</div>
|
|
223
|
+
</header>
|
|
224
|
+
|
|
225
|
+
<div className="flex min-h-0 flex-1">
|
|
226
|
+
{focus && headings.length > 0 && (
|
|
227
|
+
<TableOfContents
|
|
228
|
+
className="hidden w-48 shrink-0 self-start ps-8 pt-28 xl:block"
|
|
229
|
+
defaultValue={headings[0]!.id}
|
|
230
|
+
>
|
|
231
|
+
<TableOfContentsTitle className="sr-only">{texts.outline}</TableOfContentsTitle>
|
|
232
|
+
<TableOfContentsList>
|
|
233
|
+
{headings.map((block) => (
|
|
234
|
+
<TableOfContentsItem key={block.id} value={block.id!}>
|
|
235
|
+
<TableOfContentsLink
|
|
236
|
+
href={`#${block.id}`}
|
|
237
|
+
onClick={(event) => {
|
|
238
|
+
// The note's blocks carry their id as `data-id`.
|
|
239
|
+
event.preventDefault();
|
|
240
|
+
document
|
|
241
|
+
.querySelector(`[data-id="${block.id}"]`)
|
|
242
|
+
?.scrollIntoView({ block: "start" });
|
|
243
|
+
}}
|
|
244
|
+
>
|
|
245
|
+
{block.text}
|
|
246
|
+
</TableOfContentsLink>
|
|
247
|
+
</TableOfContentsItem>
|
|
248
|
+
))}
|
|
249
|
+
</TableOfContentsList>
|
|
250
|
+
</TableOfContents>
|
|
251
|
+
)}
|
|
252
|
+
|
|
253
|
+
<div className="min-w-0 flex-1 overflow-y-auto">
|
|
254
|
+
{done && note.memory && !version && (
|
|
255
|
+
<NoteEditorBanner icon={SquareLock02Icon}>
|
|
256
|
+
{texts.inMemorySince(note.memory.since, note.memory.confirmedBy)}
|
|
257
|
+
{" · "}
|
|
258
|
+
<Link href="#memory">{texts.seeMemory}</Link>
|
|
259
|
+
</NoteEditorBanner>
|
|
260
|
+
)}
|
|
261
|
+
{offline && (
|
|
262
|
+
<NoteEditorBanner icon={WifiDisconnected01Icon}>{texts.offline}</NoteEditorBanner>
|
|
263
|
+
)}
|
|
264
|
+
{saveFailed && (
|
|
265
|
+
<NoteEditorBanner icon={RefreshIcon} className="py-1">
|
|
266
|
+
<span className="flex flex-wrap items-center gap-2">
|
|
267
|
+
<span className="flex-1">{texts.saveFailed}</span>
|
|
268
|
+
<Button variant="outline" size="xs" onClick={onRetry}>
|
|
269
|
+
{texts.retry}
|
|
270
|
+
</Button>
|
|
271
|
+
</span>
|
|
272
|
+
</NoteEditorBanner>
|
|
273
|
+
)}
|
|
274
|
+
<div className="mx-auto w-full max-w-[42rem] px-6 py-10">
|
|
275
|
+
<NoteEditor
|
|
276
|
+
// A version and the note are two notes to the editor.
|
|
277
|
+
key={version?.id ?? note.id}
|
|
278
|
+
label={version ? texts.viewing(version.label) : texts.note}
|
|
279
|
+
placeholder={texts.emptyNote}
|
|
280
|
+
readOnly={readOnly}
|
|
281
|
+
value={diff ? diff.blocks : (note.blocks as NoteBlock[])}
|
|
282
|
+
changes={diff?.changes}
|
|
283
|
+
onValueChange={(blocks) => onBlocks(blocks)}
|
|
284
|
+
presence={version ? undefined : note.presence}
|
|
285
|
+
comments={version ? undefined : note.comments}
|
|
286
|
+
onComment={({ text, ...anchor }) =>
|
|
287
|
+
onComments([
|
|
288
|
+
...(note.comments ?? []),
|
|
289
|
+
{
|
|
290
|
+
id: `c${(note.comments?.length ?? 0) + 1}`,
|
|
291
|
+
...anchor,
|
|
292
|
+
messages: text ? [{ id: "m1", author: workspace.me, time: "now", text }] : [],
|
|
293
|
+
},
|
|
294
|
+
])
|
|
295
|
+
}
|
|
296
|
+
onCommentReply={(id, text) =>
|
|
297
|
+
onComments(
|
|
298
|
+
(note.comments ?? []).map((thread) =>
|
|
299
|
+
thread.id === id
|
|
300
|
+
? {
|
|
301
|
+
...thread,
|
|
302
|
+
messages: [
|
|
303
|
+
...thread.messages,
|
|
304
|
+
{
|
|
305
|
+
id: `m${thread.messages.length + 1}`,
|
|
306
|
+
author: workspace.me,
|
|
307
|
+
time: "now",
|
|
308
|
+
text,
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
}
|
|
312
|
+
: thread,
|
|
313
|
+
),
|
|
314
|
+
)
|
|
315
|
+
}
|
|
316
|
+
onCommentResolve={(id) =>
|
|
317
|
+
onComments(
|
|
318
|
+
(note.comments ?? []).map((thread) =>
|
|
319
|
+
thread.id === id ? { ...thread, resolved: true } : thread,
|
|
320
|
+
),
|
|
321
|
+
)
|
|
322
|
+
}
|
|
323
|
+
suggestions={version ? undefined : note.suggestions}
|
|
324
|
+
onSuggestionAccept={(suggestion) => {
|
|
325
|
+
// Under a heading it's a paragraph of its own; in a list item, a new line in it.
|
|
326
|
+
onBlocks(
|
|
327
|
+
note.blocks.flatMap((block) => {
|
|
328
|
+
if (block.id !== suggestion.blockId) return [block];
|
|
329
|
+
return String(block.type).startsWith("heading")
|
|
330
|
+
? [block, { type: "paragraph", text: suggestion.text }]
|
|
331
|
+
: [{ ...block, text: `${block.text}\n${suggestion.text}` }];
|
|
332
|
+
}) as NoteBlock[],
|
|
333
|
+
);
|
|
334
|
+
onSuggestions((note.suggestions ?? []).filter((each) => each.id !== suggestion.id));
|
|
335
|
+
}}
|
|
336
|
+
onSuggestionDiscard={(suggestion) =>
|
|
337
|
+
onSuggestions((note.suggestions ?? []).filter((each) => each.id !== suggestion.id))
|
|
338
|
+
}
|
|
339
|
+
>
|
|
340
|
+
<NoteEditorHeader>
|
|
341
|
+
{(area || note.meta) && (
|
|
342
|
+
<NoteEditorMeta>
|
|
343
|
+
{area && <NoteEditorMetaMark className={area.mark} />}
|
|
344
|
+
{[area?.label, note.template, note.meta].filter(Boolean).join(" · ")}
|
|
345
|
+
</NoteEditorMeta>
|
|
346
|
+
)}
|
|
347
|
+
<NoteEditorTitle
|
|
348
|
+
aria-label={texts.title}
|
|
349
|
+
value={note.title}
|
|
350
|
+
onValueChange={onTitle}
|
|
351
|
+
readOnly={readOnly}
|
|
352
|
+
/>
|
|
353
|
+
</NoteEditorHeader>
|
|
354
|
+
<NoteEditorContent label={version ? texts.viewing(version.label) : texts.note} />
|
|
355
|
+
<NoteEditorTemplates>
|
|
356
|
+
<span>{texts.startWith}</span>
|
|
357
|
+
{templates.map(({ name, blocks }) => (
|
|
358
|
+
<NoteEditorTemplate key={name} blocks={blocks}>
|
|
359
|
+
{name}
|
|
360
|
+
</NoteEditorTemplate>
|
|
361
|
+
))}
|
|
362
|
+
</NoteEditorTemplates>
|
|
363
|
+
<NoteEditorMenu />
|
|
364
|
+
<NoteEditorToolbar>
|
|
365
|
+
<Button variant="ghost" size="sm" onClick={() => onPanel("assistant")}>
|
|
366
|
+
<NoteEditorAssistantMark />
|
|
367
|
+
{texts.askAssistant}
|
|
368
|
+
</Button>
|
|
369
|
+
</NoteEditorToolbar>
|
|
370
|
+
<NoteEditorComments />
|
|
371
|
+
<NoteEditorSuggestions />
|
|
372
|
+
</NoteEditor>
|
|
373
|
+
{version && (
|
|
374
|
+
<div className="mt-10 flex flex-wrap items-center gap-2 border-t border-border pt-3.5 text-sm">
|
|
375
|
+
<p className="min-w-0 flex-1 text-muted-foreground">
|
|
376
|
+
{texts.versionEnd(version.label)}
|
|
377
|
+
</p>
|
|
378
|
+
<Link
|
|
379
|
+
href="#current"
|
|
380
|
+
onClick={(event) => (event.preventDefault(), onVersion(undefined))}
|
|
381
|
+
>
|
|
382
|
+
{texts.seeCurrent}
|
|
383
|
+
</Link>
|
|
384
|
+
</div>
|
|
385
|
+
)}
|
|
386
|
+
</div>
|
|
387
|
+
</div>
|
|
388
|
+
|
|
389
|
+
{column === "assistant" && (
|
|
390
|
+
<AssistantPanel
|
|
391
|
+
note={note}
|
|
392
|
+
area={area?.label ?? ""}
|
|
393
|
+
texts={texts}
|
|
394
|
+
onClose={() => onPanel(null)}
|
|
395
|
+
onOpenTo={() => onAccess("area")}
|
|
396
|
+
onAsk={onAsk}
|
|
397
|
+
/>
|
|
398
|
+
)}
|
|
399
|
+
{column === "history" && (
|
|
400
|
+
<HistoryPanel
|
|
401
|
+
note={note}
|
|
402
|
+
texts={texts}
|
|
403
|
+
viewing={version?.id}
|
|
404
|
+
onView={onVersion}
|
|
405
|
+
onClose={() => (onVersion(undefined), onPanel(null))}
|
|
406
|
+
/>
|
|
407
|
+
)}
|
|
408
|
+
{column === "memory" && <MemoryPanel note={note} texts={texts} />}
|
|
409
|
+
</div>
|
|
410
|
+
</div>
|
|
411
|
+
);
|
|
412
|
+
}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Add01Icon,
|
|
5
|
+
CheckmarkCircle02Icon,
|
|
6
|
+
Folder01Icon,
|
|
7
|
+
SquareLock02Icon,
|
|
8
|
+
Search01Icon,
|
|
9
|
+
} from "@hugeicons/core-free-icons";
|
|
10
|
+
import { Button } from "abby/button";
|
|
11
|
+
import { Icon } from "abby/icon";
|
|
12
|
+
import { Kbd } from "abby/kbd";
|
|
13
|
+
import { LinkPart } from "abby/link";
|
|
14
|
+
import { NoteLiveDots, NoteStatusIcon } from "abby/note-status";
|
|
15
|
+
import {
|
|
16
|
+
Sidebar,
|
|
17
|
+
SidebarContent,
|
|
18
|
+
SidebarFooter,
|
|
19
|
+
SidebarGroup,
|
|
20
|
+
SidebarHeader,
|
|
21
|
+
SidebarMenu,
|
|
22
|
+
SidebarMenuButton,
|
|
23
|
+
SidebarMenuItem,
|
|
24
|
+
SidebarMenuSkeleton,
|
|
25
|
+
} from "abby/sidebar";
|
|
26
|
+
import { Tree, TreeGroup, TreeItem, TreeItemIndicator, TreeItemLabel } from "abby/tree";
|
|
27
|
+
import { useShortcutHint } from "abby/utilities/platform";
|
|
28
|
+
import type { NotesNote, NotesWorkspace } from "../data.ts";
|
|
29
|
+
import type { NotesTexts } from "../texts.ts";
|
|
30
|
+
import { placeOf } from "./place.ts";
|
|
31
|
+
|
|
32
|
+
// The sidebar: a new note, then the notes by area and folder, with the ones
|
|
33
|
+
// waiting for your review first and the ones in Memory at the foot. Each note
|
|
34
|
+
// ends with who is writing in it and its status, on one column.
|
|
35
|
+
|
|
36
|
+
type Row = {
|
|
37
|
+
value: string;
|
|
38
|
+
label: string;
|
|
39
|
+
mark?: string;
|
|
40
|
+
folder?: boolean;
|
|
41
|
+
note?: NotesNote;
|
|
42
|
+
children?: Row[];
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** The tree's rows: each area, its notes outside a folder, then its folders. */
|
|
46
|
+
function rows(workspace: NotesWorkspace, notes: NotesNote[]): Row[] {
|
|
47
|
+
// A note you can't open isn't listed: its title is the owner's to show.
|
|
48
|
+
const live = notes.filter((note) => note.status !== "done" && !note.locked);
|
|
49
|
+
const noteRow = (note: NotesNote, prefix = ""): Row => ({
|
|
50
|
+
value: `${prefix}${note.id}`,
|
|
51
|
+
label: note.title,
|
|
52
|
+
note,
|
|
53
|
+
});
|
|
54
|
+
const review = live.filter((note) => note.reviewBy);
|
|
55
|
+
return [
|
|
56
|
+
...(review.length
|
|
57
|
+
? [
|
|
58
|
+
{
|
|
59
|
+
value: "to-review",
|
|
60
|
+
label: "",
|
|
61
|
+
children: review.map((note) => noteRow(note, "review:")),
|
|
62
|
+
},
|
|
63
|
+
]
|
|
64
|
+
: []),
|
|
65
|
+
...workspace.areas.map((area) => ({
|
|
66
|
+
value: area.value,
|
|
67
|
+
label: area.label,
|
|
68
|
+
mark: area.mark,
|
|
69
|
+
children: [
|
|
70
|
+
...(area.folders ?? []).map((folder) => ({
|
|
71
|
+
value: folder.value,
|
|
72
|
+
label: folder.label,
|
|
73
|
+
folder: true,
|
|
74
|
+
children: live.filter((note) => note.place === folder.value).map((note) => noteRow(note)),
|
|
75
|
+
})),
|
|
76
|
+
...live.filter((note) => note.place === area.value).map((note) => noteRow(note)),
|
|
77
|
+
],
|
|
78
|
+
})),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const count = (row: Row): number =>
|
|
83
|
+
(row.children ?? []).reduce((sum, child) => sum + (child.note ? 1 : count(child)), 0);
|
|
84
|
+
|
|
85
|
+
function TreeRows({
|
|
86
|
+
nodes,
|
|
87
|
+
texts,
|
|
88
|
+
href,
|
|
89
|
+
}: {
|
|
90
|
+
nodes: Row[];
|
|
91
|
+
texts: NotesTexts;
|
|
92
|
+
href: (id: string) => string;
|
|
93
|
+
}) {
|
|
94
|
+
const label = (row: Row) => (row.value === "to-review" ? texts.toReview : row.label);
|
|
95
|
+
return nodes.map((row) => {
|
|
96
|
+
const note = row.note;
|
|
97
|
+
const details = note
|
|
98
|
+
? [
|
|
99
|
+
texts[note.status === "review" ? "inReview" : note.status],
|
|
100
|
+
note.access === "private" ? texts.onlyYou : null,
|
|
101
|
+
note.writing?.length ? texts.writing(note.writing.map((person) => person.name)) : null,
|
|
102
|
+
]
|
|
103
|
+
.filter(Boolean)
|
|
104
|
+
.join(", ")
|
|
105
|
+
: null;
|
|
106
|
+
return (
|
|
107
|
+
// `branch`: a tree written as children doesn't learn its branches from their groups.
|
|
108
|
+
<TreeItem
|
|
109
|
+
key={row.value}
|
|
110
|
+
value={row.value}
|
|
111
|
+
branch={Boolean(row.children)}
|
|
112
|
+
aria-describedby={details ? `notes-${row.value}-details` : undefined}
|
|
113
|
+
>
|
|
114
|
+
<TreeItemLabel
|
|
115
|
+
render={note ? <LinkPart href={href(note.id)} /> : undefined}
|
|
116
|
+
className={row.mark || row.value === "to-review" ? "font-medium" : undefined}
|
|
117
|
+
>
|
|
118
|
+
{row.children && <TreeItemIndicator />}
|
|
119
|
+
{row.value === "to-review" ? (
|
|
120
|
+
<span aria-hidden="true" className="size-1.5 shrink-0 rounded-full bg-warning" />
|
|
121
|
+
) : row.mark ? (
|
|
122
|
+
<span aria-hidden="true" className={`size-2 shrink-0 rounded-2xs ${row.mark}`} />
|
|
123
|
+
) : row.folder ? (
|
|
124
|
+
<Icon icon={Folder01Icon} className="text-muted-foreground" />
|
|
125
|
+
) : null}
|
|
126
|
+
<span className="min-w-0 flex-1 truncate">{label(row)}</span>
|
|
127
|
+
{/* The row's end is drawn, and said by the row's description instead. */}
|
|
128
|
+
<span aria-hidden="true" className="flex shrink-0 items-center gap-2">
|
|
129
|
+
{note?.writing && <NoteLiveDots people={note.writing} />}
|
|
130
|
+
{note?.access === "private" && (
|
|
131
|
+
<Icon icon={SquareLock02Icon} className="size-3.5 text-subtle" />
|
|
132
|
+
)}
|
|
133
|
+
<span className="flex w-7 justify-center text-xs font-normal text-subtle tabular-nums">
|
|
134
|
+
{note ? <NoteStatusIcon status={note.status} /> : count(row) || null}
|
|
135
|
+
</span>
|
|
136
|
+
</span>
|
|
137
|
+
</TreeItemLabel>
|
|
138
|
+
{details && (
|
|
139
|
+
<span id={`notes-${row.value}-details`} hidden aria-hidden="true">
|
|
140
|
+
{details}
|
|
141
|
+
</span>
|
|
142
|
+
)}
|
|
143
|
+
{row.children && row.children.length > 0 && (
|
|
144
|
+
<TreeGroup>
|
|
145
|
+
<TreeRows nodes={row.children} texts={texts} href={href} />
|
|
146
|
+
</TreeGroup>
|
|
147
|
+
)}
|
|
148
|
+
</TreeItem>
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
type NotesSidebarProps = {
|
|
154
|
+
workspace: NotesWorkspace;
|
|
155
|
+
notes: NotesNote[];
|
|
156
|
+
/** The note on screen. */
|
|
157
|
+
current: string | null;
|
|
158
|
+
loading?: boolean;
|
|
159
|
+
texts: NotesTexts;
|
|
160
|
+
href: (id: string) => string;
|
|
161
|
+
onOpen: (id: string) => void;
|
|
162
|
+
onNew: () => void;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export function NotesSidebar({
|
|
166
|
+
workspace,
|
|
167
|
+
notes,
|
|
168
|
+
current,
|
|
169
|
+
loading,
|
|
170
|
+
texts,
|
|
171
|
+
href,
|
|
172
|
+
onOpen,
|
|
173
|
+
onNew,
|
|
174
|
+
}: NotesSidebarProps) {
|
|
175
|
+
const hint = useShortcutHint("mod+shift+n");
|
|
176
|
+
const memory = notes.filter((note) => note.status === "done");
|
|
177
|
+
const inMemory = Boolean(current && memory.some((note) => note.id === current));
|
|
178
|
+
const open = (value: string) => {
|
|
179
|
+
const id = value.startsWith("review:") ? value.slice("review:".length) : value;
|
|
180
|
+
if (notes.some((note) => note.id === id)) onOpen(id);
|
|
181
|
+
};
|
|
182
|
+
// The current note's branches open, wherever it is.
|
|
183
|
+
const reviewing = notes.find((note) => note.id === current)?.reviewBy;
|
|
184
|
+
const shownCurrent = current ? (reviewing ? `review:${current}` : current) : undefined;
|
|
185
|
+
// Open on the current note: its area and folder join the branches open by default.
|
|
186
|
+
const place = notes.find((note) => note.id === current && !note.locked)?.place;
|
|
187
|
+
const { area, folder } = place ? placeOf(workspace, place) : {};
|
|
188
|
+
const expanded = [
|
|
189
|
+
...new Set([
|
|
190
|
+
"to-review",
|
|
191
|
+
"product",
|
|
192
|
+
"product/plans",
|
|
193
|
+
"marketing",
|
|
194
|
+
...[area?.value, folder?.value].filter((value) => value !== undefined),
|
|
195
|
+
]),
|
|
196
|
+
];
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
// Alma's shell: the tree on the window's paper, the note on a card beside it.
|
|
200
|
+
<Sidebar variant="inset">
|
|
201
|
+
<SidebarHeader className="flex-row items-center gap-1 pt-3">
|
|
202
|
+
<h2 className="min-w-0 flex-1 px-2 text-heading-4">{texts.notes}</h2>
|
|
203
|
+
<Button variant="ghost" size="icon-sm" aria-label={texts.searchNotes}>
|
|
204
|
+
<Icon icon={Search01Icon} />
|
|
205
|
+
</Button>
|
|
206
|
+
</SidebarHeader>
|
|
207
|
+
<SidebarContent>
|
|
208
|
+
<SidebarGroup className="pb-0">
|
|
209
|
+
<SidebarMenu>
|
|
210
|
+
<SidebarMenuItem>
|
|
211
|
+
<SidebarMenuButton onClick={onNew} aria-keyshortcuts={hint.ariaKeyshortcuts}>
|
|
212
|
+
<Icon icon={Add01Icon} />
|
|
213
|
+
<span>{texts.newNote}</span>
|
|
214
|
+
<Kbd aria-hidden="true" className="ms-auto">
|
|
215
|
+
{hint.text}
|
|
216
|
+
</Kbd>
|
|
217
|
+
</SidebarMenuButton>
|
|
218
|
+
</SidebarMenuItem>
|
|
219
|
+
</SidebarMenu>
|
|
220
|
+
</SidebarGroup>
|
|
221
|
+
<SidebarGroup>
|
|
222
|
+
{loading ? (
|
|
223
|
+
<div aria-hidden="true" className="flex flex-col gap-0.5">
|
|
224
|
+
{["40%", "70%", "55%", "40%", "65%", "50%"].map((width, index) => (
|
|
225
|
+
<SidebarMenuSkeleton key={index} width={width} />
|
|
226
|
+
))}
|
|
227
|
+
</div>
|
|
228
|
+
) : (
|
|
229
|
+
<Tree
|
|
230
|
+
aria-label={texts.tree}
|
|
231
|
+
mode="none"
|
|
232
|
+
current={shownCurrent}
|
|
233
|
+
defaultExpanded={expanded}
|
|
234
|
+
onAction={open}
|
|
235
|
+
>
|
|
236
|
+
<TreeRows nodes={rows(workspace, notes)} texts={texts} href={href} />
|
|
237
|
+
</Tree>
|
|
238
|
+
)}
|
|
239
|
+
</SidebarGroup>
|
|
240
|
+
</SidebarContent>
|
|
241
|
+
{!loading && memory.length > 0 && (
|
|
242
|
+
<SidebarFooter className="border-t border-sidebar-border">
|
|
243
|
+
<Tree
|
|
244
|
+
aria-label={texts.inMemory}
|
|
245
|
+
mode="none"
|
|
246
|
+
current={inMemory ? current : undefined}
|
|
247
|
+
defaultExpanded={inMemory ? ["memory"] : []}
|
|
248
|
+
onAction={open}
|
|
249
|
+
>
|
|
250
|
+
<TreeItem value="memory" branch>
|
|
251
|
+
<TreeItemLabel className="font-medium">
|
|
252
|
+
<TreeItemIndicator />
|
|
253
|
+
<Icon icon={CheckmarkCircle02Icon} className="text-success" />
|
|
254
|
+
<span className="min-w-0 flex-1 truncate">{texts.inMemory}</span>
|
|
255
|
+
<span
|
|
256
|
+
aria-hidden="true"
|
|
257
|
+
className="flex w-7 justify-center text-xs font-normal text-subtle tabular-nums"
|
|
258
|
+
>
|
|
259
|
+
{memory.length}
|
|
260
|
+
</span>
|
|
261
|
+
</TreeItemLabel>
|
|
262
|
+
<TreeGroup>
|
|
263
|
+
{memory.map((note) => (
|
|
264
|
+
<TreeItem key={note.id} value={note.id}>
|
|
265
|
+
<TreeItemLabel render={<LinkPart href={href(note.id)} />}>
|
|
266
|
+
<span className="min-w-0 flex-1 truncate">{note.title}</span>
|
|
267
|
+
</TreeItemLabel>
|
|
268
|
+
</TreeItem>
|
|
269
|
+
))}
|
|
270
|
+
</TreeGroup>
|
|
271
|
+
</TreeItem>
|
|
272
|
+
</Tree>
|
|
273
|
+
</SidebarFooter>
|
|
274
|
+
)}
|
|
275
|
+
</Sidebar>
|
|
276
|
+
);
|
|
277
|
+
}
|