refactor: 完成静态网站转换,移除所有 CMS 和动态功能
- 删除数据库相关代码 (src/db/) - 删除 API 路由 (src/app/api/) - 删除认证相关代码 (src/lib/auth/, src/providers/) - 删除监控和安全中间件 (src/lib/security/, src/lib/monitoring/) - 删除 hooks (use-news, use-products, use-services) - 更新组件为静态数据源 - 添加 nginx 静态配置和部署脚本 - 添加 static-link 组件
This commit is contained in:
@@ -1,37 +1,11 @@
|
||||
import { Suspense } from 'react';
|
||||
import { db } from '@/db';
|
||||
import { siteConfig } from '@/db/schema';
|
||||
import { HomeContent } from './home-content';
|
||||
import { SectionSkeleton } from '@/components/ui/loading-skeleton';
|
||||
|
||||
interface SiteConfig {
|
||||
feature_services?: { enabled: boolean; items: string[] };
|
||||
feature_products?: { enabled: boolean; showPricing: boolean; featuredProducts: string[] };
|
||||
feature_news?: { enabled: boolean; displayCount: number; categories: string[]; sortOrder: 'asc' | 'desc' };
|
||||
}
|
||||
|
||||
async function getSiteConfig(): Promise<SiteConfig> {
|
||||
try {
|
||||
const allConfigs = await db.select().from(siteConfig);
|
||||
|
||||
const configMap = allConfigs.reduce((acc, config) => {
|
||||
acc[config.key] = config.value;
|
||||
return acc;
|
||||
}, {} as Record<string, any>);
|
||||
|
||||
return configMap as SiteConfig;
|
||||
} catch (error) {
|
||||
console.error('获取配置失败:', error);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
export default async function HomePage() {
|
||||
const config = await getSiteConfig();
|
||||
|
||||
export default function HomePage() {
|
||||
return (
|
||||
<Suspense fallback={<SectionSkeleton />}>
|
||||
<HomeContent config={config} />
|
||||
<HomeContent />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user