feat : 알림 메시지를 TUI 스타일 팝업(<dialog>)으로 표시
SpecialSource Frontend (React) CD / deploy (push) Successful in 13s

- 이중선 테두리·그림자·[ 확인 ] 버튼의 DOS 대화상자 스타일, 팔레트 색 따라감
- Enter·Esc·클릭으로 닫으면 명령 입력창으로 포커스 복귀
- 입력창 Enter에서 preventDefault: 같은 Enter로 팝업이 바로 닫히던 문제 방지

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
headporterandClaude Opus 5.5 committed 2026-11-25 16:59:04 +09:00
1 parent 4bbf5c1ba4
commit ca4df3e9a3
2 files changed
+36 -1

No files matched your search

+19 -1
View File
@@ -97,6 +97,14 @@ export default function BbsTerminal() {
};
}, [feedKind, feedBoard, state.token, state.rev]);
// 오류·안내 메시지가 생기면 팝업으로 띄우고, 다른 경로로 지워지면 닫음
const dialogRef = useRef<HTMLDialogElement>(null);
useEffect(() => {
const d = dialogRef.current;
if (state.error && !d?.open) d?.showModal();
else if (!state.error && d?.open) d.close();
}, [state.error]);
// 무한 스크롤: 목록 맨 아래가 보이면 다음 페이지를 불러와 이어 붙임 (붙일지 말지는 execute가 판단)
const loadMore = () => {
const f = state.feed;
@@ -244,10 +252,18 @@ export default function BbsTerminal() {
{state.screen === "post" && state.token && (
<PostDetail post={state.feed?.posts.find((p) => p.id === state.postId)} token={state.token} />
)}
{state.error && <div className={`${styles.full} ${styles.error}`}>{state.error}</div>}
</div>
</div>
{/* 알림 팝업: <dialog>.showModal()이 화면 맨 위에 띄우고 뒤를 막음. Esc·확인으로 닫으면 입력창으로 포커스가 돌아감 */}
<dialog ref={dialogRef} className={styles.dialog} onClose={() => dispatch({ error: null })}>
<span className={styles.cap}>═ 알림 ═</span>
<p>{state.error}</p>
<form method="dialog">
<button autoFocus>확인</button>
</form>
</dialog>
<div className={styles.cmdline}>
<label htmlFor="bbs-cmd" className={styles.prompt}>
선택 &gt;
@@ -260,6 +276,8 @@ export default function BbsTerminal() {
onChange={(e) => setInput(e.target.value)}
onKeyDown={(e) => {
if (e.key !== "Enter" || e.nativeEvent.isComposing) return;
// 기본 동작을 막아야 이어지는 keypress가 안 생김. 안 막으면 명령 실행으로 뜬 알림 팝업의 [확인]이 같은 Enter로 바로 눌림
e.preventDefault();
dispatch(input);
setInput("");
}}