import React, { Image, Component, Text, View, TouchableHighlight, StyleSheet, AsyncStorage } from 'react-native';
import Video from 'react-native-video';
import moment from 'moment';

import User from '../models/User';

export default class NavigationView extends Component {
  constructor(props) {
    super(props);
    this.state = {
      user: { gravatar: '' }
    };
  }

  onSelect(item) {
    this.props.parent.drawer.closeDrawer();
    this.props.navigator.replace({ name: item });
  }

  componentDidMount() {
    AsyncStorage.getItem('UserDetails').then((userData) => {
      let user = new User(JSON.parse(userData));
      this.setState({ user: user });
    });
  }

  render() {
    let christmasTime = moment().isBetween(moment("Dec 23 2015"), moment("Dec 26 2015"));
    return (
      <View style={styles.nav}>
        <Image style={styles.background} source={ christmasTime ? require('../img/snowfall.png') : { uri: 'http://lorempixel.com/400/200/abstract/' }}>
          <Image  style={styles.thumb} source={{ uri: this.state.user.gravatar }} />
        </Image>
        <View style={styles.container} >
          <TouchableHighlight onPress={() => this.onSelect("Add Entry")} style={styles.item} underlayColor="#DDD">
            <Text style={styles.text}>
              Add Entry
            </Text>
          </TouchableHighlight>

          <TouchableHighlight onPress={() => this.onSelect("Leaderboard")} style={styles.item} underlayColor="#DDD">
            <Text style={styles.text}>
              Leaderboard
            </Text>
          </TouchableHighlight>

          <TouchableHighlight onPress={() => this.onSelect("Timeline")} style={styles.item} underlayColor="#DDD">
            <Text style={styles.text}>
              Timeline
            </Text>
          </TouchableHighlight>

          <TouchableHighlight onPress={() => this.onSelect("Profile")} style={styles.item} underlayColor="#DDD">
            <Text style={styles.text}>
              Profile
            </Text>
          </TouchableHighlight>
        </View>
      </View>
    );
  }
}

let styles = StyleSheet.create({
  nav: {
    flex: 1,
    backgroundColor: '#fff',
    flexDirection: 'column'
  },
  container: {
  },
  item: {
    flex: 0.2,
    height: 64,
    justifyContent: 'center'
  },
  text: {
    marginLeft: 30,
    color: '#444',
    margin: 10,
    fontSize: 15,
    textAlign: 'left'
  },
  thumb: {
    resizeMode: 'contain',
    borderRadius: 1000,
    height: 150,
    marginTop: 20,
    marginBottom: 15,
  },
  background: {
    width: 250,
    height: 210,
    resizeMode: 'stretch',
  }
});

@@ -111,48 +111,8 @@
 e';%0A
-import Video from 'react-native-video';%0A
 impo

remove unused library