feat: POP 배너를 화면설정에서 관리 가능하도록 연동

PopShell에서 하드코딩 배너 → popConfig.bannerEnabled/bannerText 읽기
- 설정에서 배너 OFF → 배너 숨김
- 설정에서 텍스트 입력 → 해당 텍스트 표시
- 설정 없으면 기존 기본 문구 유지 (폴백)
This commit is contained in:
SeongHyun Kim
2026-04-07 16:30:53 +09:00
parent acd30d3c83
commit 73199876fd

View File

@@ -3,6 +3,7 @@
import React, { useState, useEffect, useRef, ReactNode } from "react";
import { useRouter } from "next/navigation";
import { useAuth } from "@/hooks/useAuth";
import { usePopSettings } from "@/hooks/pop/usePopSettings";
interface PopShellProps {
children: ReactNode;
@@ -98,8 +99,12 @@ export function PopShell({ children, showBanner = true, title, showBack = false,
logout();
};
const marqueeText =
"[공지] 금일 오후 3시 전체 안전교육 실시 예정입니다. 전 직원 필참 바랍니다. \u00a0\u00a0|\u00a0\u00a0 [알림] 내일 설비 정기점검으로 인한 3호기 가동 중지 예정 \u00a0\u00a0|\u00a0\u00a0 [안내] 4월 생산실적 우수팀 발표 - 생산1팀 축하드립니다!";
// POP 설정에서 배너 텍스트 로드 (POP화면설정에서 관리)
const { settings: popSettings } = usePopSettings("/pop/home");
const homeConfig = (popSettings as any)?.screens?.home;
const bannerEnabled = homeConfig?.bannerEnabled ?? true;
const bannerText = homeConfig?.bannerText;
const marqueeText = bannerText || "[공지] 금일 오후 3시 전체 안전교육 실시 예정입니다. 전 직원 필참 바랍니다. \u00a0\u00a0|\u00a0\u00a0 [알림] 내일 설비 정기점검으로 인한 3호기 가동 중지 예정 \u00a0\u00a0|\u00a0\u00a0 [안내] 4월 생산실적 우수팀 발표 - 생산1팀 축하드립니다!";
return (
<div className="min-h-screen min-h-dvh flex flex-col" style={{ background: "#F5F5F5" }}>
@@ -296,7 +301,7 @@ export function PopShell({ children, showBanner = true, title, showBack = false,
</header>
{/* ===== NOTICE BANNER (Marquee) ===== */}
{showBanner && <div className="bg-amber-50 border-b border-amber-200 px-4 py-2 flex items-center gap-3">
{showBanner && bannerEnabled && <div className="bg-amber-50 border-b border-amber-200 px-4 py-2 flex items-center gap-3">
<div className="flex items-center gap-1.5 shrink-0">
<span className="text-amber-600 text-sm">📢</span>
<span className="text-xs font-bold text-amber-700"></span>