diff --git a/frontend/providers/costcenter/src/components/RechargeModal.tsx b/frontend/providers/costcenter/src/components/RechargeModal.tsx index 24529ddc6b6..b39c30068a7 100644 --- a/frontend/providers/costcenter/src/components/RechargeModal.tsx +++ b/frontend/providers/costcenter/src/components/RechargeModal.tsx @@ -346,14 +346,14 @@ const RechargeModal = forwardRef( {} ); const [defaultSteps, ratios, steps, specialBonus] = useMemo(() => { - const defaultSteps = Object.entries(bonuses?.data?.discount.defaultSteps || {}).toSorted( + const defaultSteps = Object.entries(bonuses?.data?.discount.defaultSteps || {}).sort( (a, b) => +a[0] - +b[0] ); const ratios = defaultSteps.map(([key, value]) => value); const steps = defaultSteps.map(([key, value]) => +key); - const specialBonus = Object.entries( - bonuses?.data?.discount.firstRechargeDiscount || {} - ).toSorted((a, b) => +a[0] - +b[0]); + const specialBonus = Object.entries(bonuses?.data?.discount.firstRechargeDiscount || {}).sort( + (a, b) => +a[0] - +b[0] + ); const temp: number[] = []; specialBonus.forEach(([k, v]) => { const step = +k; diff --git a/frontend/providers/costcenter/src/components/billing/BillingLineChart.tsx b/frontend/providers/costcenter/src/components/billing/BillingLineChart.tsx index 2443e056ad7..0703244162f 100644 --- a/frontend/providers/costcenter/src/components/billing/BillingLineChart.tsx +++ b/frontend/providers/costcenter/src/components/billing/BillingLineChart.tsx @@ -1,15 +1,7 @@ import ReactEChartsCore from 'echarts-for-react/lib/core'; // Import the echarts core module, which provides the necessary interfaces for using echarts. -import * as echarts from 'echarts/core'; -import { - GridComponent, - VisualMapComponent, - MarkLineComponent, - TooltipComponent -} from 'echarts/components'; -import { LineChart } from 'echarts/charts'; -import { UniversalTransition } from 'echarts/features'; -import { CanvasRenderer } from 'echarts/renderers'; +import useOverviewStore from '@/stores/overview'; +import { Cycle } from '@/types/cycle'; import { addDays, addHours, @@ -38,9 +30,17 @@ import { subWeeks, subYears } from 'date-fns'; +import { LineChart } from 'echarts/charts'; +import { + GridComponent, + MarkLineComponent, + TooltipComponent, + VisualMapComponent +} from 'echarts/components'; +import * as echarts from 'echarts/core'; +import { UniversalTransition } from 'echarts/features'; +import { CanvasRenderer } from 'echarts/renderers'; import { useTranslation } from 'next-i18next'; -import { Cycle } from '@/types/cycle'; -import useOverviewStore from '@/stores/overview'; echarts.use([ GridComponent, @@ -76,8 +76,8 @@ export default function Trend({ data, cycle }: { data: [number, string][]; cycle const startOfTime = methods[1](startTime); const source = [ // ['date', 'amount'], - ...data - .toSorted(([aD], [bD]) => aD - bD) + ...[...data] + .sort(([aD], [bD]) => aD - bD) .reduce<[Date, number][]>( (pre, [curDate, curVal]) => { const len = pre.length; diff --git a/frontend/providers/costcenter/src/components/cost_overview/components/barChart.tsx b/frontend/providers/costcenter/src/components/cost_overview/components/barChart.tsx index 599bb4a9dce..d26cb8f02f8 100644 --- a/frontend/providers/costcenter/src/components/cost_overview/components/barChart.tsx +++ b/frontend/providers/costcenter/src/components/cost_overview/components/barChart.tsx @@ -21,8 +21,8 @@ export default function Chart({ const { t } = useTranslation(); const series = data.map(([sourceRaw, seriesName]) => { const source = [ - ...sourceRaw - .toSorted(([aDate], [bDate]) => aDate - bDate) + ...[...sourceRaw] + .sort(([aDate], [bDate]) => aDate - bDate) .reduce<[Date, number][]>( (pre, [curDate, curVal]) => { const len = pre.length; diff --git a/frontend/providers/costcenter/src/components/cost_overview/components/lineChart.tsx b/frontend/providers/costcenter/src/components/cost_overview/components/lineChart.tsx index dab46cf00f1..fdd98214685 100644 --- a/frontend/providers/costcenter/src/components/cost_overview/components/lineChart.tsx +++ b/frontend/providers/costcenter/src/components/cost_overview/components/lineChart.tsx @@ -44,8 +44,8 @@ export default function Trend({ const series = data.map(([sourceRaw, seriesName]) => { const source = [ // ['date', 'amount'], - ...sourceRaw - .toSorted((a, b) => a[0] - b[0]) + ...[...sourceRaw] + .sort((a, b) => a[0] - b[0]) .reduce<[Date, number][]>( (pre, [curDate, curVal]) => { const len = pre.length; diff --git a/frontend/providers/costcenter/src/pages/api/billing/costs.ts b/frontend/providers/costcenter/src/pages/api/billing/costs.ts index 26c5b85d851..72b6b4740df 100644 --- a/frontend/providers/costcenter/src/pages/api/billing/costs.ts +++ b/frontend/providers/costcenter/src/pages/api/billing/costs.ts @@ -45,7 +45,7 @@ export default async function handler(req: NextApiRequest, resp: NextApiResponse en: string; } ] - >((d) => [d.data.toSorted(([aDate], [bDate]) => aDate - bDate), d.region.name]); + >((d) => [d.data.sort(([aDate], [bDate]) => aDate - bDate), d.region.name]); let pointers: number[] = new Array(someArr.length).fill(0); const maxPointers = someArr.map((d) => d[0].length); diff --git a/frontend/providers/costcenter/src/pages/valuation/index.tsx b/frontend/providers/costcenter/src/pages/valuation/index.tsx index ae3d5e2cab6..e4798028443 100644 --- a/frontend/providers/costcenter/src/pages/valuation/index.tsx +++ b/frontend/providers/costcenter/src/pages/valuation/index.tsx @@ -84,7 +84,7 @@ function Valuation() { } ]; }) - .toSorted((a, b) => a.idx - b.idx) || [], + .sort((a, b) => a.idx - b.idx) || [], [_data, t, cycleIdx] ); const PriceTableData = useMemo(