diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..d168557
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,7 @@
+node_modules
+.next
+out
+.git
+.idea
+*.tsbuildinfo
+study-notes.md
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..582888e
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,12 @@
+# 1단계: Next.js 정적 빌드 → /app/out
+FROM node:22-alpine AS build
+WORKDIR /app
+COPY package.json package-lock.json ./
+RUN npm ci
+COPY . .
+RUN npm run build
+
+# 2단계: nginx로 정적 파일 서비스 (기존 Vue 배포와 같은 방식)
+FROM nginx:alpine
+COPY --from=build /app/out /usr/share/nginx/html
+EXPOSE 80
diff --git a/README.md b/README.md
index e215bc4..772b241 100644
--- a/README.md
+++ b/README.md
@@ -1,36 +1,32 @@
-This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
+# ss-front-react
-## Getting Started
-
-First, run the development server:
+PC통신 스타일 BBS UI — Next.js 16 (App Router) + React 19 + TypeScript
```bash
-npm run dev
-# or
-yarn dev
-# or
-pnpm dev
-# or
-bun dev
+npm install
+npm run dev # http://localhost:3000
```
-Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
+## 디렉토리 구조
-You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
+```
+src/
+├─ app/ # 라우팅 전용 (page / layout)
+│ ├─ layout.tsx
+│ ├─ page.tsx
+│ ├─ globals.css # 전역 토큰·리셋
+│ └─ _components/ # 이 라우트에서만 쓰는 컴포넌트 (private folder, 라우팅 제외)
+└─ features/ # 도메인(기능) 단위 모듈
+ └─ bbs/
+ ├─ index.ts # 외부 공개 API (여기서만 import)
+ ├─ types.ts
+ ├─ constants/ # 메뉴·팔레트 정의
+ ├─ mocks/ # 목업 데이터 → API 연동 시 api/ 로 교체
+ ├─ lib/command.ts # 명령 처리 순수 함수 (useReducer reducer)
+ └─ components/ # BbsTerminal(client) + 화면별 컴포넌트 + CSS Module
+```
-This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
-
-## Learn More
-
-To learn more about Next.js, take a look at the following resources:
-
-- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
-- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
-
-You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
-
-## Deploy on Vercel
-
-The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
-
-Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
+규칙
+- `app/`에는 라우팅 파일만, 로직은 `features/<도메인>/`에.
+- 다른 곳에서는 `@/features/bbs` (index.ts)로만 import.
+- 여러 feature가 공유하는 코드가 생기면 그때 `src/components`, `src/lib`, `src/hooks` 추가.
diff --git a/next-env.d.ts b/next-env.d.ts
new file mode 100644
index 0000000..ce4e94a
--- /dev/null
+++ b/next-env.d.ts
@@ -0,0 +1,7 @@
+///
+///
+import "./.next/types/routes.d.ts";
+import "./.next/types/root-params.d.ts";
+
+// NOTE: This file should not be edited
+// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/next.config.ts b/next.config.ts
index 6bcbe28..9ee88b8 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -1,9 +1,9 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
- /* config options here */
- cacheComponents: true,
- partialPrefetching: true,
+ output: "export", // 정적 HTML/JS로 빌드 → nginx로 서비스
+ // localhost 외 주소로 개발 서버 접속 허용 (Tailscale 등). 호스트명만, 포트/스킴 없이
+ allowedDevOrigins: ["100.102.165.37"],
};
export default nextConfig;
diff --git a/public/file.svg b/public/file.svg
deleted file mode 100644
index 004145c..0000000
--- a/public/file.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/globe.svg b/public/globe.svg
deleted file mode 100644
index 567f17b..0000000
--- a/public/globe.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/next.svg b/public/next.svg
deleted file mode 100644
index 5174b28..0000000
--- a/public/next.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/vercel.svg b/public/vercel.svg
deleted file mode 100644
index 7705396..0000000
--- a/public/vercel.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/public/window.svg b/public/window.svg
deleted file mode 100644
index b2b2a44..0000000
--- a/public/window.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/app/_components/Intro.tsx b/src/app/_components/Intro.tsx
new file mode 100644
index 0000000..7a432ca
--- /dev/null
+++ b/src/app/_components/Intro.tsx
@@ -0,0 +1,18 @@
+import styles from "./home.module.css";
+
+export default function Intro() {
+ return (
+
+ Concept preview — 클릭 · 명령어 둘 다 됩니다
+ PC통신 스타일 TUI — 넘버 메뉴
+
+ BOARD 화면을 번호와 메뉴명을 직접 쳐서 이동하던 예전 PC통신 방식 으로 바꾼 화면입니다. 마우스
+ 클릭도 되지만, 클릭은 아래 명령어창에 같은 숫자를 입력하고 엔터 치는 것과 동일한 경로를 탑니다.
+
+
+ 👉 입력창에 2 또는 board → 글 번호 입력해서 읽기 → L 목록,{" "}
+ M 메인
+
+
+ );
+}
diff --git a/src/app/_components/Notes.tsx b/src/app/_components/Notes.tsx
new file mode 100644
index 0000000..5d5bfa9
--- /dev/null
+++ b/src/app/_components/Notes.tsx
@@ -0,0 +1,22 @@
+import styles from "./home.module.css";
+
+const NOTES = [
+ ["클릭 = 명령어 대리 입력.", "메뉴/게시글 줄을 클릭하면 입력창에 번호가 채워졌다가 자동으로 엔터가 눌립니다. 마우스든 키보드든 같은 명령 처리 함수(features/bbs/lib/command.ts) 하나로 들어갑니다."],
+ ["\"읽음\" 기능이 그대로 이어집니다.", "글을 읽으면 \"2. 자유게시판\"에서 빠지고 \"3. 내가 읽은 글\"로 넘어갑니다 — viewed_at 플래그 기능을 재현."],
+ ["팔레트는 실제 테마 시스템과 바로 연결 가능.", "블루/그린/앰버 버튼은 기존 테마 셀렉터와 같은 구조(data-palette 속성 + CSS 변수)입니다."],
+];
+
+export default function Notes() {
+ return (
+
+ {NOTES.map(([title, desc]) => (
+
+
▲
+
+ {title} {desc}
+
+
+ ))}
+
+ );
+}
diff --git a/src/app/_components/home.module.css b/src/app/_components/home.module.css
new file mode 100644
index 0000000..3e898d5
--- /dev/null
+++ b/src/app/_components/home.module.css
@@ -0,0 +1,19 @@
+.intro { max-width: 740px; width: 100%; }
+.eyebrow { font-size: 11px; letter-spacing: 0.16em; color: #5a6b5a; text-transform: uppercase; margin: 0 0 10px; }
+.intro h1 { margin: 0 0 14px; font-size: clamp(19px, 3vw, 25px); color: var(--ink); font-weight: 700; text-wrap: balance; }
+.intro p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.75; color: var(--ink-3); max-width: 66ch; }
+.intro b, .note b { color: var(--ink); font-weight: 600; }
+
+.hint {
+ margin-top: 14px; font-size: 12px; color: var(--ink-4); border: 1px dashed var(--line);
+ padding: 9px 12px; display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap;
+}
+.hint kbd {
+ background: #151515; border: 1px solid #333; border-radius: 3px; padding: 1px 6px;
+ font-size: 11px; color: var(--ink);
+}
+
+.notes { max-width: 740px; width: 100%; display: flex; flex-direction: column; gap: 14px; }
+.note { display: flex; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); background: var(--panel-soft); }
+.mark { color: #4dff4d; font-size: 12px; flex-shrink: 0; padding-top: 1px; }
+.note p { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--ink-3); }
diff --git a/src/app/globals.css b/src/app/globals.css
index 4c18fb3..b937c85 100644
--- a/src/app/globals.css
+++ b/src/app/globals.css
@@ -1,49 +1,34 @@
:root {
- --background: #ffffff;
- --foreground: #171717;
+ --void: #050505;
+ --ink: #eafff0;
+ --ink-2: #c9d6c9;
+ --ink-3: #a9bdae;
+ --ink-4: #8fae93;
+ --line: #2c3a2c;
+ --panel-soft: rgba(255, 255, 255, 0.03);
+ --mono: ui-monospace, "D2Coding", "Cascadia Mono", "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
+ color-scheme: dark;
}
-@media (prefers-color-scheme: dark) {
- :root {
- --background: #0a0a0a;
- --foreground: #ededed;
- }
-}
-
-html {
- height: 100%;
-}
-
-html,
-body {
- max-width: 100vw;
- overflow-x: hidden;
-}
+* { box-sizing: border-box; }
body {
- min-height: 100%;
+ margin: 0;
+ background: var(--void);
+ color: var(--ink-2);
+ font-family: var(--mono);
+}
+
+button, input { font-family: inherit; }
+
+.page {
+ padding: clamp(20px, 4vw, 56px) clamp(14px, 4vw, 40px) 80px;
display: flex;
flex-direction: column;
- color: var(--foreground);
- background: var(--background);
- font-family: Arial, Helvetica, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
+ align-items: center;
+ gap: 32px;
}
-* {
- box-sizing: border-box;
- padding: 0;
- margin: 0;
-}
-
-a {
- color: inherit;
- text-decoration: none;
-}
-
-@media (prefers-color-scheme: dark) {
- html {
- color-scheme: dark;
- }
+@media (prefers-reduced-motion: reduce) {
+ * { transition: none !important; }
}
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index f58d37c..d8b31b2 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -1,25 +1,23 @@
import type { Metadata } from "next";
-import { Geist, Geist_Mono } from "next/font/google";
+import { PALETTE_KEY } from "@/features/bbs";
import "./globals.css";
-const geistSans = Geist({
- variable: "--font-geist-sans",
- subsets: ["latin"],
-});
-
-const geistMono = Geist_Mono({
- variable: "--font-geist-mono",
- subsets: ["latin"],
-});
-
export const metadata: Metadata = {
- title: "Create Next App",
- description: "Generated by create next app",
+ title: "SPECIALSOURCE-BBS",
+ description: "PC통신 스타일 TUI — 넘버 메뉴",
};
export default function RootLayout({ children }: LayoutProps<"/">) {
return (
-
+ // 아래 스크립트가 hydration 전에 data-palette를 붙이므로 경고 억제
+
+
+
+
{children}
);
diff --git a/src/app/page.module.css b/src/app/page.module.css
deleted file mode 100644
index 90fe305..0000000
--- a/src/app/page.module.css
+++ /dev/null
@@ -1,150 +0,0 @@
-.page {
- --background: #fafafa;
- --foreground: #fff;
-
- --text-primary: #000;
- --text-secondary: #666;
-
- --button-primary-hover: #383838;
- --button-secondary-hover: #f2f2f2;
- --button-secondary-border: #ebebeb;
-
- display: flex;
- flex: 1;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- font-family: var(--font-geist-sans);
- background-color: var(--background);
-}
-
-.main {
- display: flex;
- flex: 1;
- width: 100%;
- max-width: 800px;
- flex-direction: column;
- align-items: flex-start;
- justify-content: space-between;
- background-color: var(--foreground);
- padding: 120px 60px;
-}
-
-.intro {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- text-align: left;
- gap: 24px;
-}
-
-.intro h1 {
- max-width: 320px;
- font-size: 40px;
- font-weight: 600;
- line-height: 48px;
- letter-spacing: -2.4px;
- text-wrap: balance;
- color: var(--text-primary);
-}
-
-.intro p {
- max-width: 440px;
- font-size: 18px;
- line-height: 32px;
- text-wrap: balance;
- color: var(--text-secondary);
-}
-
-.intro a {
- font-weight: 500;
- color: var(--text-primary);
-}
-
-.ctas {
- display: flex;
- flex-direction: row;
- width: 100%;
- max-width: 440px;
- gap: 16px;
- font-size: 14px;
-}
-
-.ctas a {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 40px;
- padding: 0 16px;
- border-radius: 128px;
- border: 1px solid transparent;
- transition: 0.2s;
- cursor: pointer;
- width: fit-content;
- font-weight: 500;
-}
-
-a.primary {
- background: var(--text-primary);
- color: var(--background);
- gap: 8px;
-}
-
-a.secondary {
- border-color: var(--button-secondary-border);
-}
-
-/* Enable hover only on non-touch devices */
-@media (hover: hover) and (pointer: fine) {
- a.primary:hover {
- background: var(--button-primary-hover);
- border-color: transparent;
- }
-
- a.secondary:hover {
- background: var(--button-secondary-hover);
- border-color: transparent;
- }
-}
-
-@media (max-width: 600px) {
- .main {
- padding: 48px 24px;
- }
-
- .intro {
- gap: 16px;
- }
-
- .intro h1 {
- font-size: 32px;
- line-height: 40px;
- letter-spacing: -1.92px;
- }
-}
-
-@media (prefers-color-scheme: dark) {
- .logo {
- filter: invert();
- }
-
- .page {
- --background: #000;
- --foreground: #000;
-
- --text-primary: #ededed;
- --text-secondary: #999;
-
- --button-primary-hover: #ccc;
- --button-secondary-hover: #1a1a1a;
- --button-secondary-border: #1a1a1a;
- }
-}
-
-.code {
- font-family: var(--font-geist-mono);
- font-size: 0.9em;
- background: color-mix(in srgb, currentColor 8%, transparent);
- padding: 0.1em 0.4em;
- border-radius: 6px;
-}
diff --git a/src/app/page.tsx b/src/app/page.tsx
index 3f611f9..b828cd5 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -1,69 +1,13 @@
-import Image from "next/image";
-import styles from "./page.module.css";
+import { BbsTerminal } from "@/features/bbs";
+import Intro from "./_components/Intro";
+import Notes from "./_components/Notes";
export default function Home() {
return (
-
-
-
-
-
- To get started, edit the{" "}
- page.tsx file.
-
-
- Looking for a starting point or more instructions? Head over to{" "}
-
- Templates
- {" "}
- or the{" "}
-
- Learning
- {" "}
- center.
-
-
-
-
-
+
+
+
+
+
);
}
diff --git a/src/features/bbs/components/BbsTerminal.tsx b/src/features/bbs/components/BbsTerminal.tsx
new file mode 100644
index 0000000..dd0681a
--- /dev/null
+++ b/src/features/bbs/components/BbsTerminal.tsx
@@ -0,0 +1,116 @@
+"use client";
+
+import { useEffect, useReducer, useRef, useState, useSyncExternalStore } from "react";
+import { PALETTE_KEY, PALETTES } from "../constants";
+import { execute, initialState } from "../lib/command";
+import type { Nav, Palette } from "../types";
+import MainMenu from "./MainMenu";
+import PaletteSwitch from "./PaletteSwitch";
+import PostDetail from "./PostDetail";
+import PostList from "./PostList";
+import styles from "./bbs.module.css";
+
+const DEFAULT_PALETTE: Palette = "blue";
+
+// localStorage를 외부 저장소로 보고 React가 구독 (다른 탭에서 바꿔도 동기화됨)
+const subscribe = (onChange: () => void) => {
+ const handler = () => {
+ document.documentElement.dataset.palette = readPalette(); // 색은 CSS가 속성으로 적용
+ onChange(); // 버튼 활성 표시는 React가 갱신
+ };
+ window.addEventListener("storage", handler);
+ return () => window.removeEventListener("storage", handler);
+};
+
+const readPalette = (): Palette => {
+ try {
+ const saved = localStorage.getItem(PALETTE_KEY);
+ return PALETTES.find((p) => p.key === saved)?.key ?? DEFAULT_PALETTE;
+ } catch {
+ return DEFAULT_PALETTE;
+ }
+};
+
+export default function BbsTerminal() {
+ const [state, dispatch] = useReducer(execute, initialState);
+ const palette = useSyncExternalStore(subscribe, readPalette, () => DEFAULT_PALETTE);
+ const [input, setInput] = useState("");
+ const inputRef = useRef(null);
+ const mounted = useRef(false);
+
+ // 화면 이동을 브라우저 history에 기록 → 스와이프/뒤로가기 버튼/Alt+←가 그대로 앞뒤 이동이 됨
+ useEffect(() => {
+ const nav: Nav = { screen: state.screen, list: state.list, postId: state.postId };
+ if (!mounted.current) {
+ mounted.current = true;
+ history.replaceState({ bbs: nav }, ""); // 새로고침 시 이전 기록 대신 현재 화면으로 시작
+ } else if (JSON.stringify(history.state?.bbs) !== JSON.stringify(nav)) {
+ history.pushState({ bbs: nav }, "");
+ }
+ }, [state.screen, state.list, state.postId]);
+
+ useEffect(() => {
+ const onPop = (e: PopStateEvent) => {
+ if (e.state?.bbs) dispatch(e.state.bbs);
+ };
+ addEventListener("popstate", onPop);
+ return () => removeEventListener("popstate", onPop);
+ }, []);
+
+ const changePalette = (p: Palette) => {
+ try {
+ localStorage.setItem(PALETTE_KEY, p);
+ } catch {}
+ window.dispatchEvent(new StorageEvent("storage")); // 같은 탭은 storage 이벤트가 안 오므로 직접 알림
+ };
+
+ // 클릭 = 명령어 대리 입력: 입력창에 채운 뒤 엔터와 같은 경로로 실행
+ const submitFromClick = (cmd: string) => {
+ setInput(cmd);
+ // 터치 기기에서 포커스하면 가상 키보드가 튀어나와 화면을 가림 → 마우스 환경에서만
+ if (matchMedia("(pointer: fine)").matches) inputRef.current?.focus();
+ setTimeout(() => {
+ dispatch(cmd);
+ setInput("");
+ }, 160);
+ };
+
+ return (
+
+
+
+
+
+ SPECIALSOURCE-BBS v3.2
+ {state.loggedIn ? "ONLINE: 7 · admin 접속중" : "ONLINE: 6 · 비로그인"}
+
+
+
+ {state.screen === "main" &&
}
+ {state.screen === "list" &&
}
+ {state.screen === "post" && state.postId !== null &&
}
+ {state.error &&
{state.error}
}
+
+
+
+ >
+ setInput(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key !== "Enter" || e.nativeEvent.isComposing) return;
+ dispatch(input);
+ setInput("");
+ }}
+ placeholder="번호 또는 메뉴명을 입력하세요"
+ aria-label="BBS 명령어 입력"
+ autoComplete="off"
+ autoFocus
+ />
+
+
+
+ );
+}
diff --git a/src/features/bbs/components/MainMenu.tsx b/src/features/bbs/components/MainMenu.tsx
new file mode 100644
index 0000000..3fe5511
--- /dev/null
+++ b/src/features/bbs/components/MainMenu.tsx
@@ -0,0 +1,33 @@
+import { MENU } from "../constants";
+import { POSTS } from "../mocks/posts";
+import styles from "./bbs.module.css";
+
+interface Props {
+ readIds: number[];
+ onSelect: (cmd: string) => void;
+}
+
+export default function MainMenu({ readIds, onSelect }: Props) {
+ const unread = POSTS.length - readIds.length;
+
+ return (
+ <>
+ SPECIALSOURCE.SYSTEM 메인 메뉴
+ 번호나 메뉴명을 입력하거나, 줄을 클릭하세요.
+
+ {MENU.map((m) => (
+ onSelect(String(m.num))}>
+ {m.num}.
+ {m.label}
+ {m.en}
+ {m.key === "board" && (안읽음 {unread}) }
+ {m.key === "viewed" && ({readIds.length}건) }
+
+ ))}
+
+
+ 예) 2 또는 board 입력 → 자유게시판 이동
+
+ >
+ );
+}
diff --git a/src/features/bbs/components/PaletteSwitch.tsx b/src/features/bbs/components/PaletteSwitch.tsx
new file mode 100644
index 0000000..760e3f6
--- /dev/null
+++ b/src/features/bbs/components/PaletteSwitch.tsx
@@ -0,0 +1,26 @@
+import { PALETTES } from "../constants";
+import type { Palette } from "../types";
+import styles from "./bbs.module.css";
+
+interface Props {
+ value: Palette;
+ onChange: (p: Palette) => void;
+}
+
+export default function PaletteSwitch({ value, onChange }: Props) {
+ return (
+
+ {PALETTES.map((p) => (
+ onChange(p.key)}
+ >
+ {p.label}
+
+ ))}
+
+ );
+}
diff --git a/src/features/bbs/components/PostDetail.tsx b/src/features/bbs/components/PostDetail.tsx
new file mode 100644
index 0000000..30eadf9
--- /dev/null
+++ b/src/features/bbs/components/PostDetail.tsx
@@ -0,0 +1,22 @@
+import { POSTS } from "../mocks/posts";
+import styles from "./bbs.module.css";
+
+export default function PostDetail({ postId }: { postId: number }) {
+ const post = POSTS.find((p) => p.id === postId);
+ if (!post) return null;
+
+ return (
+ <>
+ {post.title}
+
+ 글쓴이 {post.author} · 조회 {post.views} · {post.date}
+
+
+ {post.body}
+
+
+ L =목록으로 · M =메인메뉴
+
+ >
+ );
+}
diff --git a/src/features/bbs/components/PostList.tsx b/src/features/bbs/components/PostList.tsx
new file mode 100644
index 0000000..4add5c9
--- /dev/null
+++ b/src/features/bbs/components/PostList.tsx
@@ -0,0 +1,38 @@
+import { POSTS } from "../mocks/posts";
+import type { ListKind } from "../types";
+import styles from "./bbs.module.css";
+
+interface Props {
+ kind: ListKind;
+ readIds: number[];
+ onSelect: (cmd: string) => void;
+}
+
+export default function PostList({ kind, readIds, onSelect }: Props) {
+ const viewed = kind === "viewed";
+ const posts = POSTS.filter((p) => readIds.includes(p.id) === viewed);
+
+ return (
+ <>
+
+ [{viewed ? 3 : 2}] {viewed ? "내가 읽은 글" : "자유게시판"}
+
+ 글 번호를 입력하면 읽습니다 · 총 {posts.length}건
+
+ {posts.length === 0 && 표시할 글이 없습니다.
}
+ {posts.map((p) => (
+ onSelect(String(p.id))}>
+ {p.id}
+ {p.title}
+
+ {p.author} · 조회 {p.views} · {p.date}
+
+
+ ))}
+
+
+ 번호 =글읽기 · M =메인 · L =이 목록 새로고침
+
+ >
+ );
+}
diff --git a/src/features/bbs/components/bbs.module.css b/src/features/bbs/components/bbs.module.css
new file mode 100644
index 0000000..fd7fb58
--- /dev/null
+++ b/src/features/bbs/components/bbs.module.css
@@ -0,0 +1,87 @@
+/* --- BBS 팔레트 (시대별 PC통신 느낌) --- */
+/* 는 layout.tsx 인라인 스크립트가 첫 페인트 전에 설정 → 깜빡임 없음 */
+.frame, :global(html[data-palette="blue"]) .frame {
+ --bbs-bg: #000033; --bbs-fg: #d9d9f5; --bbs-accent: #55ffff;
+ --bbs-highlight: #ffff55; --bbs-dim: #7d7dc4; --bbs-border: #ffffff; --bbs-glow: rgba(85, 255, 255, 0.35);
+}
+:global(html[data-palette="green"]) .frame {
+ --bbs-bg: #000d00; --bbs-fg: #cdf7cd; --bbs-accent: #4dff4d;
+ --bbs-highlight: #ffff55; --bbs-dim: #3f8f3f; --bbs-border: #4dff4d; --bbs-glow: rgba(77, 255, 77, 0.35);
+}
+:global(html[data-palette="amber"]) .frame {
+ --bbs-bg: #190f00; --bbs-fg: #ffe3ba; --bbs-accent: #ffb347;
+ --bbs-highlight: #ffffff; --bbs-dim: #a06a2c; --bbs-border: #ffb347; --bbs-glow: rgba(255, 179, 71, 0.35);
+}
+
+.shell { width: 100%; max-width: 760px; display: flex; flex-direction: column; align-items: center; }
+
+.paletteSwitch { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
+.paletteBtn {
+ background: none; border: 1px solid #333; color: #8fae93; font-size: 11px;
+ padding: 6px 12px; cursor: pointer; letter-spacing: 0.02em;
+}
+.paletteBtn:hover, .active { border-color: #eafff0; color: #eafff0; }
+
+.frame {
+ width: 100%; background: var(--bbs-bg); color: var(--bbs-fg);
+ border: 3px double var(--bbs-border);
+ box-shadow: 0 0 24px var(--bbs-glow), 0 20px 60px rgba(0, 0, 0, 0.6);
+ position: relative; overflow: hidden;
+}
+/* CRT 스캔라인 */
+.frame::after {
+ content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
+ background: linear-gradient(rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.12) 50%);
+ background-size: 100% 3px; mix-blend-mode: overlay; opacity: 0.5;
+}
+.frame :focus-visible { outline: 2px solid var(--bbs-accent); outline-offset: 2px; }
+
+.titlebar {
+ display: flex; justify-content: space-between; align-items: center; gap: 8px;
+ padding: 8px 16px; border-bottom: 1px solid var(--bbs-border);
+ font-size: 12.5px; font-weight: 700; color: var(--bbs-accent); letter-spacing: 0.03em;
+}
+.screen { padding: 18px 20px; min-height: 360px; font-size: 13.5px; line-height: 1.9; }
+
+.row { display: flex; gap: 10px; cursor: pointer; padding: 1px 4px; margin: 0 -4px; }
+.row:hover { background: rgba(255, 255, 255, 0.08); }
+.num { color: var(--bbs-highlight); font-weight: 700; width: 1.4em; flex-shrink: 0; text-align: right; }
+.dim { color: var(--bbs-dim); }
+.accent { color: var(--bbs-accent); }
+
+.title { color: var(--bbs-accent); font-weight: 700; margin-bottom: 4px; }
+.sub { color: var(--bbs-dim); font-size: 12px; margin-bottom: 10px; }
+.error { color: #ff6b6b; }
+.rule { border: none; border-top: 1px solid var(--bbs-dim); opacity: 0.5; margin: 8px 0 12px; }
+
+.postRow { font-size: 13px; }
+.postIdx { color: var(--bbs-highlight); width: 1.6em; flex-shrink: 0; text-align: right; }
+.postTitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.postMeta { color: var(--bbs-dim); font-size: 11.5px; flex-shrink: 0; white-space: nowrap; }
+
+.body { white-space: pre-wrap; margin-bottom: 14px; }
+
+.footer { color: var(--bbs-dim); font-size: 11.5px; }
+.footer b { color: var(--bbs-highlight); }
+
+.cmdline {
+ display: flex; align-items: center; gap: 8px; padding: 10px 16px;
+ border-top: 1px solid var(--bbs-border); background: rgba(0, 0, 0, 0.25);
+}
+.prompt { color: var(--bbs-highlight); font-size: 13px; font-weight: 700; flex-shrink: 0; }
+.cmdline input {
+ flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--bbs-fg);
+ font-size: 13.5px; caret-color: var(--bbs-highlight);
+}
+.cmdline input::placeholder { color: var(--bbs-dim); }
+
+@media (max-width: 560px) {
+ .postMeta { display: none; }
+ .screen { padding: 14px; }
+ .titlebar { padding: 8px 12px; font-size: 11.5px; }
+}
+/* iOS는 16px 미만 input에 포커스하면 화면을 확대함 */
+@media (pointer: coarse) {
+ .cmdline input { font-size: 16px; }
+ .row { padding: 4px; } /* 손가락 터치 영역 확보 */
+}
diff --git a/src/features/bbs/constants/index.ts b/src/features/bbs/constants/index.ts
new file mode 100644
index 0000000..cd50b2a
--- /dev/null
+++ b/src/features/bbs/constants/index.ts
@@ -0,0 +1,19 @@
+import type { MenuItem, Palette } from "../types";
+
+export const MENU: MenuItem[] = [
+ { num: 1, key: "notice", label: "공지사항", en: "NOTICE", aliases: ["공지", "notice"] },
+ { num: 2, key: "board", label: "자유게시판", en: "BOARD", aliases: ["게시판", "자유게시판", "board"] },
+ { num: 3, key: "viewed", label: "내가 읽은 글", en: "VIEWED", aliases: ["읽음", "내가읽은글", "viewed"] },
+ { num: 4, key: "youtube", label: "유튜브 자료실", en: "YOUTUBE", aliases: ["유튜브", "youtube"] },
+ { num: 5, key: "about", label: "회사 소개", en: "ABOUT", aliases: ["소개", "회사소개", "about"] },
+ { num: 6, key: "contact", label: "문의하기", en: "CONTACT", aliases: ["문의", "contact"] },
+ { num: 7, key: "login", label: "로그아웃", en: "LOGOUT", aliases: ["로그인", "로그아웃", "login", "logout"] },
+];
+
+export const PALETTE_KEY = "bbs-palette";
+
+export const PALETTES: { key: Palette; label: string }[] = [
+ { key: "blue", label: "블루" },
+ { key: "green", label: "그린" },
+ { key: "amber", label: "앰버" },
+];
diff --git a/src/features/bbs/index.ts b/src/features/bbs/index.ts
new file mode 100644
index 0000000..6ffd270
--- /dev/null
+++ b/src/features/bbs/index.ts
@@ -0,0 +1,2 @@
+export { PALETTE_KEY } from "./constants";
+export { default as BbsTerminal } from "./components/BbsTerminal";
diff --git a/src/features/bbs/lib/command.ts b/src/features/bbs/lib/command.ts
new file mode 100644
index 0000000..d00f77e
--- /dev/null
+++ b/src/features/bbs/lib/command.ts
@@ -0,0 +1,52 @@
+import { MENU } from "../constants";
+import { POSTS } from "../mocks/posts";
+import type { BbsState, MenuItem, Nav } from "../types";
+
+export const initialState: BbsState = {
+ screen: "main",
+ list: "board",
+ postId: null,
+ readIds: [],
+ loggedIn: true,
+ error: null,
+};
+
+function findMenu(raw: string): MenuItem | undefined {
+ const n = Number(raw);
+ if (!Number.isNaN(n)) return MENU.find((m) => m.num === n);
+ const lower = raw.toLowerCase();
+ return MENU.find((m) => m.aliases.includes(lower));
+}
+
+/** 클릭/키보드 입력이 모두 거치는 단일 명령 처리기 (순수 함수 → useReducer reducer로 사용) */
+export function execute(prev: BbsState, input: string | Nav): BbsState {
+ if (typeof input !== "string") return { ...prev, ...input, error: null }; // 뒤로/앞으로 이동 복원
+ const raw = input.trim();
+ if (!raw) return prev;
+ const state = { ...prev, error: null };
+ const cmd = raw.toLowerCase();
+ const isMain = cmd === "m" || cmd === "메인";
+ const isList = cmd === "l" || cmd === "목록";
+
+ if (state.screen === "main") {
+ const m = findMenu(raw);
+ if (!m) return { ...state, error: `※ 알 수 없는 메뉴입니다: "${raw}"` };
+ if (m.key === "board" || m.key === "viewed") return { ...state, screen: "list", list: m.key };
+ if (m.key === "login") return { ...state, loggedIn: !state.loggedIn };
+ return { ...state, error: `※ "${m.label}"는 이 목업에서는 미리보기 대상이 아닙니다 (BOARD/VIEWED만 시연).` };
+ }
+
+ if (isMain) return { ...state, screen: "main" };
+
+ if (state.screen === "list") {
+ if (isList) return state;
+ const post = POSTS.find((p) => p.id === Number(raw));
+ if (!post) return { ...state, error: `※ 목록에 없는 번호입니다: "${raw}"` };
+ const readIds = state.readIds.includes(post.id) ? state.readIds : [...state.readIds, post.id];
+ return { ...state, screen: "post", postId: post.id, readIds };
+ }
+
+ // screen === "post"
+ if (isList) return { ...state, screen: "list" };
+ return { ...state, error: '※ "L"(목록) 또는 "M"(메인)만 입력해 보세요.' };
+}
diff --git a/src/features/bbs/types.ts b/src/features/bbs/types.ts
new file mode 100644
index 0000000..19ed3eb
--- /dev/null
+++ b/src/features/bbs/types.ts
@@ -0,0 +1,34 @@
+export type MenuKey = "notice" | "board" | "viewed" | "youtube" | "about" | "contact" | "login";
+
+export interface MenuItem {
+ num: number;
+ key: MenuKey;
+ label: string;
+ en: string;
+ aliases: string[];
+}
+
+export interface Post {
+ id: number;
+ title: string;
+ author: string;
+ date: string;
+ views: number;
+ body: string;
+}
+
+export type Palette = "blue" | "green" | "amber";
+export type Screen = "main" | "list" | "post";
+export type ListKind = "board" | "viewed";
+
+export interface BbsState {
+ screen: Screen;
+ list: ListKind;
+ postId: number | null;
+ readIds: number[];
+ loggedIn: boolean;
+ error: string | null;
+}
+
+/** 브라우저 history에 저장하는 화면 위치 (뒤로/앞으로 제스처로 복원) */
+export type Nav = Pick;
diff --git a/study-notes.md b/study-notes.md
new file mode 100644
index 0000000..a0fc1e2
--- /dev/null
+++ b/study-notes.md
@@ -0,0 +1,148 @@
+# React / Next.js 공부 노트
+
+---
+
+## 1. 디렉토리 네이밍 규칙 (src/app, src/features)
+
+**질문:** src/app, features 디렉토리 네이밍룰이 실무에서도 이래?
+
+**요약:** 대체로 실무 표준에 가깝다. 핵심은 "어떤 규칙이든 팀 안에서 일관되게".
+
+### 실무에서 흔한 패턴
+- `src/app/` : Next.js App Router 폴더. **폴더 구조 = URL 경로**.
+ - `page.tsx` → 그 경로의 화면, `layout.tsx` → 공통 껍데기
+- `_폴더명` (예: `_components`) : **언더스코어로 시작하면 라우팅에서 제외** (Next.js 공식 규칙).
+ 페이지 전용 컴포넌트를 근처에 두고 싶을 때 사용.
+- `src/features/기능명/` : **기능 단위 폴더 구조** (bulletproof-react 스타일).
+ - `components/` 화면 조각, `lib/` 로직, `constants` 상수, `types.ts` 타입
+ - `index.ts` = 이 기능의 "공개 창구". 밖에서는 `@/features/bbs` 로만 import.
+- 파일명 규칙
+ - 컴포넌트: PascalCase (`PostList.tsx`)
+ - 그 외: camelCase / 소문자 (`command.ts`)
+ - 모두 kebab-case(`post-list.tsx`)로 쓰는 팀도 많음 → 정답은 없고 통일이 중요.
+
+### 개선 포인트
+1. 파일 하나뿐이면 폴더 대신 파일로: `constants/index.ts` → `constants.ts` (`types.ts`와 맞춤). 커지면 그때 폴더로.
+2. CSS Module은 보통 컴포넌트당 하나: `PostList.module.css`. 하나를 여럿이 공유하면 커질수록 추적이 어려움.
+3. `mocks/`(가짜 데이터)는 feature 안에 있어도 OK. MSW 같은 도구를 쓰면 보통 최상위로 이동.
+
+### 키워드
+App Router, Private Folder(`_`), Feature-based 구조, Barrel 파일(`index.ts`), CSS Modules
+
+---
+
+## 2. localStorage에 값 기억하기 (useSyncExternalStore)
+
+**질문:** 팔레트 선택을 기억하게 해줘. localStorage에 넣을 거야?
+
+**요약:** 네. 단, Next.js에서는 서버에 localStorage가 없으므로 "서버는 기본값 → 브라우저에서 저장값"으로 읽어야 한다.
+React 19에서는 `useSyncExternalStore`가 정석.
+
+### 핵심 내용
+- **localStorage**: 브라우저에 문자열을 영구 저장 (`setItem` / `getItem`). 새로고침해도 유지, 서버에서는 없음.
+- **Hydration**: 서버가 만든 HTML과 브라우저 첫 렌더 결과가 같아야 함. 처음부터 localStorage 값으로 그리면 불일치 에러.
+- 흔한 방법 `useEffect(() => setState(저장값), [])` → React 19 ESLint가 막음 (`set-state-in-effect`, 렌더가 두 번 일어남).
+- **useSyncExternalStore(subscribe, 브라우저값, 서버값)**
+ - `subscribe`: 값이 바뀔 때 React에 알려줄 방법 (여기선 `storage` 이벤트)
+ - 두 번째 인자: 브라우저에서 현재 값 읽기
+ - 세 번째 인자: 서버 렌더용 기본값 → hydration 문제 자동 해결
+- `storage` 이벤트는 **다른 탭**에서만 발생 → 같은 탭에선 직접 `dispatchEvent`로 알림. 덤으로 탭 간 동기화.
+- localStorage 값은 사용자가 조작 가능 → 읽을 때 허용된 값인지 검사 (`PALETTES.find`)
+- `try/catch`: 시크릿 모드 등에서 localStorage 접근이 실패할 수 있음.
+
+### 키워드
+localStorage, Hydration, useSyncExternalStore, storage 이벤트, You Might Not Need an Effect
+
+---
+
+## 3. IP로 접속하면 버튼이 안 눌리는 이유 (allowedDevOrigins)
+
+**증상:** `http://100.102.165.37:3000`으로 접속 → 화면은 보이는데 클릭 반응 없음.
+콘솔: `WebSocket connection to 'ws://.../_next/hmr' failed`
+
+**요약:** Next.js 개발 서버는 보안상 `localhost`가 아닌 주소에서 오는 개발용 요청(JS, HMR)을 막는다.
+→ `next.config.ts`의 `allowedDevOrigins`에 그 주소를 등록하면 해결.
+
+### 핵심 내용
+- **SSR vs Hydration**: 서버가 HTML을 먼저 보내서 화면은 보임. 클릭 같은 동작은 브라우저에서 JS가 붙어야(hydration) 작동.
+ JS가 막히면 "보이지만 죽은 화면"이 된다.
+- **HMR**(Hot Module Replacement): 코드 저장 시 새로고침 없이 반영하는 개발용 기능. WebSocket(`/_next/hmr`)으로 연결.
+- 설정:
+ ```ts
+ allowedDevOrigins: ["100.102.165.37"], // 호스트명만, http:// 와 포트 제외
+ ```
+- `next.config.ts`를 바꾸면 **개발 서버 재시작** 필요.
+- 개발 모드 전용 설정. 배포(`next build` / `next start`)와는 무관.
+
+### 키워드
+allowedDevOrigins, Hydration, HMR, WebSocket, Cross-origin
+
+---
+
+## 4. 새로고침 시 색 깜빡임 없애기 (FOUC 방지)
+
+**문제:** 저장된 색이 앰버여도 새로고침하면 잠깐 블루가 보였다가 바뀜.
+
+**요약:** 서버는 localStorage를 모르니 기본색으로 HTML을 보내고, React가 나중에 바꾸기 때문.
+→ ``의 짧은 인라인 스크립트가 **화면을 그리기 전에** ``를 붙이고, 색은 CSS가 담당.
+
+### 핵심 내용
+- **FOUC** (Flash of Unstyled/Incorrect Content): 잘못된 스타일이 잠깐 보이는 현상. 다크모드 깜빡임과 같은 문제.
+- 브라우저는 ``의 `