<commit_before>/* @flow */
import { addNewAnimation, selectAnimation } from 'Actions/animations';
import { Avatar, Divider, List, ListItem, Paper } from 'material-ui';
import { connect } from 'react-redux';
import { t } from 'i18next';
import AnimationInMenu from './AnimationInMenu';
import NotificationMms from 'material-ui/svg-icons/notification/mms';
import NotificationSms from 'material-ui/svg-icons/notification/sms';
import Radium from 'radium';
import React from 'react';
import type { Animation } from 'Reducer';
import type { Map } from 'immutable';

type Props = {
  animations?: Map<string, Animation>,
  selectedId?: ?string,
  addNewAnimationAction: typeof addNewAnimation,
};

const style = {
  wrap: {
    alignItems: 'center',
    display: 'flex',
    // flex: '0 0 20%',
    flexDirection: 'column',
    paddingTop: 10,
    paddingLeft: 15,
    paddingRight: 15,
  },
};

class Menu extends React.Component<Props> {

  constructor(props) {
    super(props);
    const { animations, selectAnimationAction } = this.props
    if((/Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent))) {
      if(animations.toList().size == 0) {
        this.addNewAnimationText();
      }
      selectAnimationAction(animations.toList().get(0));
    }
  }



  addNewAnimationText = () => {
    this.props.addNewAnimationAction('text');
  };
  addNewAnimation = () => {
    this.props.addNewAnimationAction('pixel');
  };

  render() {
    const { animations, selectedId } = this.props;

    if (!animations) {
      return null;
    }
<commit_msg>automatically open first text animation on mobile (closed menu), automatically add a new text animation, if no is existing<commit_after>/* @flow */
import { addNewAnimation, selectAnimation } from 'Actions/animations';
import { Avatar, Divider, List, ListItem, Paper } from 'material-ui';
import { connect } from 'react-redux';
import { t } from 'i18next';
import AnimationInMenu from './AnimationInMenu';
import NotificationMms from 'material-ui/svg-icons/notification/mms';
import NotificationSms from 'material-ui/svg-icons/notification/sms';
import Radium from 'radium';
import React from 'react';
import type { Animation } from 'Reducer';
import type { Map } from 'immutable';

type Props = {
  animations?: Map<string, Animation>,
  selectedId?: ?string,
  addNewAnimationAction: typeof addNewAnimation,
};

const style = {
  wrap: {
    alignItems: 'center',
    display: 'flex',
    // flex: '0 0 20%',
    flexDirection: 'column',
    paddingTop: 10,
    paddingLeft: 15,
    paddingRight: 15,
  },
};

class Menu extends React.Component<Props> {

  constructor(props) {
    super(props);
    const { animations, selectAnimationAction } = this.props;
    var animation;
    if((/Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent))) {
      if(animations.toList().size == 0) {
        animation = this.props.addNewAnimationAction('text').payload;
      }
      selectAnimationAction(animation || animations.toList().get(0));
    }
  }



  addNewAnimationText = () => {
    this.props.addNewAnimationAction('text');
  };
  addNewAnimation = () => {
    this.props.addNewAnimationAction('pixel');
  };

  render() {
    const { animations, selectedId } = this.props;

    if (!animations) {
      return null;
    }

{'fraction_non_alphanumeric': 0.13875453446191052, 'fraction_numerical': 0.008464328899637243, 'mean_word_length': 3.873343151693667, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '1515961', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1003, 'n_words': 244}