fix: report intervals

This commit is contained in:
Carl-Gerhard Lindesvärd
2026-01-22 21:49:13 +01:00
parent 32ea28b2f6
commit 9e5b482447
11 changed files with 37 additions and 85 deletions

View File

@@ -4,6 +4,7 @@ import FullPageLoadingState from '@/components/full-page-loading-state';
import { LoginNavbar } from '@/components/login-navbar';
import { OverviewInterval } from '@/components/overview/overview-interval';
import { OverviewRange } from '@/components/overview/overview-range';
import { useOverviewOptions } from '@/components/overview/useOverviewOptions';
import { ReportChart } from '@/components/report-chart';
import { useTRPC } from '@/integrations/trpc/react';
import { useSuspenseQuery } from '@tanstack/react-query';
@@ -63,6 +64,7 @@ function RouteComponent() {
const { shareId } = Route.useParams();
const { header } = useSearch({ from: '/share/report/$shareId' });
const trpc = useTRPC();
const { range, startDate, endDate, interval } = useOverviewOptions();
const shareQuery = useSuspenseQuery(
trpc.share.report.queryOptions({
shareId,
@@ -81,8 +83,6 @@ function RouteComponent() {
const share = shareQuery.data;
console.log('share', share);
// Handle password protection
if (share.password && !hasAccess) {
return <ShareEnterPassword shareId={share.id} shareType="report" />;
@@ -114,7 +114,16 @@ function RouteComponent() {
<div className="font-medium text-xl">{share.report.name}</div>
</div>
<div className="p-4">
<ReportChart report={share.report} shareId={shareId} />
<ReportChart
report={{
...share.report,
range: range ?? share.report.range,
startDate: startDate ?? share.report.startDate,
endDate: endDate ?? share.report.endDate,
interval: interval ?? share.report.interval,
}}
shareId={shareId}
/>
</div>
</div>
</div>