mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-29 07:20:43 +00:00
Every import, the catalog pin and the docs name @hanzo/app and github.com/hanzoai/app. lib/rooms.ts is lib/app.ts and components/rooms.tsx is components/app.tsx.
56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
'use client'
|
|
|
|
/**
|
|
* The visit is counted where it arrived, then the reader goes to the chat.
|
|
*
|
|
* The tag manager (app/providers.tsx `startTags`) loads the tags the visitor's
|
|
* choice and region allow, from the site's tag set: hanzo.chat's own GA4 stream
|
|
* and the Meta Pixel, beside our stream's `$pageview`. The page leaves once they
|
|
* have taken the page view (`tagsReady`) or after LIMIT, whichever is first, so
|
|
* a blocked tag never holds a reader here. A tag the choice does not load is not
|
|
* waited for. `authorize` carries the visitor to hanzo.ai and sends our stream's
|
|
* queue before the page goes. The query and fragment ride along, so
|
|
* hanzo.chat/?q=… asks the chat.
|
|
*/
|
|
|
|
import { useEffect } from 'react'
|
|
import { Box } from '@hanzo/ui'
|
|
import { Line } from '@hanzo/ui/marketing'
|
|
import { authorize, tagsReady } from '@hanzo/app/lib/tags'
|
|
import { WEB } from '@hanzo/app/lib/host'
|
|
|
|
/** The longest a reader waits on the tags. */
|
|
const LIMIT = 3000
|
|
|
|
/** Time for the last hit a tag queued to leave before the page does. */
|
|
const BEAT = 250
|
|
|
|
export default function Forward() {
|
|
useEffect(() => {
|
|
let timer = 0
|
|
let gone = false
|
|
void tagsReady(LIMIT).then(() => {
|
|
if (gone) return
|
|
timer = window.setTimeout(() => {
|
|
const { search, hash } = window.location
|
|
window.location.replace(authorize(`${WEB}${search}${hash}`))
|
|
}, BEAT)
|
|
})
|
|
return () => {
|
|
gone = true
|
|
window.clearTimeout(timer)
|
|
}
|
|
}, [])
|
|
|
|
return (
|
|
<Box display="flex" flexDirection="column" minH="100vh" bg="$background" items="center" justify="center" gap="$3">
|
|
<Line render="h1" display="block" fontSize="$4" fontWeight="500" color="var(--foreground)">
|
|
Opening Hanzo Chat…
|
|
</Line>
|
|
<Line href={WEB} fontSize="$2" color="color-mix(in oklab, var(--pure-white) 50%, transparent)">
|
|
hanzo.ai/chat
|
|
</Line>
|
|
</Box>
|
|
)
|
|
}
|