import { useState, useEffect } from 'react' import { HashRouter, Routes, Route, Link } from 'react-router-dom' const API_BASE = 'https://glowstudio-api.up.railway.app/api' // Railway URL function formatCount(n: number): string { if (n >= 1000000) return (n / 1000000).toFixed(1) + 'M' if (n >= 1000) return (n / 1000).toFixed(1) + 'K' return n.toString() } interface Video { id: string text: string authorMeta: { name: string } videoMeta: { duration: number } playCount: number diggCount: number } // Home Page function Home() { return (
{/* Hero */}
AI 기반 K-뷰티 콘텐츠 운영체제

북미에서 먹히는
K-뷰티 콘텐츠를
만드세요

TikTok 트렌드 분석, AI 스크립트 생성, Gen Z 톤 변환까지

묣으로 시작하기 →
{/* Features */}

5가지 핵심 기능

{[ { emoji: '🔍', title: '디스커버', desc: '북미 트렌딩 콘텐츠 실시간 탐색' }, { emoji: '✍️', title: '생성', desc: 'AI 스크립트 3분 완성' }, { emoji: '📊', title: '분석', desc: '조회수와 전환율 동시 분석' }, { emoji: '🚀', title: '성장', desc: '브랜드 매칭으로 수익화' }, { emoji: '📦', title: '제품 허브', desc: '제품 링크 → 촬영 분석' }, ].map(f => (
{f.emoji}

{f.title}

{f.desc}

))}
) } // Discover Page - TikTok Search function Discover() { const [query, setQuery] = useState('kbeauty') const [videos, setVideos] = useState([]) const [loading, setLoading] = useState(false) const [apiConnected, setApiConnected] = useState(false) useEffect(() => { // Check API health fetch(`${API_BASE}/health`) .then(r => r.ok && setApiConnected(true)) .catch(() => {}) // Initial load search() }, []) async function search() { setLoading(true) try { const res = await fetch(`${API_BASE}/tiktok/search`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ hashtag: query.replace(/^#/, ''), limit: 12 }), }) if (!res.ok) throw new Error('API failed') const data = await res.json() setVideos(data.videos || []) } catch { // Mock fallback setVideos([ { id: '1', text: '이 선크림 진짜 미쳤어요 🔥', authorMeta: { name: 'glow_creator' }, videoMeta: { duration: 32 }, playCount: 2400000, diggCount: 180000 }, { id: '2', text: 'GRWM: 아침 스킨케어 루틴 ✨', authorMeta: { name: 'skincare_guru' }, videoMeta: { duration: 65 }, playCount: 1800000, diggCount: 120000 }, { id: '3', text: '$10으로 만드는 글래스 스킨', authorMeta: { name: 'beauty_by_jen' }, videoMeta: { duration: 45 }, playCount: 3200000, diggCount: 240000 }, { id: '4', text: 'POV: 한국 앰플 처음 써봤을 때', authorMeta: { name: 'kbeauty_lover' }, videoMeta: { duration: 28 }, playCount: 890000, diggCount: 67000 }, { id: '5', text: '30일 챌린지 결과 | 피부 변화', authorMeta: { name: 'glowwithme' }, videoMeta: { duration: 52 }, playCount: 1500000, diggCount: 98000 }, { id: '6', text: '이 제품이 내 인생을 바꿨어요', authorMeta: { name: 'skinroutine' }, videoMeta: { duration: 38 }, playCount: 4100000, diggCount: 320000 }, ]) } setLoading(false) } return (
{/* Header */}
GLOWSTUDIO AI 디스커버 {apiConnected ? 'TikTok 실시간 연동' : '샘플 데이터'}
{/* Search */}
setQuery(e.target.value)} onKeyDown={e => e.key === 'Enter' && search()} placeholder="#kbeauty, #grwm, #skincare" style={{ flex: 1, padding: '14px 20px', border: '2px solid #e5e5e5', borderRadius: 9999, fontSize: 16, outline: 'none' }} />
{/* Loading */} {loading &&
검색 중...
} {/* Videos */}
{videos.map(v => (
▶️
{v.text}
@{v.authorMeta.name} • {Math.floor(v.videoMeta.duration / 60)}:{(v.videoMeta.duration % 60).toString().padStart(2, '0')}
👁 {formatCount(v.playCount)} • ❤️ {formatCount(v.diggCount)}
))}
) } // App function App() { return ( } /> } /> ) } export default App