mirror of
https://github.com/hanzoai/site.git
synced 2026-11-21 01:07:08 +00:00
hanzo.ai's funnels read the events hanzo-inc/app fires on its landing,
and they stop counting when hanzo.ai moves to this site. Fire them here
under the same names with the same params, at the same actions:
home_viewed the hero is drawn
cta_clicked any link in main, with its band as `section`
hero_demo sidebar, account, the phone's Chat and Dev,
Download App
home_copied the terminal, the install lines, the tour
setup_prompt_copied, agent_menu_toggled, setup_agent_chosen
the setup prompt's three moves, in Hanzo.Start
only, as in the app
agent_step_opened, agent_script_shown, agent_step_copied,
agent_script_copied the agent script
search_performed the palette's question and the models search
Mark the bands the app marks for $view with data-hz-view: models,
products (on the journey too), compatible, works-with, faster, cheaper,
pareto, open-source, plans and trusted on the landing, race on /dev,
research and trusted on /investors.
A press on a link to a page of this site never reaches an onClick:
components/Morph.jsx takes it over at the top of the capture phase and
stops it. press() reads such a link where Morph does. Morph also took
/skill.md for a page, so "Copy setup prompt" navigated instead of
copying; a .md file is no page, like a .txt.
Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
14 lines
880 B
JavaScript
14 lines
880 B
JavaScript
/* A press on a link to a page of this site is taken over by the page transition (components/Morph.jsx), at the top of the
|
|
capture phase, and stopped there: a handler on the link, or on anything below the document, never hears it. A moment that
|
|
belongs to such a link is read where the transition reads it, on the document in the capture phase, like the funnel's
|
|
own (components/Telemetry.jsx). `on` is a selector or an element; `fire(el, event)` hears each press on a match.
|
|
Returns the cleanup, so an effect can hand it back. */
|
|
export function press(on, fire) {
|
|
const click = (e) => {
|
|
const el = typeof on === 'string' ? e.target?.closest?.(on) : on?.contains(e.target) ? on : null;
|
|
if (el) fire(el, e);
|
|
};
|
|
document.addEventListener('click', click, { capture: true });
|
|
return () => document.removeEventListener('click', click, { capture: true });
|
|
}
|