mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-29 07:20:43 +00:00
@hanzo/ui's Corner, mounted once (components/shell/help.tsx): Get help (/support), Docs (docs.hanzo.ai, a new tab) and Contact us (/contact), then Theme and Language. It sits at the start corner, so Arabic puts it bottom-right. No Currency row: hanzo.ai bills in US dollars only. Language is lib/language.ts, now in Corner's shape: @hanzo/i18n's registry less the locales waiting for review, each in its own script with its English name to search by, and the i18n setter, which sets <html lang dir>. Not drawn in the app: the rooms and the app at /, /dev and /studio keep the account at the rail's foot, bottom-left, and their Settings holds the preferences there. /dashboard joins the rooms' table. Not drawn while the cookie banner asks, so the two never share the foot. /start's composer band now clears the start side on a phone, where it cleared the end for the help mark removed earlier, and the corner mounts after the page so it paints over that band. Gate: e2e/gates/help.spec.ts.
31 lines
1.4 KiB
TypeScript
31 lines
1.4 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
||
import { locales } from '@hanzo/i18n'
|
||
import { offered } from '../../lib/language'
|
||
|
||
/**
|
||
* THE CORNER OFFERS WHAT THE PICKER OFFERS.
|
||
*
|
||
* `offered` is what hanzo.ai hands the corner control; Settings → General draws
|
||
* @hanzo/i18n's own `LanguagePicker`. Both follow one rule: every locale but
|
||
* those waiting for a native reader, and the reader's own language whatever it
|
||
* is. Held against the registry, so a locale cleared from review appears in
|
||
* both at once.
|
||
*/
|
||
|
||
const waiting = locales.filter((l) => l.review).map((l) => l.code)
|
||
|
||
test('every language a native reader has cleared, named in its own script, its English name to search by, with its direction', () => {
|
||
const list = offered('en-US')
|
||
expect(list.map((l) => l.code)).toEqual(locales.filter((l) => !l.review).map((l) => l.code))
|
||
expect(list.find((l) => l.code === 'ar')).toEqual({ code: 'ar', label: 'العربية', hint: 'Arabic', dir: 'rtl' })
|
||
expect(list.find((l) => l.code === 'en-US')?.dir).toBe('ltr')
|
||
})
|
||
|
||
test('a language waiting for review is not offered, unless it is the reader’s own', () => {
|
||
expect(waiting.length, 'the registry marks some as waiting').toBeGreaterThan(0)
|
||
for (const code of waiting) {
|
||
expect(offered('en-US').map((l) => l.code)).not.toContain(code)
|
||
expect(offered(code).map((l) => l.code)).toContain(code)
|
||
}
|
||
})
|