Spaces:
Running
Running
File size: 2,446 Bytes
0daf81d 8ea8b32 0daf81d 8ea8b32 0daf81d 8ea8b32 0daf81d 8ea8b32 0daf81d 8ea8b32 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | import { lazy, Suspense, useState } from 'react'
import { Loader2 } from 'lucide-react'
import PackGallery from './components/PackGallery'
const LiveMaker = lazy(() => import('./components/LiveMaker'))
type Tab = 'maker' | 'gallery'
export default function App() {
const [tab, setTab] = useState<Tab>(() => (typeof window !== 'undefined' && window.location.hash === '#gallery' ? 'gallery' : 'maker'))
const go = (t: Tab) => {
setTab(t)
if (typeof window !== 'undefined') window.history.replaceState(null, '', t === 'gallery' ? '#gallery' : '#maker')
}
return (
<div className="min-h-screen bg-[#0d0d10] text-neutral-100">
<main className="mx-auto max-w-6xl px-5 pb-24 pt-8 sm:px-8">
<nav className="mb-8 flex items-center justify-between gap-4">
<div className="text-sm font-semibold tracking-wide text-neutral-300">
这个用英语怎么说<span className="text-[#ff3b5c]">?</span>
</div>
<div className="flex rounded-full border border-white/10 p-1 text-sm">
{([['maker', '实况图制作工具'], ['gallery', '示例素材包']] as const).map(([k, l]) => (
<button
key={k}
type="button"
onClick={() => go(k)}
className={`rounded-full px-4 py-1.5 transition ${tab === k ? 'bg-white font-semibold text-neutral-900' : 'text-neutral-300 hover:text-white'}`}
>
{l}
</button>
))}
</div>
</nav>
{tab === 'maker' ? (
<>
<header className="mb-8 max-w-3xl">
<h1 className="text-3xl font-black leading-tight tracking-tight sm:text-4xl">自己做「这个用英语怎么说?」实况图</h1>
<p className="mt-3 text-[15px] leading-7 text-neutral-400">
放一张底图,填上单词和中文,选好读音、音效和样式,直接导出苹果实况照片(JPG + MOV,带声音)。不需要 AI:读音可以用维基共享资源的真人录音、你自己的录音或上传的音频。
</p>
</header>
<Suspense fallback={<div className="flex items-center gap-2 text-neutral-400"><Loader2 className="h-4 w-4 animate-spin" />加载中</div>}>
<LiveMaker />
</Suspense>
</>
) : (
<PackGallery />
)}
</main>
</div>
)
}
|