/** * Start page interaction */ import React, { Component } from "react"; import { connect } from "react-redux"; import { history } from "site/store"; import actions from "site/actions"; import "./home.css"; let clicked = false; let started = false; class Home extends Component { constructor(props) { super(props); this.ref = React.createRef(); this.handleClick = this.handleClick.bind(this); this.state = { open: false, hidden: this.props.interactive, showCurtain: true, }; } componentDidMount() { const roadblock = document.querySelector(".roadblock"); if (roadblock) roadblock.style.display = "none"; setTimeout(() => { this.setState({ showCurtain: false }); }, 100); } handleClick(e) { e && e.preventDefault(); actions.site.interact(); this.index = 0; const FLASH_TIME = 150; const order = [ ["home orange-text intro", FLASH_TIME], ["home white-text orange-bg", FLASH_TIME], ["home orange-text white-bg", FLASH_TIME], ["home white-text orange-bg", FLASH_TIME], ["home orange-text white-bg", FLASH_TIME], ["home white-text orange-bg", FLASH_TIME], ]; const go = () => { clearTimeout(this.timeout); const item = order[this.index]; if (item) { this.ref.current.className = item[0]; this.index += 1; this.timeout = setTimeout(go, item[1]); } else { this.ref.current.className = "home orange-text intro hidden"; clicked = true; } }; if (!clicked) { go(); } else if (!started) { this.ref.current.className = "home orange-text black-bg open"; setTimeout(() => { started = true; }, 200); } else { this.ref.current.className = "home orange-text orange-bg open"; setTimeout(() => { history.push("/thelastmuseum/egill-intro"); }, FLASH_TIME); } } render() { return (