<commit_before>import React from 'react';
import PropTypes from 'prop-types';

import IconButton from 'material-ui/IconButton';
import NavigationBack from 'material-ui/svg-icons/navigation/arrow-back';

import Carousel from 'nuka-carousel';
import EventView from './EventView';
import WeatherView from './WeatherView';

const EVENT_LIST_SLIDE_TYPE = 'eventList';
const EVENT_SLIDE_TYPE = 'event';
const IMAGE_SLIDE_TYPE = 'image';
const WEATHER_SLIDE_TYPE = 'weather';

export default class PresentationView extends React.PureComponent {
  constructor(props) {
    super(props);

    this.state = {
      currentSlideIndex: 0,
      currentSlide: props.presentation.slides[0],
    };
  }

  componentDidMount() {
    const currentSlide = this.props.presentation.slides[0];

    this.props.setAppTitle(currentSlide.title);
    this.props.hideAppBar(currentSlide.type === IMAGE_SLIDE_TYPE && !this.props.interactiveMode);
  }

  componentWillUnmount() {
    clearInterval(this.state.progressRefreshInterval);
  }

  onSlideChange(index) {
    const currentSlide = this.props.presentation.slides[index];
    this.setState({
      currentSlide,
      currentSlideIndex: index,
    });

    // set title
    this.props.setAppTitle(currentSlide.title);
    this.props.hideAppBar(currentSlide.type === IMAGE_SLIDE_TYPE && !this.props.interactiveMode);

    scroll(0, 0);
  }

  // it's a bit ugly to have the presentation handle event details...
  setSelectedEvent(event) {<commit_msg>Fixed issue that would scroll to top on any touch event<commit_after>import React from 'react';
import PropTypes from 'prop-types';

import IconButton from 'material-ui/IconButton';
import NavigationBack from 'material-ui/svg-icons/navigation/arrow-back';

import Carousel from 'nuka-carousel';
import EventView from './EventView';
import WeatherView from './WeatherView';

const EVENT_LIST_SLIDE_TYPE = 'eventList';
const EVENT_SLIDE_TYPE = 'event';
const IMAGE_SLIDE_TYPE = 'image';
const WEATHER_SLIDE_TYPE = 'weather';

export default class PresentationView extends React.PureComponent {
  constructor(props) {
    super(props);

    this.state = {
      currentSlideIndex: 0,
      currentSlide: props.presentation.slides[0],
    };
  }

  componentDidMount() {
    const currentSlide = this.props.presentation.slides[0];

    this.props.setAppTitle(currentSlide.title);
    this.props.hideAppBar(currentSlide.type === IMAGE_SLIDE_TYPE && !this.props.interactiveMode);
  }

  componentWillUnmount() {
    clearInterval(this.state.progressRefreshInterval);
  }

  onSlideChange(index) {
    const currentSlide = this.props.presentation.slides[index];

    if (index === this.state.currentSlideIndex) return;

    this.setState({
      currentSlide,
      currentSlideIndex: index,
    });

    // set title
    this.props.setAppTitle(currentSlide.title);
    this.props.hideAppBar(currentSlide.type === IMAGE_SLIDE_TYPE && !this.props.interactiveMode);

    scroll(0, 0);
  }

  // it's a bit ugly to have the presentation handle event details...
  setSelectedEvent(event) {
{'fraction_non_alphanumeric': 0.11452879581151833, 'fraction_numerical': 0.0032722513089005235, 'mean_word_length': 4.270689655172414, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7224587', 'n_tokens_mistral': 968, 'n_tokens_neox': 935, 'n_words': 196}