mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-28 07:32:52 +00:00
The bar is Models, Dev, Platform, Pricing, Docs, Enterprise, Log in, and Get API key. The homepage is seven sections. Launch pages stay in the tree and drop out of the index through lib/launch.ts. /platform forwards to /cloud. Model and repository floors come from the snapshots the build already keeps. Co-authored-by: z <[email protected]>
39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
'use client'
|
|
|
|
/**
|
|
* How many models Hanzo serves, as the price list counts itself (GET
|
|
* /v1/pricing/summary), read when the page opens. No count is typed and none
|
|
* is baked: a phrase that states one says "every model on the gateway" until
|
|
* the count is read, and keeps saying it if the backend does not answer.
|
|
*/
|
|
|
|
import { useI18n } from '@hanzo/i18n/react'
|
|
import { Text } from '@hanzo/ui'
|
|
import { ready, useSummary } from '@/lib/api/use'
|
|
import type { Summary } from '@/lib/api/read'
|
|
import { MODEL_COUNT } from '@/lib/counts'
|
|
|
|
/**
|
|
* Floored to the hundred, so copy says "400+" for 438 and keeps saying it at
|
|
* 499. Rounding up would advertise models nobody serves.
|
|
*/
|
|
const floor = (n: number) => Math.floor(n / 100) * 100
|
|
|
|
/** "500+ models", or "every model on the gateway" until the count is read. */
|
|
export function Models() {
|
|
const { t } = useI18n()
|
|
const n = ready(useSummary())?.totalModels ?? MODEL_COUNT
|
|
return <>{t('{n}+ models', { n: floor(n) || n })}</>
|
|
}
|
|
|
|
/** One of the price list's own counts, set as a figure; an ellipsis until it is read, a dash when it cannot be. */
|
|
export function Tally({ of }: { of: keyof Pick<Summary, 'totalModels' | 'providers' | 'freeModels'> }) {
|
|
const reading = useSummary()
|
|
const doc = ready(reading)
|
|
return (
|
|
<Text fontWeight="500" color="$ink" data-tally={of} data-api={reading.state}>
|
|
{doc ? doc[of] : of === 'totalModels' && reading.state === 'loading' ? MODEL_COUNT : reading.state === 'loading' ? '…' : '—'}
|
|
</Text>
|
|
)
|
|
}
|