summaryrefslogtreecommitdiff
path: root/frontend/site/projects/museum/views/home.js
blob: 8ad8d4911f9d0c1540c1f1400158fc80300bc194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/**
 * 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 (
      <div
        ref={this.ref}
        className="home orange-text intro"
        onClick={this.handleClick}
      >
        <div className="home-byline byline-top">KW PRESENTS</div>
        <div className="home-title title-1">
          THE L<span>AST</span>
        </div>
        <div className="home-title title-2">MUSEUM</div>
        <div className="home-artists">
          <div>CHARLES STANKIEVECH</div>
          <div>NORA AL-BADRI</div>
          <div>JULIANA CERQUEIRA LEITE</div>
          <div>ZOHRA OPOKU</div>
          <div>NICOLE FORESHEW</div>
          <div>PETROS MORIS</div>
          <div>JAKRAWAL NILTHAMRONG</div>
        </div>
        <div className="home-byline byline-bottom">CURATED BY NADIM SAMMAN</div>
        <div className="home-message">
          The Last Museum hovers somewhere between life and death, lockdown and
          escape. Spanning six continents and too many screens, it is home to
          new muses - born of encounters between digital space and facts on the
          ground. It is web-site-specific. You are already here.
        </div>
        <div
          className={this.state.showCurtain ? "curtain" : "curtain hidden"}
        />
      </div>
    );
  }
}

const mapStateToProps = (state) => ({
  interactive: state.site.interactive,
  language: state.site.language,
});

export default connect(mapStateToProps)(Home);