Merge branch 'iipbs/sn/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/sn/dev

This commit is contained in:
2026-09-23 13:50:59 +09:00
750 changed files with 39836 additions and 9013 deletions
+7 -1
View File
@@ -1,6 +1,12 @@
{
"include": ["."],
"exclude": ["dist", "build", "node_modules"],
"exclude": [
"dist",
"build",
"node_modules",
"coverage",
"storybook-static"
],
"compilerOptions": {
"moduleResolution": "node",
"baseUrl": "."
+1
View File
@@ -19,6 +19,7 @@ packages/common/auth/
├── types.ts # 타입 정의
├── token-manager.ts # 토큰 관리 로직
├── cookie.ts # 쿠키 유틸리티
├── device-id.ts # 기기 ID (쿠키)
├── jwt-utils.ts # JWT 유틸리티
└── README.md # 문서
```
+27
View File
@@ -0,0 +1,27 @@
import { v4 as uuidv4 } from "uuid";
import { getCookie, removeCookie, setCookie } from "./cookie";
const DEVICE_ID_KEY = "x-device-id";
const COOKIE_DOMAIN = process.env.NEXT_PUBLIC_COOKIE_DOMAIN;
export function getOrCreateDeviceId(): string {
const existing = getCookie(DEVICE_ID_KEY);
if (existing) return existing;
const id = uuidv4();
const isHttps =
typeof window !== "undefined" && window.location.protocol === "https:";
setCookie(DEVICE_ID_KEY, id, {
secure: isHttps,
sameSite: "lax",
domain: COOKIE_DOMAIN,
path: "/",
expires: 365,
});
return id;
}
export function clearDeviceId(): void {
removeCookie(DEVICE_ID_KEY, { domain: COOKIE_DOMAIN, path: "/" });
}
+1
View File
@@ -2,6 +2,7 @@ export { createTokenManager } from "./token-manager";
export type { TokenManager } from "./token-manager";
export { getCookie, setCookie, removeCookie } from "./cookie";
export { clearDeviceId, getOrCreateDeviceId } from "./device-id";
export {
getJwtExpiry,
getRemainingMs,
+2 -1
View File
@@ -8,7 +8,8 @@
".": "./index.ts"
},
"dependencies": {
"js-cookie": "^3.0.5"
"js-cookie": "^3.0.5",
"uuid": "^14.0.1"
},
"devDependencies": {
"@types/js-cookie": "^3.0.6",
+7 -1
View File
@@ -3,6 +3,7 @@
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"target": "ES2017",
"types": ["node"],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
@@ -19,5 +20,10 @@
"incremental": true
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
"exclude": [
"node_modules",
"dist",
"coverage",
"storybook-static"
]
}
@@ -188,8 +188,9 @@ export const sigunguCenter: Record<string, [number, number]> = {
"11530": [943255.85156361, 1944224.7496726601], // 구로구
"41310": [967836.346287095, 1955821.725581055], // 구리시
"47190": [1076297.5737083051, 1801900.2253747801], // 구미시
"45130": [904674.42544751, 1767715.183037305], // 군산시
"27720": [1103849.611897755, 1797204.1944948], // 군위군
"45130": [931167.80, 1774809.14], // 군산시 (육지(시청·군청) 기준, 도서지역 제외)
"27720": [1096402.36, 1805597.71], // 군위군 (군청 기준)
"47720": [1096402.36, 1805597.71], // 군위군 경북 구코드 (군청 기준)
"41410": [948411.5776788951, 1927135.757437655], // 군포시
"44710": [998110.87580872, 1792026.97835628], // 금산군
"26410": [1144696.85330015, 1697028.92074261], // 금정구
@@ -214,7 +215,8 @@ export const sigunguCenter: Record<string, [number, number]> = {
"27290": [1092874.923985485, 1758802.075636735], // 달서구
"27710": [1092556.27778919, 1753550.63671916], // 달성군
"46710": [953252.8048743049, 1699620.87304459], // 담양군
"44270": [922626.193186825, 1879100.4990195702], // 당진시
"44270": [923895.22, 1877173.14], // 당진시 (육지(시청·군청) 기준, 도서지역 제외)
"44830": [923895.22, 1877173.14], // 당진시 신코드 (육지(시청·군청) 기준, 도서지역 제외)
"30230": [995239.980794815, 1823508.474804295], // 대덕구
"11320": [958705.07469343, 1963040.273132075], // 도봉구
"26170": [1140792.941703185, 1682445.908553165], // 동구
@@ -235,7 +237,7 @@ export const sigunguCenter: Record<string, [number, number]> = {
"47280": [1055620.11152262, 1855147.380883595], // 문경시
"28170": [926226.3594373399, 1940093.5607894901], // 미추홀구
"48270": [1117632.749546145, 1722736.830743895], // 밀양시
"44180": [896412.984839845, 1817364.412693855], // 보령시
"44180": [920366.76, 1815478.75], // 보령시 (육지(시청·군청) 기준, 도서지역 제외)
"46780": [974939.082074685, 1646364.3864357], // 보성군
"43720": [1018843.696119875, 1832681.50774474], // 보은군
"47920": [1125627.975921425, 1881676.019098885], // 봉화군
@@ -284,7 +286,8 @@ export const sigunguCenter: Record<string, [number, number]> = {
"45770": [962532.77503817, 1714757.02288094], // 순창군
"46150": [989441.17839757, 1668074.09581569], // 순천시
"41390": [934025.6249972349, 1932609.450570995], // 시흥시
"46910": [837068.838454425, 1628081.7615658198], // 신안군
"46910": [894983.16, 1649365.33], // 신안군 (군청 압해도 기준, 목포 인접)
"12870": [894983.16, 1649365.33], // 신안군 전남광주통합특별시 코드 (군청 압해도 기준, 목포 인접)
"44200": [953095.1457245699, 1866467.6723041101], // 아산시
"47170": [1108716.740335165, 1841036.9856003649], // 안동시
"41273": [921146.8917017151, 1914174.551465955], // 안산시 단원구
@@ -298,7 +301,8 @@ export const sigunguCenter: Record<string, [number, number]> = {
"41710": [957059.65493005, 1978556.8707086649], // 양주시
"11470": [943115.85871501, 1947726.50098438], // 양천구
"41830": [1006799.81121338, 1946640.3454016], // 양평군
"46130": [1005710.6789662449, 1606473.622557845], // 여수시
"46130": [1014844.04, 1640669.82], // 여수시 (육지(시청·군청) 기준, 도서지역 제외)
"12130": [1014844.04, 1640669.82], // 여수시 전남광주통합특별시 코드 (육지(시청·군청) 기준, 도서지역 제외)
"41730": [1007389.488139985, 1920986.5590416798], // 여주시
"28185": [924301.1973107599, 1932716.5874987599], // 연수구
"26470": [1143967.4104618952, 1688206.29479672], // 연제구
@@ -318,13 +322,14 @@ export const sigunguCenter: Record<string, [number, number]> = {
"41370": [959957.253397675, 1907245.6871241601], // 오산시
"43730": [1016925.1630849349, 1812306.15335931], // 옥천군
"28720": [831017.06725137, 1941763.7671776651], // 옹진군
"46890": [934681.072970785, 1580260.96434381], // 완도군
"46890": [931461.10, 1591076.05], // 완도군 (육지(시청·군청) 기준, 도서지역 제외)
"12850": [931461.10, 1591076.05], // 완도군 전남광주통합특별시 코드 (육지(시청·군청) 기준, 도서지역 제외)
"45710": [971714.974980355, 1764297.860421155], // 완주군
"11170": [954152.265892775, 1948105.11473188], // 용산구
"41463": [966362.167328945, 1919086.059435395], // 용인시 기흥구
"41465": [962751.309054115, 1926067.760215145], // 용인시 수지구
"41461": [979413.39966679, 1913728.657159615], // 용인시 처인구
"47940": [1339459.86503077, 1939972.251018405], // 울릉군
"47940": [1297396.76, 1949622.47], // 울릉군 (울릉도 본섬 중심, 독도 제외)
"31710": [1152103.383022245, 1727062.6953479801], // 울주군
"47930": [1158508.6557213152, 1879083.142978875], // 울진군
"42130": [1042675.604280725, 1925192.470561375], // 원주시
@@ -382,7 +387,7 @@ export const sigunguCenter: Record<string, [number, number]> = {
"43130": [1034982.8699803599, 1889790.67989893], // 충주시
"47850": [1086736.697665845, 1779277.075473485], // 칠곡군
"42190": [1131634.14282853, 1912631.8063723398], // 태백시
"44825": [864678.84145598, 1854929.12571281], // 태안군
"44825": [892666.48, 1861510.33], // 태안군 (육지(시청·군청) 기준, 도서지역 제외)
"48220": [1085316.421521755, 1640596.827168765], // 통영시
"41480": [941812.744809255, 1983528.9263305948], // 파주시
"42760": [1088652.567431635, 1949959.4658569149], // 평창군
@@ -15,6 +15,8 @@ type thisProps = {
dataList: DemandCompType[];
rtnValue: (searchText: string, pageCnt: number) => void;
rtnInputData: (data: DemandCompType) => void;
onDelete?: (data: DemandCompType) => void | Promise<void>;
deleteDisabled?: boolean;
bodyClassNm?: string;
updateList?: DemandCompType;
readOnly?: boolean;
@@ -122,6 +124,8 @@ export default function SdmInsertForm({
dataList,
rtnValue,
rtnInputData,
onDelete,
deleteDisabled,
bodyClassNm,
updateList,
readOnly,
@@ -227,16 +231,28 @@ export default function SdmInsertForm({
readOnly={readOnly}
openNetwork={openNetwork}
/>
<div className="flex justify-center pt-4">
<div className="flex justify-center gap-3 pt-4">
{readOnly == true ? (
<></>
) : (
<Button
type="submit"
className="hover:bg-primary/90 w-32 rounded-md bg-primary px-4 py-2 font-semibold text-primary-foreground transition-colors duration-200"
>
{updateList ? "수정" : "등록"}
</Button>
<>
{updateList && onDelete ? (
<Button
type="button"
className="w-32 rounded-md bg-red-600 px-4 py-2 font-semibold text-white transition-colors duration-200 hover:bg-red-700"
disabled={deleteDisabled}
onClick={() => onDelete(updateList)}
>
삭제
</Button>
) : null}
<Button
type="submit"
className="hover:bg-primary/90 w-32 rounded-md bg-primary px-4 py-2 font-semibold text-primary-foreground transition-colors duration-200"
>
{updateList ? "수정" : "등록"}
</Button>
</>
)}
</div>
</form>
@@ -42,6 +42,18 @@ export const getMenuList = async (siteId: string): Promise<MenuItem[]> => {
return response.json();
};
export const getMenuDetail = async (menuCd: number): Promise<MenuItem> => {
const response = await fetch(
`${BASE_URL}${ENDPOINT.CMS_SERVICE.MENUS}/${menuCd}`,
{
method: "GET",
headers: getAuthHeaders(),
credentials: "include",
},
);
return response.json();
};
export const getPreviewTreeMenuList = async (
siteId: string,
): Promise<TreeMenu[]> => {
+2 -2
View File
@@ -57,7 +57,7 @@ export interface SiteListResponse {
const { PROXY_HOST } = getConfig();
const BASE_URL = `${PROXY_HOST}/server`;
export const getSiteInfo = async (siteId: string) => {
export const getSiteInfo = async (siteId: string): Promise<SiteInfo> => {
const response = await fetch(
`${BASE_URL}${ENDPOINT.CMS_SERVICE.SITES}/${siteId}`,
{
@@ -66,7 +66,7 @@ export const getSiteInfo = async (siteId: string) => {
credentials: "include",
},
);
return response.json() as Promise<SiteInfo>;
return response.json();
};
export const getSiteList = async (): Promise<SiteListResponse> => {
+2
View File
@@ -1,2 +1,4 @@
export * from "./api";
export * from "./config";
export * from "./lib";
export * from "./ui";
@@ -1,59 +0,0 @@
import { useEffect, useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { getSiteInfo } from "../api/site";
import { getIpList } from "../api/ip";
import { ENDPOINT } from "../config";
import { getCookie } from "../lib";
const siteId = getCookie("site-id-key") ?? "";
const ClientIpGuard = ({
currentPath,
children,
}: {
currentPath?: string;
children: React.ReactNode;
}) => {
const queryClient = useQueryClient();
const [clientIp, setClientIp] = useState("");
const [isAllowed, setIsAllowed] = useState(true);
useEffect(() => {
(async () => {
const response = await fetch("https://api.ipify.org?format=json");
const data = await response.json();
if (!data?.ip) return;
setClientIp(data.ip);
})();
}, []);
useEffect(() => {
(async () => {
if (!siteId || !clientIp) return;
const siteInfo = await queryClient.ensureQueryData({
queryKey: [ENDPOINT.CMS_SERVICE.SITES, siteId],
queryFn: () => getSiteInfo(siteId),
});
if (siteInfo.siteKndCd === "O") return;
const { content: ipList } = await getIpList({
siteId,
prmYn: "Y",
});
const allowedClientIp = ipList.some((ip) => ip.ipAddr === clientIp);
setIsAllowed(allowedClientIp);
})();
}, [queryClient, clientIp, currentPath]);
if (!isAllowed) {
alert("허용되지 않은 IP로 접근하였습니다.");
return <></>;
}
return <>{children}</>;
};
export { ClientIpGuard };
@@ -1,55 +0,0 @@
"use client";
import { createContext, useContext, useState, useCallback } from "react";
interface HelpDialogContextType {
openHelp: () => void;
closeHelp: () => void;
isOpen: boolean;
setHelpContent: (content: string) => void;
helpContent: string;
}
const HelpDialogContext = createContext<HelpDialogContextType | undefined>(
undefined,
);
export function HelpDialogProvider({
children,
}: {
children: React.ReactNode;
}) {
const [isOpen, setIsOpen] = useState(false);
const [helpContent, setHelpContent] = useState<string>("");
const openHelp = useCallback(() => {
setIsOpen(true);
}, []);
const closeHelp = useCallback(() => {
setIsOpen(false);
}, []);
return (
<HelpDialogContext.Provider
value={{
openHelp,
closeHelp,
isOpen,
setHelpContent,
helpContent,
}}
>
{children}
</HelpDialogContext.Provider>
);
}
export function useHelpDialog() {
const context = useContext(HelpDialogContext);
if (context === undefined) {
throw new Error("useHelpDialog must be used within a HelpDialogProvider");
}
return context;
}
@@ -99,7 +99,8 @@ async function legacyLogout(tokenManager?: TokenManager) {
}
}
function formatRemainingMs(remainingMs: number): string {
function formatRemainingMs(remainingMs: number | null): string {
if (remainingMs === null) return "-";
if (remainingMs <= 0) return "만료됨";
const totalSeconds = Math.floor(remainingMs / 1000);
@@ -109,15 +110,18 @@ function formatRemainingMs(remainingMs: number): string {
return `${minutes}분 ${seconds}초`;
}
function useTokenRemainingMs(enabled: boolean): number {
const [remainingMs, setRemainingMs] = useState(0);
function useTokenRemainingMs(enabled: boolean): number | null {
const [remainingMs, setRemainingMs] = useState<number | null>(null);
useEffect(() => {
if (!enabled) return;
if (!enabled) {
setRemainingMs(null);
return;
}
const update = () => {
const token = getCookie(appConfig.CLAIM_NAME ?? "");
setRemainingMs(token ? getRemainingMs(token) : 0);
setRemainingMs(token ? getRemainingMs(token, 0) : 0);
};
update();
@@ -142,9 +146,25 @@ export function Header({
const [logoWidth, setLogoWidth] = useState(0);
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
const logoRef = useRef<HTMLImageElement>(null);
const remainingMs = useTokenRemainingMs(mounted && isLoggedIn && !viewOnly);
const siteId = getCookie("site-id-key") ?? "";
const remainingMs = useTokenRemainingMs(mounted && isLoggedIn && !viewOnly);
useEffect(() => {
if (
!mounted ||
!isLoggedIn ||
viewOnly ||
!authService ||
remainingMs === null ||
remainingMs > 0
) {
return;
}
void authService.logout();
}, [mounted, viewOnly, authService, remainingMs]);
useSessionExtendConfirm({
enabled:
mounted &&
@@ -395,7 +415,7 @@ function UserMenuContent({
remainingMs,
onLogout,
}: {
remainingMs: number;
remainingMs: number | null;
onLogout: () => void;
}) {
return (
@@ -2,8 +2,6 @@ import type { AuthService, TokenManager } from "@common/auth";
import type { QueryClient } from "@tanstack/react-query";
import { QueryProvider } from "../../provider/query-provider";
import { PopupProvider } from "../../provider/popup-provider";
import { HelpDialogProvider } from "../../provider/help-dialog-context";
import { ClientIpGuard } from "../../lib/client-ip-guard";
import type { MenuItem } from "../../api";
import { SidebarProvider } from "../sidebar";
import { LNB } from "../lnb";
@@ -29,30 +27,26 @@ export function BaseLayout({
}) {
return (
<QueryProvider queryClient={queryClient}>
<ClientIpGuard currentPath={currentPath}>
<PopupProvider>
<HelpDialogProvider>
<SidebarProvider>
<div className="flex-1">
<Header
authService={authService}
tokenManager={authService ? undefined : tokenManager}
/>
<div className="flex">
<LNB
currentPath={currentPath}
handleMenuClick={handleMenuClick}
/>
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col">
<div className="flex-1">{children}</div>
<Footer />
</div>
</div>
<PopupProvider>
<SidebarProvider>
<div className="flex-1">
<Header
authService={authService}
tokenManager={authService ? undefined : tokenManager}
/>
<div className="flex">
<LNB
currentPath={currentPath}
handleMenuClick={handleMenuClick}
/>
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col">
<div className="flex-1">{children}</div>
<Footer />
</div>
</SidebarProvider>
</HelpDialogProvider>
</PopupProvider>
</ClientIpGuard>
</div>
</div>
</SidebarProvider>
</PopupProvider>
</QueryProvider>
);
}
@@ -1,8 +1,6 @@
import type { QueryClient } from "@tanstack/react-query";
import { QueryProvider } from "../../provider/query-provider";
import { PopupProvider } from "../../provider/popup-provider";
import { HelpDialogProvider } from "../../provider/help-dialog-context";
import { ClientIpGuard } from "../../lib/client-ip-guard";
import type { MenuItem } from "../../api";
import { SidebarProvider } from "../sidebar";
import { LNB } from "../lnb";
@@ -25,26 +23,22 @@ export function NoFooterLayout({
}) {
return (
<QueryProvider queryClient={queryClient}>
<ClientIpGuard currentPath={currentPath}>
<PopupProvider>
<HelpDialogProvider>
<SidebarProvider>
<div className="flex-1">
<Header authService={authService} />
<div className="flex">
<LNB
currentPath={currentPath}
handleMenuClick={handleMenuClick}
/>
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
</div>
</div>
<PopupProvider>
<SidebarProvider>
<div className="flex-1">
<Header authService={authService} />
<div className="flex">
<LNB
currentPath={currentPath}
handleMenuClick={handleMenuClick}
/>
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
</div>
</SidebarProvider>
</HelpDialogProvider>
</PopupProvider>
</ClientIpGuard>
</div>
</div>
</SidebarProvider>
</PopupProvider>
</QueryProvider>
);
}
@@ -1,9 +1,7 @@
import type { AuthService, TokenManager } from "@common/auth";
import type { AuthService } from "@common/auth";
import type { QueryClient } from "@tanstack/react-query";
import { QueryProvider } from "../../provider/query-provider";
import { PopupProvider } from "../../provider/popup-provider";
import { HelpDialogProvider } from "../../provider/help-dialog-context";
import { ClientIpGuard } from "../../lib/client-ip-guard";
import type { MenuItem } from "../../api";
import { SidebarProvider } from "../sidebar";
import { Header } from "../header";
@@ -14,39 +12,28 @@ export function NoLNBLayout({
children,
queryClient,
authService,
tokenManager,
currentPath,
}: {
children: React.ReactNode;
queryClient?: QueryClient;
authService?: AuthService;
/** @deprecated authService를 사용하세요. authService가 없을 때만 Header legacy logout에 사용됩니다. */
tokenManager?: TokenManager;
currentPath?: string;
handleMenuClick?: (item: MenuItem) => void;
}) {
return (
<QueryProvider queryClient={queryClient}>
<ClientIpGuard currentPath={currentPath}>
<PopupProvider>
<HelpDialogProvider>
<SidebarProvider>
<div className="flex-1">
<Header
authService={authService}
tokenManager={authService ? undefined : tokenManager}
/>
<div className="flex">
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
<Footer />
</div>
</div>
<PopupProvider>
<SidebarProvider>
<div className="flex-1">
<Header authService={authService} />
<div className="flex">
<div className="flex min-h-[calc(100vh-50px)] flex-1 flex-col overflow-auto">
<div className="flex-1">{children}</div>
<Footer />
</div>
</SidebarProvider>
</HelpDialogProvider>
</PopupProvider>
</ClientIpGuard>
</div>
</div>
</SidebarProvider>
</PopupProvider>
</QueryProvider>
);
}
@@ -1,5 +1,4 @@
import { QueryProvider } from "../../provider/query-provider";
import { HelpDialogProvider } from "../../provider/help-dialog-context";
import { SidebarProvider } from "../sidebar";
import { LNB } from "../lnb";
import { Header } from "../header";
@@ -17,8 +16,7 @@ export function VBaseLayout({
}) {
return (
<QueryProvider queryClient={queryClient}>
<HelpDialogProvider>
<SidebarProvider>
<SidebarProvider>
<div className="flex-1">
<Header viewOnly />
<div className="flex h-[calc(100vh-50px)]">
@@ -32,7 +30,6 @@ export function VBaseLayout({
</div>
</div>
</SidebarProvider>
</HelpDialogProvider>
</QueryProvider>
);
}
@@ -22,16 +22,8 @@ import {
CollapsibleContent,
CollapsibleTrigger,
} from "../collapsible";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "../dialog";
import { ENDPOINT } from "../../config";
import { cn, getCookie, setCookie } from "../../lib";
import { useHelpDialog } from "../../provider/help-dialog-context";
import {
getMenuList,
getPreviewTreeMenuList,
@@ -65,13 +57,6 @@ export function LNB({
const [currentMenuCode, setCurrentMenuCode] = useState<number | null>(null);
const prevPathRef = useRef(currentPath);
const { browser } = useDetectDevice();
const {
isOpen: isHelpModalOpen,
openHelp,
closeHelp,
setHelpContent,
helpContent,
} = useHelpDialog();
const appSiteId = getCookie("site-id-key") ?? "";
const siteId = propSiteId ?? appSiteId;
@@ -110,7 +95,6 @@ export function LNB({
const matchedMenuIds: number[] = [];
let matchedMenuCode: number | null = null;
let matchedMenuHelp: string = "";
const findMatchedMenus = (items: MenuItem[]) => {
items.forEach((item) => {
@@ -127,7 +111,6 @@ export function LNB({
if (matchedMenuCode) return;
if (currentPath === item.urlPath) {
matchedMenuCode = item.menuCd;
matchedMenuHelp = item.menuHlpCn || "";
}
if (item.children) findMatchedMenuCode(item.children);
});
@@ -148,7 +131,6 @@ export function LNB({
if (matchedMenuCode) {
setCurrentMenuCode(matchedMenuCode);
setHelpContent(matchedMenuHelp);
}
// 접속 로그 저장
@@ -298,46 +280,6 @@ export function LNB({
<MenuItem key={item.menuCd} item={item} />
))}
</SidebarMenu>
{/* 도움말 아이콘 */}
<div className="mt-auto pb-4">
<Dialog
open={isHelpModalOpen}
onOpenChange={(open) => (open ? openHelp() : closeHelp())}
>
<DialogTrigger asChild></DialogTrigger>
<DialogContent className="flex max-h-[90vh] flex-col sm:max-w-[85rem]">
<DialogHeader>
<DialogTitle>도움말</DialogTitle>
</DialogHeader>
<div className="min-h-0 flex-1 overflow-y-auto py-4">
{helpContent ? (
<div
style={{
fontSize: "16px",
lineHeight: "1.5",
}}
>
<div
dangerouslySetInnerHTML={{
__html: helpContent
.replace(/<body[^>]*>/gi, "<div>")
.replace(/<\/body>/gi, "</div>"),
}}
style={{
fontSize: "inherit",
}}
/>
</div>
) : (
<p className="text-sm text-muted-foreground">
현재 페이지에 대한 도움말이 없습니다.
</p>
)}
</div>
</DialogContent>
</Dialog>
</div>
</SidebarContent>
</Sidebar>
);
@@ -1,43 +1,95 @@
"use client";
import React from "react";
import { useHelpDialog } from "../../provider/help-dialog-context";
import React, { useState } from "react";
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "../dialog";
import { useQuery } from "@tanstack/react-query";
import { getMenuDetail } from "../../api";
import { ENDPOINT } from "../../config";
const PageTitle = ({
title,
menuCd,
menuPaths,
}: {
title: string;
menuCd?: number;
menuPaths: string[];
}) => {
const { openHelp } = useHelpDialog();
const [isHelpDialogOpen, setIsHelpDialogOpen] = useState(false);
const { data: menuDetail } = useQuery({
queryKey: [ENDPOINT.CMS_SERVICE.MENUS, menuCd],
queryFn: () => getMenuDetail(menuCd!),
enabled: !!menuCd,
});
return (
<div className="flex w-full items-center justify-between px-[1.8rem] pt-[2rem]">
<div className="flex items-center gap-3">
<h2 className="text-[2.4rem] font-semibold text-title">{title}</h2>
<>
<div className="flex w-full items-center justify-between px-[1.8rem] pt-[2rem]">
<div className="flex items-center gap-3">
<h2 className="text-[2.4rem] font-semibold text-title">{title}</h2>
</div>
<div className="flex items-center gap-3">
{menuPaths.length > 0 && (
<div className="flex items-center gap-3">
<i className="diveicon di-home-fill text-foreground" />
{menuPaths?.map((path, i) => (
<React.Fragment key={`${i}-${path}`}>
{i !== 0 && (
<i className="diveicon di-arrow-forward text-foreground" />
)}
<span className="text-xl text-foreground">{path}</span>
</React.Fragment>
))}
</div>
)}
<button
onClick={() => setIsHelpDialogOpen(true)}
className="flex cursor-pointer items-center gap-3 transition-opacity hover:opacity-80"
>
<img
src="/images/help.png"
alt="도움말"
className="h-[20px] w-[20px]"
/>
</button>
</div>
</div>
<div className="flex items-center gap-3">
{menuPaths.length > 0 && (
<div className="flex items-center gap-3">
<i className="diveicon di-home-fill text-foreground" />
{menuPaths?.map((path, i) => (
<React.Fragment key={`${i}-${path}`}>
{i !== 0 && (
<i className="diveicon di-arrow-forward text-foreground" />
)}
<span className="text-xl text-foreground">{path}</span>
</React.Fragment>
))}
</div>
)}
<button
onClick={openHelp}
className="flex items-center gap-3 cursor-pointer hover:opacity-80 transition-opacity"
>
<img src="/images/help.png" alt="도움말" className="w-[20px] h-[20px]" />
</button>
</div>
</div>
{/* 도움말 다이얼로그 */}
<Dialog open={isHelpDialogOpen} onOpenChange={setIsHelpDialogOpen}>
<DialogContent className="flex max-h-[90vh] flex-col sm:max-w-[85rem]">
<DialogHeader>
<DialogTitle>도움말</DialogTitle>
</DialogHeader>
<div className="min-h-0 flex-1 overflow-y-auto py-4">
{menuDetail?.menuHlpCn ? (
<div
style={{
fontSize: "16px",
lineHeight: "1.5",
}}
>
<div
dangerouslySetInnerHTML={{
__html: menuDetail.menuHlpCn
.replace(/<body[^>]*>/gi, "<div>")
.replace(/<\/body>/gi, "</div>"),
}}
style={{
fontSize: "inherit",
}}
/>
</div>
) : (
<p className="text-lg text-muted-foreground">
현재 페이지에 대한 도움말이 없습니다.
</p>
)}
</div>
</DialogContent>
</Dialog>
</>
);
};
+9 -8
View File
@@ -12,21 +12,22 @@
"noEmit": false,
"incremental": true,
"strict": true,
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
"@/*": ["./src/*"]
}
},
"exclude": ["**/node_modules", "**/.*/*", "dist"],
"exclude": [
"node_modules",
".next",
"dist",
"coverage",
"storybook-static",
"public"
],
"include": [
".eslintrc.*",
"**/*.ts",
"**/*.tsx",
"**/*.mts",
"**/*.cjs",
"**/*.mjs",
"**/*.jsx",
"**/*.json",
".storybook/env.ts"
]
}
+6 -1
View File
@@ -9,5 +9,10 @@
"incremental": false
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules", "dist"]
"exclude": [
"node_modules",
"dist",
"coverage",
"storybook-static"
]
}
+4
View File
@@ -9,6 +9,8 @@ interface ClientConfig {
siteId: string;
}
const DEVICE_ID_KEY = "x-device-id";
class Client {
private static instance: Client;
private axiosInstance: AxiosInstance;
@@ -26,6 +28,7 @@ class Client {
this.axiosInstance.interceptors.request.use((config) => {
const token = Cookies.get(CLAIM_NAME);
const userId = Cookies.get(AUTH_USER_ID);
const deviceId = Cookies.get(DEVICE_ID_KEY);
if (!token || !userId) {
return config;
@@ -33,6 +36,7 @@ class Client {
config.headers[CLAIM_NAME] = token;
config.headers[AUTH_USER_ID] = userId;
config.headers["X-Device-Id"] = deviceId;
return config;
});
+4 -3
View File
@@ -2,9 +2,10 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"module": "ESNext"
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["node"]
},
"include": ["."],
"exclude": ["node_modules", "dist"]
"exclude": ["node_modules", "dist", "coverage", "storybook-static"]
}
+1
View File
@@ -0,0 +1 @@
declare module "*.css";