260205_05_ENH: 1차 lg 수정 요청사항 반영
This commit is contained in:
@@ -5,44 +5,17 @@ import {CategoryByData} from "@/components/lge-dashboard";
|
||||
import {apiBrandShareByYear} from "@/config/sample.data";
|
||||
import {PageData, ServerBannerRow} from "@/types/lg";
|
||||
import {buildGapRow} from "@/lib/lg-dashboard";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, LAST_YEAR, YEARS} from "@/const/lgConst";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, SITE_TITLE, YEARS} from "@/const/lgConst";
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
import {CategoryTypeValue} from "@/components/layout/CategoryFilter";
|
||||
import {buildHeader_Banner, exportDashboardExcel, Section} from "@/lib/lg-export-excel";
|
||||
|
||||
const Brand = () => {
|
||||
const {filterValue, registerExcelExporter} = useLayoutFilter();
|
||||
const tableDataArray = useMemo<PageData<ServerBannerRow>[]>(() => {
|
||||
const cleaned = apiBrandShareByYear.filter(
|
||||
(r) => !(r.year === LAST_YEAR && r.rowLabel === "gap")
|
||||
);
|
||||
|
||||
const gapRow = buildGapRow(cleaned, 25, 26, "lg", "gap");
|
||||
|
||||
let finalData = cleaned;
|
||||
|
||||
if (gapRow) {
|
||||
const insertIdx = cleaned.findIndex(
|
||||
(r) => r.year === LAST_YEAR && r.rowLabel === "lg"
|
||||
);
|
||||
|
||||
if (insertIdx >= 0) {
|
||||
finalData = [
|
||||
...cleaned.slice(0, insertIdx + 1),
|
||||
gapRow,
|
||||
...cleaned.slice(insertIdx + 1),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
title: "브랜드",
|
||||
chartMode: "reverseStack",
|
||||
data: finalData,
|
||||
},
|
||||
];
|
||||
}, []);
|
||||
const tableDataArray = useMemo<PageData<ServerBannerRow>[]>(() => [
|
||||
{title: "브랜드", chartMode:"reverseStack", data: apiBrandShareByYear},
|
||||
], []);
|
||||
|
||||
useEffect(() => {
|
||||
registerExcelExporter(async (payload) => {
|
||||
@@ -63,7 +36,7 @@ const Brand = () => {
|
||||
});
|
||||
|
||||
await exportDashboardExcel({
|
||||
fileName: `20${LAST_YEAR}년도 가전 보급률 Dashboard(${sheetName}).xlsx`,
|
||||
fileName: `${SITE_TITLE}(${sheetName}).xlsx`,
|
||||
sheetName: sheetName,
|
||||
sections: sections,
|
||||
});
|
||||
@@ -76,6 +49,7 @@ const Brand = () => {
|
||||
{tableDataArray.map((tableData) => (
|
||||
<CategoryByData
|
||||
key={`cbd-${tableData.title.replaceAll(/\s+/g, "_")}`}
|
||||
selectedYear={filterValue.year}
|
||||
title={tableData.title}
|
||||
chartMode={tableData.chartMode}
|
||||
allTableData={tableData.data}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
'use client'
|
||||
|
||||
import {useLayoutFilter} from "@/components/layout/LayoutFilterContext";
|
||||
import {useEffect, useMemo} from "react";
|
||||
import {useEffect, useMemo, useState} from "react";
|
||||
import {PageData, ServerBannerRow} from "@/types/lg";
|
||||
import {apiOwnershipPathByYear, apiOwnershipTriggerByYear} from "@/config/sample.data";
|
||||
import {CategoryByData} from "@/components/lge-dashboard";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, LAST_YEAR, YEARS} from "@/const/lgConst";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, SITE_TITLE, YEARS} from "@/const/lgConst";
|
||||
import {CategoryTypeValue} from "@/components/layout/CategoryFilter";
|
||||
import {buildHeader_Banner, exportDashboardExcel, Section} from "@/lib/lg-export-excel";
|
||||
|
||||
@@ -14,8 +14,8 @@ const OwnershipPath = () => {
|
||||
console.log(filterValue);
|
||||
|
||||
const tableDataArray = useMemo<PageData<ServerBannerRow>[]>(() => [
|
||||
{title: "보유 경로", chartMode:"reverseStack", data: apiOwnershipPathByYear.filter(r => !(r.year === LAST_YEAR && r.rowLabel === "gap"))},
|
||||
{title: "구입 계기", chartMode:"horizontal", data: apiOwnershipTriggerByYear.filter(r => !(r.year === LAST_YEAR && r.rowLabel === "gap"))},
|
||||
{title: "보유 경로", chartMode:"reverseStack", data: apiOwnershipPathByYear},
|
||||
{title: "구입 계기", chartMode:"horizontal", data: apiOwnershipTriggerByYear, chartHeight: 550,},
|
||||
], []);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -37,7 +37,7 @@ const OwnershipPath = () => {
|
||||
});
|
||||
|
||||
await exportDashboardExcel({
|
||||
fileName: `20${LAST_YEAR}년도 가전 보급률 Dashboard(${sheetName}).xlsx`,
|
||||
fileName: `${SITE_TITLE}(${sheetName}).xlsx`,
|
||||
sheetName: sheetName,
|
||||
sections: sections,
|
||||
});
|
||||
@@ -50,6 +50,7 @@ const OwnershipPath = () => {
|
||||
{tableDataArray.map((tableData) => (
|
||||
<CategoryByData
|
||||
key={`cbd-${tableData.title.replaceAll(/\s+/g, "_")}`}
|
||||
selectedYear={filterValue.year}
|
||||
title={tableData.title}
|
||||
chartMode={tableData.chartMode}
|
||||
allTableData={tableData.data}
|
||||
|
||||
@@ -5,7 +5,7 @@ import {apiPaymentMethodByYear} from "@/config/sample.data";
|
||||
import {useEffect, useMemo} from "react";
|
||||
import {PageData, ServerBannerRow} from "@/types/lg";
|
||||
import {CategoryByData} from "@/components/lge-dashboard";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, LAST_YEAR, YEARS} from "@/const/lgConst";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, SITE_TITLE, YEARS} from "@/const/lgConst";
|
||||
import {CategoryTypeValue} from "@/components/layout/CategoryFilter";
|
||||
import {buildHeader_Banner, exportDashboardExcel, Section} from "@/lib/lg-export-excel";
|
||||
|
||||
@@ -14,7 +14,7 @@ const PaymentMethod = () => {
|
||||
console.log(filterValue);
|
||||
|
||||
const tableDataArray = useMemo<PageData<ServerBannerRow>[]>(() => [
|
||||
{title: "구매 형식", chartMode:"reverseStack", data: apiPaymentMethodByYear.filter(r => !(r.year === LAST_YEAR && r.rowLabel === "gap"))},
|
||||
{title: "구매 형식", chartMode:"reverseStack", data: apiPaymentMethodByYear},
|
||||
], []);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -36,7 +36,7 @@ const PaymentMethod = () => {
|
||||
});
|
||||
|
||||
await exportDashboardExcel({
|
||||
fileName: `20${LAST_YEAR}년도 가전 보급률 Dashboard(${sheetName}).xlsx`,
|
||||
fileName: `${SITE_TITLE}(${sheetName}).xlsx`,
|
||||
sheetName: sheetName,
|
||||
sections: sections,
|
||||
});
|
||||
@@ -49,6 +49,7 @@ const PaymentMethod = () => {
|
||||
{tableDataArray.map((tableData) => (
|
||||
<CategoryByData
|
||||
key={`cbd-${tableData.title.replaceAll(/\s+/g, "_")}`}
|
||||
selectedYear={filterValue.year}
|
||||
title={tableData.title}
|
||||
chartMode={tableData.chartMode}
|
||||
allTableData={tableData.data}
|
||||
|
||||
@@ -13,7 +13,7 @@ const PenetrationChange = () => {
|
||||
const penetrationChangeData = useMemo<ServerBannerRow[]>(() => apiYearIndex, []);
|
||||
|
||||
return(
|
||||
<BannerSummary data={penetrationChangeData} useChart={true} />
|
||||
<BannerSummary data={penetrationChangeData} useChart={true} useYear={false} />
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ const Profile = () => {
|
||||
}, [isTotal, filterValue]);
|
||||
|
||||
return (
|
||||
<BannerSummary data={profileData} useChart={false} />
|
||||
<BannerSummary data={profileData} useChart={false} useYear={true} />
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import {useEffect, useMemo} from "react";
|
||||
import {PageData, ServerBannerRow} from "@/types/lg";
|
||||
import { apiOwnershipPathByYear, apiOwnershipTriggerByYear} from "@/config/sample.data";
|
||||
import {CategoryByData} from "@/components/lge-dashboard";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, LAST_YEAR, YEARS} from "@/const/lgConst";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, SITE_TITLE, YEARS} from "@/const/lgConst";
|
||||
import {CategoryTypeValue} from "@/components/layout/CategoryFilter";
|
||||
import {buildHeader_Banner, exportDashboardExcel, Section} from "@/lib/lg-export-excel";
|
||||
|
||||
@@ -14,8 +14,8 @@ const PurchaseBehavior = () => {
|
||||
console.log(filterValue);
|
||||
|
||||
const tableDataArray = useMemo<PageData<ServerBannerRow>[]>(() => [
|
||||
{title: "보유 경로", chartMode:"horizontal", data: apiOwnershipPathByYear.filter(r => !(r.year === LAST_YEAR && r.rowLabel === "gap"))},
|
||||
{title: "구입 계기", chartMode:"horizontal", data: apiOwnershipTriggerByYear.filter(r => !(r.year === LAST_YEAR && r.rowLabel === "gap"))},
|
||||
{title: "보유 경로", chartMode:"horizontal", data: apiOwnershipPathByYear},
|
||||
{title: "구입 계기", chartMode:"horizontal", data: apiOwnershipTriggerByYear},
|
||||
], []);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -37,7 +37,7 @@ const PurchaseBehavior = () => {
|
||||
});
|
||||
|
||||
await exportDashboardExcel({
|
||||
fileName: `20${LAST_YEAR}년도 가전 보급률 Dashboard(${sheetName}).xlsx`,
|
||||
fileName: `${SITE_TITLE}(${sheetName}).xlsx`,
|
||||
sheetName: sheetName,
|
||||
sections: sections,
|
||||
});
|
||||
@@ -50,6 +50,7 @@ const PurchaseBehavior = () => {
|
||||
{tableDataArray.map((tableData) => (
|
||||
<CategoryByData
|
||||
key={`cbd-${tableData.title.replaceAll(/\s+/g, "_")}`}
|
||||
selectedYear={filterValue.year}
|
||||
title={tableData.title}
|
||||
chartMode={tableData.chartMode}
|
||||
allTableData={tableData.data}
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import {useEffect, useMemo} from "react";
|
||||
import {PageData, ServerBannerRow} from "@/types/lg";
|
||||
import {CategoryByData} from "@/components/lge-dashboard";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, LAST_YEAR, YEARS} from "@/const/lgConst";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, SITE_TITLE, YEARS} from "@/const/lgConst";
|
||||
import {CategoryTypeValue} from "@/components/layout/CategoryFilter";
|
||||
import {buildHeader_Banner, exportDashboardExcel, Section} from "@/lib/lg-export-excel";
|
||||
|
||||
@@ -20,12 +20,12 @@ const PurchaseChannel = () => {
|
||||
{
|
||||
title: "구매 채널(온/오프라인)",
|
||||
chartMode: "reverseStack",
|
||||
data: apiPurchaseChannelSummaryByYear.filter(r => !(r.year === LAST_YEAR && r.rowLabel === "gap")),
|
||||
data: apiPurchaseChannelSummaryByYear,
|
||||
},
|
||||
{
|
||||
title: "구매 채널(상세)",
|
||||
chartMode: "horizontal",
|
||||
data: apiPurchaseChannelByYear.filter(r => !(r.year === LAST_YEAR && r.rowLabel === "gap")),
|
||||
data: apiPurchaseChannelByYear,
|
||||
chartHeight: 550,
|
||||
},
|
||||
], []);
|
||||
@@ -49,7 +49,7 @@ const PurchaseChannel = () => {
|
||||
});
|
||||
|
||||
await exportDashboardExcel({
|
||||
fileName: `20${LAST_YEAR}년도 가전 보급률 Dashboard(${sheetName}).xlsx`,
|
||||
fileName: `${SITE_TITLE}(${sheetName}).xlsx`,
|
||||
sheetName: sheetName,
|
||||
sections: sections,
|
||||
});
|
||||
@@ -62,6 +62,7 @@ const PurchaseChannel = () => {
|
||||
{tableDataArray.map((tableData) => (
|
||||
<CategoryByData
|
||||
key={`cbd-${tableData.title.replaceAll(/\s+/g, "_")}`}
|
||||
selectedYear={filterValue.year}
|
||||
title={tableData.title}
|
||||
chartMode={tableData.chartMode}
|
||||
allTableData={tableData.data}
|
||||
|
||||
@@ -5,7 +5,7 @@ import {useEffect, useMemo} from "react";
|
||||
import {PageData, ServerBannerRow} from "@/types/lg";
|
||||
import {apiFridgeDoorTypeByYear} from "@/config/sample.data";
|
||||
import {CategoryByData} from "@/components/lge-dashboard";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, LAST_YEAR, YEARS} from "@/const/lgConst";
|
||||
import {BANNER_GROUP, BANNER_KEY_MAP, SITE_TITLE, YEARS} from "@/const/lgConst";
|
||||
import {CategoryTypeValue} from "@/components/layout/CategoryFilter";
|
||||
import {buildHeader_Banner, exportDashboardExcel, Section} from "@/lib/lg-export-excel";
|
||||
|
||||
@@ -17,7 +17,7 @@ const TypeSpec = () => {
|
||||
{
|
||||
title: "타입",
|
||||
chartMode: "horizontal",
|
||||
data: apiFridgeDoorTypeByYear.filter(r => !(r.year === LAST_YEAR && r.rowLabel === "gap")),
|
||||
data: apiFridgeDoorTypeByYear,
|
||||
},
|
||||
], []);
|
||||
|
||||
@@ -40,7 +40,7 @@ const TypeSpec = () => {
|
||||
});
|
||||
|
||||
await exportDashboardExcel({
|
||||
fileName: `20${LAST_YEAR}년도 가전 보급률 Dashboard(${sheetName}).xlsx`,
|
||||
fileName: `${SITE_TITLE}(${sheetName}).xlsx`,
|
||||
sheetName: sheetName,
|
||||
sections: sections,
|
||||
});
|
||||
@@ -53,6 +53,7 @@ const TypeSpec = () => {
|
||||
{tableDataArray.map((tableData) => (
|
||||
<CategoryByData
|
||||
key={`cbd-${tableData.title.replaceAll(/\s+/g, "_")}`}
|
||||
selectedYear={filterValue.year}
|
||||
title={tableData.title}
|
||||
chartMode={tableData.chartMode}
|
||||
allTableData={tableData.data}
|
||||
|
||||
Reference in New Issue
Block a user