重构
This commit is contained in:
@@ -14,6 +14,12 @@ export function resolveAdminBreadcrumb(
|
||||
{ label: t('breadcrumb.settlement') },
|
||||
];
|
||||
}
|
||||
if (path === '/matches/market-templates') {
|
||||
return [
|
||||
{ label: t('nav.matches'), to: '/matches' },
|
||||
{ label: t('nav.matches.market_templates') },
|
||||
];
|
||||
}
|
||||
if (/^\/matches\/[^/]+\/edit/.test(path)) {
|
||||
return [
|
||||
{ label: t('nav.matches'), to: '/matches' },
|
||||
|
||||
@@ -14,13 +14,13 @@ export type ChartI18n = {
|
||||
};
|
||||
|
||||
const tooltipBase = {
|
||||
backgroundColor: '#141414',
|
||||
borderColor: '#2a2a2a',
|
||||
textStyle: { color: '#e0e0e0', fontSize: 12 },
|
||||
backgroundColor: '#ffffff',
|
||||
borderColor: '#e7e2d8',
|
||||
textStyle: { color: '#1f2320', fontSize: 12 },
|
||||
};
|
||||
|
||||
const axisLabel = { color: '#888', fontSize: 11 };
|
||||
const splitLine = { lineStyle: { color: '#252525' } };
|
||||
const axisLabel = { color: '#78746b', fontSize: 11 };
|
||||
const splitLine = { lineStyle: { color: '#eee9df' } };
|
||||
|
||||
export type ChartSeries = { name: string; color: string; values: number[] };
|
||||
export type PieSegment = { label: string; value: number; color: string };
|
||||
@@ -45,14 +45,14 @@ export function buildBarChartOption(
|
||||
bottom: 0,
|
||||
itemWidth: 10,
|
||||
itemHeight: 10,
|
||||
textStyle: { color: '#999', fontSize: 11 },
|
||||
textStyle: { color: '#78746b', fontSize: 11 },
|
||||
},
|
||||
grid: { left: 52, right: 12, top: 20, bottom: 48 },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: labels,
|
||||
axisLabel,
|
||||
axisLine: { lineStyle: { color: '#333' } },
|
||||
axisLine: { lineStyle: { color: '#e7e2d8' } },
|
||||
axisTick: { show: false },
|
||||
},
|
||||
yAxis: {
|
||||
@@ -90,7 +90,7 @@ export function buildMultiLineChartOption(
|
||||
bottom: 0,
|
||||
itemWidth: 10,
|
||||
itemHeight: 10,
|
||||
textStyle: { color: '#999', fontSize: 11 },
|
||||
textStyle: { color: '#78746b', fontSize: 11 },
|
||||
},
|
||||
grid: { left: 52, right: 12, top: 20, bottom: 48 },
|
||||
xAxis: {
|
||||
@@ -98,7 +98,7 @@ export function buildMultiLineChartOption(
|
||||
data: labels,
|
||||
boundaryGap: false,
|
||||
axisLabel,
|
||||
axisLine: { lineStyle: { color: '#333' } },
|
||||
axisLine: { lineStyle: { color: '#e7e2d8' } },
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
@@ -145,7 +145,7 @@ export function buildPieChartOption(
|
||||
top: 'middle',
|
||||
itemWidth: 8,
|
||||
itemHeight: 8,
|
||||
textStyle: { color: '#999', fontSize: 11 },
|
||||
textStyle: { color: '#78746b', fontSize: 11 },
|
||||
},
|
||||
series: [
|
||||
{
|
||||
@@ -154,19 +154,19 @@ export function buildPieChartOption(
|
||||
radius: ['42%', '68%'],
|
||||
center: ['36%', '50%'],
|
||||
avoidLabelOverlap: true,
|
||||
itemStyle: { borderRadius: 4, borderColor: '#111', borderWidth: 2 },
|
||||
itemStyle: { borderRadius: 4, borderColor: '#ffffff', borderWidth: 2 },
|
||||
label: {
|
||||
show: segments.length > 0,
|
||||
color: '#bbb',
|
||||
color: '#5f5b53',
|
||||
fontSize: 11,
|
||||
formatter: '{b}\n{d}%',
|
||||
},
|
||||
labelLine: { lineStyle: { color: '#444' } },
|
||||
labelLine: { lineStyle: { color: '#d5cfc3' } },
|
||||
emphasis: {
|
||||
label: { fontSize: 12, fontWeight: 'bold' },
|
||||
scaleSize: 6,
|
||||
},
|
||||
data: data.length ? data : [{ name: noData, value: 1, itemStyle: { color: '#333' } }],
|
||||
data: data.length ? data : [{ name: noData, value: 1, itemStyle: { color: '#e6e1d8' } }],
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -189,7 +189,7 @@ export function buildCombinedTrendOption(
|
||||
const countSuffix = i18n.countSuffix;
|
||||
return {
|
||||
backgroundColor: 'transparent',
|
||||
color: [...amountSeries.map((s) => s.color), '#fb923c'],
|
||||
color: [...amountSeries.map((s) => s.color), '#956400'],
|
||||
tooltip: {
|
||||
...tooltipBase,
|
||||
trigger: 'axis',
|
||||
@@ -210,7 +210,7 @@ export function buildCombinedTrendOption(
|
||||
top: 0,
|
||||
itemWidth: 10,
|
||||
itemHeight: 10,
|
||||
textStyle: { color: '#999', fontSize: 11 },
|
||||
textStyle: { color: '#78746b', fontSize: 11 },
|
||||
},
|
||||
grid: { left: 56, right: 48, top: 36, bottom: 28 },
|
||||
xAxis: {
|
||||
@@ -218,20 +218,20 @@ export function buildCombinedTrendOption(
|
||||
data: labels,
|
||||
boundaryGap: true,
|
||||
axisLabel,
|
||||
axisLine: { lineStyle: { color: '#333' } },
|
||||
axisLine: { lineStyle: { color: '#e7e2d8' } },
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
name: i18n.axisAmount,
|
||||
nameTextStyle: { color: '#666', fontSize: 10 },
|
||||
nameTextStyle: { color: '#8c867c', fontSize: 10 },
|
||||
axisLabel: { ...axisLabel, formatter: (v: number) => formatAmount(v, 2, loc) },
|
||||
splitLine,
|
||||
},
|
||||
{
|
||||
type: 'value',
|
||||
name: i18n.axisCount,
|
||||
nameTextStyle: { color: '#666', fontSize: 10 },
|
||||
nameTextStyle: { color: '#8c867c', fontSize: 10 },
|
||||
axisLabel: { ...axisLabel, formatter: (v: number) => fmtCount(v, loc) },
|
||||
splitLine: { show: false },
|
||||
},
|
||||
@@ -254,7 +254,7 @@ export function buildCombinedTrendOption(
|
||||
yAxisIndex: 1,
|
||||
data: betCounts,
|
||||
barMaxWidth: 14,
|
||||
itemStyle: { color: 'rgba(251, 146, 60, 0.45)', borderRadius: [3, 3, 0, 0] },
|
||||
itemStyle: { color: 'rgba(149, 100, 0, 0.34)', borderRadius: [3, 3, 0, 0] },
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -286,7 +286,7 @@ export function buildTriplePieOption(
|
||||
top: '6%',
|
||||
style: {
|
||||
text: b.title,
|
||||
fill: '#aaa',
|
||||
fill: '#5f5b53',
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
textAlign: 'center',
|
||||
@@ -307,7 +307,7 @@ export function buildTriplePieOption(
|
||||
labelLine: { show: false },
|
||||
data: data.length
|
||||
? data
|
||||
: [{ name: pieEmpty, value: 1, itemStyle: { color: '#333' } }],
|
||||
: [{ name: pieEmpty, value: 1, itemStyle: { color: '#e6e1d8' } }],
|
||||
};
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -2,11 +2,11 @@ import type { EChartsOption } from 'echarts';
|
||||
import { buildBarChartOption, buildPieChartOption, type PieSegment } from './dashboard-charts';
|
||||
|
||||
const STATUS_COLORS: Record<string, string> = {
|
||||
PENDING: '#e8a040',
|
||||
WON: '#d4d4d4',
|
||||
LOST: '#ff453a',
|
||||
PUSH: '#8e8e93',
|
||||
VOID: '#555',
|
||||
PENDING: '#956400',
|
||||
WON: '#346538',
|
||||
LOST: '#9f2f2d',
|
||||
PUSH: '#5f5b53',
|
||||
VOID: '#aaa49a',
|
||||
};
|
||||
|
||||
function withCompactHeader(option: EChartsOption, text: string, subtext?: string): EChartsOption {
|
||||
@@ -19,8 +19,8 @@ function withCompactHeader(option: EChartsOption, text: string, subtext?: string
|
||||
subtext,
|
||||
left: 'center',
|
||||
top: 0,
|
||||
textStyle: { color: '#ccc', fontSize: 11, fontWeight: 600 },
|
||||
subtextStyle: { color: '#777', fontSize: 9 },
|
||||
textStyle: { color: '#1f2320', fontSize: 11, fontWeight: 700 },
|
||||
subtextStyle: { color: '#78746b', fontSize: 9 },
|
||||
itemGap: 2,
|
||||
},
|
||||
grid: { ...grid, top: Math.max(top, grid.top ?? 0) },
|
||||
@@ -44,7 +44,7 @@ function compactPie(option: EChartsOption, centerLines?: string[]): EChartsOptio
|
||||
style: {
|
||||
text: line,
|
||||
textAlign: 'center' as const,
|
||||
fill: i === 0 ? '#eee' : '#888',
|
||||
fill: i === 0 ? '#1f2320' : '#78746b',
|
||||
fontSize: i === 0 ? 15 : 9,
|
||||
fontWeight: i === 0 ? 700 : 400,
|
||||
},
|
||||
@@ -57,7 +57,7 @@ function compactPie(option: EChartsOption, centerLines?: string[]): EChartsOptio
|
||||
left: 'center',
|
||||
itemWidth: 8,
|
||||
itemHeight: 8,
|
||||
textStyle: { color: '#999', fontSize: 9 },
|
||||
textStyle: { color: '#78746b', fontSize: 9 },
|
||||
},
|
||||
graphic,
|
||||
};
|
||||
@@ -74,8 +74,8 @@ export function buildBetTypePieOption(input: {
|
||||
centerLabel: string;
|
||||
}): EChartsOption {
|
||||
const segments: PieSegment[] = [
|
||||
{ label: input.labels.single, value: input.singleBets, color: '#d4d4d4' },
|
||||
{ label: input.labels.parlay, value: input.parlayBets, color: '#fb923c' },
|
||||
{ label: input.labels.single, value: input.singleBets, color: '#346538' },
|
||||
{ label: input.labels.parlay, value: input.parlayBets, color: '#956400' },
|
||||
].filter((s) => s.value > 0);
|
||||
|
||||
const base = buildPieChartOption(input.title, segments, { pieTooltip: '{b}:{c}({d}%)' });
|
||||
@@ -94,7 +94,7 @@ export function buildStatusPieOption(input: {
|
||||
.map(([status, value]) => ({
|
||||
label: input.labelFor(status),
|
||||
value,
|
||||
color: STATUS_COLORS[status] ?? '#666',
|
||||
color: STATUS_COLORS[status] ?? '#8c867c',
|
||||
}));
|
||||
|
||||
const total = segments.reduce((sum, s) => sum + s.value, 0);
|
||||
@@ -112,7 +112,7 @@ export function buildSelectionStakeBarOption(input: {
|
||||
}): EChartsOption {
|
||||
const base = buildBarChartOption(
|
||||
input.labels,
|
||||
[{ name: input.seriesName, color: '#d4d4d4', values: input.stakes }],
|
||||
[{ name: input.seriesName, color: '#346538', values: input.stakes }],
|
||||
{ amountAxis: true },
|
||||
);
|
||||
return withCompactHeader(
|
||||
|
||||
Reference in New Issue
Block a user