This commit is contained in:
dsyoon
2025-12-27 15:02:23 +09:00
parent 7b7e82873e
commit d68f3d03db
3 changed files with 25 additions and 11 deletions

View File

@@ -81,6 +81,13 @@ npm run dev # 개발 서버 (http://localhost:5173)
| marked 5 | Markdown → HTML 변환 | | marked 5 | Markdown → HTML 변환 |
| tesseract.js| 이미지 OCR | | tesseract.js| 이미지 OCR |
## 재빌드
```bash
npm run build
npm run preview # http://localhost:4173
```
## 빌드 & 미리보기 ## 빌드 & 미리보기
```bash ```bash
nvm use 20 nvm use 20
@@ -88,12 +95,6 @@ npm ci # (처음/의존성 변경 시 권장) 이미 설치돼 있으면 npm
npm run build npm run build
``` ```
## 재빌드
```bash
npm run build
npm run preview # http://localhost:4173
```
## 프로덕션 배포 (Apache) ## 프로덕션 배포 (Apache)
이 프로젝트는 기본적으로 API 호출을 `API_BASE_URL` 기준으로 수행합니다. 이 프로젝트는 기본적으로 API 호출을 `API_BASE_URL` 기준으로 수행합니다.

View File

@@ -58,7 +58,7 @@ export default function App() {
lecture: <LecturePage />, lecture: <LecturePage />,
// community 제거 // community 제거
login: <LoginPage onLoggedIn={() => { handleNavigate('chat'); }} />, login: <LoginPage onLoggedIn={() => { handleNavigate('chat'); }} />,
ai_news: <AiNewsPage />, ai_news: <AiNewsPage onNavigate={handleNavigate} />,
qna: <QnaPage />, qna: <QnaPage />,
}; };

View File

@@ -17,7 +17,7 @@ function normalizeExternalUrl(raw) {
return s; // leave as-is (could be relative path on same origin) return s; // leave as-is (could be relative path on same origin)
} }
export default function AiNewsPage() { export default function AiNewsPage({ onNavigate }) {
const { user } = useAuth(); const { user } = useAuth();
const [news, setNews] = useState([]); const [news, setNews] = useState([]);
const [newsOffset, setNewsOffset] = useState(0); const [newsOffset, setNewsOffset] = useState(0);
@@ -116,6 +116,10 @@ export default function AiNewsPage() {
const submitNews = async () => { const submitNews = async () => {
if (!newsUrl.trim()) return; if (!newsUrl.trim()) return;
if (!user) {
setNewsError('로그인 후 뉴스 등록이 가능합니다.');
return;
}
await fetch(`${API_BASE_URL}/community/ai_news`, { await fetch(`${API_BASE_URL}/community/ai_news`, {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
@@ -191,11 +195,20 @@ export default function AiNewsPage() {
</span> </span>
</div> </div>
)} )}
{user && !showNewsEditor && ( {!showNewsEditor && (
<button <button
onClick={() => setShowNewsEditor(true)} onClick={() => {
if (!user) {
// App 내부 라우팅(상태 기반) 지원
if (typeof onNavigate === 'function') onNavigate('login');
else window.location.href = '/login';
return;
}
setShowNewsEditor(true);
}}
className="btn btn-primary" className="btn btn-primary"
style={{ position: 'fixed', right: 24, bottom: 24, zIndex: 1000 }} style={{ position: 'fixed', right: 24, bottom: 24, zIndex: 1000, opacity: user ? 1 : 0.85 }}
title={user ? '뉴스 등록' : '로그인 후 사용 가능합니다'}
> >
뉴스등록 뉴스등록
</button> </button>