260326_01_ENH: 일부 설정 파일들 리펙토링
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
export default Header;
|
||||
|
||||
@@ -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;
|
||||
export default MainLayout;
|
||||
|
||||
@@ -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;
|
||||
export default SubMenu;
|
||||
|
||||
@@ -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;
|
||||
export default TotalFilter;
|
||||
|
||||
@@ -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;
|
||||
export default BaseEChart;
|
||||
|
||||
@@ -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 <BaseEChart option={option} height={height} onEvents={onEvents} />;
|
||||
}
|
||||
|
||||
export default GroupedOverlayBar;
|
||||
export default GroupedOverlayBar;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 <BaseEChart option={option} height={height} className={className} />;
|
||||
}
|
||||
|
||||
export default HorizontalBar;
|
||||
export default HorizontalBar;
|
||||
|
||||
@@ -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 <BaseEChart option={option} height={height} className={className} />;
|
||||
}
|
||||
|
||||
export default VerticalBar;
|
||||
export default VerticalBar;
|
||||
|
||||
86
src/components/lge-dashboard/chart/chart.config.ts
Normal file
86
src/components/lge-dashboard/chart/chart.config.ts
Normal file
@@ -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>;
|
||||
@@ -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;
|
||||
export default BannerSummary;
|
||||
|
||||
@@ -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;
|
||||
export default CategoryByData;
|
||||
|
||||
@@ -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<T> = {
|
||||
/** 차트를 삽입할 컬럼 key(해당 컬럼 td는 startRow에서만 렌더되고 rowSpan 적용) */
|
||||
|
||||
@@ -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;
|
||||
export default LifeStageDiv;
|
||||
|
||||
@@ -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) {
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<T extends Record<string, unknown>> = {
|
||||
columns: DataColumn<T>[];
|
||||
@@ -269,4 +269,4 @@ const DataTable = <T extends Record<string, unknown>>({
|
||||
);
|
||||
}
|
||||
|
||||
export default DataTable;
|
||||
export default DataTable;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user