mirror of
https://github.com/hanzoai/site.git
synced 2026-11-20 21:14:28 +00:00
* Type scripts under strict Playwright's API the checks use is declared in host.ts (the package is the app repo's); caught errors read through why(). tabs-tree.test waits for the typed tabsTree. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type the shared components under strict Window globals (__lenis, __hzHold, google) and the two react-dom calls are declared in components/*.d.ts, since @types/react-dom is not a dependency and the lockfile is frozen. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type components/v2 under strict Props, state, refs and DOM events in the 93 v2 files. A2Motion's easing tuples are as const. Two real bugs: x-archimedes/MaskLines imported a NoJs that does not exist, and x-hypatia/PinChapters returned the element from a ref callback, which React 19 reads as a cleanup. AppSheet no longer sets aria-label to a JSX label. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type components/home under strict The race, cost and frontier figures, the plan cards, the repository card and the product stories take Run, Models and Plan types from lib. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type the hero devices and the app routes under strict HeroScene and its parts describe hero-scenes.json; the [slug] pages take params as a Promise, and metadata and viewport carry Next's types. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Give the integrations previews their Preview type Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Use the bench Card type for the closing cards Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
30 lines
2.2 KiB
TypeScript
30 lines
2.2 KiB
TypeScript
// Read what Hanzo's signed-out header controls show (language, log in, search) so the rebuild keeps all of it.
|
|
// Usage: node scripts/header-menus.mjs
|
|
import puppeteer from 'puppeteer-core';
|
|
import { lock } from './lock.ts';
|
|
await lock();
|
|
|
|
const b = await puppeteer.launch({ executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', headless: true });
|
|
const p = await b.newPage();
|
|
await p.setViewport({ width: 1470, height: 900 });
|
|
await p.goto('https://hanzo.ai/', { waitUntil: 'networkidle2' });
|
|
const W = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
|
const dump = (label: string) => p.evaluate((label) => {
|
|
const vis = [...document.querySelectorAll<HTMLElement>('[role=menu],[role=dialog],[role=listbox],[data-state=open]')].filter((e) => e.offsetHeight > 30);
|
|
return label + ' :: ' + vis.map((v) => v.getAttribute('role') + ' | ' + v.innerText.replace(/\n+/g, ' ; ').slice(0, 2500) + ' | links: ' + [...v.querySelectorAll('a')].map((a) => a.getAttribute('href')).join(' ')).join(' ### ');
|
|
}, label);
|
|
const clickText = async (text: string) => {
|
|
for (const x of await p.$$('header button')) {
|
|
if ((await x.evaluate((e) => e.textContent.trim())) === text) { await x.click(); return true; }
|
|
}
|
|
return false;
|
|
};
|
|
// the cookie notice is taken out of this throwaway page (no choice is made on it), so it does not cover the menus
|
|
const banner = await p.evaluate(() => { const d = [...document.querySelectorAll<HTMLElement>('[role=dialog]')].find((x) => /Essential cookies/.test(x.innerText)); const html = d ? d.outerHTML.length + ' chars | ' + d.innerText.replace(/\n+/g, ' ; ') + ' | buttons: ' + [...d.querySelectorAll('button,a')].map((x) => x.textContent.trim()).join(' / ') : 'none'; d?.remove(); return html; });
|
|
console.log('COOKIES ::', banner);
|
|
await p.click('header button[aria-label^="Language"]'); await W(800); console.log(await dump('LANG')); await p.keyboard.press('Escape'); await W(400);
|
|
await clickText('Log in'); await W(800); console.log(await dump('LOGIN')); await p.keyboard.press('Escape'); await W(400);
|
|
await p.click('header button[aria-label^="Search"]'); await W(800); console.log(await dump('SEARCH'));
|
|
await p.keyboard.type('pricing'); await W(1800); console.log(await dump('SEARCH pricing'));
|
|
await b.close();
|