M5: 포터블 exe 앱 (트레이·설정 창·첫 실행 마법사) + M6 사전 기능
- app/src/main: Electron 메인(트레이 상태 아이콘, 설정 창, 단일 실행, DPAPI safeStorage, 스모크 모드), IPC(window.gvr), 파인튜닝 관리 - app/src/renderer: 설정 8개 탭 + 5단계 첫 실행 마법사 (React) - electron-builder: GameVoiceRecorder.exe, zip(폴더 포터블) + 단일 exe 포터블, 워커·리소스 포함 - 사전: 사이트에서 단어·교정 규칙 추가/삭제(/api/dictionary), 게임 패치 이름 자동 추가, 묶음별 중복 허용 + DB 마이그레이션 - 사이트 서버: 종료 시 WebSocket 먼저 끊기(재시작 멈춤 수정) + 재연결 테스트 - scripts/finetune-e2e.mts, stt-eval.mts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
107
app/src/renderer/main.tsx
Normal file
107
app/src/renderer/main.tsx
Normal file
@@ -0,0 +1,107 @@
|
||||
// 겜녹이 설정 창 렌더러 진입점. 라우팅: #/wizard[/단계] · #/settings/<탭>
|
||||
import { useEffect, useState, type ReactNode } from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import tray from './assets/tray@2x.png';
|
||||
import { AppProvider, isMock, useApp } from './store';
|
||||
import './styles.css';
|
||||
import { AudioTab } from './tabs/AudioTab';
|
||||
import { DiagTab } from './tabs/DiagTab';
|
||||
import { DictTab } from './tabs/DictTab';
|
||||
import { DiscordTab } from './tabs/DiscordTab';
|
||||
import { GamesTab } from './tabs/GamesTab';
|
||||
import { GeneralTab } from './tabs/GeneralTab';
|
||||
import { StorageTab } from './tabs/StorageTab';
|
||||
import { SttTab } from './tabs/SttTab';
|
||||
import { Dot } from './ui';
|
||||
import { go } from './util';
|
||||
import { Wizard } from './wizard/Wizard';
|
||||
|
||||
const TABS: { id: string; icon: string; label: string; el: () => ReactNode }[] = [
|
||||
{ id: 'discord', icon: '🤖', label: '디스코드', el: () => <DiscordTab /> },
|
||||
{ id: 'games', icon: '🎯', label: '게임 연동', el: () => <GamesTab /> },
|
||||
{ id: 'stt', icon: '🧠', label: 'STT 모델', el: () => <SttTab /> },
|
||||
{ id: 'audio', icon: '🔊', label: '음성 처리', el: () => <AudioTab /> },
|
||||
{ id: 'dict', icon: '📖', label: '단어사전', el: () => <DictTab /> },
|
||||
{ id: 'storage', icon: '💾', label: '저장 · 사이트', el: () => <StorageTab /> },
|
||||
{ id: 'diag', icon: '🔬', label: '진단', el: () => <DiagTab /> },
|
||||
{ id: 'general', icon: '⚙️', label: '일반', el: () => <GeneralTab /> },
|
||||
];
|
||||
|
||||
function useHash(): string {
|
||||
const [h, setH] = useState(location.hash);
|
||||
useEffect(() => {
|
||||
const on = () => setH(location.hash);
|
||||
window.addEventListener('hashchange', on);
|
||||
return () => window.removeEventListener('hashchange', on);
|
||||
}, []);
|
||||
return h;
|
||||
}
|
||||
|
||||
function Router() {
|
||||
const { settings } = useApp();
|
||||
const hash = useHash();
|
||||
const parts = hash.replace(/^#\/?/, '').split('/');
|
||||
|
||||
// 첫 실행이면 마법사로, 주소가 비었으면 디스코드 탭으로
|
||||
useEffect(() => {
|
||||
if (!hash || hash === '#' || hash === '#/') go(settings.firstRunDone ? '#/settings/discord' : '#/wizard');
|
||||
}, [hash, settings.firstRunDone]);
|
||||
|
||||
const isWizard = parts[0] === 'wizard';
|
||||
useEffect(() => {
|
||||
document.title = isWizard ? '겜녹이 · 첫 실행 설정' : '겜녹이 · 설정';
|
||||
}, [isWizard]);
|
||||
|
||||
if (isWizard) return <Wizard step={Math.max(1, Math.min(5, Number(parts[1]) || 1))} />;
|
||||
const tab = TABS.find((t) => t.id === parts[1]) ?? TABS[0]!;
|
||||
return (
|
||||
<div className="app">
|
||||
<Nav current={tab.id} />
|
||||
<main className="content" key={tab.id}>
|
||||
{tab.el()}
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Nav({ current }: { current: string }) {
|
||||
const { state } = useApp();
|
||||
const bot = state.bot.status;
|
||||
const botTone = bot === 'ready' ? 'ok' : bot === 'connecting' ? 'warn' : bot === 'error' ? 'err' : 'off';
|
||||
const botText = bot === 'ready' ? (state.bot.recording.active ? '녹음 중' : '정상') : bot === 'connecting' ? '연결 중' : bot === 'error' ? '오류' : '꺼짐';
|
||||
const r = state.relay.state;
|
||||
const relayTone = r === 'online' ? 'ok' : r === 'connecting' ? 'warn' : r === 'error' ? 'err' : 'off';
|
||||
const relayText = r === 'online' ? '연결됨' : r === 'connecting' ? '연결 중' : r === 'error' ? '오류' : '미등록';
|
||||
return (
|
||||
<nav className="side">
|
||||
{TABS.map((t) => (
|
||||
<a key={t.id} href={`#/settings/${t.id}`} className={`tab ${t.id === current ? 'on' : ''}`}>
|
||||
<span className="ic">{t.icon}</span>
|
||||
{t.label}
|
||||
</a>
|
||||
))}
|
||||
<div className="nav-status">
|
||||
<div className="brand-mini">
|
||||
<img src={tray} alt="" />
|
||||
겜녹이 v{state.version}
|
||||
{isMock && <span className="badge mock">MOCK</span>}
|
||||
</div>
|
||||
<div title={state.bot.error ?? ''}>
|
||||
봇: <Dot tone={botTone} /> <span className={`t-${botTone}`}>{botText}</span>
|
||||
</div>
|
||||
<div title={state.relay.error ?? ''}>
|
||||
사이트 서버: <Dot tone={relayTone} /> <span className={`t-${relayTone}`}>{relayText}</span>
|
||||
</div>
|
||||
<div>
|
||||
STT 대기열 {state.stt.queue}건{state.stt.worker !== 'ready' && <span className="t-warn"> · 엔진 {state.stt.worker === 'starting' ? '시작 중' : '꺼짐'}</span>}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<AppProvider>
|
||||
<Router />
|
||||
</AppProvider>,
|
||||
);
|
||||
Reference in New Issue
Block a user