@contui/ui 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/LICENSE +30 -0
- package/README.md +150 -2
- package/cli/contui.mjs +250 -0
- package/dist/charts/area-chart.d.ts +8 -0
- package/dist/charts/area-chart.js +9 -0
- package/dist/charts/bar-chart.d.ts +9 -0
- package/dist/charts/bar-chart.js +10 -0
- package/dist/charts/bubble-chart.d.ts +60 -0
- package/dist/charts/bubble-chart.js +392 -0
- package/dist/charts/bullet-chart.d.ts +53 -0
- package/dist/charts/bullet-chart.js +123 -0
- package/dist/charts/candlestick-chart.d.ts +77 -0
- package/dist/charts/candlestick-chart.js +558 -0
- package/dist/charts/cartesian.d.ts +121 -0
- package/dist/charts/cartesian.js +625 -0
- package/dist/charts/chart-card.d.ts +80 -0
- package/dist/charts/chart-card.js +114 -0
- package/dist/charts/donut-chart.d.ts +40 -0
- package/dist/charts/donut-chart.js +88 -0
- package/dist/charts/funnel-chart.d.ts +16 -0
- package/dist/charts/funnel-chart.js +164 -0
- package/dist/charts/horizontal-bar-chart.d.ts +67 -0
- package/dist/charts/horizontal-bar-chart.js +481 -0
- package/dist/charts/index.d.ts +21 -0
- package/dist/charts/index.js +32 -0
- package/dist/charts/legend.d.ts +23 -0
- package/dist/charts/legend.js +22 -0
- package/dist/charts/lib/candlestick-window.d.ts +15 -0
- package/dist/charts/lib/candlestick-window.js +23 -0
- package/dist/charts/lib/color.d.ts +39 -0
- package/dist/charts/lib/color.js +83 -0
- package/dist/charts/lib/format.d.ts +11 -0
- package/dist/charts/lib/format.js +33 -0
- package/dist/charts/lib/frame.d.ts +6 -0
- package/dist/charts/lib/frame.js +6 -0
- package/dist/charts/lib/layout.d.ts +11 -0
- package/dist/charts/lib/layout.js +71 -0
- package/dist/charts/lib/path.d.ts +35 -0
- package/dist/charts/lib/path.js +203 -0
- package/dist/charts/lib/scale.d.ts +41 -0
- package/dist/charts/lib/scale.js +80 -0
- package/dist/charts/lib/use-active.d.ts +18 -0
- package/dist/charts/lib/use-active.js +71 -0
- package/dist/charts/lib/use-size.d.ts +9 -0
- package/dist/charts/lib/use-size.js +40 -0
- package/dist/charts/line-chart.d.ts +7 -0
- package/dist/charts/line-chart.js +8 -0
- package/dist/charts/radar-chart.d.ts +27 -0
- package/dist/charts/radar-chart.js +165 -0
- package/dist/charts/rose-chart.d.ts +35 -0
- package/dist/charts/rose-chart.js +242 -0
- package/dist/charts/sparkline.d.ts +35 -0
- package/dist/charts/sparkline.js +110 -0
- package/dist/charts/tooltip.d.ts +35 -0
- package/dist/charts/tooltip.js +22 -0
- package/dist/charts/treemap.d.ts +28 -0
- package/dist/charts/treemap.js +103 -0
- package/dist/charts/uptime-strip.d.ts +40 -0
- package/dist/charts/uptime-strip.js +178 -0
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.js +34 -0
- package/dist/components/activity-item.d.ts +12 -0
- package/dist/components/activity-item.js +6 -0
- package/dist/components/alert.d.ts +21 -0
- package/dist/components/alert.js +58 -0
- package/dist/components/assistant-answer.d.ts +52 -0
- package/dist/components/assistant-answer.js +40 -0
- package/dist/components/assistant-prompt.d.ts +63 -0
- package/dist/components/assistant-prompt.js +122 -0
- package/dist/components/avatar.d.ts +28 -0
- package/dist/components/avatar.js +75 -0
- package/dist/components/badge.d.ts +16 -0
- package/dist/components/badge.js +33 -0
- package/dist/components/bar-list.d.ts +65 -0
- package/dist/components/bar-list.js +119 -0
- package/dist/components/block-slider.d.ts +43 -0
- package/dist/components/block-slider.js +63 -0
- package/dist/components/branch-graph.d.ts +87 -0
- package/dist/components/branch-graph.js +231 -0
- package/dist/components/breadcrumb.d.ts +41 -0
- package/dist/components/breadcrumb.js +53 -0
- package/dist/components/button.d.ts +23 -0
- package/dist/components/button.js +108 -0
- package/dist/components/calendar.d.ts +5 -0
- package/dist/components/calendar.js +90 -0
- package/dist/components/card.d.ts +65 -0
- package/dist/components/card.js +104 -0
- package/dist/components/chat-attachment.d.ts +47 -0
- package/dist/components/chat-attachment.js +63 -0
- package/dist/components/chat-event.d.ts +7 -0
- package/dist/components/chat-event.js +7 -0
- package/dist/components/chat-message.d.ts +59 -0
- package/dist/components/chat-message.js +91 -0
- package/dist/components/chat-reference.d.ts +20 -0
- package/dist/components/chat-reference.js +41 -0
- package/dist/components/chat-shared.d.ts +21 -0
- package/dist/components/chat-shared.js +23 -0
- package/dist/components/chat-suggestions.d.ts +59 -0
- package/dist/components/chat-suggestions.js +88 -0
- package/dist/components/chat-thread.d.ts +39 -0
- package/dist/components/chat-thread.js +172 -0
- package/dist/components/chat-typing.d.ts +35 -0
- package/dist/components/chat-typing.js +66 -0
- package/dist/components/checkbox.d.ts +18 -0
- package/dist/components/checkbox.js +33 -0
- package/dist/components/checklist.d.ts +26 -0
- package/dist/components/checklist.js +18 -0
- package/dist/components/chip.d.ts +29 -0
- package/dist/components/chip.js +61 -0
- package/dist/components/code-input.d.ts +40 -0
- package/dist/components/code-input.js +285 -0
- package/dist/components/color-picker.d.ts +38 -0
- package/dist/components/color-picker.js +855 -0
- package/dist/components/combobox.d.ts +75 -0
- package/dist/components/combobox.js +112 -0
- package/dist/components/command-menu.d.ts +58 -0
- package/dist/components/command-menu.js +166 -0
- package/dist/components/copy-button.d.ts +16 -0
- package/dist/components/copy-button.js +31 -0
- package/dist/components/data-grid.d.ts +50 -0
- package/dist/components/data-grid.js +599 -0
- package/dist/components/date-picker.d.ts +109 -0
- package/dist/components/date-picker.js +268 -0
- package/dist/components/description-list.d.ts +12 -0
- package/dist/components/description-list.js +10 -0
- package/dist/components/dialog.d.ts +57 -0
- package/dist/components/dialog.js +140 -0
- package/dist/components/dock.d.ts +45 -0
- package/dist/components/dock.js +79 -0
- package/dist/components/drop-zone.d.ts +46 -0
- package/dist/components/drop-zone.js +101 -0
- package/dist/components/dropdown-menu.d.ts +50 -0
- package/dist/components/dropdown-menu.js +78 -0
- package/dist/components/editable-cell.d.ts +34 -0
- package/dist/components/editable-cell.js +89 -0
- package/dist/components/empty-state.d.ts +17 -0
- package/dist/components/empty-state.js +9 -0
- package/dist/components/field.d.ts +43 -0
- package/dist/components/field.js +75 -0
- package/dist/components/filter-condition.d.ts +188 -0
- package/dist/components/filter-condition.js +113 -0
- package/dist/components/filter-menu.d.ts +57 -0
- package/dist/components/filter-menu.js +46 -0
- package/dist/components/header-bar.d.ts +84 -0
- package/dist/components/header-bar.js +94 -0
- package/dist/components/hold-button.d.ts +15 -0
- package/dist/components/hold-button.js +88 -0
- package/dist/components/icon-tile.d.ts +12 -0
- package/dist/components/icon-tile.js +29 -0
- package/dist/components/info-tip.d.ts +13 -0
- package/dist/components/info-tip.js +26 -0
- package/dist/components/input.d.ts +17 -0
- package/dist/components/input.js +83 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +7 -0
- package/dist/components/menu-item.d.ts +56 -0
- package/dist/components/menu-item.js +94 -0
- package/dist/components/message-composer.d.ts +75 -0
- package/dist/components/message-composer.js +199 -0
- package/dist/components/nav-rail.d.ts +31 -0
- package/dist/components/nav-rail.js +85 -0
- package/dist/components/notice.d.ts +45 -0
- package/dist/components/notice.js +66 -0
- package/dist/components/optimistic-undo.d.ts +28 -0
- package/dist/components/optimistic-undo.js +43 -0
- package/dist/components/option-row.d.ts +15 -0
- package/dist/components/option-row.js +14 -0
- package/dist/components/page-content.d.ts +11 -0
- package/dist/components/page-content.js +31 -0
- package/dist/components/pagination.d.ts +34 -0
- package/dist/components/pagination.js +41 -0
- package/dist/components/popover.d.ts +27 -0
- package/dist/components/popover.js +25 -0
- package/dist/components/progress.d.ts +33 -0
- package/dist/components/progress.js +75 -0
- package/dist/components/radio-group.d.ts +7 -0
- package/dist/components/radio-group.js +33 -0
- package/dist/components/readonly-field.d.ts +33 -0
- package/dist/components/readonly-field.js +80 -0
- package/dist/components/segmented-control.d.ts +21 -0
- package/dist/components/segmented-control.js +108 -0
- package/dist/components/select.d.ts +42 -0
- package/dist/components/select.js +86 -0
- package/dist/components/separator.d.ts +10 -0
- package/dist/components/separator.js +7 -0
- package/dist/components/setting-row.d.ts +53 -0
- package/dist/components/setting-row.js +93 -0
- package/dist/components/sidebar-switcher.d.ts +47 -0
- package/dist/components/sidebar-switcher.js +20 -0
- package/dist/components/sidebar.d.ts +220 -0
- package/dist/components/sidebar.js +327 -0
- package/dist/components/skeleton.d.ts +18 -0
- package/dist/components/skeleton.js +23 -0
- package/dist/components/slider.d.ts +15 -0
- package/dist/components/slider.js +28 -0
- package/dist/components/spinner.d.ts +14 -0
- package/dist/components/spinner.js +19 -0
- package/dist/components/status-dot.d.ts +24 -0
- package/dist/components/status-dot.js +35 -0
- package/dist/components/stepper.d.ts +60 -0
- package/dist/components/stepper.js +197 -0
- package/dist/components/switch.d.ts +9 -0
- package/dist/components/switch.js +26 -0
- package/dist/components/table-cell.d.ts +38 -0
- package/dist/components/table-cell.js +107 -0
- package/dist/components/table-context.d.ts +48 -0
- package/dist/components/table-context.js +69 -0
- package/dist/components/table-head.d.ts +42 -0
- package/dist/components/table-head.js +188 -0
- package/dist/components/table-tree.d.ts +96 -0
- package/dist/components/table-tree.js +137 -0
- package/dist/components/table.d.ts +78 -0
- package/dist/components/table.js +119 -0
- package/dist/components/tabs.d.ts +27 -0
- package/dist/components/tabs.js +79 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/theme.d.ts +41 -0
- package/dist/components/theme.js +60 -0
- package/dist/components/thinking.d.ts +68 -0
- package/dist/components/thinking.js +94 -0
- package/dist/components/toast.d.ts +39 -0
- package/dist/components/toast.js +110 -0
- package/dist/components/toolbar.d.ts +25 -0
- package/dist/components/toolbar.js +92 -0
- package/dist/components/tooltip.d.ts +23 -0
- package/dist/components/tooltip.js +27 -0
- package/dist/components/top-nav.d.ts +129 -0
- package/dist/components/top-nav.js +211 -0
- package/dist/components/truncate.d.ts +29 -0
- package/dist/components/truncate.js +138 -0
- package/dist/deprecated.d.ts +43 -0
- package/dist/deprecated.js +47 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +93 -0
- package/dist/lib/cn.d.ts +5 -0
- package/dist/lib/cn.js +14 -0
- package/dist/lib/color.d.ts +136 -0
- package/dist/lib/color.js +307 -0
- package/dist/lib/contrast.d.ts +53 -0
- package/dist/lib/contrast.js +169 -0
- package/dist/lib/create-theme.d.ts +240 -0
- package/dist/lib/create-theme.js +461 -0
- package/dist/lib/harmony.d.ts +102 -0
- package/dist/lib/harmony.js +426 -0
- package/dist/lib/import-theme.d.ts +22 -0
- package/dist/lib/import-theme.js +221 -0
- package/dist/lib/overflow-scroll.d.ts +25 -0
- package/dist/lib/overflow-scroll.js +66 -0
- package/dist/lib/radio-toggle-render.d.ts +3 -0
- package/dist/lib/radio-toggle-render.js +9 -0
- package/dist/lib/reorder.d.ts +38 -0
- package/dist/lib/reorder.js +193 -0
- package/dist/lib/spacing.d.ts +101 -0
- package/dist/lib/spacing.js +118 -0
- package/dist/lib/tailwind-palette.d.ts +5 -0
- package/dist/lib/tailwind-palette.js +351 -0
- package/dist/lib/truncate.d.ts +18 -0
- package/dist/lib/truncate.js +69 -0
- package/dist/lib/use-single-value.d.ts +5 -0
- package/dist/lib/use-single-value.js +17 -0
- package/dist/styles.css +7988 -0
- package/mcp/server.mjs +87590 -0
- package/package.json +58 -5
- package/skills/continuum-fix-padding/SKILL.md +69 -0
- package/skills/continuum-fix-padding/scripts/compute.ts +155 -0
- package/skills/continuum-fix-padding/scripts/spacing.ts +189 -0
- package/skills/continuum-taste/SKILL.md +186 -0
- package/skills/continuum-taste/assets/tokens.css +647 -0
- package/skills/continuum-taste/references/charts.md +375 -0
- package/skills/continuum-taste/references/components.md +1369 -0
- package/skills/continuum-taste/references/foundations.md +539 -0
- package/skills/continuum-taste/references/media/canvas.md +75 -0
- package/skills/continuum-taste/references/media/css.md +61 -0
- package/skills/continuum-taste/references/media/react.md +161 -0
- package/skills/continuum-taste/references/method.md +87 -0
- package/skills/continuum-taste/references/pages.md +391 -0
- package/skills/continuum-taste/references/patterns.md +77 -0
- package/skills/continuum-taste/references/screens/agent.tsx +450 -0
- package/skills/continuum-taste/references/screens/analytics-overview.tsx +377 -0
- package/skills/continuum-taste/references/screens/checkout-funnel.tsx +193 -0
- package/skills/continuum-taste/references/screens/customer.tsx +475 -0
- package/skills/continuum-taste/references/screens/customers.tsx +608 -0
- package/skills/continuum-taste/references/screens/index.tsx +72 -0
- package/skills/continuum-taste/references/screens/invoice-editor.tsx +558 -0
- package/skills/continuum-taste/references/screens/new-customer.tsx +205 -0
- package/skills/continuum-taste/references/screens/overview.tsx +196 -0
- package/skills/continuum-taste/references/screens/report-generator.tsx +329 -0
- package/skills/continuum-taste/references/screens/risk-report.tsx +577 -0
- package/skills/continuum-taste/references/screens/sequence-editor.tsx +455 -0
- package/skills/continuum-taste/references/screens/settings.tsx +288 -0
- package/skills/continuum-taste/references/screens/shared.tsx +204 -0
- package/skills/continuum-taste/references/screens/sign-in.tsx +104 -0
- package/skills/continuum-taste/references/screens/workspace.tsx +596 -0
- package/skills/continuum-taste/references/theming.md +95 -0
- package/src/charts/area-chart.tsx +17 -0
- package/src/charts/bar-chart.tsx +15 -0
- package/src/charts/bubble-chart.tsx +913 -0
- package/src/charts/bullet-chart.tsx +419 -0
- package/src/charts/candlestick-chart.tsx +1242 -0
- package/src/charts/cartesian.tsx +1437 -0
- package/src/charts/chart-card.tsx +394 -0
- package/src/charts/donut-chart.tsx +299 -0
- package/src/charts/funnel-chart.tsx +373 -0
- package/src/charts/horizontal-bar-chart.tsx +991 -0
- package/src/charts/index.ts +76 -0
- package/src/charts/legend.tsx +59 -0
- package/src/charts/lib/candlestick-window.ts +42 -0
- package/src/charts/lib/color.ts +110 -0
- package/src/charts/lib/format.ts +42 -0
- package/src/charts/lib/frame.ts +6 -0
- package/src/charts/lib/layout.ts +78 -0
- package/src/charts/lib/path.ts +225 -0
- package/src/charts/lib/scale.ts +91 -0
- package/src/charts/lib/use-active.ts +87 -0
- package/src/charts/lib/use-size.ts +45 -0
- package/src/charts/line-chart.tsx +16 -0
- package/src/charts/radar-chart.tsx +485 -0
- package/src/charts/rose-chart.tsx +553 -0
- package/src/charts/sparkline.tsx +293 -0
- package/src/charts/tooltip.tsx +105 -0
- package/src/charts/treemap.tsx +271 -0
- package/src/charts/uptime-strip.tsx +469 -0
- package/src/components/accordion.tsx +136 -0
- package/src/components/activity-item.tsx +43 -0
- package/src/components/alert.tsx +135 -0
- package/src/components/assistant-answer.tsx +185 -0
- package/src/components/assistant-prompt.tsx +352 -0
- package/src/components/avatar.tsx +157 -0
- package/src/components/badge.tsx +55 -0
- package/src/components/bar-list.tsx +350 -0
- package/src/components/block-slider.tsx +189 -0
- package/src/components/branch-graph.tsx +580 -0
- package/src/components/breadcrumb.tsx +173 -0
- package/src/components/button.tsx +157 -0
- package/src/components/calendar.tsx +154 -0
- package/src/components/card.tsx +296 -0
- package/src/components/chat-attachment.tsx +255 -0
- package/src/components/chat-event.tsx +34 -0
- package/src/components/chat-message.tsx +332 -0
- package/src/components/chat-reference.tsx +100 -0
- package/src/components/chat-shared.ts +41 -0
- package/src/components/chat-suggestions.tsx +188 -0
- package/src/components/chat-thread.tsx +348 -0
- package/src/components/chat-typing.tsx +155 -0
- package/src/components/checkbox.tsx +83 -0
- package/src/components/checklist.tsx +146 -0
- package/src/components/chip.tsx +152 -0
- package/src/components/code-input.tsx +406 -0
- package/src/components/color-picker.tsx +1385 -0
- package/src/components/combobox.tsx +420 -0
- package/src/components/command-menu.tsx +405 -0
- package/src/components/copy-button.tsx +87 -0
- package/src/components/data-grid.tsx +965 -0
- package/src/components/date-picker.tsx +652 -0
- package/src/components/description-list.tsx +39 -0
- package/src/components/dialog.tsx +367 -0
- package/src/components/dock.tsx +192 -0
- package/src/components/drop-zone.tsx +283 -0
- package/src/components/dropdown-menu.tsx +323 -0
- package/src/components/editable-cell.tsx +219 -0
- package/src/components/empty-state.tsx +50 -0
- package/src/components/field.tsx +148 -0
- package/src/components/filter-condition.tsx +463 -0
- package/src/components/filter-menu.tsx +196 -0
- package/src/components/header-bar.tsx +220 -0
- package/src/components/hold-button.tsx +146 -0
- package/src/components/icon-tile.tsx +43 -0
- package/src/components/info-tip.tsx +87 -0
- package/src/components/input.tsx +136 -0
- package/src/components/kbd.tsx +17 -0
- package/src/components/menu-item.tsx +216 -0
- package/src/components/message-composer.tsx +458 -0
- package/src/components/nav-rail.tsx +235 -0
- package/src/components/notice.tsx +133 -0
- package/src/components/optimistic-undo.ts +68 -0
- package/src/components/option-row.tsx +54 -0
- package/src/components/page-content.tsx +44 -0
- package/src/components/pagination.tsx +182 -0
- package/src/components/popover.tsx +113 -0
- package/src/components/progress.tsx +222 -0
- package/src/components/radio-group.tsx +80 -0
- package/src/components/readonly-field.tsx +251 -0
- package/src/components/segmented-control.tsx +205 -0
- package/src/components/select.tsx +259 -0
- package/src/components/separator.tsx +30 -0
- package/src/components/setting-row.tsx +277 -0
- package/src/components/sidebar-switcher.tsx +134 -0
- package/src/components/sidebar.tsx +804 -0
- package/src/components/skeleton.tsx +57 -0
- package/src/components/slider.tsx +106 -0
- package/src/components/spinner.tsx +43 -0
- package/src/components/status-dot.tsx +100 -0
- package/src/components/stepper.tsx +459 -0
- package/src/components/switch.tsx +54 -0
- package/src/components/table-cell.tsx +239 -0
- package/src/components/table-context.ts +135 -0
- package/src/components/table-head.tsx +393 -0
- package/src/components/table-tree.tsx +357 -0
- package/src/components/table.tsx +295 -0
- package/src/components/tabs.tsx +191 -0
- package/src/components/textarea.tsx +44 -0
- package/src/components/theme.tsx +120 -0
- package/src/components/thinking.tsx +295 -0
- package/src/components/toast.tsx +308 -0
- package/src/components/toolbar.tsx +166 -0
- package/src/components/tooltip.tsx +84 -0
- package/src/components/top-nav.tsx +660 -0
- package/src/components/truncate.tsx +234 -0
- package/src/deprecated.ts +61 -0
- package/src/index.ts +184 -0
- package/src/lib/cn.ts +22 -0
- package/src/lib/color.ts +469 -0
- package/src/lib/contrast.ts +220 -0
- package/src/lib/create-theme.ts +659 -0
- package/src/lib/harmony.ts +609 -0
- package/src/lib/import-theme.ts +272 -0
- package/src/lib/overflow-scroll.tsx +108 -0
- package/src/lib/radio-toggle-render.tsx +15 -0
- package/src/lib/reorder.ts +222 -0
- package/src/lib/spacing.ts +189 -0
- package/src/lib/tailwind-palette.ts +355 -0
- package/src/lib/truncate.ts +79 -0
- package/src/lib/use-single-value.ts +23 -0
- package/src/styles/continuum.css +3 -0
- package/src/styles/theme.css +524 -0
- package/src/styles/tokens.css +647 -0
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Avatar,
|
|
3
|
+
Badge,
|
|
4
|
+
BottomBar,
|
|
5
|
+
Button,
|
|
6
|
+
Checkbox,
|
|
7
|
+
Dock,
|
|
8
|
+
DockAction,
|
|
9
|
+
DockCount,
|
|
10
|
+
DockItem,
|
|
11
|
+
DropdownMenu,
|
|
12
|
+
DropdownMenuContent,
|
|
13
|
+
DropdownMenuItem,
|
|
14
|
+
DropdownMenuSeparator,
|
|
15
|
+
DropdownMenuTrigger,
|
|
16
|
+
defaultFilterOperator,
|
|
17
|
+
EmptyState,
|
|
18
|
+
FilterCondition,
|
|
19
|
+
FilterConditionAdd,
|
|
20
|
+
FilterConditionField,
|
|
21
|
+
FilterConditionOperator,
|
|
22
|
+
FilterConditionRemove,
|
|
23
|
+
FilterConditions,
|
|
24
|
+
FilterConditionValue,
|
|
25
|
+
type FilterField,
|
|
26
|
+
filterOperators,
|
|
27
|
+
Pagination,
|
|
28
|
+
Select,
|
|
29
|
+
SelectContent,
|
|
30
|
+
SelectItem,
|
|
31
|
+
SelectTrigger,
|
|
32
|
+
SelectValue,
|
|
33
|
+
Table,
|
|
34
|
+
TableBody,
|
|
35
|
+
TableCell,
|
|
36
|
+
TableConditions,
|
|
37
|
+
TableHead,
|
|
38
|
+
TableHeader,
|
|
39
|
+
TableRow,
|
|
40
|
+
TableSearch,
|
|
41
|
+
TableToolbar,
|
|
42
|
+
TableToolbarEnd,
|
|
43
|
+
Toolbar,
|
|
44
|
+
ToolbarButton,
|
|
45
|
+
useToast,
|
|
46
|
+
} from '@contui/ui';
|
|
47
|
+
import {
|
|
48
|
+
Archive,
|
|
49
|
+
ArrowUpRight,
|
|
50
|
+
Clock,
|
|
51
|
+
Download,
|
|
52
|
+
EllipsisVertical,
|
|
53
|
+
Euro,
|
|
54
|
+
Layers,
|
|
55
|
+
Mail,
|
|
56
|
+
Plus,
|
|
57
|
+
SearchX,
|
|
58
|
+
Upload,
|
|
59
|
+
UserRound,
|
|
60
|
+
X,
|
|
61
|
+
} from 'lucide-react';
|
|
62
|
+
import { type MouseEvent, useRef, useState } from 'react';
|
|
63
|
+
import { useScreenNav } from './shared';
|
|
64
|
+
import {
|
|
65
|
+
allCustomers,
|
|
66
|
+
type Customer,
|
|
67
|
+
formatEuro,
|
|
68
|
+
owners,
|
|
69
|
+
PageHead,
|
|
70
|
+
type Plan,
|
|
71
|
+
type Status,
|
|
72
|
+
statusTone,
|
|
73
|
+
useShellCompact,
|
|
74
|
+
Workspace,
|
|
75
|
+
} from './workspace';
|
|
76
|
+
|
|
77
|
+
const icon = { strokeWidth: 2 } as const;
|
|
78
|
+
|
|
79
|
+
const views: ('All' | Status)[] = ['All', 'Active', 'Trial', 'Past due', 'Churned'];
|
|
80
|
+
|
|
81
|
+
const PAGE_SIZE = 10;
|
|
82
|
+
|
|
83
|
+
type Kind = keyof typeof filterOperators;
|
|
84
|
+
|
|
85
|
+
type FieldDef = FilterField & { kind: Kind; options: string[] };
|
|
86
|
+
|
|
87
|
+
const ownerField: FieldDef = {
|
|
88
|
+
id: 'owner',
|
|
89
|
+
label: 'Owner',
|
|
90
|
+
icon: <UserRound {...icon} />,
|
|
91
|
+
kind: 'many',
|
|
92
|
+
options: owners.map(owner => owner.name),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The plan as a condition, for a compact shell: there the bar has no room for the plan's select
|
|
97
|
+
* beside the search, so the plan joins the conditions the Filter button offers.
|
|
98
|
+
*/
|
|
99
|
+
const planField: FieldDef = {
|
|
100
|
+
id: 'plan',
|
|
101
|
+
label: 'Plan',
|
|
102
|
+
icon: <Layers {...icon} />,
|
|
103
|
+
kind: 'one',
|
|
104
|
+
options: ['Enterprise', 'Pro', 'Starter'],
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/** What a condition can be on: the columns a select does not already cover. */
|
|
108
|
+
const fields: FieldDef[] = [
|
|
109
|
+
ownerField,
|
|
110
|
+
{
|
|
111
|
+
id: 'seen',
|
|
112
|
+
label: 'Last seen',
|
|
113
|
+
icon: <Clock {...icon} />,
|
|
114
|
+
kind: 'date',
|
|
115
|
+
options: ['7 days', '30 days', '90 days'],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: 'mrr',
|
|
119
|
+
label: 'Monthly revenue',
|
|
120
|
+
icon: <Euro {...icon} />,
|
|
121
|
+
kind: 'number',
|
|
122
|
+
options: ['500', '1,000', '5,000'],
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
type Condition = { field: string; operator: string; values: string[] };
|
|
127
|
+
|
|
128
|
+
const fieldOf = (id: string) => [...fields, planField].find(field => field.id === id) ?? ownerField;
|
|
129
|
+
|
|
130
|
+
const amount = (value: string) => Number(value.replace(/[^\d.]/g, ''));
|
|
131
|
+
|
|
132
|
+
/** Whether a customer passes a condition. A condition without a value yet passes everyone. */
|
|
133
|
+
const passes = (customer: Customer, condition: Condition) => {
|
|
134
|
+
// Every customer has one owner, so "is empty" keeps no one and "is not empty" everyone.
|
|
135
|
+
if (condition.field === 'owner' && condition.operator === 'empty') return false;
|
|
136
|
+
if (condition.field === 'owner' && condition.operator === 'notEmpty') return true;
|
|
137
|
+
if (condition.values.length === 0) return true;
|
|
138
|
+
switch (condition.field) {
|
|
139
|
+
case 'owner': {
|
|
140
|
+
const hit = condition.values.includes(customer.owner);
|
|
141
|
+
if (condition.operator === 'none') return !hit;
|
|
142
|
+
// One owner each: "has all of" holds only while a single name is asked for.
|
|
143
|
+
if (condition.operator === 'all') return hit && condition.values.length === 1;
|
|
144
|
+
return hit;
|
|
145
|
+
}
|
|
146
|
+
case 'plan': {
|
|
147
|
+
const hit = condition.values.includes(customer.plan);
|
|
148
|
+
return condition.operator === 'isNot' ? !hit : hit;
|
|
149
|
+
}
|
|
150
|
+
case 'seen': {
|
|
151
|
+
const days = amount(condition.values[0] ?? '');
|
|
152
|
+
if (condition.operator === 'last') return customer.seenDays <= days;
|
|
153
|
+
if (condition.operator === 'before') return customer.seenDays > days;
|
|
154
|
+
if (condition.operator === 'after') return customer.seenDays < days;
|
|
155
|
+
return customer.seenDays === days;
|
|
156
|
+
}
|
|
157
|
+
case 'mrr': {
|
|
158
|
+
const limit = amount(condition.values[0] ?? '');
|
|
159
|
+
if (condition.operator === 'gt') return customer.mrr > limit;
|
|
160
|
+
if (condition.operator === 'lt') return customer.mrr < limit;
|
|
161
|
+
if (condition.operator === 'ne') return customer.mrr !== limit;
|
|
162
|
+
return customer.mrr === limit;
|
|
163
|
+
}
|
|
164
|
+
default:
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
// The row opens on a click anywhere in it; the checkbox and the menu keep their clicks to themselves.
|
|
170
|
+
const keep = (event: MouseEvent) => event.stopPropagation();
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* A list: the views in the dock, the table's own bar (a plain search, the plan select and the
|
|
174
|
+
* conditions that narrow this table) inside its frame, and pages at the foot. Selecting rows swaps
|
|
175
|
+
* the dock for the bar of what can be done to them all. A row opens the customer's own page.
|
|
176
|
+
*/
|
|
177
|
+
export const Customers = () => {
|
|
178
|
+
const nav = useScreenNav();
|
|
179
|
+
const toast = useToast();
|
|
180
|
+
const [view, setView] = useState<'All' | Status>('All');
|
|
181
|
+
const [query, setQuery] = useState('');
|
|
182
|
+
const [plan, setPlan] = useState<'any' | Plan>('any');
|
|
183
|
+
const [conditions, setConditions] = useState<Condition[]>([
|
|
184
|
+
{ field: 'owner', operator: 'any', values: ownerField.options.slice(0, 2) },
|
|
185
|
+
]);
|
|
186
|
+
const [archived, setArchived] = useState<string[]>([]);
|
|
187
|
+
const [selected, setSelected] = useState<string[]>([]);
|
|
188
|
+
const [page, setPage] = useState(1);
|
|
189
|
+
|
|
190
|
+
// Everything but the view narrows the counts in the dock, so each view says what it would show.
|
|
191
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
192
|
+
const matching = allCustomers.filter(
|
|
193
|
+
customer =>
|
|
194
|
+
!archived.includes(customer.id) &&
|
|
195
|
+
words.every(word =>
|
|
196
|
+
`${customer.name} ${customer.domain}`.toLowerCase().includes(word),
|
|
197
|
+
) &&
|
|
198
|
+
(plan === 'any' || customer.plan === plan) &&
|
|
199
|
+
conditions.every(condition => passes(customer, condition)),
|
|
200
|
+
);
|
|
201
|
+
const rows = matching.filter(customer => view === 'All' || customer.status === view);
|
|
202
|
+
const counts = Object.fromEntries(
|
|
203
|
+
views.map(item => [
|
|
204
|
+
item,
|
|
205
|
+
matching.filter(customer => item === 'All' || customer.status === item).length,
|
|
206
|
+
]),
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
const pageCount = Math.max(1, Math.ceil(rows.length / PAGE_SIZE));
|
|
210
|
+
const current = Math.min(page, pageCount);
|
|
211
|
+
const first = (current - 1) * PAGE_SIZE;
|
|
212
|
+
const shown = rows.slice(first, first + PAGE_SIZE);
|
|
213
|
+
|
|
214
|
+
// A selection only holds what is on the page now: a row filtered or paged away leaves it.
|
|
215
|
+
const chosen = selected.filter(id => shown.some(row => row.id === id));
|
|
216
|
+
const all = shown.length > 0 && chosen.length === shown.length;
|
|
217
|
+
const some = chosen.length > 0 && !all;
|
|
218
|
+
const filtered = query !== '' || plan !== 'any' || conditions.length > 0;
|
|
219
|
+
|
|
220
|
+
// In a compact shell the plan's select folds into the Filter button, unless a plan is picked
|
|
221
|
+
// in it already: a filter that applies is never hidden.
|
|
222
|
+
const frame = useRef<HTMLDivElement>(null);
|
|
223
|
+
const compact = useShellCompact(frame);
|
|
224
|
+
const planSelect = !compact || plan !== 'any';
|
|
225
|
+
const offered = planSelect ? fields : [planField, ...fields];
|
|
226
|
+
const remaining = offered.filter(field => !conditions.some(c => c.field === field.id));
|
|
227
|
+
|
|
228
|
+
const toggle = (id: string, on: boolean) =>
|
|
229
|
+
setSelected(on ? [...chosen, id] : chosen.filter(item => item !== id));
|
|
230
|
+
const update = (index: number, patch: Partial<Condition>) =>
|
|
231
|
+
setConditions(current =>
|
|
232
|
+
current.map((item, i) => (i === index ? { ...item, ...patch } : item)),
|
|
233
|
+
);
|
|
234
|
+
const clearFilters = () => {
|
|
235
|
+
setQuery('');
|
|
236
|
+
setPlan('any');
|
|
237
|
+
setConditions([]);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// Archiving can be undone, so it asks nothing first and offers the undo after.
|
|
241
|
+
const archive = (ids: string[]) => {
|
|
242
|
+
setArchived(current => [...current, ...ids]);
|
|
243
|
+
setSelected([]);
|
|
244
|
+
const one = allCustomers.find(customer => customer.id === ids[0]);
|
|
245
|
+
toast.add({
|
|
246
|
+
title:
|
|
247
|
+
ids.length === 1 && one
|
|
248
|
+
? `${one.name} archived`
|
|
249
|
+
: `${ids.length} customers archived`,
|
|
250
|
+
actionProps: {
|
|
251
|
+
children: 'Undo',
|
|
252
|
+
onClick: () => setArchived(current => current.filter(id => !ids.includes(id))),
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// The list's views and its one primary action, at the panel's foot.
|
|
258
|
+
const dock = (
|
|
259
|
+
<BottomBar floating>
|
|
260
|
+
<Dock
|
|
261
|
+
aria-label="Views"
|
|
262
|
+
onValueChange={value => {
|
|
263
|
+
setView(value as 'All' | Status);
|
|
264
|
+
setPage(1);
|
|
265
|
+
}}
|
|
266
|
+
value={view}
|
|
267
|
+
>
|
|
268
|
+
{views.map(item => (
|
|
269
|
+
<DockItem key={item} value={item}>
|
|
270
|
+
{item}
|
|
271
|
+
<DockCount>{counts[item]}</DockCount>
|
|
272
|
+
</DockItem>
|
|
273
|
+
))}
|
|
274
|
+
</Dock>
|
|
275
|
+
<DockAction onClick={() => nav.open('form')}>
|
|
276
|
+
<Plus {...icon} />
|
|
277
|
+
New customer
|
|
278
|
+
</DockAction>
|
|
279
|
+
</BottomBar>
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
// What a selection is for: the bar holds the actions on it, and clears it.
|
|
283
|
+
const bulk = (
|
|
284
|
+
<BottomBar floating>
|
|
285
|
+
<Toolbar aria-label="Selected customers" variant="floating">
|
|
286
|
+
<span className="flex items-center px-3 font-medium text-neutral-950 text-xs tabular-nums">
|
|
287
|
+
{chosen.length} selected
|
|
288
|
+
</span>
|
|
289
|
+
<ToolbarButton>
|
|
290
|
+
<Mail {...icon} />
|
|
291
|
+
Message
|
|
292
|
+
</ToolbarButton>
|
|
293
|
+
<ToolbarButton>
|
|
294
|
+
<Download {...icon} />
|
|
295
|
+
Export
|
|
296
|
+
</ToolbarButton>
|
|
297
|
+
<ToolbarButton onClick={() => archive(chosen)}>
|
|
298
|
+
<Archive {...icon} />
|
|
299
|
+
Archive
|
|
300
|
+
</ToolbarButton>
|
|
301
|
+
<ToolbarButton aria-label="Clear the selection" onClick={() => setSelected([])}>
|
|
302
|
+
<X {...icon} />
|
|
303
|
+
</ToolbarButton>
|
|
304
|
+
</Toolbar>
|
|
305
|
+
</BottomBar>
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
const add = (
|
|
309
|
+
<FilterConditionAdd
|
|
310
|
+
fields={remaining}
|
|
311
|
+
onAdd={id =>
|
|
312
|
+
setConditions(current => [
|
|
313
|
+
...current,
|
|
314
|
+
{ field: id, operator: defaultFilterOperator(fieldOf(id).kind), values: [] },
|
|
315
|
+
])
|
|
316
|
+
}
|
|
317
|
+
/>
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
// The bar finds and picks; the conditions narrow, in a row of their own while any apply,
|
|
321
|
+
// the add button at its end. With nothing to show, the table's head goes and the bar stays.
|
|
322
|
+
const toolbar = (
|
|
323
|
+
<>
|
|
324
|
+
<TableToolbar
|
|
325
|
+
className={rows.length === 0 && conditions.length === 0 ? 'border-b-0' : undefined}
|
|
326
|
+
>
|
|
327
|
+
<TableSearch
|
|
328
|
+
aria-label="Search customers"
|
|
329
|
+
onChange={event => {
|
|
330
|
+
setQuery(event.target.value);
|
|
331
|
+
setPage(1);
|
|
332
|
+
}}
|
|
333
|
+
placeholder="Search customers"
|
|
334
|
+
value={query}
|
|
335
|
+
/>
|
|
336
|
+
{(planSelect || conditions.length === 0) && (
|
|
337
|
+
<TableToolbarEnd>
|
|
338
|
+
{planSelect && (
|
|
339
|
+
<Select
|
|
340
|
+
onValueChange={value => {
|
|
341
|
+
setPlan(value as 'any' | Plan);
|
|
342
|
+
setPage(1);
|
|
343
|
+
}}
|
|
344
|
+
value={plan}
|
|
345
|
+
>
|
|
346
|
+
<SelectTrigger aria-label="Plan" size="sm">
|
|
347
|
+
<SelectValue />
|
|
348
|
+
</SelectTrigger>
|
|
349
|
+
<SelectContent align="end">
|
|
350
|
+
<SelectItem value="any">Any plan</SelectItem>
|
|
351
|
+
<SelectItem value="Enterprise">Enterprise</SelectItem>
|
|
352
|
+
<SelectItem value="Pro">Pro</SelectItem>
|
|
353
|
+
<SelectItem value="Starter">Starter</SelectItem>
|
|
354
|
+
</SelectContent>
|
|
355
|
+
</Select>
|
|
356
|
+
)}
|
|
357
|
+
{conditions.length === 0 && add}
|
|
358
|
+
</TableToolbarEnd>
|
|
359
|
+
)}
|
|
360
|
+
</TableToolbar>
|
|
361
|
+
{conditions.length > 0 && (
|
|
362
|
+
<TableConditions className={rows.length === 0 ? 'border-b-0' : undefined}>
|
|
363
|
+
<FilterConditions onClear={() => setConditions([])}>
|
|
364
|
+
{conditions.map((condition, index) => {
|
|
365
|
+
const field = fieldOf(condition.field);
|
|
366
|
+
return (
|
|
367
|
+
<FilterCondition
|
|
368
|
+
aria-label={`${field.label} filter`}
|
|
369
|
+
key={condition.field}
|
|
370
|
+
>
|
|
371
|
+
<FilterConditionField icon={field.icon}>
|
|
372
|
+
{field.label}
|
|
373
|
+
</FilterConditionField>
|
|
374
|
+
<FilterConditionOperator
|
|
375
|
+
onValueChange={operator => update(index, { operator })}
|
|
376
|
+
options={filterOperators[field.kind]}
|
|
377
|
+
value={condition.operator}
|
|
378
|
+
/>
|
|
379
|
+
<FilterConditionValue
|
|
380
|
+
multiple={field.kind === 'many'}
|
|
381
|
+
onValueChange={values => update(index, { values })}
|
|
382
|
+
options={field.options.map(value => ({ value }))}
|
|
383
|
+
value={condition.values}
|
|
384
|
+
/>
|
|
385
|
+
<FilterConditionRemove
|
|
386
|
+
aria-label={`Remove the ${String(field.label).toLowerCase()} filter`}
|
|
387
|
+
onClick={() =>
|
|
388
|
+
setConditions(current =>
|
|
389
|
+
current.filter((_, i) => i !== index),
|
|
390
|
+
)
|
|
391
|
+
}
|
|
392
|
+
/>
|
|
393
|
+
</FilterCondition>
|
|
394
|
+
);
|
|
395
|
+
})}
|
|
396
|
+
</FilterConditions>
|
|
397
|
+
<TableToolbarEnd>{add}</TableToolbarEnd>
|
|
398
|
+
</TableConditions>
|
|
399
|
+
)}
|
|
400
|
+
</>
|
|
401
|
+
);
|
|
402
|
+
|
|
403
|
+
return (
|
|
404
|
+
<Workspace
|
|
405
|
+
bar={chosen.length > 0 ? bulk : dock}
|
|
406
|
+
// The block gap: the head with its line over a table of ten rows, its toolbar and pages.
|
|
407
|
+
gap="gap-14"
|
|
408
|
+
place="customers"
|
|
409
|
+
trail={['Customers']}
|
|
410
|
+
width="wide"
|
|
411
|
+
>
|
|
412
|
+
{/* The counts are the dock's; the title says what the list holds. */}
|
|
413
|
+
<PageHead
|
|
414
|
+
description="The companies on a plan or a trial, and the ones that have left."
|
|
415
|
+
secondary={
|
|
416
|
+
<Button variant="secondary">
|
|
417
|
+
<Upload {...icon} />
|
|
418
|
+
Import
|
|
419
|
+
</Button>
|
|
420
|
+
}
|
|
421
|
+
title="Customers"
|
|
422
|
+
/>
|
|
423
|
+
|
|
424
|
+
<div className="flex flex-col gap-4" ref={frame}>
|
|
425
|
+
<Table toolbar={toolbar}>
|
|
426
|
+
{rows.length > 0 && (
|
|
427
|
+
<>
|
|
428
|
+
{/* On a narrow table the revenue, owner and last seen hide: who it is,
|
|
429
|
+
its plan and its status are what a row is told apart by. */}
|
|
430
|
+
<TableHeader>
|
|
431
|
+
<TableRow>
|
|
432
|
+
<TableHead className="w-11">
|
|
433
|
+
<Checkbox
|
|
434
|
+
aria-label="Select every customer on this page"
|
|
435
|
+
checked={all}
|
|
436
|
+
indeterminate={some}
|
|
437
|
+
onCheckedChange={() =>
|
|
438
|
+
setSelected(all ? [] : shown.map(row => row.id))
|
|
439
|
+
}
|
|
440
|
+
/>
|
|
441
|
+
</TableHead>
|
|
442
|
+
<TableHead>Customer</TableHead>
|
|
443
|
+
<TableHead className="w-32">Plan</TableHead>
|
|
444
|
+
<TableHead className="w-32">Status</TableHead>
|
|
445
|
+
<TableHead className="w-32 text-right" optional>
|
|
446
|
+
Monthly revenue
|
|
447
|
+
</TableHead>
|
|
448
|
+
<TableHead className="w-44" optional>
|
|
449
|
+
Owner
|
|
450
|
+
</TableHead>
|
|
451
|
+
<TableHead className="w-32" optional>
|
|
452
|
+
Last seen
|
|
453
|
+
</TableHead>
|
|
454
|
+
<TableHead className="w-11">
|
|
455
|
+
<span className="sr-only">Actions</span>
|
|
456
|
+
</TableHead>
|
|
457
|
+
</TableRow>
|
|
458
|
+
</TableHeader>
|
|
459
|
+
<TableBody>
|
|
460
|
+
{shown.map(customer => (
|
|
461
|
+
<TableRow
|
|
462
|
+
className="cursor-pointer"
|
|
463
|
+
data-selected={chosen.includes(customer.id) || undefined}
|
|
464
|
+
key={customer.id}
|
|
465
|
+
onClick={() => nav.open('detail', customer.id)}
|
|
466
|
+
>
|
|
467
|
+
<TableCell onClick={keep}>
|
|
468
|
+
<Checkbox
|
|
469
|
+
aria-label={`Select ${customer.name}`}
|
|
470
|
+
checked={chosen.includes(customer.id)}
|
|
471
|
+
onCheckedChange={on =>
|
|
472
|
+
toggle(customer.id, on === true)
|
|
473
|
+
}
|
|
474
|
+
/>
|
|
475
|
+
</TableCell>
|
|
476
|
+
<TableCell>
|
|
477
|
+
<span className="flex min-w-0 items-center gap-3">
|
|
478
|
+
<Avatar
|
|
479
|
+
alt={customer.name}
|
|
480
|
+
fallback={customer.initials}
|
|
481
|
+
size={24}
|
|
482
|
+
/>
|
|
483
|
+
<span className="flex min-w-0 flex-col">
|
|
484
|
+
{/* The name is the row's link, for the keyboard and the reader. */}
|
|
485
|
+
<button
|
|
486
|
+
className="cursor-pointer truncate text-left text-neutral-950 hover:underline"
|
|
487
|
+
onClick={event => {
|
|
488
|
+
event.stopPropagation();
|
|
489
|
+
nav.open('detail', customer.id);
|
|
490
|
+
}}
|
|
491
|
+
type="button"
|
|
492
|
+
>
|
|
493
|
+
{customer.name}
|
|
494
|
+
</button>
|
|
495
|
+
<span className="truncate font-normal text-neutral-600 text-xxs">
|
|
496
|
+
{customer.domain}
|
|
497
|
+
</span>
|
|
498
|
+
</span>
|
|
499
|
+
</span>
|
|
500
|
+
</TableCell>
|
|
501
|
+
<TableCell className="font-normal text-neutral-700">
|
|
502
|
+
{customer.plan}
|
|
503
|
+
</TableCell>
|
|
504
|
+
<TableCell>
|
|
505
|
+
<Badge tone={statusTone[customer.status]}>
|
|
506
|
+
{customer.status}
|
|
507
|
+
</Badge>
|
|
508
|
+
</TableCell>
|
|
509
|
+
<TableCell className="text-right tabular-nums" optional>
|
|
510
|
+
{customer.mrr ? formatEuro(customer.mrr) : '—'}
|
|
511
|
+
</TableCell>
|
|
512
|
+
<TableCell optional>
|
|
513
|
+
<span className="flex items-center gap-2 font-normal text-neutral-700">
|
|
514
|
+
<Avatar
|
|
515
|
+
alt={customer.owner}
|
|
516
|
+
fallback={customer.ownerInitials}
|
|
517
|
+
shape="round"
|
|
518
|
+
size={24}
|
|
519
|
+
/>
|
|
520
|
+
{customer.owner}
|
|
521
|
+
</span>
|
|
522
|
+
</TableCell>
|
|
523
|
+
<TableCell
|
|
524
|
+
className="font-normal text-neutral-600"
|
|
525
|
+
optional
|
|
526
|
+
>
|
|
527
|
+
{customer.seen}
|
|
528
|
+
</TableCell>
|
|
529
|
+
<TableCell onClick={keep}>
|
|
530
|
+
<DropdownMenu>
|
|
531
|
+
<DropdownMenuTrigger
|
|
532
|
+
render={
|
|
533
|
+
<Button
|
|
534
|
+
aria-label={`Actions for ${customer.name}`}
|
|
535
|
+
size="icon-sm"
|
|
536
|
+
variant="ghost"
|
|
537
|
+
/>
|
|
538
|
+
}
|
|
539
|
+
>
|
|
540
|
+
<EllipsisVertical {...icon} />
|
|
541
|
+
</DropdownMenuTrigger>
|
|
542
|
+
<DropdownMenuContent align="end">
|
|
543
|
+
<DropdownMenuItem
|
|
544
|
+
onClick={() =>
|
|
545
|
+
nav.open('detail', customer.id)
|
|
546
|
+
}
|
|
547
|
+
>
|
|
548
|
+
<ArrowUpRight {...icon} />
|
|
549
|
+
Open
|
|
550
|
+
</DropdownMenuItem>
|
|
551
|
+
<DropdownMenuItem>
|
|
552
|
+
<Mail {...icon} />
|
|
553
|
+
Message
|
|
554
|
+
</DropdownMenuItem>
|
|
555
|
+
<DropdownMenuSeparator />
|
|
556
|
+
<DropdownMenuItem
|
|
557
|
+
onClick={() => archive([customer.id])}
|
|
558
|
+
variant="danger"
|
|
559
|
+
>
|
|
560
|
+
<Archive {...icon} />
|
|
561
|
+
Archive
|
|
562
|
+
</DropdownMenuItem>
|
|
563
|
+
</DropdownMenuContent>
|
|
564
|
+
</DropdownMenu>
|
|
565
|
+
</TableCell>
|
|
566
|
+
</TableRow>
|
|
567
|
+
))}
|
|
568
|
+
</TableBody>
|
|
569
|
+
</>
|
|
570
|
+
)}
|
|
571
|
+
</Table>
|
|
572
|
+
|
|
573
|
+
{rows.length > 0 ? (
|
|
574
|
+
<Pagination
|
|
575
|
+
onPageChange={setPage}
|
|
576
|
+
page={current}
|
|
577
|
+
pageCount={pageCount}
|
|
578
|
+
results={`Showing ${first + 1}–${first + shown.length} of ${rows.length}`}
|
|
579
|
+
/>
|
|
580
|
+
) : filtered ? (
|
|
581
|
+
<EmptyState
|
|
582
|
+
action={
|
|
583
|
+
<Button onClick={clearFilters} variant="secondary">
|
|
584
|
+
Clear the filters
|
|
585
|
+
</Button>
|
|
586
|
+
}
|
|
587
|
+
description={`No ${view === 'All' ? '' : `${view.toLowerCase()} `}customer matches the search and the filters.`}
|
|
588
|
+
icon={<SearchX {...icon} />}
|
|
589
|
+
title="Nothing matches"
|
|
590
|
+
/>
|
|
591
|
+
) : (
|
|
592
|
+
<EmptyState
|
|
593
|
+
action={
|
|
594
|
+
<Button onClick={() => setView('All')} variant="secondary">
|
|
595
|
+
Show all customers
|
|
596
|
+
</Button>
|
|
597
|
+
}
|
|
598
|
+
description="A customer shows here as soon as it has this status."
|
|
599
|
+
icon={<UserRound {...icon} />}
|
|
600
|
+
title={
|
|
601
|
+
view === 'All' ? 'No customers' : `No ${view.toLowerCase()} customers`
|
|
602
|
+
}
|
|
603
|
+
/>
|
|
604
|
+
)}
|
|
605
|
+
</div>
|
|
606
|
+
</Workspace>
|
|
607
|
+
);
|
|
608
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Agent } from './agent';
|
|
3
|
+
import { CustomerDetail } from './customer';
|
|
4
|
+
import { Customers } from './customers';
|
|
5
|
+
import { NewCustomer } from './new-customer';
|
|
6
|
+
import { Overview } from './overview';
|
|
7
|
+
import { Settings } from './settings';
|
|
8
|
+
import { SignIn } from './sign-in';
|
|
9
|
+
|
|
10
|
+
export type Screen = {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
description: string;
|
|
14
|
+
/** `still` draws it as a shot: nothing opens on its own. */
|
|
15
|
+
render: (still?: boolean) => ReactNode;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Seven generic screens of one app, built from the system alone. They follow the
|
|
20
|
+
* playground's mode and the theme of the current project, every colour, corner
|
|
21
|
+
* and font of them. Shown live, they lead into each other: the sidebar, a row,
|
|
22
|
+
* the breadcrumb and a form's actions open the screen they name.
|
|
23
|
+
*/
|
|
24
|
+
export const screens: Screen[] = [
|
|
25
|
+
{
|
|
26
|
+
id: 'dashboard',
|
|
27
|
+
title: 'Dashboard',
|
|
28
|
+
description: 'Four numbers, revenue over twelve weeks, where it comes from and what moved.',
|
|
29
|
+
render: () => <Overview />,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'list',
|
|
33
|
+
title: 'List',
|
|
34
|
+
description:
|
|
35
|
+
'Search and filters over a ruled table, views in the dock, rows to select, and pages at the foot.',
|
|
36
|
+
render: () => <Customers />,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'detail',
|
|
40
|
+
title: 'Detail',
|
|
41
|
+
description:
|
|
42
|
+
'One record: what it is, what to do with it, its facets in tabs, and its history in a sheet.',
|
|
43
|
+
render: () => <CustomerDetail />,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'form',
|
|
47
|
+
title: 'Form',
|
|
48
|
+
description:
|
|
49
|
+
'The company, its plan, billing and first user in short sections, and one action at the end.',
|
|
50
|
+
render: () => <NewCustomer />,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'settings',
|
|
54
|
+
title: 'Settings',
|
|
55
|
+
description:
|
|
56
|
+
'The areas in the dock, a card per group with a row per setting, and the plan in force under Billing.',
|
|
57
|
+
render: () => <Settings />,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'agent',
|
|
61
|
+
title: 'Agent',
|
|
62
|
+
description:
|
|
63
|
+
'A large prompt with the recent chats under it; a question turns the page into the conversation, the reply written out as it comes.',
|
|
64
|
+
render: () => <Agent />,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'sign-in',
|
|
68
|
+
title: 'Sign in',
|
|
69
|
+
description: 'One card on the canvas: the email and password, and a way in without them.',
|
|
70
|
+
render: () => <SignIn />,
|
|
71
|
+
},
|
|
72
|
+
];
|