260129_01_ENH: 카테고리 파트 layout 및 route 구조 변경
This commit is contained in:
12
src/app/(pages)/(main)/category/[category]/brand/page.tsx
Normal file
12
src/app/(pages)/(main)/category/[category]/brand/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
|
||||
const BrandPage = () => {
|
||||
const { categoryValue } = useLayoutFilter();
|
||||
console.log(categoryValue);
|
||||
|
||||
return <div>Brand</div>;
|
||||
}
|
||||
|
||||
export default BrandPage;
|
||||
@@ -0,0 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
|
||||
const OwnershipPathPage = () => {
|
||||
const { categoryValue } = useLayoutFilter();
|
||||
console.log(categoryValue);
|
||||
|
||||
return <div>ownership path</div>;
|
||||
};
|
||||
|
||||
export default OwnershipPathPage;
|
||||
@@ -0,0 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
|
||||
const PenetrationChangePage = () => {
|
||||
const { categoryValue } = useLayoutFilter();
|
||||
console.log(categoryValue);
|
||||
|
||||
return <div>PenetrationChange</div>
|
||||
}
|
||||
|
||||
export default PenetrationChangePage
|
||||
12
src/app/(pages)/(main)/category/[category]/profile/page.tsx
Normal file
12
src/app/(pages)/(main)/category/[category]/profile/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
|
||||
const ProfilePage = () => {
|
||||
const { categoryValue } = useLayoutFilter();
|
||||
console.log(categoryValue);
|
||||
|
||||
return <div>Profile</div>
|
||||
}
|
||||
|
||||
export default ProfilePage;
|
||||
@@ -0,0 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
|
||||
const PurchaseBehaviorPage = () => {
|
||||
const { categoryValue } = useLayoutFilter();
|
||||
console.log(categoryValue);
|
||||
|
||||
return <div>PurchaseBehavior</div>;
|
||||
};
|
||||
|
||||
export default PurchaseBehaviorPage;
|
||||
@@ -0,0 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
|
||||
const PurchaseChannelPage = () => {
|
||||
const { categoryValue } = useLayoutFilter();
|
||||
console.log(categoryValue);
|
||||
|
||||
return <div>PurchaseChannel</div>;
|
||||
};
|
||||
|
||||
export default PurchaseChannelPage;
|
||||
@@ -0,0 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
|
||||
const PurchaseFormatPage = () => {
|
||||
const { categoryValue } = useLayoutFilter();
|
||||
console.log(categoryValue);
|
||||
|
||||
return <div>PurchaseFormat</div>
|
||||
}
|
||||
|
||||
export default PurchaseFormatPage;
|
||||
@@ -0,0 +1,12 @@
|
||||
'use client'
|
||||
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
|
||||
const TypeSpecPage = () => {
|
||||
const { categoryValue } = useLayoutFilter();
|
||||
console.log(categoryValue);
|
||||
|
||||
return <div>TypeSpec</div>
|
||||
}
|
||||
|
||||
export default TypeSpecPage;
|
||||
@@ -1,9 +0,0 @@
|
||||
'use client'
|
||||
|
||||
const AirSolutionPage = () => {
|
||||
return (
|
||||
<div>AirSolutionPage</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default AirSolutionPage;
|
||||
@@ -1,11 +0,0 @@
|
||||
'use client'
|
||||
|
||||
const HAKitchenPage = () => {
|
||||
return (
|
||||
<div>
|
||||
<div>HAKitchenPage</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default HAKitchenPage;
|
||||
@@ -1,9 +0,0 @@
|
||||
'use client'
|
||||
|
||||
const HALivingPage = () => {
|
||||
return (
|
||||
<div>HALivingPage</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default HALivingPage;
|
||||
@@ -1,9 +0,0 @@
|
||||
'use client'
|
||||
|
||||
const MSDigitalPage = () => {
|
||||
return (
|
||||
<div>MSDigitalPage</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default MSDigitalPage;
|
||||
@@ -1,20 +1,21 @@
|
||||
'use client'
|
||||
|
||||
import {
|
||||
GaugeCardTable, GaugeColumn,
|
||||
GroupedOverlayBar, GroupedOverlayBarData, LifeStageRow,
|
||||
GroupedOverlayBar, GroupedOverlayBarData,
|
||||
signStyleGapRow, TopChartTable, TopChartTableRow
|
||||
} from "@/components/lge-dashboard";
|
||||
import {PRODUCT_KEYS, PRODUCTS, YEARS} from "@/const/lgConst";
|
||||
import {useMemo} from "react";
|
||||
import {
|
||||
apiLifeStageByProduct,
|
||||
apiLifeStageByProductForGauge,
|
||||
apiOwnShareOfTotalPenetration,
|
||||
apiTrendCategories
|
||||
} from "@/config/sample.data";
|
||||
import LifeStageDiv from "@/components/lge-dashboard/sub-page/LifeStageDiv";
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
|
||||
const LGPenetrationPage = () => {
|
||||
const { totalValue } = useLayoutFilter();
|
||||
console.log(totalValue);
|
||||
|
||||
const displayRowLabel = (i:number, rowLabel: string) => {
|
||||
if (rowLabel === "gap") return "전년 대비 GAP(%)";
|
||||
@@ -57,52 +58,7 @@ const LGPenetrationPage = () => {
|
||||
focus: focus,
|
||||
}
|
||||
|
||||
const norm = (s: string) => s.replace(/\s+/g, "").toLowerCase();
|
||||
const asNum = (v: unknown): number | null => typeof v === "number" && Number.isFinite(v) ? v : null;
|
||||
|
||||
const LIFE_STAGE_COLUMNS: GaugeColumn<LifeStageRow>[] = [
|
||||
{ key: "item", header: "", rowHead: true, renderLabel: (r) => r.item },
|
||||
|
||||
{ key: "total", header: "전체", max: 100, align: "left", cellType:"number"},
|
||||
{ key: "single", header: "미혼", max: 100 , align: "left"},
|
||||
|
||||
{ key: "noKids", header: "무자녀", group: "기혼", max: 100 , align: "left"},
|
||||
{ key: "preschoolKids", header: "미취학", group: "기혼", max: 100 , align: "left"},
|
||||
{ key: "schoolKids", header: "취학자녀", group: "기혼", max: 100 , align: "left"},
|
||||
{ key: "adultKids", header: "성인자녀", group: "기혼", max: 100 , align: "left"},
|
||||
|
||||
{ key: "independentSenior", header: "독립\n시니어", max: 100 , align: "left"},
|
||||
];
|
||||
|
||||
const LIFE_STAGE_GROUPS = [
|
||||
{ title: "필수가전 군", items: ["냉장고", "세탁기", "에어컨", "TV", "청소기", "김치 냉장고"] },
|
||||
{ title: "케어가전 군", items: ["공기 청정기", "가습기", "제습기"] },
|
||||
{ title: "Must & Best", items: ["건조기", "식기 세척기", "의류 관리기"] },
|
||||
{ title: "신가전 군", items: ["로봇 청소기"] },
|
||||
] as const;
|
||||
|
||||
const lifeStageRowsByGroup = useMemo(() => {
|
||||
const pick = (label: string) => apiLifeStageByProduct.find((r) => norm(r.rowLabel) === norm(label));
|
||||
|
||||
return LIFE_STAGE_GROUPS.map((g) => {
|
||||
const rows: LifeStageRow[] = g.items.map((label) => {
|
||||
const r = pick(label);
|
||||
|
||||
return {
|
||||
item: label,
|
||||
total: asNum((r as any)?.total), // 서버에 all이 없으면 null로 남음
|
||||
single: asNum((r as any)?.single),
|
||||
noKids: asNum((r as any)?.noKids),
|
||||
preschoolKids: asNum((r as any)?.preschoolKids),
|
||||
schoolKids: asNum((r as any)?.schoolKids),
|
||||
adultKids: asNum((r as any)?.adultKids),
|
||||
independentSenior: asNum((r as any)?.independentSenior),
|
||||
};
|
||||
});
|
||||
|
||||
return { title: g.title, rows };
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -121,33 +77,7 @@ const LGPenetrationPage = () => {
|
||||
signStyle={signStyleGapRow}
|
||||
/>
|
||||
|
||||
<div className="mt-6">
|
||||
<div className="flex justify-end gap-6 text-xs text-muted-foreground mb-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="inline-block h-4 w-8 border bg-gray-200 border-gray-300"/>
|
||||
<span>제품 보유율</span>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<span
|
||||
className="inline-block h-4 w-8 border border-gray-300"
|
||||
style={{ backgroundColor: "hsl(var(--lg-pink-300) / 0.4)" }}
|
||||
/>
|
||||
<span>시장 기회공간</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
{lifeStageRowsByGroup.map((g) => (
|
||||
<GaugeCardTable
|
||||
key={g.title}
|
||||
title={g.title}
|
||||
columns={LIFE_STAGE_COLUMNS}
|
||||
rows={g.rows}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<LifeStageDiv/>
|
||||
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -10,8 +10,12 @@ import {
|
||||
TopChartTableRow
|
||||
} from "@/components/lge-dashboard";
|
||||
import { apiOwnShareOfTotalPurchase, apiTrendBuy} from "@/config/sample.data";
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
|
||||
const LGPurchasePage = () => {
|
||||
const { totalValue } = useLayoutFilter();
|
||||
console.log(totalValue);
|
||||
|
||||
const displayRowLabel = (i:number, rowLabel: string) => {
|
||||
if (rowLabel === "gap") return "전년 대비 GAP(%)";
|
||||
return rowLabel;
|
||||
|
||||
@@ -15,6 +15,8 @@ import {BRAND_LIST, PRODUCT_KEYS, PRODUCTS, YEARS, AXIS_HIDE_STYLE, GRID_X_NOT_P
|
||||
|
||||
const PenetrationPage = () => {
|
||||
const { totalValue, registerExcelExporter } = useLayoutFilter();
|
||||
console.log(totalValue);
|
||||
|
||||
const [isBrandShare, setIsBrandShare] = useState<boolean>(false);
|
||||
|
||||
const displayRowLabel = (i:number, rowLabel: string) => {
|
||||
|
||||
@@ -7,8 +7,12 @@ import {
|
||||
TopChartTableRow, VerticalBar
|
||||
} from "@/components/lge-dashboard";
|
||||
import {apiTrendBuy} from "@/config/sample.data";
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
|
||||
const PurchasePage = () => {
|
||||
const { totalValue } = useLayoutFilter();
|
||||
console.log(totalValue);
|
||||
|
||||
const displayRowLabel = (i:number, rowLabel: string) => {
|
||||
if (rowLabel === "gap") return "전년 대비 GAP(%)";
|
||||
return rowLabel;
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import {Toaster} from "sonner";
|
||||
import {AppProvider} from "@/components/providers/AppProvider";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
@@ -25,10 +26,10 @@ const RootLayout = ({
|
||||
}>) => {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
|
||||
{children}
|
||||
<Toaster />
|
||||
</body>
|
||||
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
|
||||
<AppProvider>{children}</AppProvider>
|
||||
<Toaster />
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user