integratedhub/islands/OnboardingHashGate.tsx
2026-02-14 02:20:19 +00:00

24 lines
742 B
TypeScript

import { useEffect } from "preact/hooks";
export default function OnboardingHashGate() {
useEffect(() => {
const landlordSection = document.getElementById("landlord");
const tenantSection = document.getElementById("tenant");
if (!landlordSection || !tenantSection) return;
const applyHashState = () => {
const tenantOnly = globalThis.location.hash === "#tenant";
landlordSection.classList.toggle("hidden", tenantOnly);
tenantSection.classList.toggle("onboarding-tenant-full", tenantOnly);
};
applyHashState();
globalThis.addEventListener("hashchange", applyHashState);
return () => {
globalThis.removeEventListener("hashchange", applyHashState);
};
}, []);
return null;
}