Убрал rollupOptions из vite.config. Убрал equipments. Скорректировал route. Декомпозировал EdgeDetailPage.

This commit is contained in:
Первов Артем
2026-06-21 03:08:35 +03:00
parent 31add10e56
commit 61ab9eb37a
17 changed files with 238 additions and 317 deletions

View File

@@ -1,28 +0,0 @@
import { useMemo } from 'react';
import { useQuery } from '@tanstack/react-query';
import { getHistory } from '../../entities/history/api';
import { toIsoFromInput } from '../../utils/format';
import { getHistoryGranularity } from '../../utils/historyGranularity';
import type { DateRangeState } from './dateRange';
export function useHistoryQuery(edgeId: string, selectedTag: string | undefined, range: DateRangeState) {
const from = toIsoFromInput(range.from) as string;
const to = toIsoFromInput(range.to) as string;
const granularity = useMemo(() => getHistoryGranularity(from, to), [from, to]);
const query = useQuery({
queryKey: ['history', edgeId, selectedTag, from, to, granularity.granulate],
queryFn: () =>
getHistory({
edge: edgeId,
tag: selectedTag as string,
from,
to,
granulate: granularity.granulate,
}),
enabled: Boolean(edgeId && selectedTag),
refetchInterval: false,
});
return { query, from, to, granularity };
}