diff --git a/app/(app)/analytics/geo/page.tsx b/app/(app)/analytics/geo/page.tsx
index 8cb0897..ebe5c46 100644
--- a/app/(app)/analytics/geo/page.tsx
+++ b/app/(app)/analytics/geo/page.tsx
@@ -92,7 +92,7 @@ export default function GeoAnalyticsPage() {
{item.percentage.toFixed(1)}%
-
+
-
+
Welcome to ShortURL Analytics
-
+
Dashboard
-
+
View your overall analytics and key metrics
-
+
Events
-
+
Track and analyze event data
-
+
Geographic Analysis
-
+
Explore visitor locations and geographic patterns
-
+
Device Analytics
-
+
Understand how users access your links
diff --git a/app/(swagger)/swagger/page.tsx b/app/(swagger)/swagger/page.tsx
index c73ef64..7568e8d 100644
--- a/app/(swagger)/swagger/page.tsx
+++ b/app/(swagger)/swagger/page.tsx
@@ -1,8 +1,20 @@
"use client";
import { useEffect } from 'react';
-import SwaggerUI from 'swagger-ui-react';
-import 'swagger-ui-react/swagger-ui.css';
+
+// 动态导入,避免生产环境问题
+let SwaggerUI = () => Swagger UI is not available in production ;
+let swaggerCss = null;
+
+// 只在开发环境中导入 Swagger UI
+if (process.env.NODE_ENV === 'development') {
+ try {
+ SwaggerUI = require('swagger-ui-react').default;
+ require('swagger-ui-react/swagger-ui.css');
+ } catch (e) {
+ console.error('Failed to load Swagger UI:', e);
+ }
+}
export default function SwaggerPage() {
useEffect(() => {
@@ -10,6 +22,21 @@ export default function SwaggerPage() {
document.title = 'API Documentation - ShortURL Analytics';
}, []);
+ // 生产环境显示替代内容
+ if (process.env.NODE_ENV !== 'development') {
+ return (
+
+ API Documentation
+
+ Swagger UI is only available in development environment.
+
+
+ Please run the application in development mode to access the full API documentation.
+
+
+ );
+ }
+
// Swagger配置
const swaggerConfig = {
openapi: '3.0.0',
diff --git a/app/components/analytics/DeviceAnalytics.tsx b/app/components/analytics/DeviceAnalytics.tsx
index 290d905..e191301 100644
--- a/app/components/analytics/DeviceAnalytics.tsx
+++ b/app/components/analytics/DeviceAnalytics.tsx
@@ -22,16 +22,16 @@ function StatCard({ title, items }: { title: string; items: { name: string; coun
};
return (
-
- {title}
+
+ {title}
{items.map((item, index) => (
-
+
{item.name || 'Unknown'}
{formatNumber(item.count)} ({formatPercent(item.percentage)}%)
-
+
-
-
+
+
- |
+ |
Location
|
-
+ |
Visits
|
-
+ |
Unique Visitors
|
-
+ |
Percentage
|
-
+
{data.map((item, index) => (
-
- |
+ |
+ |
{item.city ? `${item.city}, ${item.region}, ${item.country}` : item.region ? `${item.region}, ${item.country}` : item.country || item.location || 'Unknown'}
|
-
+ |
{formatNumber(item.visits)}
|
-
+ |
{formatNumber(item.uniqueVisitors || item.visitors)}
|
-
+ |
{formatPercent(item.percentage)}%
-
+
diff --git a/app/layout.tsx b/app/layout.tsx
index 83deb4c..07a63ee 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -12,7 +12,7 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
-
+
{children}
diff --git a/app/page.tsx b/app/page.tsx
index 4128c67..c1e4e72 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -48,10 +48,10 @@ export default function HomePage() {
-
+
Welcome to ShortURL Analytics
-
+
Get detailed insights into your link performance and visitor behavior
@@ -61,19 +61,19 @@ export default function HomePage() {
-
-
-
+
{section.description}
diff --git a/next.config.js b/next.config.js
index cd39660..fbccc35 100644
--- a/next.config.js
+++ b/next.config.js
@@ -1,18 +1,33 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
- // 启用 webpack 配置
- webpack: (config) => {
+ // 设置需要转译的包
+ transpilePackages: ['swagger-ui-react'],
+
+ // 禁用严格模式,避免开发时重复渲染
+ reactStrictMode: false,
+
+ webpack: (config, { dev }) => {
// 添加 CSS 处理规则
config.module.rules.push({
test: /\.css$/,
type: 'asset/source',
});
-
+
+ // 仅在生产环境中排除 Swagger
+ if (!dev) {
+ config.resolve.alias = {
+ ...config.resolve.alias,
+ 'swagger-ui-react': false,
+ };
+ }
+
return config;
},
+
eslint: {
ignoreDuringBuilds: true,
},
+
typescript: {
ignoreBuildErrors: true,
},
diff --git a/next.config.ts b/next.config.ts
deleted file mode 100644
index 75c5a22..0000000
--- a/next.config.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import type { NextConfig } from "next";
-
-const nextConfig: NextConfig = {
- /* config options here */
- // 设置需要转译的包
- transpilePackages: ['swagger-ui-react'],
-
- // 配置实验性选项
- experimental: {
- // 禁用外部目录处理,避免monorepo问题
- // externalDir: true,
- },
-
- // 禁用严格模式,避免开发时重复渲染
- reactStrictMode: false,
-
- // 暂时禁用standalone输出模式,解决构建问题
- // output: 'standalone',
-
- // 忽略ESLint错误,不会在构建时中断
- eslint: {
- ignoreDuringBuilds: true,
- },
-
- // 忽略TypeScript错误,不会在构建时中断
- typescript: {
- ignoreBuildErrors: true,
- },
-}
-
-export default nextConfig;
diff --git a/tailwind.config.ts b/tailwind.config.ts
index dca00d8..a88f667 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -6,6 +6,7 @@ const config: Config = {
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
+ darkMode: "class",
theme: {
extend: {
colors: {
| |