integratedhub/islands/OnboardingHashGate.tsx
2026-01-20 09:02:26 -06:00

24 lines
721 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 = window.location.hash === "#tenant";
landlordSection.classList.toggle("hidden", tenantOnly);
tenantSection.style.gridColumn = tenantOnly ? "1 / -1" : "";
};
applyHashState();
window.addEventListener("hashchange", applyHashState);
return () => {
window.removeEventListener("hashchange", applyHashState);
};
}, []);
return null;
}