Skip to content

Commit 674d348

Browse files
committed
feat: add support for ForcePeakCutEnabled configuration in NetworkChart
1 parent 579b4f8 commit 674d348

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/components/NetworkChart.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ export const NetworkChartClient = React.memo(function NetworkChart({
9494

9595
const customBackgroundImage = (window.CustomBackgroundImage as string) !== "" ? window.CustomBackgroundImage : undefined
9696

97+
const forcePeakCutEnabled = (window.ForcePeakCutEnabled as boolean) ?? false
98+
9799
const [activeChart, setActiveChart] = React.useState(defaultChart)
98-
const [isPeakEnabled, setIsPeakEnabled] = React.useState(false)
100+
const [isPeakEnabled, setIsPeakEnabled] = React.useState(forcePeakCutEnabled)
99101

100102
const handleButtonClick = useCallback(
101103
(chart: string) => {
@@ -281,11 +283,7 @@ export const NetworkChartClient = React.memo(function NetworkChart({
281283
// 根据时间跨度调整显示间隔
282284
if (hours <= 12) {
283285
// 12小时内,每60分钟显示一个刻度
284-
return (
285-
index === 0 ||
286-
index === array.length - 1 ||
287-
new Date(item.created_at).getMinutes() % 60 === 0
288-
)
286+
return index === 0 || index === array.length - 1 || new Date(item.created_at).getMinutes() % 60 === 0
289287
}
290288
// 超过12小时,每2小时显示一个刻度
291289
const date = new Date(item.created_at)

src/hooks/use-background.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ declare global {
77
ForceShowServices: boolean
88
ForceCardInline: boolean
99
ForceShowMap: boolean
10+
ForcePeakCutEnabled: boolean
1011
}
1112
}
1213

0 commit comments

Comments
 (0)