diff --git a/src/app/(pages)/(main)/category/sub-page/CategoryPage.tsx b/src/app/(pages)/(main)/category/sub-page/CategoryPage.tsx index 4f018ce..2386623 100644 --- a/src/app/(pages)/(main)/category/sub-page/CategoryPage.tsx +++ b/src/app/(pages)/(main)/category/sub-page/CategoryPage.tsx @@ -2,12 +2,13 @@ import {useMemo} from "react"; import {useLayoutFilter} from "@/components/layout/LayoutFilterContext"; -import {CategoryTargetData} from "@/config/filter.types"; -import {BannerRow, CategoryResolvedField, StatisticsRequest} from "@/types/lg"; +import {CategoryTargetData} from "@/types/filter.types"; +import {BannerRow, CategoryResolvedField, StatisticsRequest} from "@/types/lg.types"; import {useDebouncedValue} from "@/hooks/useDebouncedValue"; import {CategoryFilterValue} from "@/components/layout/CategoryFilter"; import {buildCategoryFilter, buildPageModeConfig} from "@/lib/lg-dashboard"; -import {BANNER_GROUP_KEY, API_DECIMAL_POINT, USE_CACHE} from "@/const/lgConst"; +import {BANNER_GROUP_KEY} from "@/const/lg-banner.const"; +import {API_DECIMAL_POINT, USE_CACHE} from "@/const/lg-common.const"; import Profile from "./category-page/Profile"; import PenetrationChange from "./category-page/PenetrationChange"; import CategoryDetail from "./category-page/CategoryDetail"; @@ -55,4 +56,4 @@ const CategoryPage = () => { return Comp ? : null; } -export default CategoryPage; \ No newline at end of file +export default CategoryPage; diff --git a/src/app/(pages)/(main)/category/sub-page/category-page/CategoryDetail.tsx b/src/app/(pages)/(main)/category/sub-page/category-page/CategoryDetail.tsx index 7f3ce44..d7d47fd 100644 --- a/src/app/(pages)/(main)/category/sub-page/category-page/CategoryDetail.tsx +++ b/src/app/(pages)/(main)/category/sub-page/category-page/CategoryDetail.tsx @@ -3,9 +3,12 @@ import {useLayoutFilter} from "@/components/layout/LayoutFilterContext"; import {useDebouncedValue} from "@/hooks/useDebouncedValue"; import {CategoryFilterValue} from "@/components/layout/CategoryFilter"; import {useEffect, useMemo} from "react"; -import {BannerRow, PageData} from "@/types/lg"; +import {BannerRow, PageData} from "@/types/lg.types"; import {buildHeader_Banner, exportDashboardExcel, Section} from "@/lib/lg-export-excel"; -import {BANNER_GROUP, BANNER_KEY_MAP, QID_SURVEY_TITLE, SITE_TITLE, YEARS} from "@/const/lgConst"; +import {BANNER_GROUP} from "@/const/lg-banner.const"; +import {BANNER_KEY_MAP} from "@/const/lg-schema.const"; +import {QID_SURVEY_TITLE} from "@/const/lg-survey.const"; +import {SITE_TITLE, YEARS} from "@/const/lg-common.const"; import {CategoryByData} from "@/components/lge-dashboard"; const CategoryDetail = ({ @@ -89,4 +92,4 @@ const CategoryDetail = ({ ); } -export default CategoryDetail; \ No newline at end of file +export default CategoryDetail; diff --git a/src/app/(pages)/(main)/category/sub-page/category-page/PenetrationChange.tsx b/src/app/(pages)/(main)/category/sub-page/category-page/PenetrationChange.tsx index 6657bf7..35c175e 100644 --- a/src/app/(pages)/(main)/category/sub-page/category-page/PenetrationChange.tsx +++ b/src/app/(pages)/(main)/category/sub-page/category-page/PenetrationChange.tsx @@ -2,9 +2,9 @@ import BannerSummary from "@/components/lge-dashboard/combo/BannerSummary"; import {useMemo} from "react"; -import {BannerRow} from "@/types/lg"; +import {BannerRow} from "@/types/lg.types"; import {CategoryPageProps} from "../../sub-page/CategoryPage"; -import {LAST_YEAR} from "@/const/lgConst"; +import {LAST_YEAR} from "@/const/lg-common.const"; const PenetrationChange = ({ dataMap @@ -35,4 +35,4 @@ const PenetrationChange = ({ ); } -export default PenetrationChange \ No newline at end of file +export default PenetrationChange diff --git a/src/app/(pages)/(main)/category/sub-page/category-page/Profile.tsx b/src/app/(pages)/(main)/category/sub-page/category-page/Profile.tsx index 1df4526..f1477a9 100644 --- a/src/app/(pages)/(main)/category/sub-page/category-page/Profile.tsx +++ b/src/app/(pages)/(main)/category/sub-page/category-page/Profile.tsx @@ -3,12 +3,12 @@ import {useLayoutFilter} from "@/components/layout/LayoutFilterContext"; import BannerSummary from "@/components/lge-dashboard/combo/BannerSummary"; import {useMemo} from "react"; -import {BannerRow} from "@/types/lg"; +import {BannerRow} from "@/types/lg.types"; import {CategoryFilterValue} from "@/components/layout/CategoryFilter"; import {useDebouncedValue} from "@/hooks/useDebouncedValue"; import { calcGapBannerRow } from "@/lib/lg-dashboard"; -import {YEARS} from "@/const/lgConst"; -import {CategoryTargetType} from "@/config/filter.types"; +import {YEARS} from "@/const/lg-common.const"; +import {CategoryTargetType} from "@/types/filter.types"; import {CategoryPageProps} from "../../sub-page/CategoryPage"; const Profile = ({ @@ -76,4 +76,4 @@ const Profile = ({ ); } -export default Profile; \ No newline at end of file +export default Profile; diff --git a/src/app/(pages)/(main)/total/lg-penetration/page.tsx b/src/app/(pages)/(main)/total/lg-penetration/page.tsx index 3e88984..e1092b4 100644 --- a/src/app/(pages)/(main)/total/lg-penetration/page.tsx +++ b/src/app/(pages)/(main)/total/lg-penetration/page.tsx @@ -9,15 +9,18 @@ import { type TopChartTableRow, } from "@/components/lge-dashboard"; import { - CHART_COLOR_BY_YEAR, - CHART_FOCUS_COLOR_BY_YEAR, API_DECIMAL_POINT, LIFE_STAGE_COLUMNS, LIFE_STAGE_GROUPS, - PRODUCT_KEY_MAP, PRODUCT_KEYS, - SITE_TITLE, USE_CACHE, - YEARS -} from "@/const/lgConst"; +} from "@/const/lg-product.const"; +import { PRODUCT_KEY_MAP } from "@/const/lg-schema.const"; +import { + API_DECIMAL_POINT, + SITE_TITLE, + USE_CACHE, + YEARS, +} from "@/const/lg-common.const"; +import { CHART_COLOR_BY_YEAR, CHART_FOCUS_COLOR_BY_YEAR } from "@/components/lge-dashboard/chart/chart.config"; import {useEffect, useMemo} from "react"; import LifeStageDiv from "@/components/lge-dashboard/combo/LifeStageDiv"; import {useLayoutFilter} from "@/components/layout/LayoutFilterContext"; @@ -34,7 +37,7 @@ import { Section } from "@/lib/lg-export-excel"; import {toNumOr0} from "@/lib/utils"; -import {LifeStageGroup, LifeStageRow, ProductKey, StatisticsRequest} from "@/types/lg"; +import {LifeStageGroup, LifeStageRow, ProductKey, StatisticsRequest} from "@/types/lg.types"; import {useDebouncedValue} from "@/hooks/useDebouncedValue"; import {SelectedMap} from "@/types/common"; import {useBannerStatisticsQuery, useProductStatisticsQuery} from "@/query/statistics"; @@ -254,4 +257,4 @@ const LGPenetrationPage = () => { ); }; -export default LGPenetrationPage; \ No newline at end of file +export default LGPenetrationPage; diff --git a/src/app/(pages)/(main)/total/lg-purchase/page.tsx b/src/app/(pages)/(main)/total/lg-purchase/page.tsx index 0e9f34c..daba2be 100644 --- a/src/app/(pages)/(main)/total/lg-purchase/page.tsx +++ b/src/app/(pages)/(main)/total/lg-purchase/page.tsx @@ -2,12 +2,16 @@ import {useEffect, useMemo} from "react"; import { - CHART_COLOR_BY_YEAR, CHART_FOCUS_COLOR_BY_YEAR, API_DECIMAL_POINT, - PRODUCT_KEY_MAP, PRODUCT_KEYS, - SITE_TITLE, USE_CACHE, - YEARS -} from "@/const/lgConst"; +} from "@/const/lg-product.const"; +import { PRODUCT_KEY_MAP } from "@/const/lg-schema.const"; +import { + API_DECIMAL_POINT, + SITE_TITLE, + USE_CACHE, + YEARS, +} from "@/const/lg-common.const"; +import { CHART_COLOR_BY_YEAR, CHART_FOCUS_COLOR_BY_YEAR } from "@/components/lge-dashboard/chart/chart.config"; import { BottomDescription, GroupedOverlayBar, @@ -26,7 +30,7 @@ import { import {buildHeader_ProductKeyMap, exportDashboardExcel} from "@/lib/lg-export-excel"; import {useDebouncedValue} from "@/hooks/useDebouncedValue"; import {SelectedMap} from "@/types/common"; -import {ProductKey, StatisticsRequest} from "@/types/lg"; +import {ProductKey, StatisticsRequest} from "@/types/lg.types"; import {useProductStatisticsQuery} from "@/query/statistics"; import {toNumOr0} from "@/lib/utils"; @@ -177,4 +181,4 @@ const LGPurchasePage = () => { ); }; -export default LGPurchasePage; \ No newline at end of file +export default LGPurchasePage; diff --git a/src/app/(pages)/(main)/total/penetration/page.tsx b/src/app/(pages)/(main)/total/penetration/page.tsx index 37462b1..36d8375 100644 --- a/src/app/(pages)/(main)/total/penetration/page.tsx +++ b/src/app/(pages)/(main)/total/penetration/page.tsx @@ -14,19 +14,21 @@ import { useLayoutFilter } from "@/components/layout/LayoutFilterContext"; import { Button } from "@/components/ui/button"; import { BRAND_LIST, - PRODUCT_KEYS, - PRODUCTS, YEARS, - AXIS_HIDE_STYLE, - GRID_X_NOT_PADDING, PRODUCT_KEY_MAP, SITE_TITLE, USE_CACHE, API_DECIMAL_POINT -} from "@/const/lgConst"; + SITE_TITLE, + USE_CACHE, + API_DECIMAL_POINT, +} from "@/const/lg-common.const"; +import { PRODUCT_KEY_MAP } from "@/const/lg-schema.const"; +import { PRODUCT_KEYS, PRODUCTS } from "@/const/lg-product.const"; +import { AXIS_HIDE_STYLE, GRID_X_NOT_PADDING } from "@/components/lge-dashboard/chart/chart.config"; import { calcCagrRow, calcGapProductRow, formatRowLabel, normalizeFilterCondition, withCagrRow, withGapRow } from "@/lib/lg-dashboard"; import {buildHeader_ProductKeyMap, exportDashboardExcel, Section} from "@/lib/lg-export-excel"; -import {StatisticsRequest} from "@/types/lg"; +import {StatisticsRequest} from "@/types/lg.types"; import {useProductStatisticsQuery} from "@/query/statistics"; import {useDebouncedValue} from "@/hooks/useDebouncedValue"; import {toNumOr0} from "@/lib/utils"; @@ -195,4 +197,4 @@ const PenetrationPage = () => { ); }; -export default PenetrationPage; \ No newline at end of file +export default PenetrationPage; diff --git a/src/app/(pages)/(main)/total/purchase/page.tsx b/src/app/(pages)/(main)/total/purchase/page.tsx index ca180cc..fb11e4b 100644 --- a/src/app/(pages)/(main)/total/purchase/page.tsx +++ b/src/app/(pages)/(main)/total/purchase/page.tsx @@ -4,11 +4,14 @@ import {useEffect, useMemo} from "react"; import { PRODUCT_KEYS, PRODUCTS, - AXIS_HIDE_STYLE, - GRID_X_NOT_PADDING, - PRODUCT_KEY_MAP, - SITE_TITLE, USE_CACHE, API_DECIMAL_POINT -} from "@/const/lgConst"; +} from "@/const/lg-product.const"; +import { PRODUCT_KEY_MAP } from "@/const/lg-schema.const"; +import { + SITE_TITLE, + USE_CACHE, + API_DECIMAL_POINT, +} from "@/const/lg-common.const"; +import { AXIS_HIDE_STYLE, GRID_X_NOT_PADDING } from "@/components/lge-dashboard/chart/chart.config"; import { BottomDescription, type ChartData, @@ -22,7 +25,7 @@ import {calcGapProductRow, formatRowLabel, normalizeFilterCondition, withGapRow} import {buildHeader_ProductKeyMap, exportDashboardExcel} from "@/lib/lg-export-excel"; import {useDebouncedValue} from "@/hooks/useDebouncedValue"; import {SelectedMap} from "@/types/common"; -import {StatisticsRequest} from "@/types/lg"; +import {StatisticsRequest} from "@/types/lg.types"; import {useProductStatisticsQuery} from "@/query/statistics"; const PurchasePage = () => { @@ -128,4 +131,4 @@ const PurchasePage = () => { ); }; -export default PurchasePage; \ No newline at end of file +export default PurchasePage; diff --git a/src/app/api/statistics/[[...slug]]/route.ts b/src/app/api/statistics/[[...slug]]/route.ts index b22b8ac..b32bb9c 100644 --- a/src/app/api/statistics/[[...slug]]/route.ts +++ b/src/app/api/statistics/[[...slug]]/route.ts @@ -2,7 +2,7 @@ import {NextRequest, NextResponse} from "next/server"; import {RouteContext} from "@/types/common"; import {errorToResponse} from "@/lib/http-util"; import {createBackApi} from "@/lib/server-api"; -import {ProductResponse, BannerResponse} from "@/types/lg"; +import {ProductResponse, BannerResponse} from "@/types/lg.types"; export async function POST( req: NextRequest, @@ -36,4 +36,4 @@ export async function POST( } catch (error: unknown) { return errorToResponse(error); } -} \ No newline at end of file +} diff --git a/src/components/layout/CategoryFilter.tsx b/src/components/layout/CategoryFilter.tsx index cffd56a..bd5793b 100644 --- a/src/components/layout/CategoryFilter.tsx +++ b/src/components/layout/CategoryFilter.tsx @@ -3,14 +3,15 @@ import { CategoryTargetType, TargetChild, -} from "@/config/filter.types"; -import {categoryTarget, categoryTargetType} from "@/config/filter.data"; +} from "@/types/filter.types"; +import {categoryTarget, categoryTargetType} from "@/const/filter.const"; import { ChevronRight } from "lucide-react"; import {useCallback, useMemo} from "react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; -import {ProductKey, ProductsFilterItem} from "@/types/lg"; -import {PRODUCT_KEY_MAP, YEARS} from "@/const/lgConst"; +import {ProductKey, ProductsFilterItem} from "@/types/lg.types"; +import {PRODUCT_KEY_MAP} from "@/const/lg-schema.const"; +import {YEARS} from "@/const/lg-common.const"; export type CategoryTypeValue = { label: string; diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsx index a2784c1..ada6868 100644 --- a/src/components/layout/Header.tsx +++ b/src/components/layout/Header.tsx @@ -2,11 +2,11 @@ import {useAuth} from "@/hooks/useAuth"; import {useEffect, useState} from "react"; import {LoginUser} from "@/types/auth"; import Image from "next/image"; -import {topMenus} from "@/config/menu.data"; +import {topMenus} from "@/const/menu.const"; import {Button} from "@/components/ui/button"; import {LogOut} from "lucide-react"; import {cn} from "@/lib/utils"; -import {SITE_TITLE} from "@/const/lgConst"; +import {SITE_TITLE} from "@/const/lg-common.const"; interface HeaderProps { activeTopId: string; @@ -89,4 +89,4 @@ const Header = ({ ); } -export default Header; \ No newline at end of file +export default Header; diff --git a/src/components/layout/MainLayout.tsx b/src/components/layout/MainLayout.tsx index 7cd500a..9318a86 100644 --- a/src/components/layout/MainLayout.tsx +++ b/src/components/layout/MainLayout.tsx @@ -4,17 +4,18 @@ import {ReactNode, useEffect, useMemo, useRef, useState} from "react"; import {usePathname, useRouter} from "next/navigation"; import {cn} from "@/lib/utils"; import {SelectedMap} from "@/types/common"; -import {topMenus, totalSubMenus, categorySubMenus} from "@/config/menu.data"; -import {categoryTarget, totalFilters} from "@/config/filter.data"; -import {CategoryTargetData, CategoryTargetType} from "@/config/filter.types"; +import {topMenus, totalSubMenus, categorySubMenus} from "@/const/menu.const"; +import {categoryTarget, totalFilters} from "@/const/filter.const"; +import {CategoryTargetData, CategoryTargetType} from "@/types/filter.types"; import Header from "./Header"; import SubMenu from "./SubMenu"; import TotalFilter from "./TotalFilter"; import CategoryFilter, {CategoryFilterValue} from "./CategoryFilter"; import ExcelDownloadButton from "./ExcelDownloadButton"; import {LayoutFilterProvider} from "./LayoutFilterContext"; -import {LAST_YEAR, PRODUCTS_FILTER_ITEM} from "@/const/lgConst"; -import {ProductsFilterItem} from "@/types/lg"; +import {LAST_YEAR} from "@/const/lg-common.const"; +import {PRODUCTS_FILTER_ITEM} from "@/const/lg-product.const"; +import {ProductsFilterItem} from "@/types/lg.types"; import {ArrowUp, Filter} from "lucide-react"; import {Button} from "@/components/ui/button"; @@ -238,4 +239,4 @@ const MainLayout = ({ children }: MainLayoutProps) => { ); } -export default MainLayout; \ No newline at end of file +export default MainLayout; diff --git a/src/components/layout/SubMenu.tsx b/src/components/layout/SubMenu.tsx index af45675..ba2b66c 100644 --- a/src/components/layout/SubMenu.tsx +++ b/src/components/layout/SubMenu.tsx @@ -1,4 +1,4 @@ -import {SubMenuItem} from "@/config/menu.types"; +import {SubMenuItem} from "@/types/menu.types"; import {cn} from "@/lib/utils"; interface SubMenuProps { @@ -45,4 +45,4 @@ const SubMenu = ({ ); } -export default SubMenu; \ No newline at end of file +export default SubMenu; diff --git a/src/components/layout/TotalFilter.tsx b/src/components/layout/TotalFilter.tsx index 0197ecd..30fcd8c 100644 --- a/src/components/layout/TotalFilter.tsx +++ b/src/components/layout/TotalFilter.tsx @@ -1,4 +1,4 @@ -import {TotalFilterItem} from "@/config/filter.types"; +import {TotalFilterItem} from "@/types/filter.types"; import {SelectedMap} from "@/types/common"; import {useMemo} from "react"; import {cn} from "@/lib/utils"; @@ -97,4 +97,4 @@ const TotalFilter = ({ ); } -export default TotalFilter; \ No newline at end of file +export default TotalFilter; diff --git a/src/components/lge-dashboard/BaseEChart.tsx b/src/components/lge-dashboard/BaseEChart.tsx index 2e0675c..0224e74 100644 --- a/src/components/lge-dashboard/BaseEChart.tsx +++ b/src/components/lge-dashboard/BaseEChart.tsx @@ -2,9 +2,9 @@ import dynamic from "next/dynamic"; import type { EChartsOption } from "echarts"; -import { CHART_HEIGHTS } from "@/const/chartConst"; +import { CHART_HEIGHTS } from "@/components/lge-dashboard/chart/chart.config"; import {useResizeKey} from "@/hooks/useResize"; -import { VIEW_DECIMAL_POINT } from "@/const/lgConst"; +import { VIEW_DECIMAL_POINT } from "@/const/lg-common.const"; import { useMemo } from "react"; import {roundNumber} from "@/lib/lg-dashboard"; @@ -95,4 +95,4 @@ const BaseEChart = ({ ); } -export default BaseEChart; \ No newline at end of file +export default BaseEChart; diff --git a/src/components/lge-dashboard/chart/GroupedOverlayBar.tsx b/src/components/lge-dashboard/chart/GroupedOverlayBar.tsx index ea0ea41..fe46516 100644 --- a/src/components/lge-dashboard/chart/GroupedOverlayBar.tsx +++ b/src/components/lge-dashboard/chart/GroupedOverlayBar.tsx @@ -13,8 +13,7 @@ import BaseEChart from "../BaseEChart"; import { buildLgPalette } from "../color"; import { GroupedOverlayBarData, ShowLabel} from "../types"; import {getIsShowLabel, roundedRectIcon} from "@/components/lge-dashboard/chart/utill"; -import {AXIS_HIDE_STYLE, AXIS_HIDE_Y_STYLE} from "@/const/lgConst"; -import { CHART_HEIGHTS, LEGEND_ITEM_SIZE } from "@/const/chartConst"; +import {AXIS_HIDE_STYLE, AXIS_HIDE_Y_STYLE, CHART_HEIGHTS, LEGEND_ITEM_SIZE} from "@/components/lge-dashboard/chart/chart.config"; import {makeTotalBasePct} from "@/lib/lg-dashboard"; type Props = { @@ -287,4 +286,4 @@ const GroupedOverlayBar = ({ return ; } -export default GroupedOverlayBar; \ No newline at end of file +export default GroupedOverlayBar; diff --git a/src/components/lge-dashboard/chart/GroupedStackBar.tsx b/src/components/lge-dashboard/chart/GroupedStackBar.tsx index 2e93071..483a91c 100644 --- a/src/components/lge-dashboard/chart/GroupedStackBar.tsx +++ b/src/components/lge-dashboard/chart/GroupedStackBar.tsx @@ -13,8 +13,7 @@ import BaseEChart from "../BaseEChart"; import { GroupedStackBarData, ShowLabel} from "../types"; import { buildLgPalette } from "@/components/lge-dashboard/color"; import {getIsShowLabel, roundedRectIcon} from "@/components/lge-dashboard/chart/utill"; -import {AXIS_HIDE_STYLE, AXIS_HIDE_Y_STYLE} from "@/const/lgConst"; -import { LEGEND_ITEM_SIZE } from "@/const/chartConst"; +import {AXIS_HIDE_STYLE, AXIS_HIDE_Y_STYLE, LEGEND_ITEM_SIZE} from "@/components/lge-dashboard/chart/chart.config"; type Props = { data: GroupedStackBarData; diff --git a/src/components/lge-dashboard/chart/HorizontalBar.tsx b/src/components/lge-dashboard/chart/HorizontalBar.tsx index f3a4124..11db6c6 100644 --- a/src/components/lge-dashboard/chart/HorizontalBar.tsx +++ b/src/components/lge-dashboard/chart/HorizontalBar.tsx @@ -13,7 +13,7 @@ import { createCategoryAxis, createValueAxis, } from "@/lib/chart-options"; -import { BAR_WIDTHS } from "@/const/chartConst"; +import { BAR_WIDTHS } from "@/components/lge-dashboard/chart/chart.config"; type Props = { data: ChartData; @@ -80,4 +80,4 @@ const HorizontalBar = ({ return ; } -export default HorizontalBar; \ No newline at end of file +export default HorizontalBar; diff --git a/src/components/lge-dashboard/chart/VerticalBar.tsx b/src/components/lge-dashboard/chart/VerticalBar.tsx index f9ea382..1b69546 100644 --- a/src/components/lge-dashboard/chart/VerticalBar.tsx +++ b/src/components/lge-dashboard/chart/VerticalBar.tsx @@ -13,7 +13,7 @@ import { createCategoryAxis, createValueAxis, } from "@/lib/chart-options"; -import { BAR_WIDTHS } from "@/const/chartConst"; +import { BAR_WIDTHS } from "@/components/lge-dashboard/chart/chart.config"; type Props = { data: ChartData; @@ -81,4 +81,4 @@ const VerticalBar = ({ return ; } -export default VerticalBar; \ No newline at end of file +export default VerticalBar; diff --git a/src/components/lge-dashboard/chart/chart.config.ts b/src/components/lge-dashboard/chart/chart.config.ts new file mode 100644 index 0000000..8b9a528 --- /dev/null +++ b/src/components/lge-dashboard/chart/chart.config.ts @@ -0,0 +1,86 @@ +/** + * 차트 기본 높이 설정 + */ +export const CHART_HEIGHTS = { + DEFAULT: "100%", + COMPACT: 200, + EXPANDED: 320, +} as const; + +/** + * Bar 차트의 Bar 너비 설정 + */ +export const BAR_WIDTHS = { + DEFAULT: 42, + NARROW: 30, + WIDE: 60, +} as const; + +/** + * 차트 Grid 기본 패딩 설정 + */ +export const CHART_GRID_DEFAULTS = { + DEFAULT: { + left: 16, + right: 16, + top: 36, + bottom: 12, + containLabel: true, + }, + COMPACT: { + left: 10, + right: 10, + top: 20, + bottom: 8, + containLabel: true, + }, +} as const; + +/** + * Legend 아이템 크기 설정 (GroupedOverlayBar, GroupedStackBar에서 사용) + */ +export const LEGEND_ITEM_SIZE = { + WIDTH: 25, + HEIGHT: 14, + RADIUS: 4, +} as const; + +/** + * 테이블 크기 설정 + */ +export const TABLE_DIMENSIONS = { + CELL_HEIGHT: { + DEFAULT: 26, + COMPACT: 20, + EXPANDED: 32, + }, + MIN_WIDTH: { + STANDARD: 1600, + COMPACT: 1200, + WIDE: 2000, + }, +} as const; + +import {YEARS} from "@/const/lg-common.const"; + +/** X 축 패딩 없앤 GridOption*/ +export const GRID_X_NOT_PADDING = { left: 0, right: 0, top: 50, bottom: 10, containLabel: false } as const; +/** T 축 패딩 없앤 GridOption*/ +export const GRID_Y_NOT_PADDING = { left: 10, right: 10, top: 0, bottom: 0, containLabel: false } as const; +/** 축 스타일 감춤 */ +export const AXIS_HIDE_STYLE = { axisLabel: { show: false }, axisTick: { show: false }, axisLine: { show: false }} as const; +export const AXIS_HIDE_Y_STYLE = { min:0, max:100, axisLabel: { show: false }, axisTick: { show: false }, axisLine: { show: false }} as const; + +export const CHART_COLOR_BY_YEAR = Object.fromEntries( + YEARS.map((year, i) => [ + year, + `--chart-${YEARS.length-i}-t`, + ]) +) as Record<(typeof YEARS)[number], string>; + +export const CHART_FOCUS_COLOR_BY_YEAR = Object.fromEntries( + YEARS.map((year, i) => [ + year, + `--chart-${YEARS.length-i}`, + ]) +) as Record<(typeof YEARS)[number], string>; diff --git a/src/components/lge-dashboard/combo/BannerSummary.tsx b/src/components/lge-dashboard/combo/BannerSummary.tsx index 1a48a8d..72262d3 100644 --- a/src/components/lge-dashboard/combo/BannerSummary.tsx +++ b/src/components/lge-dashboard/combo/BannerSummary.tsx @@ -1,13 +1,11 @@ import {ChartData, DataColumn, DataTable, HorizontalBar, LeftChartTable, SignStyle} from "@/components/lge-dashboard"; -import {BannerKey, BannerRow} from "@/types/lg"; +import {BannerKey, BannerRow} from "@/types/lg.types"; import {formatRowLabel, isGapRow, wrapSampleRow} from "@/lib/lg-dashboard"; import {useEffect, useMemo} from "react"; -import { - BANNER_GROUP, - BANNER_KEY_MAP, - GRID_Y_NOT_PADDING, - SITE_TITLE, -} from "@/const/lgConst"; +import {BANNER_GROUP} from "@/const/lg-banner.const"; +import {BANNER_KEY_MAP} from "@/const/lg-schema.const"; +import {SITE_TITLE} from "@/const/lg-common.const"; +import { GRID_Y_NOT_PADDING } from "@/components/lge-dashboard/chart/chart.config"; import {parseNumber} from "@/lib/utils"; import { buildHeader_DataColumn, @@ -16,7 +14,7 @@ import { } from "@/lib/lg-export-excel"; import {useLayoutFilter} from "@/components/layout/LayoutFilterContext"; import {CategoryFilterValue} from "@/components/layout/CategoryFilter"; -import {CategoryTargetData} from "@/config/filter.types"; +import {CategoryTargetData} from "@/types/filter.types"; import {useDebouncedValue} from "@/hooks/useDebouncedValue"; @@ -215,4 +213,4 @@ const BannerSummary = ({ data, useChart, useYear }: BannerSummaryProps) => { ); } -export default BannerSummary; \ No newline at end of file +export default BannerSummary; diff --git a/src/components/lge-dashboard/combo/CategoryByData.tsx b/src/components/lge-dashboard/combo/CategoryByData.tsx index 3ac4da4..63e8cc5 100644 --- a/src/components/lge-dashboard/combo/CategoryByData.tsx +++ b/src/components/lge-dashboard/combo/CategoryByData.tsx @@ -6,16 +6,17 @@ import { StackBar } from "@/components/lge-dashboard"; import BannerButtons from "@/components/lge-dashboard/BannerButtons"; -import {categoryByDataBanner, totalFilters} from "@/config/filter.data"; +import {categoryByDataBanner, totalFilters} from "@/const/filter.const"; import React, {useMemo, useState} from "react"; -import {BannerGroupKey, CategoryChartMode, BannerRow, LegendOption} from "@/types/lg"; +import {BannerGroupKey, CategoryChartMode, BannerRow, LegendOption} from "@/types/lg.types"; import { buildRowLabelSeriesChartData, buildYearSeriesChartData, formatRowLabel, isBannerGroupKey, isGapRow, wrapSampleRow } from "@/lib/lg-dashboard"; -import {BANNER_GROUP, BANNER_KEY_MAP} from "@/const/lgConst"; +import {BANNER_GROUP} from "@/const/lg-banner.const"; +import {BANNER_KEY_MAP} from "@/const/lg-schema.const"; import {createDefaultGrid, reverseCategories} from "@/lib/chart-options"; type CategoryByDataProps = { @@ -171,4 +172,4 @@ const CategoryByData = ({ ); }; -export default CategoryByData; \ No newline at end of file +export default CategoryByData; diff --git a/src/components/lge-dashboard/combo/LeftChartTable.tsx b/src/components/lge-dashboard/combo/LeftChartTable.tsx index 2efdc5e..e3ab65f 100644 --- a/src/components/lge-dashboard/combo/LeftChartTable.tsx +++ b/src/components/lge-dashboard/combo/LeftChartTable.tsx @@ -4,9 +4,9 @@ import React, { useMemo } from "react"; import { cn, parseNumber } from "@/lib/utils"; import type { DataColumn, SignStyle } from "../types"; import SectionTitle from "../SectionTitle"; -import { TABLE_DIMENSIONS } from "@/const/chartConst"; +import { TABLE_DIMENSIONS } from "@/components/lge-dashboard/chart/chart.config"; import {isSampleRow, roundNumber} from "@/lib/lg-dashboard"; -import {SAMPLE_SIZE_NOTICE, UNIT_TEXT, VIEW_DECIMAL_POINT} from "@/const/lgConst"; +import {SAMPLE_SIZE_NOTICE, UNIT_TEXT, VIEW_DECIMAL_POINT} from "@/const/lg-common.const"; type MergedChartCell = { /** 차트를 삽입할 컬럼 key(해당 컬럼 td는 startRow에서만 렌더되고 rowSpan 적용) */ diff --git a/src/components/lge-dashboard/combo/LifeStageDiv.tsx b/src/components/lge-dashboard/combo/LifeStageDiv.tsx index 259a067..44c6bff 100644 --- a/src/components/lge-dashboard/combo/LifeStageDiv.tsx +++ b/src/components/lge-dashboard/combo/LifeStageDiv.tsx @@ -1,6 +1,7 @@ import GaugeCardTable from "./GaugeCardTable"; -import {LIFE_STAGE_COLUMNS, UNIT_TEXT} from "@/const/lgConst"; -import {LifeStageGroup} from "@/types/lg"; +import {LIFE_STAGE_COLUMNS} from "@/const/lg-product.const"; +import {UNIT_TEXT} from "@/const/lg-common.const"; +import {LifeStageGroup} from "@/types/lg.types"; import SectionTitle from "../SectionTitle"; import React from "react"; @@ -48,4 +49,4 @@ const LifeStageDiv = ({lifeStageRowsByGroup}:lifeStageDivProps) => { ); } -export default LifeStageDiv; \ No newline at end of file +export default LifeStageDiv; diff --git a/src/components/lge-dashboard/combo/TopChartTable.tsx b/src/components/lge-dashboard/combo/TopChartTable.tsx index a920de7..1054597 100644 --- a/src/components/lge-dashboard/combo/TopChartTable.tsx +++ b/src/components/lge-dashboard/combo/TopChartTable.tsx @@ -4,8 +4,8 @@ import React, { useMemo } from "react"; import { cn, parseNumber } from "@/lib/utils"; import type { ChartData, SignStyle, TopChartTableRow } from "../types"; import SectionTitle from "../SectionTitle"; -import { CHART_HEIGHTS, TABLE_DIMENSIONS } from "@/const/chartConst"; -import {UNIT_TEXT} from "@/const/lgConst"; +import { CHART_HEIGHTS, TABLE_DIMENSIONS } from "@/components/lge-dashboard/chart/chart.config"; +import {UNIT_TEXT} from "@/const/lg-common.const"; import {isCagrRow, roundNumber} from "@/lib/lg-dashboard"; export type TopChartTableProps = { @@ -171,4 +171,4 @@ export default function TopChartTable(props: TopChartTableProps) { ); -} \ No newline at end of file +} diff --git a/src/components/lge-dashboard/table/DataTable.tsx b/src/components/lge-dashboard/table/DataTable.tsx index ba77e56..9881604 100644 --- a/src/components/lge-dashboard/table/DataTable.tsx +++ b/src/components/lge-dashboard/table/DataTable.tsx @@ -6,7 +6,7 @@ import { cn, parseNumber } from "@/lib/utils"; import type { DataColumn, SignDisplayMode, SignStyle } from "../types"; import SectionTitle from "../SectionTitle"; import {isCagrRow, isSampleRow, roundNumber} from "@/lib/lg-dashboard"; -import {SAMPLE_SIZE_NOTICE, UNIT_TEXT} from "@/const/lgConst"; +import {SAMPLE_SIZE_NOTICE, UNIT_TEXT} from "@/const/lg-common.const"; type Props> = { columns: DataColumn[]; @@ -269,4 +269,4 @@ const DataTable = >({ ); } -export default DataTable; \ No newline at end of file +export default DataTable; diff --git a/src/components/lge-dashboard/types.ts b/src/components/lge-dashboard/types.ts index 04fc7b7..845ea14 100644 --- a/src/components/lge-dashboard/types.ts +++ b/src/components/lge-dashboard/types.ts @@ -1,5 +1,5 @@ import type React from "react"; -import {GAP_WORDING} from "@/const/lgConst"; +import {GAP_WORDING} from "@/const/lg-common.const"; export type NewNumber = number | null | undefined; @@ -136,4 +136,4 @@ export type ShowLabel = "none" | "all" | "last" | "first"; export type bannerType = { variable:string; variableName:string; -} \ No newline at end of file +} diff --git a/src/config/lg-page.config.ts b/src/config/lg-page.config.ts new file mode 100644 index 0000000..d27bd18 --- /dev/null +++ b/src/config/lg-page.config.ts @@ -0,0 +1,254 @@ +import {CategoryFieldSpec} from "@/types/lg.types"; +import {CategoryTargetData, CategoryTargetType} from "@/types/filter.types"; + +export const CATEGORY_PAGE_FIELDS: Record = { + [CategoryTargetData.PROFILE]: [ + { + title: { + [CategoryTargetType.PENETRATION]: "보유율" + , [CategoryTargetType.PURCHASE]: "구매율" + , [CategoryTargetType.INTENDED]: "향후 구매율" + }, + requestKey: "category_${keyBase}", + chartMode:"none", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA1" + , [CategoryTargetType.PURCHASE]: "KQB0" + , [CategoryTargetType.INTENDED]: "KQC1" + }, + }, + { + title: "보유대수", + requestKey: "category_penetration_count", + chartMode:"none", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA2" + }, + }, + ], + + [CategoryTargetData.PENETRATION_CHANGE]: [ + { + title: "보급률 변화", + requestKey: "category_${keyBase}", + chartMode:"none", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA1" + }, + }, + ], + + [CategoryTargetData.BRAND]: [ + { + title: "브랜드", + requestKey: "category_${keyBase}_brand", + chartMode:"reverseStack", + chartTopMargin: 80, + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_3", + [CategoryTargetType.PURCHASE]: "KQX3_3", + }, + }, + { + title: { + [CategoryTargetType.PENETRATION]: "", + [CategoryTargetType.PURCHASE]: "구매 고려 브랜드", + [CategoryTargetType.INTENDED]: "브랜드", + }, + requestKey: "category_${keyBase}_consider_brand", + chartMode:"horizontal", + qidByMode: { + [CategoryTargetType.PURCHASE]: "KQB1", + [CategoryTargetType.INTENDED]: "KQC2", + }, + }, + ], + + [CategoryTargetData.TYPE_SPEC]: [ + { + title: "타입", + requestKey: "category_${keyBase}_type", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_4", + [CategoryTargetType.PURCHASE]: "KQX3_4", + [CategoryTargetType.INTENDED]: "KQC3_1" + } + }, + { + title: "깊이 타입", + requestKey: "category_${keyBase}_depthType", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_5", + [CategoryTargetType.PURCHASE]: "KQX3_5", + [CategoryTargetType.INTENDED]: "KQC3_2" + } + }, + { + title: "용량", + requestKey: "category_${keyBase}_capacity", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_6", + [CategoryTargetType.PURCHASE]: "KQX3_6" + } + }, + { + title: "설치 형태", + requestKey: "category_${keyBase}_installType", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_7", + [CategoryTargetType.PURCHASE]: "KQX3_7", + [CategoryTargetType.INTENDED]: "KQC3_3" + } + }, + { + title: "시공 방식", + requestKey: "category_${keyBase}_installMethod", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.INTENDED]: "KQC3_4" + } + }, + { + title: "냉장고 & 김치냉장고 설치 형태", + requestKey: "category_${keyBase}_fridgeInstallType", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.INTENDED]: "KQC3_5" + } + }, + { + title: "설치 위치", + requestKey: "category_${keyBase}_installLocation", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.INTENDED]: "KQC3_6" + } + }, + { + title: "배치/설치환경", + requestKey: "category_${keyBase}_installEnv", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_8", + [CategoryTargetType.PURCHASE]: "KQX3_8", + [CategoryTargetType.INTENDED]: "KQC3_7" + } + }, + { + title: "구입 고려 특징", + requestKey: "category_${keyBase}_buyConsiderations", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.INTENDED]: "KQC3_8" + } + }, + { + title: "기능", + requestKey: "category_${keyBase}_features", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_9", + [CategoryTargetType.PURCHASE]: "KQX3_9" + } + }, + { + title: "스크린 사이즈", + requestKey: "category_${keyBase}_screenSize", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_10", + [CategoryTargetType.PURCHASE]: "KQX3_10" + } + }, + { + title: "용도", + requestKey: "category_${keyBase}_usage", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_11", + [CategoryTargetType.PURCHASE]: "KQX3_11" + } + }, + { + title: "스마트 모니터 여부", + requestKey: "category_${keyBase}_isSmartMonitor", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_12", + [CategoryTargetType.PURCHASE]: "KQX3_12" + } + }, + { + title: "음식물처리기 구동 방식", + requestKey: "category_${keyBase}_driveMethod", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_13", + [CategoryTargetType.PURCHASE]: "KQX3_13" + } + }, + ], + + [CategoryTargetData.BEHAVIOR]: [ + { + title: { + [CategoryTargetType.PENETRATION]: "보유 경로" + , [CategoryTargetType.PURCHASE]: "구입 행태" + , [CategoryTargetType.INTENDED]: "구입 행태" + }, + requestKey: "category_${keyBase}_behavior", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_1", + [CategoryTargetType.PURCHASE]: "KQB2", + [CategoryTargetType.INTENDED]: "KQC5" + }, + }, + { + title: "구입 계기", + requestKey: "category_${keyBase}_chance", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PURCHASE]: "KQB3" + }, + }, + ], + + [CategoryTargetData.PURCHASE_CHANNEL]: [ + { + title: "구매 채널(온/오프라인)", + requestKey: "category_${keyBase}_channel", + chartMode: "reverseStack", + qidByMode: { + [CategoryTargetType.PURCHASE]: "KQB4_NET", + [CategoryTargetType.INTENDED]: "KQC6_NET" + }, + }, + { + title: "구매 채널(상세)", + requestKey: "category_${keyBase}_channel_detail", + chartMode: "horizontal", + qidByMode: { + [CategoryTargetType.PURCHASE]: "KQB4", + [CategoryTargetType.INTENDED]: "KQC6" + }, + }, + ], + + [CategoryTargetData.PAYMENT_METHOD]: [ + { + title: "구매형식", + requestKey: "category_${keyBase}_method", + chartMode:"reverseStack", + qidByMode: { + [CategoryTargetType.PENETRATION]: "KQA3_2_1", + [CategoryTargetType.PURCHASE]: "KQX3_2_1", + [CategoryTargetType.INTENDED]: "KQC7" + }, + }, + ], +}; diff --git a/src/const/chartConst.ts b/src/const/chartConst.ts deleted file mode 100644 index 4bb9516..0000000 --- a/src/const/chartConst.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * 차트 기본 높이 설정 - */ -export const CHART_HEIGHTS = { - DEFAULT: "100%", - COMPACT: 200, - EXPANDED: 320, -} as const; - -/** - * Bar 차트의 Bar 너비 설정 - */ -export const BAR_WIDTHS = { - DEFAULT: 42, - NARROW: 30, - WIDE: 60, -} as const; - -/** - * 차트 Grid 기본 패딩 설정 - */ -export const CHART_GRID_DEFAULTS = { - DEFAULT: { - left: 16, - right: 16, - top: 36, - bottom: 12, - containLabel: true, - }, - COMPACT: { - left: 10, - right: 10, - top: 20, - bottom: 8, - containLabel: true, - }, -} as const; - -/** - * Legend 아이템 크기 설정 (GroupedOverlayBar, GroupedStackBar에서 사용) - */ -export const LEGEND_ITEM_SIZE = { - WIDTH: 25, - HEIGHT: 14, - RADIUS: 4, -} as const; - -/** - * 테이블 크기 설정 - */ -export const TABLE_DIMENSIONS = { - CELL_HEIGHT: { - DEFAULT: 26, - COMPACT: 20, - EXPANDED: 32, - }, - MIN_WIDTH: { - STANDARD: 1600, - COMPACT: 1200, - WIDE: 2000, - }, -} as const; \ No newline at end of file diff --git a/src/config/filter.data.ts b/src/const/filter.const.ts similarity index 99% rename from src/config/filter.data.ts rename to src/const/filter.const.ts index e350faf..9ae509d 100644 --- a/src/config/filter.data.ts +++ b/src/const/filter.const.ts @@ -4,7 +4,7 @@ import { CategoryTargetType, CategoryTargetTypeItem, FilterItem, TotalFilterItem -} from "./filter.types"; +} from "@/types/filter.types"; export const totalFilters:TotalFilterItem[] = [ { @@ -181,4 +181,4 @@ export const categoryByDataBanner:FilterItem[] = [ variable:"region", variableName:"지역", }, -] \ No newline at end of file +] diff --git a/src/const/lg-banner.const.ts b/src/const/lg-banner.const.ts new file mode 100644 index 0000000..df3d404 --- /dev/null +++ b/src/const/lg-banner.const.ts @@ -0,0 +1,96 @@ +import type {BannerKey} from "@/types/lg.types"; +import {BANNER_KEY_MAP} from "@/const/lg-schema.const"; + +export const BANNER_KEYS = Object.keys(BANNER_KEY_MAP) as Array; +export const BANNER_KEY = Object.keys(BANNER_KEY_MAP).reduce((acc, k) => { + (acc as any)[k] = k; + return acc; +}, {} as { [K in BannerKey]: K }); + +export const BANNER_GROUP = { + lifeStage: { + label: "라이프스테이지 별", + keys: [ + BANNER_KEY["KLIFEstAGE#1"], + BANNER_KEY["KLIFEstAGE#2"], + BANNER_KEY["KLIFEstAGE#3"], + BANNER_KEY["KLIFEstAGE#4"], + BANNER_KEY["KLIFEstAGE#5"], + BANNER_KEY["KLIFEstAGE#6"], + BANNER_KEY["KLIFEstAGE#7"], + BANNER_KEY["KLIFEstAGE#8"], + ], + }, + household: { + label: "가구원수 별", + keys: [ + BANNER_KEY["KSQ8_R_DB#1"], + BANNER_KEY["KSQ8_R_DB#2"], + BANNER_KEY["KSQ8_R_DB#3"], + BANNER_KEY["KSQ8_R_DB#4"], + ], + }, + age: { + label: "연령", + keys: [ + BANNER_KEY["KSQ2_R_R#1"], + BANNER_KEY["KSQ2_R_R#2"], + BANNER_KEY["KSQ2_R_R#3"], + BANNER_KEY["KSQ2_R_R#4"], + BANNER_KEY["KSQ2_R_R#5"], + ], + }, + occupancy: { + label: "입주 형태", + keys: [ + BANNER_KEY["KDQ6#1"], + BANNER_KEY["KDQ6#2"], + BANNER_KEY["KDQ6#3"], + BANNER_KEY["KDQ6#4"], + BANNER_KEY["KDQ6#5"], + ], + }, + housing: { + label: "주거 형태", + keys: [ + BANNER_KEY["KDQ4#1"], + BANNER_KEY["KDQ4#2"], + BANNER_KEY["KDQ4#3"], + BANNER_KEY["KDQ4#4"], + BANNER_KEY["KDQ4#5"], + BANNER_KEY["KDQ4#6"], + ], + }, + houseSize: { + label: "거주 평형", + keys: [ + BANNER_KEY["KDQ5#1"], + BANNER_KEY["KDQ5#2"], + BANNER_KEY["KDQ5#3"], + BANNER_KEY["KDQ5#4"], + BANNER_KEY["KDQ5#5"], + ], + }, + region: { + label: "거주 지역", + keys: [ + BANNER_KEY["KSQ4_R_R#1"], + BANNER_KEY["KSQ4_R_R#2"], + BANNER_KEY["KSQ4_R_R#3"], + BANNER_KEY["KSQ4_R_R#4"], + BANNER_KEY["KSQ4_R_R#5"], + BANNER_KEY["KSQ4_R_R#6"], + ], + }, + income: { + label: "소득수준", + keys: [ + BANNER_KEY["KDQ3_DB#1"], + BANNER_KEY["KDQ3_DB#2"], + BANNER_KEY["KDQ3_DB#3"], + BANNER_KEY["KDQ3_DB#4"], + ], + }, +} as const; + +export const BANNER_GROUP_KEY = Object.keys(BANNER_GROUP) as string[]; diff --git a/src/const/lg-common.const.ts b/src/const/lg-common.const.ts new file mode 100644 index 0000000..c63a366 --- /dev/null +++ b/src/const/lg-common.const.ts @@ -0,0 +1,14 @@ +export const USE_CACHE = true; +export const API_DECIMAL_POINT = 0; +export const VIEW_DECIMAL_POINT = 0; + +export const SITE_TITLE = 'LGE CX Dashboard'; + +export const YEARS = ["2023", "2024", "2025"]; +export const LAST_YEAR = YEARS.at(-1)!; + +export const GAP_WORDING = "전년 대비 GAP(%p)"; +export const UNIT_TEXT = "(단위 %)" +export const SAMPLE_SIZE_NOTICE = "* 30표본 미만 해석에 주의"; + +export const BRAND_LIST = ['Cbrand', '삼성', 'LG']; diff --git a/src/const/lg-product.const.ts b/src/const/lg-product.const.ts new file mode 100644 index 0000000..bb000f9 --- /dev/null +++ b/src/const/lg-product.const.ts @@ -0,0 +1,67 @@ +import {GaugeColumn} from "@/components/lge-dashboard"; +import {PRODUCT_KEY_MAP} from "@/const/lg-schema.const"; +import type {LifeStageRow} from "@/types/lg.types"; + +export const LIFE_STAGE_COLUMNS: GaugeColumn[] = [ + { key: "item", header: "", headRowSpan:2, rowHead: true, render: (r) => r.item }, + + { key: "total", header: "전체", headRowSpan:2, max: 100, align: "left", cellType:"number"}, + { key: "KLIFEstAGE#1", header: "미혼" , headRowSpan:2, max: 100 , align: "left"}, + + { key: "KLIFEstAGE#2", header: "무자녀", group: "기혼", max: 100 , align: "left"}, + { key: "KLIFEstAGE#3", header: "미취학", group: "기혼", max: 100 , align: "left"}, + { key: "KLIFEstAGE#4", header: "취학자녀", group: "기혼", max: 100 , align: "left"}, + { key: "KLIFEstAGE#5", header: "성인자녀", group: "기혼", max: 100 , align: "left"}, + + { key: "KLIFEstAGE#6", header: "독립\n시니어", headRowSpan:2, max: 100 , align: "left"}, + { key: "KLIFEstAGE#7", header: "비혼중년", headRowSpan:2, max: 100 , align: "left"}, + { key: "KLIFEstAGE#8", header: "기타", headRowSpan:2, max: 100 , align: "left"}, +]; + +export const LIFE_STAGE_GROUPS = [ + { title: "대형가전 군", items: ["KPRODUCT#1", "KPRODUCT#7", "KPRODUCT#8", "KPRODUCT#12", "KPRODUCT#14", "KPRODUCT#2", "KPRODUCT#3", "KPRODUCT#11"] }, + { title: "소형가전 군", items: ["KPRODUCT#9", "KPRODUCT#13", "KPRODUCT#4"] }, + { title: "신가전 군", items: ["KPRODUCT#10", "KPRODUCT#6"] }, +] as const; + +export const PRODUCT_KEYS = Object.keys(PRODUCT_KEY_MAP) as Array; +export const PRODUCTS = Object.values(PRODUCT_KEY_MAP) as Array; + +export const PRODUCTS_FILTER_ITEM = [ + { + path: "kitchen", + items: [ + "KPRODUCT#1", // 냉장고 + "KPRODUCT#2", // 김치 냉장고 + "KPRODUCT#3", // 정수기 + "KPRODUCT#4", // 전기 레인지 + "KPRODUCT#5", // 식기 세척기 + "KPRODUCT#6", // 음식물처리기 + ], + }, + { + path: "living", + items: [ + "KPRODUCT#7", // 세탁기 + "KPRODUCT#9", // 건조기 + "KPRODUCT#8", // 청소기 + "KPRODUCT#10", // 로봇 청소기 + "KPRODUCT#11", // 의류 관리기 + ], + }, + { + path: "es", + items: [ + "KPRODUCT#12", // 에어컨 + "KPRODUCT#13", // 공기 청정기 + ], + }, + { + path: "ms", + items: [ + "KPRODUCT#14", // TV + "KPRODUCT#15", // 노트북 + "KPRODUCT#16", // 모니터 + ], + }, +] as const; diff --git a/src/const/lg-schema.const.ts b/src/const/lg-schema.const.ts new file mode 100644 index 0000000..327f62f --- /dev/null +++ b/src/const/lg-schema.const.ts @@ -0,0 +1,82 @@ +export const PRODUCT_KEY_MAP = { + "KPRODUCT#1": "냉장고", + "KPRODUCT#2": "김치 냉장고", + "KPRODUCT#3": "정수기", + "KPRODUCT#4": "전기 레인지", + "KPRODUCT#5": "식기 세척기", + "KPRODUCT#6": "음식물처리기", + + "KPRODUCT#7": "세탁기", + "KPRODUCT#8": "청소기", + "KPRODUCT#9": "건조기", + "KPRODUCT#10": "로봇 청소기", + "KPRODUCT#11": "의류 관리기", + + "KPRODUCT#12": "에어컨", + "KPRODUCT#13": "공기 청정기", + + "KPRODUCT#14": "TV", + "KPRODUCT#15": "노트북", + "KPRODUCT#16": "모니터", +} as const; + +export const BANNER_KEY_MAP = { + // 라이프 스테이지 + "KLIFEstAGE#1": "미혼", + "KLIFEstAGE#2": "무자녀", + "KLIFEstAGE#3": "미취학", + "KLIFEstAGE#4": "취학자녀", + "KLIFEstAGE#5": "성인자녀", + "KLIFEstAGE#6": "독립시니어", + "KLIFEstAGE#7": "비혼중년", + "KLIFEstAGE#8": "기타", + + // 가구원수 + "KSQ8_R_DB#1": "1인 가구", + "KSQ8_R_DB#2": "2인 가구", + "KSQ8_R_DB#3": "3인 가구", + "KSQ8_R_DB#4": "4인 이상 가구", + + // 연령 + "KSQ2_R_R#1": "20대", + "KSQ2_R_R#2": "30대", + "KSQ2_R_R#3": "40대", + "KSQ2_R_R#4": "50대", + "KSQ2_R_R#5": "60대", + + // 점유형태 + "KDQ6#1": "자가", + "KDQ6#2": "전세", + "KDQ6#3": "전+월세 (보증금有)", + "KDQ6#4": "월세 (보증금無)", + "KDQ6#5": "기타", + + // 주거형태 + "KDQ4#1": "아파트", + "KDQ4#2": "주택", + "KDQ4#3": "오피스텔", + "KDQ4#4": "(연립)빌라", + "KDQ4#5": "원룸", + "KDQ4#6": "기타", + + // 평형 + "KDQ5#1": "19평 이하", + "KDQ5#2": "20평형 대", + "KDQ5#3": "30평형 대", + "KDQ5#4": "40평형 대", + "KDQ5#5": "50평형 대 이상", + + // 권역 + "KSQ4_R_R#1": "서울, 인천, 경기도", + "KSQ4_R_R#2": "경남, 부산, 울산", + "KSQ4_R_R#3": "경북, 대구", + "KSQ4_R_R#4": "전라도, 광주", + "KSQ4_R_R#5": "충청, 대전, 세종", + "KSQ4_R_R#6": "강원, 제주", + + // 소득 + "KDQ3_DB#1": "299만원 이하", + "KDQ3_DB#2": "300~599만원 이하", + "KDQ3_DB#3": "600~899만원 이하", + "KDQ3_DB#4": "900만원 이상", +} as const; diff --git a/src/const/lg-survey.const.ts b/src/const/lg-survey.const.ts new file mode 100644 index 0000000..de6358e --- /dev/null +++ b/src/const/lg-survey.const.ts @@ -0,0 +1,45 @@ +export const QID_SURVEY_TITLE: Record = { + "KQX3_3": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 브랜드는 어떻게 되십니까?", + "KQB1": "Q. 귀하께서 [#YEAR#]년에 제품을 구매하실 때 구매를 고려하셨던 브랜드는 무엇입니까? 모두 선택하여 주시기 바랍니다", + "KQX3_4": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 타입은 어떻게 되십니까?", + "KQX3_5": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 깊이 타입은 어떻게 되십니까?", + "KQX3_6": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 용량은 어떻게 되십니까?", + "KQX3_7": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 설치 형태는 어떻게 되십니까?", + "KQX3_8": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품은 메인 가구와 어떻게 배치되어 있습니까?", + "KQX3_9": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품에 포함되어 있는 기능이 있으십니까? 모두 선택해 주세요.", + "KQX3_10": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 스크린 사이즈는 어떻게 되십니까?", + "KQX3_11": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 가장 주된 용도는 무엇입니까?", + "KQX3_12": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품은 스마트 모니터(자체적으로 OS를 가지고 있어, 기타 기기 연결 없이 작동이 가능한 모니터) 입니까?", + "KQX3_13": "Q. 보유하고 계신 제품의 구동 방식은 어떻게 되십니까?", + "KQB2": "Q. 귀하께서는 [#YEAR#]년에 제품을 신규로 구입하신 건가요? 교체/추가 구입하신 건가요? 한 가지만 선택해주세요", + "KQB3": "Q. 귀하께서 [#YEAR#]년에 제품을 구입하신 이유/계기(상황)는 무엇입니까? 가장 주요한 이유/계기를 한 가지만 선택해주세요", + "KQB4_NET": "Q. 최종적으로 제품을 구매하신 곳은 어디십니까? 한 가지만 선택해주세요", + "KQB4": "Q. 최종적으로 제품을 구매하신 곳은 어디십니까? 한 가지만 선택해주세요", + "KQX3_2_1": "Q. 귀하께서는 제품을 어떤 방식으로 구입하셨습니까? 한가지만 선택해주세요", + "KQA3_3": "Q. 보유하고 계신 제품의 브랜드는 어떻게 되십니까?", + "KQA3_4": "Q. 보유하고 계신 제품의 타입은 어떻게 되십니까?", + "KQA3_5": "Q. 보유하고 계신 제품의 깊이 타입은 어떻게 되십니까?", + "KQA3_6": "Q. 보유하고 계신 제품의 용량은 어떻게 되십니까?", + "KQA3_7": "Q. 보유하고 계신 제품의 설치 형태는 어떻게 되십니까?", + "KQA3_8": "Q. 보유하고 계신 제품은 메인 가구와 어떻게 배치되어 있습니까?", + "KQA3_9": "Q. 보유하고 계신 제품에 포함되어 있는 기능이 있으십니까? 모두 선택해 주세요.", + "KQA3_10": "Q. 보유하고 계신 제품의 스크린 사이즈는 어떻게 되십니까?", + "KQA3_11": "Q. 보유하고 계신 제품의 가장 주된 용도는 무엇입니까?", + "KQA3_12": "Q. 보유하고 계신 제품은 스마트 모니터(자체적으로 OS를 가지고 있어, 기타 기기 연결 없이 작동이 가능한 모니터) 입니까?", + "KQA3_13": "Q. 보유하고 계신 제품의 구동 방식은 어떻게 되십니까?", + "KQA3_1": "Q. 보유하고 계신 제품을 구매 또는 보유하게 된 경로가 어떻게 되십니까? ", + "KQA3_2_1": "Q. 귀하께서는 제품을 어떤 방식으로 구입하셨습니까? ", + "KQC2": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 브랜드로 고려하고 계신 것은 무엇입니까? 모두 선택해주세요", + "KQC3_1": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 타입으로 고려하고 계신 것은 무엇입니까? 모두 선택해주세요", + "KQC3_2": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 깊이 타입으로 고려하고 계신 것은 무엇입니까? 모두 선택해주세요", + "KQC3_3": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 설치 형태로 고려하고 계신 것은 무엇입니까? 모두 선택해주세요", + "KQC3_4": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 설치 방식을 실제 공간에 구현하기 위해서 다음 중 어떤 방식의 시공이 필요하다고 생각하십니까?", + "KQC3_5": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 <냉장고와 김치냉장고>를 어떤 형태로 설치하실 계획이십니까?", + "KQC3_6": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품은 어디에 설치하실 계획이십니까?", + "KQC3_7": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품은 어떤 환경에 설치하실 계획이십니까?", + "KQC3_8": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 특징으로 고려하고 계신 것은 무엇입니까? 모두 선택해주세요", + "KQC5": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품을 신규로 구입하실 건가요? 교체/추가 구입하실 건가요? 한 가지만 선택해주세요", + "KQC6_NET": "Q. [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품을 구매하고 싶으신 곳은 어디십니까? 한 가지만 선택해주세요", + "KQC6": "Q. [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품을 구매하고 싶으신 곳은 어디십니까? 한 가지만 선택해주세요", + "KQC7": "Q. 그렇다면, [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품을 어떤 방식으로 구입하길 원하십니까? 한가지만 선택해주세요", +} diff --git a/src/const/lgConst.ts b/src/const/lgConst.ts deleted file mode 100644 index 184c6cd..0000000 --- a/src/const/lgConst.ts +++ /dev/null @@ -1,579 +0,0 @@ -import {BannerKey, CategoryFieldSpec, LifeStageRow} from "@/types/lg"; -import {GaugeColumn} from "@/components/lge-dashboard"; -import {CategoryTargetData, CategoryTargetType} from "@/config/filter.types"; - -export const USE_CACHE = true; -export const API_DECIMAL_POINT = 0; -export const VIEW_DECIMAL_POINT = 0; - -export const SITE_TITLE = 'LGE CX Dashboard'; - -export const YEARS = ["2023", "2024", "2025"]; -export const LAST_YEAR = YEARS.at(-1)!; - -export const GAP_WORDING = "전년 대비 GAP(%p)"; -export const UNIT_TEXT = "(단위 %)" -export const SAMPLE_SIZE_NOTICE = "* 30표본 미만 해석에 주의"; - -export const BRAND_LIST = ['Cbrand', '삼성', 'LG']; - -export const PRODUCT_KEY_MAP = { - "KPRODUCT#1": "냉장고", - "KPRODUCT#2": "김치 냉장고", - "KPRODUCT#3": "정수기", - "KPRODUCT#4": "전기 레인지", - "KPRODUCT#5": "식기 세척기", - "KPRODUCT#6": "음식물처리기", - - "KPRODUCT#7": "세탁기", - "KPRODUCT#8": "청소기", - "KPRODUCT#9": "건조기", - "KPRODUCT#10": "로봇 청소기", - "KPRODUCT#11": "의류 관리기", - - "KPRODUCT#12": "에어컨", - "KPRODUCT#13": "공기 청정기", - - "KPRODUCT#14": "TV", - "KPRODUCT#15": "노트북", - "KPRODUCT#16": "모니터", -} as const; - -export const BANNER_KEY_MAP = { - // 라이프 스테이지 - "KLIFEstAGE#1": "미혼", - "KLIFEstAGE#2": "무자녀", - "KLIFEstAGE#3": "미취학", - "KLIFEstAGE#4": "취학자녀", - "KLIFEstAGE#5": "성인자녀", - "KLIFEstAGE#6": "독립시니어", - "KLIFEstAGE#7": "비혼중년", - "KLIFEstAGE#8": "기타", - - // 가구원수 - "KSQ8_R_DB#1": "1인 가구", - "KSQ8_R_DB#2": "2인 가구", - "KSQ8_R_DB#3": "3인 가구", - "KSQ8_R_DB#4": "4인 이상 가구", - - // 연령 - "KSQ2_R_R#1": "20대", - "KSQ2_R_R#2": "30대", - "KSQ2_R_R#3": "40대", - "KSQ2_R_R#4": "50대", - "KSQ2_R_R#5": "60대", - - // 점유형태 - "KDQ6#1": "자가", - "KDQ6#2": "전세", - "KDQ6#3": "전+월세 (보증금有)", - "KDQ6#4": "월세 (보증금無)", - "KDQ6#5": "기타", - - // 주거형태 - "KDQ4#1": "아파트", - "KDQ4#2": "주택", - "KDQ4#3": "오피스텔", - "KDQ4#4": "(연립)빌라", - "KDQ4#5": "원룸", - "KDQ4#6": "기타", - - // 평형 - "KDQ5#1": "19평 이하", - "KDQ5#2": "20평형 대", - "KDQ5#3": "30평형 대", - "KDQ5#4": "40평형 대", - "KDQ5#5": "50평형 대 이상", - - // 권역 - "KSQ4_R_R#1": "서울, 인천, 경기도", - "KSQ4_R_R#2": "경남, 부산, 울산", - "KSQ4_R_R#3": "경북, 대구", - "KSQ4_R_R#4": "전라도, 광주", - "KSQ4_R_R#5": "충청, 대전, 세종", - "KSQ4_R_R#6": "강원, 제주", - - // 소득 - "KDQ3_DB#1": "299만원 이하", - "KDQ3_DB#2": "300~599만원 이하", - "KDQ3_DB#3": "600~899만원 이하", - "KDQ3_DB#4": "900만원 이상", -} as const; - -export const LIFE_STAGE_COLUMNS: GaugeColumn[] = [ - { key: "item", header: "", headRowSpan:2, rowHead: true, render: (r) => r.item }, - - { key: "total", header: "전체", headRowSpan:2, max: 100, align: "left", cellType:"number"}, - { key: "KLIFEstAGE#1", header: "미혼" , headRowSpan:2, max: 100 , align: "left"}, - - { key: "KLIFEstAGE#2", header: "무자녀", group: "기혼", max: 100 , align: "left"}, - { key: "KLIFEstAGE#3", header: "미취학", group: "기혼", max: 100 , align: "left"}, - { key: "KLIFEstAGE#4", header: "취학자녀", group: "기혼", max: 100 , align: "left"}, - { key: "KLIFEstAGE#5", header: "성인자녀", group: "기혼", max: 100 , align: "left"}, - - { key: "KLIFEstAGE#6", header: "독립\n시니어", headRowSpan:2, max: 100 , align: "left"}, - { key: "KLIFEstAGE#7", header: "비혼중년", headRowSpan:2, max: 100 , align: "left"}, - { key: "KLIFEstAGE#8", header: "기타", headRowSpan:2, max: 100 , align: "left"}, -]; - -export const LIFE_STAGE_GROUPS = [ - { title: "대형가전 군", items: ["KPRODUCT#1", "KPRODUCT#7", "KPRODUCT#8", "KPRODUCT#12", "KPRODUCT#14", "KPRODUCT#2", "KPRODUCT#3", "KPRODUCT#11"] }, - { title: "소형가전 군", items: ["KPRODUCT#9", "KPRODUCT#13", "KPRODUCT#4"] }, - { title: "신가전 군", items: ["KPRODUCT#10", "KPRODUCT#6"] }, -] as const; - -export const PRODUCT_KEYS = Object.keys(PRODUCT_KEY_MAP) as Array; -export const PRODUCTS = Object.values(PRODUCT_KEY_MAP) as Array; - -export const PRODUCTS_FILTER_ITEM = [ - { - path: "kitchen", - items: [ - "KPRODUCT#1", // 냉장고 - "KPRODUCT#2", // 김치 냉장고 - "KPRODUCT#3", // 정수기 - "KPRODUCT#4", // 전기 레인지 - "KPRODUCT#5", // 식기 세척기 - "KPRODUCT#6", // 음식물처리기 - ], - }, - { - path: "living", - items: [ - "KPRODUCT#7", // 세탁기 - "KPRODUCT#9", // 건조기 - "KPRODUCT#8", // 청소기 - "KPRODUCT#10", // 로봇 청소기 - "KPRODUCT#11", // 의류 관리기 - ], - }, - { - path: "es", - items: [ - "KPRODUCT#12", // 에어컨 - "KPRODUCT#13", // 공기 청정기 - ], - }, - { - path: "ms", - items: [ - "KPRODUCT#14", // TV - "KPRODUCT#15", // 노트북 - "KPRODUCT#16", // 모니터 - ], - }, -] as const; - -export const BANNER_KEYS = Object.keys(BANNER_KEY_MAP) as Array; -export const BANNER_KEY = Object.keys(BANNER_KEY_MAP).reduce((acc, k) => { - (acc as any)[k] = k; - return acc; -}, {} as { [K in BannerKey]: K }); - -export const BANNER_GROUP = { - lifeStage: { - label: "라이프스테이지 별", - keys: [ - BANNER_KEY["KLIFEstAGE#1"], - BANNER_KEY["KLIFEstAGE#2"], - BANNER_KEY["KLIFEstAGE#3"], - BANNER_KEY["KLIFEstAGE#4"], - BANNER_KEY["KLIFEstAGE#5"], - BANNER_KEY["KLIFEstAGE#6"], - BANNER_KEY["KLIFEstAGE#7"], - BANNER_KEY["KLIFEstAGE#8"], - ], - }, - household: { - label: "가구원수 별", - keys: [ - BANNER_KEY["KSQ8_R_DB#1"], - BANNER_KEY["KSQ8_R_DB#2"], - BANNER_KEY["KSQ8_R_DB#3"], - BANNER_KEY["KSQ8_R_DB#4"], - ], - }, - age: { - label: "연령", - keys: [ - BANNER_KEY["KSQ2_R_R#1"], - BANNER_KEY["KSQ2_R_R#2"], - BANNER_KEY["KSQ2_R_R#3"], - BANNER_KEY["KSQ2_R_R#4"], - BANNER_KEY["KSQ2_R_R#5"], - ], - }, - occupancy: { - label: "입주 형태", - keys: [ - BANNER_KEY["KDQ6#1"], - BANNER_KEY["KDQ6#2"], - BANNER_KEY["KDQ6#3"], - BANNER_KEY["KDQ6#4"], - BANNER_KEY["KDQ6#5"], - ], - }, - housing: { - label: "주거 형태", - keys: [ - BANNER_KEY["KDQ4#1"], - BANNER_KEY["KDQ4#2"], - BANNER_KEY["KDQ4#3"], - BANNER_KEY["KDQ4#4"], - BANNER_KEY["KDQ4#5"], - BANNER_KEY["KDQ4#6"], - ], - }, - houseSize: { - label: "거주 평형", - keys: [ - BANNER_KEY["KDQ5#1"], - BANNER_KEY["KDQ5#2"], - BANNER_KEY["KDQ5#3"], - BANNER_KEY["KDQ5#4"], - BANNER_KEY["KDQ5#5"], - ], - }, - region: { - label: "거주 지역", - keys: [ - BANNER_KEY["KSQ4_R_R#1"], - BANNER_KEY["KSQ4_R_R#2"], - BANNER_KEY["KSQ4_R_R#3"], - BANNER_KEY["KSQ4_R_R#4"], - BANNER_KEY["KSQ4_R_R#5"], - BANNER_KEY["KSQ4_R_R#6"], - ], - }, - income: { - label: "소득수준", - keys: [ - BANNER_KEY["KDQ3_DB#1"], - BANNER_KEY["KDQ3_DB#2"], - BANNER_KEY["KDQ3_DB#3"], - BANNER_KEY["KDQ3_DB#4"], - ], - }, -} as const; - -export const BANNER_GROUP_KEY = Object.keys(BANNER_GROUP) as string[]; - -export const QID_SURVEY_TITLE: Record = { - "KQX3_3": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 브랜드는 어떻게 되십니까?", - "KQB1": "Q. 귀하께서 [#YEAR#]년에 제품을 구매하실 때 구매를 고려하셨던 브랜드는 무엇입니까? 모두 선택하여 주시기 바랍니다", - "KQX3_4": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 타입은 어떻게 되십니까?", - "KQX3_5": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 깊이 타입은 어떻게 되십니까?", - "KQX3_6": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 용량은 어떻게 되십니까?", - "KQX3_7": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 설치 형태는 어떻게 되십니까?", - "KQX3_8": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품은 메인 가구와 어떻게 배치되어 있습니까?", - "KQX3_9": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품에 포함되어 있는 기능이 있으십니까? 모두 선택해 주세요.", - "KQX3_10": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 스크린 사이즈는 어떻게 되십니까?", - "KQX3_11": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품의 가장 주된 용도는 무엇입니까?", - "KQX3_12": "Q. 귀하께서 [#YEAR#]년에 구매하신 제품은 스마트 모니터(자체적으로 OS를 가지고 있어, 기타 기기 연결 없이 작동이 가능한 모니터) 입니까?", - "KQX3_13": "Q. 보유하고 계신 제품의 구동 방식은 어떻게 되십니까?", - "KQB2": "Q. 귀하께서는 [#YEAR#]년에 제품을 신규로 구입하신 건가요? 교체/추가 구입하신 건가요? 한 가지만 선택해주세요", - "KQB3": "Q. 귀하께서 [#YEAR#]년에 제품을 구입하신 이유/계기(상황)는 무엇입니까? 가장 주요한 이유/계기를 한 가지만 선택해주세요", - "KQB4_NET": "Q. 최종적으로 제품을 구매하신 곳은 어디십니까? 한 가지만 선택해주세요", - "KQB4": "Q. 최종적으로 제품을 구매하신 곳은 어디십니까? 한 가지만 선택해주세요", - "KQX3_2_1": "Q. 귀하께서는 제품을 어떤 방식으로 구입하셨습니까? 한가지만 선택해주세요", - "KQA3_3": "Q. 보유하고 계신 제품의 브랜드는 어떻게 되십니까?", - "KQA3_4": "Q. 보유하고 계신 제품의 타입은 어떻게 되십니까?", - "KQA3_5": "Q. 보유하고 계신 제품의 깊이 타입은 어떻게 되십니까?", - "KQA3_6": "Q. 보유하고 계신 제품의 용량은 어떻게 되십니까?", - "KQA3_7": "Q. 보유하고 계신 제품의 설치 형태는 어떻게 되십니까?", - "KQA3_8": "Q. 보유하고 계신 제품은 메인 가구와 어떻게 배치되어 있습니까?", - "KQA3_9": "Q. 보유하고 계신 제품에 포함되어 있는 기능이 있으십니까? 모두 선택해 주세요.", - "KQA3_10": "Q. 보유하고 계신 제품의 스크린 사이즈는 어떻게 되십니까?", - "KQA3_11": "Q. 보유하고 계신 제품의 가장 주된 용도는 무엇입니까?", - "KQA3_12": "Q. 보유하고 계신 제품은 스마트 모니터(자체적으로 OS를 가지고 있어, 기타 기기 연결 없이 작동이 가능한 모니터) 입니까?", - "KQA3_13": "Q. 보유하고 계신 제품의 구동 방식은 어떻게 되십니까?", - "KQA3_1": "Q. 보유하고 계신 제품을 구매 또는 보유하게 된 경로가 어떻게 되십니까? ", - "KQA3_2_1": "Q. 귀하께서는 제품을 어떤 방식으로 구입하셨습니까? ", - "KQC2": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 브랜드로 고려하고 계신 것은 무엇입니까? 모두 선택해주세요", - "KQC3_1": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 타입으로 고려하고 계신 것은 무엇입니까? 모두 선택해주세요", - "KQC3_2": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 깊이 타입으로 고려하고 계신 것은 무엇입니까? 모두 선택해주세요", - "KQC3_3": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 설치 형태로 고려하고 계신 것은 무엇입니까? 모두 선택해주세요", - "KQC3_4": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 설치 방식을 실제 공간에 구현하기 위해서 다음 중 어떤 방식의 시공이 필요하다고 생각하십니까?", - "KQC3_5": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 <냉장고와 김치냉장고>를 어떤 형태로 설치하실 계획이십니까?", - "KQC3_6": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품은 어디에 설치하실 계획이십니까?", - "KQC3_7": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품은 어떤 환경에 설치하실 계획이십니까?", - "KQC3_8": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품의 특징으로 고려하고 계신 것은 무엇입니까? 모두 선택해주세요", - "KQC5": "Q. 귀하께서 [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품을 신규로 구입하실 건가요? 교체/추가 구입하실 건가요? 한 가지만 선택해주세요", - "KQC6_NET": "Q. [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품을 구매하고 싶으신 곳은 어디십니까? 한 가지만 선택해주세요", - "KQC6": "Q. [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품을 구매하고 싶으신 곳은 어디십니까? 한 가지만 선택해주세요", - "KQC7": "Q. 그렇다면, [#NEXT_YEAR#]년 이내 구입을 고려하시는 제품을 어떤 방식으로 구입하길 원하십니까? 한가지만 선택해주세요", -} - -export const CATEGORY_PAGE_FIELDS: Record = { - [CategoryTargetData.PROFILE]: [ - { - title: { - [CategoryTargetType.PENETRATION]: "보유율" - , [CategoryTargetType.PURCHASE]: "구매율" - , [CategoryTargetType.INTENDED]: "향후 구매율" - }, - requestKey: "category_${keyBase}", - chartMode:"none", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA1" - , [CategoryTargetType.PURCHASE]: "KQB0" - , [CategoryTargetType.INTENDED]: "KQC1" - }, - }, - { - title: "보유대수", - requestKey: "category_penetration_count", - chartMode:"none", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA2" - }, - }, - ], - - [CategoryTargetData.PENETRATION_CHANGE]: [ - { - title: "보급률 변화", - requestKey: "category_${keyBase}", - chartMode:"none", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA1" - }, - }, - ], - - [CategoryTargetData.BRAND]: [ - { - title: "브랜드", - requestKey: "category_${keyBase}_brand", - chartMode:"reverseStack", - chartTopMargin: 80, - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_3", - [CategoryTargetType.PURCHASE]: "KQX3_3", - }, - }, - { - title: { - [CategoryTargetType.PENETRATION]: "", - [CategoryTargetType.PURCHASE]: "구매 고려 브랜드", - [CategoryTargetType.INTENDED]: "브랜드", - }, - requestKey: "category_${keyBase}_consider_brand", - chartMode:"horizontal", - qidByMode: { - [CategoryTargetType.PURCHASE]: "KQB1", - [CategoryTargetType.INTENDED]: "KQC2", - }, - }, - ], - - [CategoryTargetData.TYPE_SPEC]: [ - { - title: "타입", - requestKey: "category_${keyBase}_type", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_4", - [CategoryTargetType.PURCHASE]: "KQX3_4", - [CategoryTargetType.INTENDED]: "KQC3_1" - } - }, - { - title: "깊이 타입", - requestKey: "category_${keyBase}_depthType", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_5", - [CategoryTargetType.PURCHASE]: "KQX3_5", - [CategoryTargetType.INTENDED]: "KQC3_2" - } - }, - { - title: "용량", - requestKey: "category_${keyBase}_capacity", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_6", - [CategoryTargetType.PURCHASE]: "KQX3_6" - } - }, - { - title: "설치 형태", - requestKey: "category_${keyBase}_installType", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_7", - [CategoryTargetType.PURCHASE]: "KQX3_7", - [CategoryTargetType.INTENDED]: "KQC3_3" - } - }, - { - title: "시공 방식", - requestKey: "category_${keyBase}_installMethod", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.INTENDED]: "KQC3_4" - } - }, - { - title: "냉장고 & 김치냉장고 설치 형태", - requestKey: "category_${keyBase}_fridgeInstallType", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.INTENDED]: "KQC3_5" - } - }, - { - title: "설치 위치", - requestKey: "category_${keyBase}_installLocation", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.INTENDED]: "KQC3_6" - } - }, - { - title: "배치/설치환경", - requestKey: "category_${keyBase}_installEnv", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_8", - [CategoryTargetType.PURCHASE]: "KQX3_8", - [CategoryTargetType.INTENDED]: "KQC3_7" - } - }, - { - title: "구입 고려 특징", - requestKey: "category_${keyBase}_buyConsiderations", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.INTENDED]: "KQC3_8" - } - }, - { - title: "기능", - requestKey: "category_${keyBase}_features", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_9", - [CategoryTargetType.PURCHASE]: "KQX3_9" - } - }, - { - title: "스크린 사이즈", - requestKey: "category_${keyBase}_screenSize", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_10", - [CategoryTargetType.PURCHASE]: "KQX3_10" - } - }, - { - title: "용도", - requestKey: "category_${keyBase}_usage", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_11", - [CategoryTargetType.PURCHASE]: "KQX3_11" - } - }, - { - title: "스마트 모니터 여부", - requestKey: "category_${keyBase}_isSmartMonitor", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_12", - [CategoryTargetType.PURCHASE]: "KQX3_12" - } - }, - { - title: "음식물처리기 구동 방식", - requestKey: "category_${keyBase}_driveMethod", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_13", - [CategoryTargetType.PURCHASE]: "KQX3_13" - } - }, - ], - - [CategoryTargetData.BEHAVIOR]: [ - { - title: { - [CategoryTargetType.PENETRATION]: "보유 경로" - , [CategoryTargetType.PURCHASE]: "구입 행태" - , [CategoryTargetType.INTENDED]: "구입 행태" - }, - requestKey: "category_${keyBase}_behavior", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_1", - [CategoryTargetType.PURCHASE]: "KQB2", - [CategoryTargetType.INTENDED]: "KQC5" - }, - }, - { - title: "구입 계기", - requestKey: "category_${keyBase}_chance", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PURCHASE]: "KQB3" - }, - }, - ], - - [CategoryTargetData.PURCHASE_CHANNEL]: [ - { - title: "구매 채널(온/오프라인)", - requestKey: "category_${keyBase}_channel", - chartMode: "reverseStack", - qidByMode: { - [CategoryTargetType.PURCHASE]: "KQB4_NET", - [CategoryTargetType.INTENDED]: "KQC6_NET" - }, - }, - { - title: "구매 채널(상세)", - requestKey: "category_${keyBase}_channel_detail", - chartMode: "horizontal", - qidByMode: { - [CategoryTargetType.PURCHASE]: "KQB4", - [CategoryTargetType.INTENDED]: "KQC6" - }, - }, - ], - - [CategoryTargetData.PAYMENT_METHOD]: [ - { - title: "구매형식", - requestKey: "category_${keyBase}_method", - chartMode:"reverseStack", - qidByMode: { - [CategoryTargetType.PENETRATION]: "KQA3_2_1", - [CategoryTargetType.PURCHASE]: "KQX3_2_1", - [CategoryTargetType.INTENDED]: "KQC7" - }, - }, - ], -}; - -/** X 축 패딩 없앤 GridOption*/ -export const GRID_X_NOT_PADDING = { left: 0, right: 0, top: 50, bottom: 10, containLabel: false } as const; -/** T 축 패딩 없앤 GridOption*/ -export const GRID_Y_NOT_PADDING = { left: 10, right: 10, top: 0, bottom: 0, containLabel: false } as const; -/** 축 스타일 감춤 */ -export const AXIS_HIDE_STYLE = { axisLabel: { show: false }, axisTick: { show: false }, axisLine: { show: false }} as const; -export const AXIS_HIDE_Y_STYLE = { min:0, max:100, axisLabel: { show: false }, axisTick: { show: false }, axisLine: { show: false }} as const; - -export const CHART_COLOR_BY_YEAR = Object.fromEntries( - YEARS.map((year, i) => [ - year, - `--chart-${YEARS.length-i}-t`, - ]) -) as Record<(typeof YEARS)[number], string>; - -export const CHART_FOCUS_COLOR_BY_YEAR = Object.fromEntries( - YEARS.map((year, i) => [ - year, - `--chart-${YEARS.length-i}`, - ]) -) as Record<(typeof YEARS)[number], string>; \ No newline at end of file diff --git a/src/config/menu.data.ts b/src/const/menu.const.ts similarity index 94% rename from src/config/menu.data.ts rename to src/const/menu.const.ts index 3402530..36b5c22 100644 --- a/src/config/menu.data.ts +++ b/src/const/menu.const.ts @@ -1,4 +1,4 @@ -import {SubMenuItem, TopMenuItem} from "@/config/menu.types"; +import {SubMenuItem, TopMenuItem} from "@/types/menu.types"; export const topMenus: TopMenuItem[] = [ { @@ -59,4 +59,4 @@ export const categorySubMenus: SubMenuItem[] = [ label: "MS", path: "/category/ms", }, -] \ No newline at end of file +] diff --git a/src/lib/chart-options.ts b/src/lib/chart-options.ts index 601ad18..00b1b2a 100644 --- a/src/lib/chart-options.ts +++ b/src/lib/chart-options.ts @@ -1,6 +1,5 @@ -import { CHART_GRID_DEFAULTS, BAR_WIDTHS } from "@/const/chartConst"; +import { AXIS_HIDE_Y_STYLE, BAR_WIDTHS, CHART_GRID_DEFAULTS } from "@/components/lge-dashboard/chart/chart.config"; import {ChartData, NewNumber} from "@/components/lge-dashboard"; -import {AXIS_HIDE_Y_STYLE} from "@/const/lgConst"; export function reverseCategories(data: T): T { const categories = [...data.categories].reverse(); diff --git a/src/lib/lg-dashboard.ts b/src/lib/lg-dashboard.ts index 006ebe1..6d9fec1 100644 --- a/src/lib/lg-dashboard.ts +++ b/src/lib/lg-dashboard.ts @@ -4,16 +4,12 @@ import { BannerRow, BuildPageModeConfigResult, ProductResponse, ProductRow, StatisticsRequest -} from "@/types/lg"; +} from "@/types/lg.types"; import {ChartData} from "@/components/lge-dashboard"; -import { - API_DECIMAL_POINT, - BANNER_GROUP, - BANNER_KEYS, - CATEGORY_PAGE_FIELDS, - GAP_WORDING, - PRODUCT_KEYS, VIEW_DECIMAL_POINT -} from "@/const/lgConst"; +import {API_DECIMAL_POINT, GAP_WORDING, VIEW_DECIMAL_POINT} from "@/const/lg-common.const"; +import {BANNER_GROUP, BANNER_KEYS} from "@/const/lg-banner.const"; +import {PRODUCT_KEYS} from "@/const/lg-product.const"; +import {CATEGORY_PAGE_FIELDS} from "@/config/lg-page.config"; import {formatNumber} from "@/lib/utils"; import {nextApi} from "@/lib/http-client"; import {CategoryFilterValue} from "@/components/layout/CategoryFilter"; @@ -533,4 +529,4 @@ export const buildPageModeConfig = ( const variableIdMap = Object.fromEntries(fields.map((f) => [f.requestKeyResolved, f.qid])) as Record; return { fields, variableIdMap }; -}; \ No newline at end of file +}; diff --git a/src/query/keys.ts b/src/query/keys.ts index a3df70f..4c2e2d5 100644 --- a/src/query/keys.ts +++ b/src/query/keys.ts @@ -1,4 +1,4 @@ -import type {StatisticsRequest} from "@/types/lg"; +import type {StatisticsRequest} from "@/types/lg.types"; const sortRecord = (obj?: Record | null): Record => { if (!obj) return {}; @@ -29,4 +29,4 @@ export const productStatisticsKey = (req: StatisticsRequest) => ["statistics", "product", normalizeReqForKey(req)] as const; export const bannerStatisticsKey = (req: StatisticsRequest) => - ["statistics", "banner", normalizeReqForKey(req)] as const; \ No newline at end of file + ["statistics", "banner", normalizeReqForKey(req)] as const; diff --git a/src/query/statistics.ts b/src/query/statistics.ts index 28ff5a1..666455e 100644 --- a/src/query/statistics.ts +++ b/src/query/statistics.ts @@ -1,4 +1,4 @@ -import {BannerResponse, ProductResponse, StatisticsRequest} from "@/types/lg"; +import {BannerResponse, ProductResponse, StatisticsRequest} from "@/types/lg.types"; import {useQuery} from "@tanstack/react-query"; import {bannerStatisticsKey, productStatisticsKey} from "@/query/keys"; import {fetchBannerStatistics, fetchProductStatistics} from "@/lib/lg-dashboard"; @@ -25,4 +25,4 @@ export function useBannerStatisticsQuery(req: StatisticsRequest, enabled = true) staleTime: 60_000, gcTime: 10 * 60_000, }); -} \ No newline at end of file +} diff --git a/src/config/filter.types.ts b/src/types/filter.types.ts similarity index 99% rename from src/config/filter.types.ts rename to src/types/filter.types.ts index d8203bc..b048e6c 100644 --- a/src/config/filter.types.ts +++ b/src/types/filter.types.ts @@ -41,4 +41,4 @@ export type TargetChild = { export type CategoryTargetItem = { type: CategoryTargetType[]; children: TargetChild[]; -} \ No newline at end of file +} diff --git a/src/types/lg.ts b/src/types/lg.types.ts similarity index 92% rename from src/types/lg.ts rename to src/types/lg.types.ts index d2080ae..6fff342 100644 --- a/src/types/lg.ts +++ b/src/types/lg.types.ts @@ -1,5 +1,7 @@ -import {BANNER_GROUP, BANNER_KEY_MAP, PRODUCT_KEY_MAP, PRODUCTS_FILTER_ITEM} from "@/const/lgConst"; -import {CategoryTargetType} from "@/config/filter.types"; +import {BANNER_GROUP} from "@/const/lg-banner.const"; +import {BANNER_KEY_MAP, PRODUCT_KEY_MAP} from "@/const/lg-schema.const"; +import {PRODUCTS_FILTER_ITEM} from "@/const/lg-product.const"; +import {CategoryTargetType} from "@/types/filter.types"; import {EChartsOption} from "echarts"; export type ProductKey = keyof typeof PRODUCT_KEY_MAP; @@ -107,4 +109,4 @@ export type CategoryResolvedField = CategoryFieldSpec & { export type BuildPageModeConfigResult = { fields: CategoryResolvedField[]; variableIdMap: Record; -}; \ No newline at end of file +}; diff --git a/src/config/menu.types.ts b/src/types/menu.types.ts similarity index 98% rename from src/config/menu.types.ts rename to src/types/menu.types.ts index 9c6d188..d881ac1 100644 --- a/src/config/menu.types.ts +++ b/src/types/menu.types.ts @@ -10,4 +10,4 @@ export type SubMenuItem = { id: string; label: string; path: string; -}; \ No newline at end of file +};