@squadbase/vantage-template 0.1.0-dev.c40b771 → 0.1.0-dev2.12326b6

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.
@@ -1,6 +1,7 @@
1
1
  import { definePage } from "@squadbase/vantage"
2
2
  import {
3
3
  DashboardCardPreset,
4
+ EChart,
4
5
  PageShell,
5
6
  PageShellContent,
6
7
  PageShellDescription,
@@ -8,6 +9,8 @@ import {
8
9
  PageShellHeading,
9
10
  PageShellTitle,
10
11
  Placeholder,
12
+ Sparkline,
13
+ type EChartsOption,
11
14
  } from "@squadbase/vantage/components"
12
15
 
13
16
  export const page = definePage({
@@ -17,13 +20,49 @@ export const page = definePage({
17
20
  })
18
21
 
19
22
  const METRICS = [
20
- { label: "Metric 1", value: "1,234" },
21
- { label: "Metric 2", value: "5,678" },
22
- { label: "Metric 3", value: "90.1%" },
23
- { label: "Metric 4", value: "$12.3k" },
23
+ { label: "Metric 1", value: "1,234", trend: [3, 4, 3, 5, 6, 5, 7] },
24
+ { label: "Metric 2", value: "5,678", trend: [6, 5, 6, 4, 5, 6, 6] },
25
+ { label: "Metric 3", value: "90.1%", trend: [2, 3, 5, 4, 6, 7, 8] },
26
+ { label: "Metric 4", value: "$12.3k", trend: [5, 6, 4, 6, 5, 7, 6] },
24
27
  ]
25
28
 
26
- const CHARTS = ["Chart 1", "Chart 2"]
29
+ // Sample charts. `EChart` paints series with `--chart-1..5` and the sparklines
30
+ // use `--primary` (both from `styles.css`), so a theme change shows up here.
31
+ const BAR_OPTION: EChartsOption = {
32
+ legend: { top: 0 },
33
+ grid: { top: 36, right: 8, bottom: 24, left: 36 },
34
+ xAxis: { type: "category", data: ["Jan", "Feb", "Mar", "Apr", "May", "Jun"] },
35
+ yAxis: { type: "value" },
36
+ series: [
37
+ { name: "Series A", type: "bar", data: [12, 18, 15, 22, 26, 24] },
38
+ { name: "Series B", type: "bar", data: [8, 11, 13, 12, 16, 19] },
39
+ { name: "Series C", type: "bar", data: [5, 7, 6, 9, 8, 11] },
40
+ ],
41
+ }
42
+
43
+ const PIE_OPTION: EChartsOption = {
44
+ legend: { bottom: 0 },
45
+ series: [
46
+ {
47
+ type: "pie",
48
+ radius: ["45%", "70%"],
49
+ center: ["50%", "45%"],
50
+ label: { show: false },
51
+ data: [
52
+ { name: "Category A", value: 35 },
53
+ { name: "Category B", value: 25 },
54
+ { name: "Category C", value: 18 },
55
+ { name: "Category D", value: 12 },
56
+ { name: "Category E", value: 10 },
57
+ ],
58
+ },
59
+ ],
60
+ }
61
+
62
+ const CHARTS = [
63
+ { title: "Chart 1", option: BAR_OPTION },
64
+ { title: "Chart 2", option: PIE_OPTION },
65
+ ]
27
66
 
28
67
  export default function HomePage() {
29
68
  return (
@@ -42,14 +81,20 @@ export default function HomePage() {
42
81
  {METRICS.map((metric) => (
43
82
  <DashboardCardPreset key={metric.label} title={metric.label}>
44
83
  <Placeholder className="text-2xl font-bold">{metric.value}</Placeholder>
84
+ <Sparkline
85
+ className="mt-2"
86
+ data={metric.trend.map((value) => ({ value }))}
87
+ color="text-primary"
88
+ area
89
+ />
45
90
  </DashboardCardPreset>
46
91
  ))}
47
92
  </section>
48
93
 
49
94
  <section className="grid grid-cols-1 gap-4 lg:grid-cols-2">
50
- {CHARTS.map((title) => (
51
- <DashboardCardPreset key={title} title={title}>
52
- <Placeholder className="h-64 w-full" />
95
+ {CHARTS.map((chart) => (
96
+ <DashboardCardPreset key={chart.title} title={chart.title}>
97
+ <EChart option={chart.option} height={256} ariaLabel={chart.title} />
53
98
  </DashboardCardPreset>
54
99
  ))}
55
100
  </section>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squadbase/vantage-template",
3
- "version": "0.1.0-dev.c40b771",
3
+ "version": "0.1.0-dev2.12326b6",
4
4
  "description": "CLI tool for initializing and customizing Squadbase Vantage projects.",
5
5
  "keywords": [
6
6
  "squadbase",
@@ -223,7 +223,7 @@ function heatmapOption(
223
223
  type: "heatmap",
224
224
  data: data.map((c) => [xAxis.indexOf(c.x), yAxis.indexOf(c.y), c.value]),
225
225
  label: { show: false },
226
- emphasis: { itemStyle: { shadowBlur: 8, shadowColor: "rgba(0,0,0,0.4)" } },
226
+ emphasis: { itemStyle: { shadowBlur: 8 } },
227
227
  },
228
228
  ],
229
229
  }
@@ -223,7 +223,7 @@ function heatmapOption(
223
223
  type: "heatmap",
224
224
  data: data.map((c) => [xAxis.indexOf(c.x), yAxis.indexOf(c.y), c.value]),
225
225
  label: { show: false },
226
- emphasis: { itemStyle: { shadowBlur: 8, shadowColor: "rgba(0,0,0,0.4)" } },
226
+ emphasis: { itemStyle: { shadowBlur: 8 } },
227
227
  },
228
228
  ],
229
229
  }
@@ -113,13 +113,13 @@ const summaryCards = [
113
113
  label: "Best step",
114
114
  value: "31.9%",
115
115
  sub: "Highest step conversion",
116
- icon: <TrendingUp className="size-4 text-emerald-600" />,
116
+ icon: <TrendingUp className="size-4 text-chart-2" />,
117
117
  },
118
118
  {
119
119
  label: "Biggest drop",
120
120
  value: "68.2%",
121
121
  sub: "Largest step drop-off",
122
- icon: <TrendingDown className="size-4 text-rose-600" />,
122
+ icon: <TrendingDown className="size-4 text-destructive" />,
123
123
  },
124
124
  ]
125
125
 
@@ -112,13 +112,13 @@ const summaryCards = [
112
112
  label: "最良ステップ",
113
113
  value: "31.9%",
114
114
  sub: "最も高いステップ転換率",
115
- icon: <TrendingUp className="size-4 text-emerald-600" />,
115
+ icon: <TrendingUp className="size-4 text-chart-2" />,
116
116
  },
117
117
  {
118
118
  label: "最大の離脱",
119
119
  value: "68.2%",
120
120
  sub: "最大のステップ離脱率",
121
- icon: <TrendingDown className="size-4 text-rose-600" />,
121
+ icon: <TrendingDown className="size-4 text-destructive" />,
122
122
  },
123
123
  ]
124
124