Skip to content

Commit 4648b66

Browse files
fmhallclaude
andcommitted
feat(scan): use bar chart for Volume to match sibling stats
Volume was rendering as an area/line chart while Transactions, Buyers, and Sellers used bars on the same screen. Switches Volume to bars on the home overview, server origin, recipient activity, and facilitator activity views (and matching loading skeletons). On the home overview Volume now follows chartMode like its siblings (bars per-bucket, area cumulative); the StatRow type alias keeps an eslint-disable since it must satisfy ChartData<T extends Record<string, number>>. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 46401a3 commit 4648b66

4 files changed

Lines changed: 14 additions & 16 deletions

File tree

  • apps/scan/src/app/(app)
    • (home)/(overview)/_components/stats
    • facilitator/[id]/(overview)/_components/activity
    • recipient/[address]/(overview)/_components/activity
    • server/[id]/(overview)/_components/activity

apps/scan/src/app/(app)/(home)/(overview)/_components/stats/charts.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { convertTokenAmount, formatTokenAmount } from '@/lib/token';
1212
import type { ChartData, ChartItems } from '@/components/ui/charts/chart/types';
1313
import { useChain } from '@/app/(app)/_contexts/chain/hook';
1414

15+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
1516
type StatRow = {
1617
transactions: number;
1718
totalAmount: number;
@@ -64,8 +65,7 @@ export const OverallCharts = () => {
6465
};
6566
});
6667

67-
// Per-bucket uses bars for counts (transactions/buyers/sellers) and an area
68-
// for volume. Cumulative uses areas for everything since the line is
68+
// Per-bucket uses bars; cumulative uses areas since the line is
6969
// monotonically increasing.
7070
const isCumulative = chartMode === 'cumulative';
7171
const buildItems = (dataKey: keyof StatRow): ChartItems<StatRow> =>
@@ -79,6 +79,7 @@ export const OverallCharts = () => {
7979
bars: [{ dataKey, color: 'var(--color-primary)' }],
8080
};
8181
const txItems = buildItems('transactions');
82+
const volumeItems = buildItems('totalAmount');
8283
const buyersItems = buildItems('buyers');
8384
const sellersItems = buildItems('sellers');
8485

@@ -109,10 +110,7 @@ export const OverallCharts = () => {
109110
<OverallStatsCard
110111
title="Volume"
111112
value={formatTokenAmount(BigInt(overallStats.total_amount))}
112-
items={{
113-
type: 'area',
114-
areas: [{ dataKey: 'totalAmount', color: 'var(--color-primary)' }],
115-
}}
113+
items={volumeItems}
116114
data={chartData}
117115
tooltipRows={[
118116
{
@@ -181,7 +179,7 @@ export const LoadingOverallCharts = () => {
181179
return (
182180
<>
183181
<LoadingOverallStatsCard type="bar" title="Transactions" />
184-
<LoadingOverallStatsCard type="area" title="Volume" />
182+
<LoadingOverallStatsCard type="bar" title="Volume" />
185183
<LoadingOverallStatsCard type="bar" title="Buyers" />
186184
<LoadingOverallStatsCard type="bar" title="Sellers" />
187185
</>

apps/scan/src/app/(app)/facilitator/[id]/(overview)/_components/activity/charts.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ export const ActivityCharts: React.FC<Props> = ({ facilitatorId }) => {
9696
amount: formatTokenAmount(BigInt(overallStats.total_amount)),
9797
},
9898
items: {
99-
type: 'area',
100-
areas: [
99+
type: 'bar',
100+
bars: [
101101
{
102102
dataKey: 'total_amount',
103103
color: 'var(--color-primary)',
@@ -165,7 +165,7 @@ export const LoadingActivityCharts = () => {
165165
<LoadingMultiCharts
166166
tabs={[
167167
{ type: 'bar', label: 'Transactions' },
168-
{ type: 'area', label: 'Volume' },
168+
{ type: 'bar', label: 'Volume' },
169169
{ type: 'bar', label: 'Buyers' },
170170
]}
171171
/>

apps/scan/src/app/(app)/recipient/[address]/(overview)/_components/activity/charts.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ export const ActivityCharts: React.FC<Props> = ({ address }) => {
100100
amount: formatTokenAmount(BigInt(overallStats.total_amount)),
101101
},
102102
items: {
103-
type: 'area',
104-
areas: [
103+
type: 'bar',
104+
bars: [
105105
{
106106
dataKey: 'total_amount',
107107
color: 'var(--color-primary)',
@@ -169,7 +169,7 @@ export const LoadingActivityCharts = () => {
169169
<LoadingMultiCharts
170170
tabs={[
171171
{ type: 'bar', label: 'Transactions' },
172-
{ type: 'area', label: 'Volume' },
172+
{ type: 'bar', label: 'Volume' },
173173
{ type: 'bar', label: 'Buyers' },
174174
]}
175175
/>

apps/scan/src/app/(app)/server/[id]/(overview)/_components/activity/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ export const OriginActivity: React.FC<Props> = ({ originId }) => {
108108
title="Volume"
109109
value={formatTokenAmount(BigInt(overallStats.total_amount))}
110110
items={{
111-
type: 'area',
112-
areas: [{ dataKey: 'totalAmount', color: 'var(--color-primary)' }],
111+
type: 'bar',
112+
bars: [{ dataKey: 'totalAmount', color: 'var(--color-primary)' }],
113113
}}
114114
data={chartData}
115115
tooltipRows={[
@@ -160,7 +160,7 @@ export const LoadingOriginActivity = () => {
160160
return (
161161
<OriginActivityContainer>
162162
<LoadingOverallStatsCard type="bar" title="Transactions" />
163-
<LoadingOverallStatsCard type="area" title="Volume" />
163+
<LoadingOverallStatsCard type="bar" title="Volume" />
164164
<LoadingOverallStatsCard type="bar" title="Buyers" />
165165
</OriginActivityContainer>
166166
);

0 commit comments

Comments
 (0)