@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,377 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BottomBar,
|
|
3
|
+
Button,
|
|
4
|
+
Card,
|
|
5
|
+
CardContent,
|
|
6
|
+
CardHeader,
|
|
7
|
+
CardTitle,
|
|
8
|
+
Chip,
|
|
9
|
+
ChipAction,
|
|
10
|
+
cn,
|
|
11
|
+
Dock,
|
|
12
|
+
DockItem,
|
|
13
|
+
DropdownMenu,
|
|
14
|
+
DropdownMenuCheckboxItem,
|
|
15
|
+
DropdownMenuContent,
|
|
16
|
+
DropdownMenuLabel,
|
|
17
|
+
DropdownMenuTrigger,
|
|
18
|
+
focusRing,
|
|
19
|
+
SegmentedControl,
|
|
20
|
+
SegmentedControlItem,
|
|
21
|
+
Table,
|
|
22
|
+
TableBody,
|
|
23
|
+
TableCell,
|
|
24
|
+
TableHead,
|
|
25
|
+
TableHeader,
|
|
26
|
+
TableRow,
|
|
27
|
+
} from '@contui/ui';
|
|
28
|
+
import { ChartCard, type ChartColor, ChartFrame, ChartLegend, DonutChart } from '@contui/ui/charts';
|
|
29
|
+
import {
|
|
30
|
+
Calendar,
|
|
31
|
+
ChartLine,
|
|
32
|
+
CloudUpload,
|
|
33
|
+
Files,
|
|
34
|
+
Gauge,
|
|
35
|
+
LayoutGrid,
|
|
36
|
+
Link,
|
|
37
|
+
ListFilter,
|
|
38
|
+
MapPin,
|
|
39
|
+
Monitor,
|
|
40
|
+
MousePointerClick,
|
|
41
|
+
ShoppingCart,
|
|
42
|
+
Smartphone,
|
|
43
|
+
Users,
|
|
44
|
+
} from 'lucide-react';
|
|
45
|
+
import { type ReactNode, useState } from 'react';
|
|
46
|
+
import { AnalyticsPage, AnalyticsTopBar, formatWeekday, PageTitle, reportWeek } from './shared';
|
|
47
|
+
|
|
48
|
+
const initialFilters = [
|
|
49
|
+
{ id: 'device', label: 'Device: 2', icon: <Monitor strokeWidth={2} /> },
|
|
50
|
+
{ id: 'os', label: 'OS: 1', icon: <Smartphone strokeWidth={2} /> },
|
|
51
|
+
{ id: 'browser', label: 'Browser: 1', icon: <Calendar strokeWidth={2} /> },
|
|
52
|
+
{ id: 'region', label: 'Region: 1', icon: <MapPin strokeWidth={2} /> },
|
|
53
|
+
{ id: 'source', label: 'Source: 1', icon: <Link strokeWidth={2} /> },
|
|
54
|
+
{ id: 'visitor', label: 'New/Returning', icon: <Users strokeWidth={2} /> },
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
// One row per day of the report week; each chart plots its own key. A release went out on Friday:
|
|
58
|
+
// the bounce rate rises and the conversion rate dips from that day.
|
|
59
|
+
const week = reportWeek.map((date, i) => ({
|
|
60
|
+
date,
|
|
61
|
+
sessions: [1580, 1840, 1910, 1760, 1950, 1820, 1540][i] ?? 0,
|
|
62
|
+
bounce: [41, 42, 40, 43, 52, 50, 48][i] ?? 0,
|
|
63
|
+
conversion: [4.2, 4.4, 4.6, 4.3, 2.8, 3.1, 3.3][i] ?? 0,
|
|
64
|
+
}));
|
|
65
|
+
const percent = (value: number) => `${value}%`;
|
|
66
|
+
|
|
67
|
+
// The headlines are the week's own figures: the sessions added up, the rates averaged by session.
|
|
68
|
+
const totalSessions = week.reduce((total, day) => total + day.sessions, 0);
|
|
69
|
+
const weekRate = (key: 'bounce' | 'conversion') =>
|
|
70
|
+
week.reduce((total, day) => total + day[key] * day.sessions, 0) / totalSessions;
|
|
71
|
+
const compact = new Intl.NumberFormat('en-GB', { notation: 'compact', maximumFractionDigits: 1 });
|
|
72
|
+
|
|
73
|
+
const sections = [
|
|
74
|
+
{ id: 'overview', label: 'Overview', icon: <LayoutGrid strokeWidth={2} /> },
|
|
75
|
+
{ id: 'traffic', label: 'Traffic', icon: <ChartLine strokeWidth={2} /> },
|
|
76
|
+
{ id: 'performance', label: 'Performance', icon: <Gauge strokeWidth={2} /> },
|
|
77
|
+
{ id: 'pages', label: 'Pages', icon: <Files strokeWidth={2} /> },
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
/** The day the release went out: the bounce rate rises and the conversion rate dips from it. */
|
|
81
|
+
const release = [{ index: 4, label: 'Release 2.4', icon: <CloudUpload /> }];
|
|
82
|
+
|
|
83
|
+
/** One rate over the report week in its card, the release marked on the day it went out. */
|
|
84
|
+
const RateCard = ({
|
|
85
|
+
title,
|
|
86
|
+
icon,
|
|
87
|
+
dataKey,
|
|
88
|
+
color,
|
|
89
|
+
value,
|
|
90
|
+
delta,
|
|
91
|
+
}: {
|
|
92
|
+
title: string;
|
|
93
|
+
icon: ReactNode;
|
|
94
|
+
dataKey: 'bounce' | 'conversion';
|
|
95
|
+
color: ChartColor;
|
|
96
|
+
value: string;
|
|
97
|
+
delta: string;
|
|
98
|
+
}) => (
|
|
99
|
+
<ChartCard
|
|
100
|
+
comparison="on last week"
|
|
101
|
+
data={week}
|
|
102
|
+
delta={delta}
|
|
103
|
+
formatX={formatWeekday}
|
|
104
|
+
formatY={percent}
|
|
105
|
+
height={240}
|
|
106
|
+
icon={icon}
|
|
107
|
+
markers={release}
|
|
108
|
+
series={[{ key: dataKey, name: title, color }]}
|
|
109
|
+
title={title}
|
|
110
|
+
trend="down"
|
|
111
|
+
value={value}
|
|
112
|
+
x="date"
|
|
113
|
+
xTicks={week.length}
|
|
114
|
+
// Rates stop at 100%, so the axis does not reach past it for headroom.
|
|
115
|
+
yMax={100}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const pages = {
|
|
120
|
+
pages: [
|
|
121
|
+
['/', '4,812', '9,204'],
|
|
122
|
+
['/pricing', '2,140', '3,388'],
|
|
123
|
+
['/blog/launch-week', '1,377', '1,902'],
|
|
124
|
+
['/docs/getting-started', '986', '2,215'],
|
|
125
|
+
['/changelog', '642', '811'],
|
|
126
|
+
],
|
|
127
|
+
entry: [
|
|
128
|
+
['/', '3,904', '3,904'],
|
|
129
|
+
['/blog/launch-week', '1,102', '1,102'],
|
|
130
|
+
['/pricing', '875', '875'],
|
|
131
|
+
['/docs', '512', '512'],
|
|
132
|
+
['/careers', '204', '204'],
|
|
133
|
+
],
|
|
134
|
+
exit: [
|
|
135
|
+
['/pricing', '1,210', '3,388'],
|
|
136
|
+
['/checkout', '806', '1,426'],
|
|
137
|
+
['/', '733', '9,204'],
|
|
138
|
+
['/docs/api', '398', '1,040'],
|
|
139
|
+
['/contact', '187', '402'],
|
|
140
|
+
],
|
|
141
|
+
} as const;
|
|
142
|
+
|
|
143
|
+
// The week's sessions by device; the shares add up to the whole week.
|
|
144
|
+
const devices = [
|
|
145
|
+
{ name: 'Desktop', share: 0.62 },
|
|
146
|
+
{ name: 'Mobile', share: 0.31 },
|
|
147
|
+
{ name: 'Tablet', share: 0.07 },
|
|
148
|
+
].map(device => ({ ...device, value: Math.round(device.share * totalSessions) }));
|
|
149
|
+
|
|
150
|
+
const TopPagesCard = () => {
|
|
151
|
+
const [view, setView] = useState<keyof typeof pages>('pages');
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<Card layout="list">
|
|
155
|
+
<CardHeader className="flex-row items-center justify-between gap-4">
|
|
156
|
+
<CardTitle>Top pages</CardTitle>
|
|
157
|
+
<SegmentedControl
|
|
158
|
+
aria-label="Page list"
|
|
159
|
+
onValueChange={next => setView(next as keyof typeof pages)}
|
|
160
|
+
value={view}
|
|
161
|
+
>
|
|
162
|
+
<SegmentedControlItem value="pages">Pages</SegmentedControlItem>
|
|
163
|
+
<SegmentedControlItem value="entry">Entry</SegmentedControlItem>
|
|
164
|
+
<SegmentedControlItem value="exit">Exit</SegmentedControlItem>
|
|
165
|
+
</SegmentedControl>
|
|
166
|
+
</CardHeader>
|
|
167
|
+
<CardContent>
|
|
168
|
+
<Table variant="rows">
|
|
169
|
+
<TableHeader>
|
|
170
|
+
<TableRow>
|
|
171
|
+
<TableHead>Page</TableHead>
|
|
172
|
+
<TableHead className="w-16" numeric>
|
|
173
|
+
Visitors
|
|
174
|
+
</TableHead>
|
|
175
|
+
<TableHead className="w-16" numeric>
|
|
176
|
+
Views
|
|
177
|
+
</TableHead>
|
|
178
|
+
</TableRow>
|
|
179
|
+
</TableHeader>
|
|
180
|
+
<TableBody>
|
|
181
|
+
{pages[view].map(([page, visitors, views]) => (
|
|
182
|
+
<TableRow key={page}>
|
|
183
|
+
<TableCell>{page}</TableCell>
|
|
184
|
+
<TableCell numeric>{visitors}</TableCell>
|
|
185
|
+
<TableCell numeric>{views}</TableCell>
|
|
186
|
+
</TableRow>
|
|
187
|
+
))}
|
|
188
|
+
</TableBody>
|
|
189
|
+
</Table>
|
|
190
|
+
</CardContent>
|
|
191
|
+
</Card>
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/** The week's sessions by device: the total at the card's head, the ring and its key beside it. */
|
|
196
|
+
const DevicesCard = () => (
|
|
197
|
+
<ChartFrame
|
|
198
|
+
comparison="sessions this week"
|
|
199
|
+
icon={<Monitor />}
|
|
200
|
+
table={{
|
|
201
|
+
columns: ['Device', 'Sessions'],
|
|
202
|
+
rows: devices.map(device => [device.name, device.value]),
|
|
203
|
+
}}
|
|
204
|
+
title="Devices"
|
|
205
|
+
value={compact.format(totalSessions)}
|
|
206
|
+
>
|
|
207
|
+
<div className="flex items-center gap-6">
|
|
208
|
+
<DonutChart
|
|
209
|
+
aria-label="Sessions by device, this week"
|
|
210
|
+
data={devices}
|
|
211
|
+
size={132}
|
|
212
|
+
total={false}
|
|
213
|
+
/>
|
|
214
|
+
<ChartLegend
|
|
215
|
+
className="min-w-0 flex-1"
|
|
216
|
+
items={devices.map(device => ({
|
|
217
|
+
name: device.name,
|
|
218
|
+
value: `${Math.round(device.share * 100)}%`,
|
|
219
|
+
}))}
|
|
220
|
+
layout="list"
|
|
221
|
+
/>
|
|
222
|
+
</div>
|
|
223
|
+
</ChartFrame>
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
/** Analytics overview (Eyes, 2026): filters, three area charts, top pages and devices. */
|
|
227
|
+
export const AnalyticsOverview = () => {
|
|
228
|
+
const [filters, setFilters] = useState(initialFilters);
|
|
229
|
+
const [section, setSection] = useState('overview');
|
|
230
|
+
const current = sections.find(s => s.id === section) ?? sections[0];
|
|
231
|
+
// The overview shows every card; each other section shows only its own.
|
|
232
|
+
const show = (id: string) => section === 'overview' || section === id;
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
<AnalyticsPage
|
|
236
|
+
bottomBar={
|
|
237
|
+
<BottomBar floating>
|
|
238
|
+
{/* The page's one primary is Add to Ask in the top bar, so the dock holds only the sections. */}
|
|
239
|
+
<Dock
|
|
240
|
+
aria-label="Sections"
|
|
241
|
+
onValueChange={next => {
|
|
242
|
+
if (next) setSection(next);
|
|
243
|
+
}}
|
|
244
|
+
value={section}
|
|
245
|
+
>
|
|
246
|
+
{sections.map(item => (
|
|
247
|
+
<DockItem key={item.id} value={item.id}>
|
|
248
|
+
{item.icon}
|
|
249
|
+
{item.label}
|
|
250
|
+
</DockItem>
|
|
251
|
+
))}
|
|
252
|
+
</Dock>
|
|
253
|
+
</BottomBar>
|
|
254
|
+
}
|
|
255
|
+
rail="analytics"
|
|
256
|
+
>
|
|
257
|
+
<AnalyticsTopBar trail={['Analytics', current?.label ?? 'Overview']} />
|
|
258
|
+
|
|
259
|
+
<div className="mt-1 flex min-h-14 items-end justify-between gap-6">
|
|
260
|
+
<div className="flex flex-wrap gap-1.5">
|
|
261
|
+
{filters.map(filter => (
|
|
262
|
+
<Chip
|
|
263
|
+
icon={filter.icon}
|
|
264
|
+
key={filter.id}
|
|
265
|
+
action={
|
|
266
|
+
<ChipAction
|
|
267
|
+
onClick={() =>
|
|
268
|
+
setFilters(current =>
|
|
269
|
+
current.filter(f => f.id !== filter.id),
|
|
270
|
+
)
|
|
271
|
+
}
|
|
272
|
+
/>
|
|
273
|
+
}
|
|
274
|
+
>
|
|
275
|
+
{filter.label}
|
|
276
|
+
</Chip>
|
|
277
|
+
))}
|
|
278
|
+
{filters.length === 0 && (
|
|
279
|
+
<span className="text-neutral-600 text-xs">No filters applied</span>
|
|
280
|
+
)}
|
|
281
|
+
</div>
|
|
282
|
+
<div className="flex shrink-0 items-center gap-4">
|
|
283
|
+
<DropdownMenu>
|
|
284
|
+
<DropdownMenuTrigger render={<Button variant="ghost" />}>
|
|
285
|
+
<ListFilter strokeWidth={2} />
|
|
286
|
+
Filters
|
|
287
|
+
</DropdownMenuTrigger>
|
|
288
|
+
<DropdownMenuContent align="end">
|
|
289
|
+
<DropdownMenuLabel>Filters</DropdownMenuLabel>
|
|
290
|
+
{initialFilters.map(filter => (
|
|
291
|
+
<DropdownMenuCheckboxItem
|
|
292
|
+
checked={filters.some(f => f.id === filter.id)}
|
|
293
|
+
key={filter.id}
|
|
294
|
+
onCheckedChange={checked =>
|
|
295
|
+
setFilters(current =>
|
|
296
|
+
checked
|
|
297
|
+
? initialFilters.filter(
|
|
298
|
+
f => f === filter || current.includes(f),
|
|
299
|
+
)
|
|
300
|
+
: current.filter(f => f.id !== filter.id),
|
|
301
|
+
)
|
|
302
|
+
}
|
|
303
|
+
>
|
|
304
|
+
{filter.icon}
|
|
305
|
+
{filter.label}
|
|
306
|
+
</DropdownMenuCheckboxItem>
|
|
307
|
+
))}
|
|
308
|
+
</DropdownMenuContent>
|
|
309
|
+
</DropdownMenu>
|
|
310
|
+
<button
|
|
311
|
+
className={cn(
|
|
312
|
+
'shrink-0 cursor-pointer rounded-xs text-neutral-600 text-xs transition-colors duration-150 hover:text-neutral-950 disabled:cursor-default disabled:opacity-50',
|
|
313
|
+
focusRing,
|
|
314
|
+
)}
|
|
315
|
+
disabled={filters.length === 0}
|
|
316
|
+
onClick={() => setFilters([])}
|
|
317
|
+
type="button"
|
|
318
|
+
>
|
|
319
|
+
Clear all
|
|
320
|
+
</button>
|
|
321
|
+
</div>
|
|
322
|
+
</div>
|
|
323
|
+
|
|
324
|
+
<div className="mt-24">
|
|
325
|
+
<PageTitle>Analytics — {current?.label}</PageTitle>
|
|
326
|
+
</div>
|
|
327
|
+
|
|
328
|
+
{/* The block gap: the bare title over the chart card 32; then the chart card over the rate
|
|
329
|
+
cards 40 and those over the pages and devices 32, each a step from 36. */}
|
|
330
|
+
<div className="mt-8 flex flex-col gap-9">
|
|
331
|
+
{show('traffic') && (
|
|
332
|
+
<ChartCard
|
|
333
|
+
comparison="on last week"
|
|
334
|
+
data={week}
|
|
335
|
+
delta="+10.7%"
|
|
336
|
+
formatX={formatWeekday}
|
|
337
|
+
height={280}
|
|
338
|
+
icon={<Users />}
|
|
339
|
+
series={[{ key: 'sessions', name: 'Sessions' }]}
|
|
340
|
+
title="Sessions this week"
|
|
341
|
+
value={compact.format(totalSessions)}
|
|
342
|
+
x="date"
|
|
343
|
+
xTicks={week.length}
|
|
344
|
+
/>
|
|
345
|
+
)}
|
|
346
|
+
|
|
347
|
+
{show('performance') && (
|
|
348
|
+
<div className="grid grid-cols-2 gap-4">
|
|
349
|
+
<RateCard
|
|
350
|
+
color="error"
|
|
351
|
+
dataKey="bounce"
|
|
352
|
+
delta="+3.1 pts"
|
|
353
|
+
icon={<MousePointerClick />}
|
|
354
|
+
title="Bounce rate"
|
|
355
|
+
value={`${Math.round(weekRate('bounce'))}%`}
|
|
356
|
+
/>
|
|
357
|
+
<RateCard
|
|
358
|
+
color="success"
|
|
359
|
+
dataKey="conversion"
|
|
360
|
+
delta="−0.4 pts"
|
|
361
|
+
icon={<ShoppingCart />}
|
|
362
|
+
title="Conversion rate"
|
|
363
|
+
value={`${weekRate('conversion').toFixed(1)}%`}
|
|
364
|
+
/>
|
|
365
|
+
</div>
|
|
366
|
+
)}
|
|
367
|
+
|
|
368
|
+
{(show('pages') || show('traffic')) && (
|
|
369
|
+
<div className={cn('grid gap-4', section === 'overview' && 'grid-cols-2')}>
|
|
370
|
+
{show('pages') && <TopPagesCard />}
|
|
371
|
+
{show('traffic') && <DevicesCard />}
|
|
372
|
+
</div>
|
|
373
|
+
)}
|
|
374
|
+
</div>
|
|
375
|
+
</AnalyticsPage>
|
|
376
|
+
);
|
|
377
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BottomBar,
|
|
3
|
+
Dock,
|
|
4
|
+
DockItem,
|
|
5
|
+
SegmentedControl,
|
|
6
|
+
SegmentedControlItem,
|
|
7
|
+
StatCard,
|
|
8
|
+
} from '@contui/ui';
|
|
9
|
+
import { ChartCard, ChartFrame, FunnelChart, type FunnelStep } from '@contui/ui/charts';
|
|
10
|
+
import { CircleCheck, ShoppingCart, UserCheck, UserPlus, Users } from 'lucide-react';
|
|
11
|
+
import { useState } from 'react';
|
|
12
|
+
import { AnalyticsPage, AnalyticsTopBar, PageTitle } from './shared';
|
|
13
|
+
|
|
14
|
+
type Segment = 'all' | 'new' | 'returning';
|
|
15
|
+
|
|
16
|
+
// Eight weeks starting Monday 31 August 2026; the axis names them W1 to W8.
|
|
17
|
+
const firstWeek = new Date(2026, 7, 31);
|
|
18
|
+
const WEEK = 7 * 24 * 60 * 60 * 1000;
|
|
19
|
+
|
|
20
|
+
// Visitors who reached /pricing and who reached /checkout/complete, per week. All visitors are the
|
|
21
|
+
// new and the returning together, so every figure on the page is worked out from these.
|
|
22
|
+
const weekly = {
|
|
23
|
+
new: {
|
|
24
|
+
entered: [188, 205, 180, 220, 229, 212, 242, 236],
|
|
25
|
+
completed: [62, 71, 64, 79, 85, 78, 90, 83],
|
|
26
|
+
},
|
|
27
|
+
returning: {
|
|
28
|
+
entered: [122, 137, 118, 145, 151, 140, 159, 152],
|
|
29
|
+
completed: [56, 65, 57, 71, 77, 71, 81, 76],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const series = (segment: Segment, key: 'entered' | 'completed') =>
|
|
34
|
+
segment === 'all'
|
|
35
|
+
? weekly.new[key].map((value, i) => value + (weekly.returning[key][i] ?? 0))
|
|
36
|
+
: weekly[segment][key];
|
|
37
|
+
|
|
38
|
+
// Where the two middle steps fall between those who entered and those who completed, the same for
|
|
39
|
+
// either segment, so the steps of all visitors are the two segments' together.
|
|
40
|
+
const CHECKOUT = 0.62;
|
|
41
|
+
const STEP_2 = 0.07;
|
|
42
|
+
|
|
43
|
+
// The median time from /pricing to /checkout/complete; all visitors sit between the two segments.
|
|
44
|
+
const timeToComplete: Record<Segment, string> = {
|
|
45
|
+
all: '1m 44s',
|
|
46
|
+
new: '2m 06s',
|
|
47
|
+
returning: '1m 21s',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const sum = (values: number[]) => values.reduce((total, value) => total + value, 0);
|
|
51
|
+
const count = new Intl.NumberFormat('en-GB');
|
|
52
|
+
const percent = (value: number) => `${value.toFixed(1)}%`;
|
|
53
|
+
|
|
54
|
+
/** The funnel, its figures and the weekly rate for one segment over the last `weeks` weeks. */
|
|
55
|
+
const funnelFor = (segment: Segment, weeks: number) => {
|
|
56
|
+
const entered = series(segment, 'entered').slice(-weeks);
|
|
57
|
+
const completed = series(segment, 'completed').slice(-weeks);
|
|
58
|
+
const total = sum(entered);
|
|
59
|
+
const done = sum(completed);
|
|
60
|
+
const stages: FunnelStep[] = [
|
|
61
|
+
{ name: '/pricing', value: total },
|
|
62
|
+
{ name: '/checkout', value: Math.round(done + (total - done) * CHECKOUT) },
|
|
63
|
+
{ name: '/checkout/step-2', value: Math.round(done + (total - done) * STEP_2) },
|
|
64
|
+
{ name: '/checkout/complete', value: done },
|
|
65
|
+
];
|
|
66
|
+
// The step that loses the largest share of the visitors who reached the one before it.
|
|
67
|
+
const drops = stages.slice(1).map((stage, i) => ({
|
|
68
|
+
label: stage.name,
|
|
69
|
+
share: 1 - stage.value / (stages[i]?.value ?? 1),
|
|
70
|
+
}));
|
|
71
|
+
const biggest = drops.reduce((a, b) => (b.share > a.share ? b : a));
|
|
72
|
+
const rows = entered.map((value, i) => ({
|
|
73
|
+
date: new Date(firstWeek.getTime() + (8 - weeks + i) * WEEK),
|
|
74
|
+
rate: Math.round(((completed[i] ?? 0) / value) * 1000) / 10,
|
|
75
|
+
}));
|
|
76
|
+
return { total, done, stages, biggest, rows };
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const formatWeek = (date: Date) =>
|
|
80
|
+
`W${Math.round((date.getTime() - firstWeek.getTime()) / WEEK) + 1}`;
|
|
81
|
+
const rateSeries = [{ key: 'rate', name: 'Completion rate', color: 'series-2' }];
|
|
82
|
+
|
|
83
|
+
/** Checkout funnel (Eyes, 2026): KPI cards, the funnel, and completion over time. */
|
|
84
|
+
export const CheckoutFunnel = () => {
|
|
85
|
+
const [segment, setSegment] = useState<Segment>('all');
|
|
86
|
+
const [range, setRange] = useState('8w');
|
|
87
|
+
|
|
88
|
+
// The range picks the weeks the whole page covers: the cards, the funnel and the chart.
|
|
89
|
+
const weeks = range === '4w' ? 4 : 8;
|
|
90
|
+
const { total, done, stages, biggest, rows } = funnelFor(segment, weeks);
|
|
91
|
+
const latest = rows.at(-1)?.rate ?? 0;
|
|
92
|
+
const change = latest - (rows.at(-2)?.rate ?? latest);
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<AnalyticsPage
|
|
96
|
+
bottomBar={
|
|
97
|
+
<BottomBar floating>
|
|
98
|
+
<Dock
|
|
99
|
+
aria-label="Visitor segment"
|
|
100
|
+
onValueChange={next => {
|
|
101
|
+
if (next) setSegment(next as Segment);
|
|
102
|
+
}}
|
|
103
|
+
value={segment}
|
|
104
|
+
>
|
|
105
|
+
<DockItem value="all">
|
|
106
|
+
<Users strokeWidth={2} />
|
|
107
|
+
All visitors
|
|
108
|
+
</DockItem>
|
|
109
|
+
<DockItem value="new">
|
|
110
|
+
<UserPlus strokeWidth={2} />
|
|
111
|
+
New
|
|
112
|
+
</DockItem>
|
|
113
|
+
<DockItem value="returning">
|
|
114
|
+
<UserCheck strokeWidth={2} />
|
|
115
|
+
Returning
|
|
116
|
+
</DockItem>
|
|
117
|
+
</Dock>
|
|
118
|
+
</BottomBar>
|
|
119
|
+
}
|
|
120
|
+
rail="analytics"
|
|
121
|
+
>
|
|
122
|
+
<AnalyticsTopBar trail={['Analytics', 'Funnels', 'Checkout funnel']} />
|
|
123
|
+
|
|
124
|
+
{/* Its foot is the block gap: the bare title over five stat cards. */}
|
|
125
|
+
<div className="mt-20 mb-10 flex items-end justify-between gap-4">
|
|
126
|
+
<PageTitle>Checkout funnel</PageTitle>
|
|
127
|
+
<SegmentedControl
|
|
128
|
+
aria-label="Range"
|
|
129
|
+
onValueChange={next => {
|
|
130
|
+
if (next) setRange(next);
|
|
131
|
+
}}
|
|
132
|
+
value={range}
|
|
133
|
+
>
|
|
134
|
+
<SegmentedControlItem value="4w">4 weeks</SegmentedControlItem>
|
|
135
|
+
<SegmentedControlItem value="8w">8 weeks</SegmentedControlItem>
|
|
136
|
+
</SegmentedControl>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<div className="flex flex-col gap-4">
|
|
140
|
+
<div className="grid grid-cols-3 gap-4">
|
|
141
|
+
<StatCard label="Entered" value={count.format(total)} />
|
|
142
|
+
<StatCard label="Completed" value={count.format(done)} />
|
|
143
|
+
<StatCard label="Completion rate" value={percent((done / total) * 100)} />
|
|
144
|
+
</div>
|
|
145
|
+
<div className="grid grid-cols-2 gap-4">
|
|
146
|
+
<StatCard
|
|
147
|
+
delta={`${Math.round(biggest.share * 100)}% leave`}
|
|
148
|
+
label="Biggest drop-off"
|
|
149
|
+
trend="down"
|
|
150
|
+
value={biggest.label}
|
|
151
|
+
/>
|
|
152
|
+
<StatCard label="Median time to complete" value={timeToComplete[segment]} />
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
{/* The block gap: the five stat cards over the funnel's card. */}
|
|
157
|
+
<ChartFrame
|
|
158
|
+
className="mt-11"
|
|
159
|
+
icon={<ShoppingCart />}
|
|
160
|
+
table={{
|
|
161
|
+
columns: ['Step', 'Visitors'],
|
|
162
|
+
rows: stages.map(stage => [stage.name, stage.value]),
|
|
163
|
+
}}
|
|
164
|
+
title="From /pricing to a paid order"
|
|
165
|
+
>
|
|
166
|
+
<FunnelChart
|
|
167
|
+
aria-label="Visitors at each step of the checkout"
|
|
168
|
+
data={stages}
|
|
169
|
+
height={240}
|
|
170
|
+
/>
|
|
171
|
+
</ChartFrame>
|
|
172
|
+
|
|
173
|
+
{/* The block gap: the funnel's card over the chart card. */}
|
|
174
|
+
<ChartCard
|
|
175
|
+
className="mt-9"
|
|
176
|
+
comparison="on the week before"
|
|
177
|
+
data={rows}
|
|
178
|
+
delta={`${change >= 0 ? '+' : '−'}${Math.abs(change).toFixed(1)} pts`}
|
|
179
|
+
formatValue={percent}
|
|
180
|
+
formatX={formatWeek}
|
|
181
|
+
formatY={value => `${value}%`}
|
|
182
|
+
height={260}
|
|
183
|
+
icon={<CircleCheck />}
|
|
184
|
+
series={rateSeries}
|
|
185
|
+
title="Completion rate, last week"
|
|
186
|
+
trend={change >= 0 ? 'up' : 'down'}
|
|
187
|
+
value={percent(latest)}
|
|
188
|
+
x="date"
|
|
189
|
+
xTicks={rows.length}
|
|
190
|
+
/>
|
|
191
|
+
</AnalyticsPage>
|
|
192
|
+
);
|
|
193
|
+
};
|