<commit_before>/** @jsx h */
import { h, Component } from 'preact';

import './style.scss';

import Room from '../../components/Room';
import Align from '../../components/Align';
import ButtonItem from '../../components/ButtonItem';
import ShareButtons from '../../components/ShareButtons';
import ThanksTimeline from '../../components/ThanksTimeline';
import audio from '../../audio';
import viewer from '../../viewer';

import transition from '../../transition';

export default class Submission extends Component {
  constructor() {
    super();
    this.state = {
      loading: 'Loading performance…',
    };

    this.shareURL = {
      googlePlus: 'https://plus.google.com/share?url=',
      twitter: 'https://twitter.com/intent/tweet?text=',
      facebook: 'https://www.facebook.com/sharer/sharer.php?u=',
    };

    this.gotoPlayback = this.gotoPlayback.bind(this);
    this.onRoomLoadError = this.onRoomLoadError.bind(this);
    this.gotoCreateGif = this.gotoCreateGif.bind(this);
  }

  componentDidMount() {
    this.mounted = true;
    this.asyncMount();
  }

  componentWillUnmount() {
    this.mounted = false;
    audio.fadeOut();
  }

  onRoomLoadError() {
    window.location = '/'; // If the room was deleted, redirect to homepage
  }

  gotoCreateGif() {
    this.props.goto('gif');
  }

  async asyncMount() {
    viewer.exitPresent();
    transition.reset();
  }

  gotoPlayback() {
    this.props.goto('playback');
  }

  render({ roomId, id, fromRecording }) {
    return (
      <div className="submission">
        <Room
          roomId={roomId}
          id={id}
          orbs
          onRoomLoadError={this.onRoomLoadError}
        >
          <ThanksTimeline fromRecording={fromRecording} />
        </Room>
        <Align type="bottom-right">
          <ButtonItem
            text={fromRecording
              ? `Watch yourself in the
full experience`
              : 'Watch in full experience'
            }
            onClick={this.gotoPlayback}
            underline
          />
        </Align>
        { fromRecording &&
          <ShareButtons roomId={roomId} id={id}>
            <ButtonItem text="Create animated GIF" onClick={this.gotoCreateGif} underline />
          </ShareButtons>
        }
      </div>
    );
  }
}<commit_msg>fix going to playback from submission<commit_after>/** @jsx h */
import { h, Component } from 'preact';

import './style.scss';

import Room from '../../components/Room';
import Align from '../../components/Align';
import ButtonItem from '../../components/ButtonItem';
import ShareButtons from '../../components/ShareButtons';
import ThanksTimeline from '../../components/ThanksTimeline';
import audio from '../../audio';
import viewer from '../../viewer';

import transition from '../../transition';

export default class Submission extends Component {
  constructor() {
    super();
    this.state = {
      loading: 'Loading performance…',
    };

    this.shareURL = {
      googlePlus: 'https://plus.google.com/share?url=',
      twitter: 'https://twitter.com/intent/tweet?text=',
      facebook: 'https://www.facebook.com/sharer/sharer.php?u=',
    };

    this.onRoomLoadError = this.onRoomLoadError.bind(this);
    this.gotoCreateGif = this.gotoCreateGif.bind(this);
  }

  componentDidMount() {
    this.mounted = true;
    this.asyncMount();
  }

  componentWillUnmount() {
    this.mounted = false;
    audio.fadeOut();
  }

  onRoomLoadError() {
    window.location = '/'; // If the room was deleted, redirect to homepage
  }

  gotoCreateGif() {
    this.props.goto('gif');
  }

  async asyncMount() {
    viewer.exitPresent();
    transition.reset();
  }

  render({ roomId, id, fromRecording }) {
    return (
      <div className="submission">
        <Room
          roomId={roomId}
          id={id}
          orbs
          onRoomLoadError={this.onRoomLoadError}
        >
          <ThanksTimeline fromRecording={fromRecording} />
        </Room>
        <Align type="bottom-right">
          <ButtonItem
            text={fromRecording
              ? `Watch yourself in the
full experience`
              : 'Watch in full experience'
            }
            onClick={this.props.onGotoFullExperience}
            underline
          />
        </Align>
        { fromRecording &&
          <ShareButtons roomId={roomId} id={id}>
            <ButtonItem text="Create animated GIF" onClick={this.gotoCreateGif} underline />
          </ShareButtons>
        }
      </div>
    );
  }
}
{'fraction_non_alphanumeric': 0.14782608695652175, 'fraction_numerical': 0.0, 'mean_word_length': 2.3131462333825703, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2629030', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1300, 'n_words': 275}