Download code/web/src/App.tsx from MiniMaxAI/oss-ecosystem-data: direct link, hf CLI and curl.
- Browser
- Download file 939 Bytes
-
https://huggingface.co/datasets/MiniMaxAI/oss-ecosystem-data/resolve/f660f69a80e04e319d382505deb00b8b3e642feb/code/web/src/App.tsx
- Command line
-
hf download hf://datasets/MiniMaxAI/oss-ecosystem-data@f660f69a80e04e319d382505deb00b8b3e642feb/code/web/src/App.tsx
-
curl -L -o App.tsx https://huggingface.co/datasets/MiniMaxAI/oss-ecosystem-data/resolve/f660f69a80e04e319d382505deb00b8b3e642feb/code/web/src/App.tsx
939 Bytes
| import { useEffect, useState } from "react" | |
| import type { Site } from "@/lib/types" | |
| import { useRoute } from "@/lib/route" | |
| import { Home } from "@/pages/home" | |
| import { CategoryPage } from "@/pages/category" | |
| export default function App() { | |
| const [site, setSite] = useState<Site | null>(null) | |
| const [failed, setFailed] = useState(false) | |
| const route = useRoute() | |
| useEffect(() => { | |
| fetch("data/site.json") | |
| .then((r) => (r.ok ? r.json() : Promise.reject(r.status))) | |
| .then(setSite) | |
| .catch(() => setFailed(true)) | |
| }, []) | |
| useEffect(() => { | |
| if (!route.cat) document.title = "MiniMax Ecosystem" | |
| }, [route.cat]) | |
| if (failed) return <p className="p-10 text-lg">The data did not load. Try refreshing the page.</p> | |
| if (!site) return <div className="dark stage min-h-screen" /> | |
| return route.cat | |
| ? <CategoryPage key={route.cat} site={site} cat={route.cat} rel={route.rel} /> | |
| : <Home site={site} /> | |
| } | |