// ============================================================
// APP — hash routing across Home/Work/Services/About/Insights/Contact
// ============================================================
function useHashRoute() {
const parseHash = () => {
const h = (window.location.hash || '#home').replace(/^#/, '');
const [path] = h.split('/');
return path || 'home';
};
const [route, setRoute] = React.useState(parseHash);
React.useEffect(() => {
const handler = () => setRoute(parseHash());
window.addEventListener('hashchange', handler);
return () => window.removeEventListener('hashchange', handler);
}, []);
const navigate = React.useCallback((id, subpath) => {
const hash = subpath ? `${id}/${subpath}` : id;
window.location.hash = hash;
}, []);
return [route, navigate];
}
function BackToTop() {
const [visible, setVisible] = React.useState(false);
React.useEffect(() => {
const onScroll = () => setVisible(window.scrollY > 600);
window.addEventListener('scroll', onScroll, { passive: true });
return () => window.removeEventListener('scroll', onScroll);
}, []);
return (
);
}
function App() {
const [route, navigate] = useHashRoute();
// Sub-route id (e.g. case study id) — not used to render distinct page
// but kept for future expansion. For now Work cases just scroll to top of work.
const [caseOpen, setCaseOpen] = React.useState(null);
React.useEffect(() => {
window.scrollTo({ top: 0, behavior: 'instant' });
}, [route]);
// Page titles
React.useEffect(() => {
const titles = {
home: 'inevidence — Customer-powered growth',
work: 'Work — inevidence',
services: 'Services — inevidence',
about: 'About — inevidence',
insights: 'Insights — inevidence',
contact: 'Let’s talk — inevidence',
};
document.title = titles[route] || 'inevidence';
}, [route]);
const onOpenCase = (id) => {
// Stub — surfaces visually with a brief inline highlight; full case-study page TBD
setCaseOpen(id);
setTimeout(() => setCaseOpen(null), 1800);
};
return (
<>
{route === 'home' && (
<>