33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
'use client';
|
|
import { useParams } from 'next/navigation';
|
|
import NotFound from '../pages/404';
|
|
import { resolvePageType } from '@/lib/resolvePageType';
|
|
|
|
import CategoryPage from '@/app/pages/Product/Category';
|
|
import ProductDetailPage from '@/app/pages/Product/ProductDetail';
|
|
import ArticlePage from '@/app/pages/Article/HomeArticlePage';
|
|
import ArticleCategoryPage from '@/app/pages/Article/CategoryPage';
|
|
import ArticleDetailPage from '@/app/pages/Article/DetailPage';
|
|
|
|
export default function DynamicPage() {
|
|
const { slug } = useParams();
|
|
const fullSlug = '/' + slug;
|
|
|
|
const pageType = resolvePageType(fullSlug);
|
|
|
|
switch (pageType) {
|
|
case 'category':
|
|
return <CategoryPage slug={fullSlug} />;
|
|
case 'product-detail':
|
|
return <ProductDetailPage slug={fullSlug} />;
|
|
case 'article-home':
|
|
return <ArticlePage />;
|
|
case 'article-category':
|
|
return <ArticleCategoryPage slug={fullSlug} />;
|
|
case 'article-detail':
|
|
return <ArticleDetailPage slug={fullSlug} />;
|
|
default:
|
|
return <NotFound />;
|
|
}
|
|
}
|