Skip to content

Commit

Permalink
feat: add support for ForcePeakCutEnabled configuration in NetworkChart
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster1963 committed Feb 20, 2025
1 parent 579b4f8 commit 674d348
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/components/NetworkChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ export const NetworkChartClient = React.memo(function NetworkChart({

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

const forcePeakCutEnabled = (window.ForcePeakCutEnabled as boolean) ?? false

const [activeChart, setActiveChart] = React.useState(defaultChart)
const [isPeakEnabled, setIsPeakEnabled] = React.useState(false)
const [isPeakEnabled, setIsPeakEnabled] = React.useState(forcePeakCutEnabled)

const handleButtonClick = useCallback(
(chart: string) => {
Expand Down Expand Up @@ -281,11 +283,7 @@ export const NetworkChartClient = React.memo(function NetworkChart({
// 根据时间跨度调整显示间隔
if (hours <= 12) {
// 12小时内,每60分钟显示一个刻度
return (
index === 0 ||
index === array.length - 1 ||
new Date(item.created_at).getMinutes() % 60 === 0
)
return index === 0 || index === array.length - 1 || new Date(item.created_at).getMinutes() % 60 === 0
}
// 超过12小时,每2小时显示一个刻度
const date = new Date(item.created_at)
Expand Down
1 change: 1 addition & 0 deletions src/hooks/use-background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare global {
ForceShowServices: boolean
ForceCardInline: boolean
ForceShowMap: boolean
ForcePeakCutEnabled: boolean
}
}

Expand Down

0 comments on commit 674d348

Please sign in to comment.