mirror of
https://github.com/hanzo-apps/magazine.git
synced 2026-10-30 19:11:40 +00:00
Real Hanzo-stack starter: Vite + React 19 + @hanzo/gui + @hanzo/iam + @hanzo/base. Three editorial views (newsstand, issue contents, article read) built from @hanzo/gui primitives; black/white/one-hot-red magazine design in src/press.tsx. schema.sql provisions org-scoped issues + articles collections. tsc + vite build green.
29 lines
987 B
TypeScript
29 lines
987 B
TypeScript
import { useIam } from '@hanzo/iam/react'
|
|
import { YStack, Spinner } from '@hanzo/gui'
|
|
import { Callback } from './auth/callback'
|
|
import { SignedOut } from './views/signed-out'
|
|
import { Shell } from './views/shell'
|
|
import { paper, red } from './press'
|
|
|
|
/**
|
|
* Top-level route + auth gate — no router dependency (one static SPA):
|
|
* /auth/callback → finish the PKCE exchange, then land on the newsstand
|
|
* signed out → the cover
|
|
* signed in → the magazine (newsstand → issue → article)
|
|
*/
|
|
export function App() {
|
|
const { isAuthenticated, isLoading } = useIam()
|
|
|
|
if (typeof window !== 'undefined' && window.location.pathname.startsWith('/auth/callback')) {
|
|
return <Callback />
|
|
}
|
|
if (isLoading) {
|
|
return (
|
|
<YStack flex={1} minHeight="100vh" alignItems="center" justifyContent="center" backgroundColor={paper}>
|
|
<Spinner size="large" color={red} />
|
|
</YStack>
|
|
)
|
|
}
|
|
return isAuthenticated ? <Shell /> : <SignedOut />
|
|
}
|