Compute analytics timeframe dynamically
This commit is contained in:
@@ -13,7 +13,7 @@ import { MobileCard, CTAButton, KpiTile, SkeletonCard } from './components/Primi
|
||||
import { getEventAnalytics, EventAnalytics } from '../api';
|
||||
import { ApiError } from '../lib/apiError';
|
||||
import { useAdminTheme } from './theme';
|
||||
import { resolveMaxCount } from './lib/analytics';
|
||||
import { resolveMaxCount, resolveTimelineHours } from './lib/analytics';
|
||||
import { adminPath } from '../constants';
|
||||
|
||||
export default function MobileEventAnalyticsPage() {
|
||||
@@ -98,7 +98,7 @@ export default function MobileEventAnalyticsPage() {
|
||||
const hasTimeline = timeline.length > 0;
|
||||
const hasContributors = contributors.length > 0;
|
||||
const hasTasks = tasks.length > 0;
|
||||
const timeframeHours = 12;
|
||||
const timeframeHours = resolveTimelineHours(timeline.map((point) => point.timestamp), 12);
|
||||
|
||||
// Prepare chart data
|
||||
const maxTimelineCount = resolveMaxCount(timeline.map((point) => point.count));
|
||||
|
||||
Reference in New Issue
Block a user