fix build

This commit is contained in:
2025-04-08 12:00:58 +08:00
parent 6940d60510
commit d21026eafd
2 changed files with 31 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
"use client";
import { useState, useEffect } from 'react';
import React, { useState, useEffect, Suspense } from 'react';
import { format, subDays } from 'date-fns';
import { DateRangePicker } from '@/app/components/ui/DateRangePicker';
import TimeSeriesChart from '@/app/components/charts/TimeSeriesChart';
@@ -11,9 +11,8 @@ import { EventsSummary, TimeSeriesData, GeoData, DeviceAnalytics as DeviceAnalyt
import { TeamSelector } from '@/app/components/ui/TeamSelector';
import { ProjectSelector } from '@/app/components/ui/ProjectSelector';
import { TagSelector } from '@/app/components/ui/TagSelector';
import { useSearchParams } from 'next/navigation';
import { useSearchParams, useRouter } from 'next/navigation';
import { useShortUrlStore } from '@/app/utils/store';
import { useRouter } from 'next/navigation';
// 事件类型定义
interface Event {
@@ -116,7 +115,8 @@ const extractEventInfo = (event: Event) => {
};
};
export default function AnalyticsPage() {
// Analytics Content Component that uses URL parameters
function AnalyticsContent() {
// 从 URL 获取查询参数
const searchParams = useSearchParams();
const router = useRouter();
@@ -834,6 +834,7 @@ export default function AnalyticsPage() {
teamIds={selectedTeamIds}
projectIds={selectedProjectIds}
tagIds={selectedTagNames}
linkId={selectedShortUrl?.externalId}
/>
</div>
@@ -1191,3 +1192,16 @@ export default function AnalyticsPage() {
</div>
);
}
// Main page component with Suspense
export default function AnalyticsPage() {
return (
<Suspense fallback={
<div className="flex items-center justify-center min-h-screen">
<div className="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-500" />
</div>
}>
<AnalyticsContent />
</Suspense>
);
}

View File

@@ -34,6 +34,19 @@ export async function GET(request: NextRequest) {
// 获取UTM类型参数
const utmType = searchParams.get('utmType') || 'source';
// 添加调试日志
console.log('UTM API received parameters:', {
startTime,
endTime,
linkId,
teamIds,
projectIds,
tagIds,
tagNames,
utmType,
url: request.url
});
// 构建WHERE子句
let whereClause = '';
const conditions = [];