<commit_before>/**
 * Created by bikash on 11/25/16.
 */

import React, { Component } from 'react';

import ReactImageZoom from 'react-image-zoom';
import { connect } from 'react-redux';
import Header from './Header';
import Footer from './Footer';
import {getProductDetails} from '../actions/infinia.js'


// var prop = {
//         width: 380,
//         height: 350,
//         zoomWidth: 600,
//         scale:1.3,
//         zoomStyle:(
//             'z-index: 1;' +
//             'border: 1px solid #c0c0c0;' +
//             'width: 700px;'
//         )
// }
// var newprop = Object.assign({}, prop, { img: "../../img/02.jpg" })

class Details extends Component{

    constructor(props){
        super(props);
        this.state = {
            setting : {
                    width: 380,
                    height: 350,
                    zoomWidth: 600,
                    scale:1.3,
                    zoomStyle:(
                        'z-index: 1;' +
                        'border: 1px solid #c0c0c0;' +
                        'width: 700px;'
                    ),
                    img: " "//yesma first image rakhnu parne cha or surumai set garnu parcha
                },
            id: 'not-img-selected'
        }
    }

    componentDidMount(){
        this.props.dispatch(getProductDetails());
    }
    // componentWillMount(){
    //     if(this.props.productDetails[0] != undefined){
    //         this.settingImage();
    //     }
    // }
    // settingImage(){
    //     console.log('set the image here');
    //     let setting = this.state.setting;
    //     setting.img = this.props.productDetails[0].img[0];
    //     this.setState(setting);
    // }

    changeImage(path,i){
        console.log(this.props.productDetails);
        let setting = this.state.setting;
        setting.img = path.path;
        // this.setState({id: 'img-selected'});

        this.setState(setting);
    }

    render(){
        let {productDetails} = this.props;
        console.log('data', productDetails);


        return(
          <div className="mycontainer">
              <Header/>
              <div className="bread-crumb">
                  <div className="select-location">Dubai > Supermarket > Walmart >
                  </div>
                  <div className="select-cat">Chicken > Item-Details
                  </div>
              </div>
              <div className="main-content ">
                  {productDetails?productDetails.map(detail=>
                      <div key={detail.id} className="container row">
                          <div className="col-md-5">
                              <div className="item-images">
                                  <div className="row">
                                      <div className="col-md-3">
                                          {detail.img.map((path,index)=>
                                              <img key={index} id={this.state.id} onMouseEnter={() => this.changeImage({path},{index})} src={path} className="img-thumbnail"/>
                                              )}
                                      </div>
                                      <div className="col-md-9">
                                          <ReactImageZoom {...this.state.setting}/>
                                      </div>
                                  </div>
                              </div>
                          </div>
                          <div className="col-md-7 detail-sec">
<commit_msg>details page image zoom<commit_after>/**
 * Created by bikash on 11/25/16.
 */

import React, { Component } from 'react';

import ReactImageZoom from 'react-image-zoom';
import { connect } from 'react-redux';
import Header from './Header';
import Footer from './Footer';
import {getProductDetails} from '../actions/infinia.js'


class Details extends Component{

    constructor(props){
        super(props);
        this.state = {
            id: 'not-img-selected'
        }
    }

    componentDidMount(){
        this.props.dispatch(getProductDetails());
    }

    changeImage(path,i){
        this.setState({image: path.path});
    }

    render(){
        let {productDetails} = this.props;
        let setting;
            productDetails.length>0? setting = {
                width: 380,
                height: 350,
                zoomWidth: 600,
                scale: 1.3,
                zoomStyle: (
                'z-index: 1;' +
                'border: 1px solid #c0c0c0;' +
                'width: 700px;'
                ),
                img: this.state.image ? this.state.image : productDetails[0].img[0]
            }:null;


        return(
          <div className="mycontainer">
              <Header/>
              <div className="bread-crumb">
                  <div className="select-location">Dubai > Supermarket > Walmart >
                  </div>
                  <div className="select-cat">Chicken > Item-Details
                  </div>
              </div>
              <div className="main-content ">
                  {productDetails.length>0?productDetails.map(detail=>
                      <div key={detail.id} className="container row">
                          <div className="col-md-5">
                              <div className="item-images">
                                  <div className="row">
                                      <div className="col-md-3">
                                          {detail.img.map((path,index)=>
                                              <img key={index} id={this.state.id} onMouseEnter={() => this.changeImage({path},{index})} src={path} className="img-thumbnail"/>
                                              )}
                                      </div>
                                      <div className="col-md-9">
                                          <ReactImageZoom {...setting}/>
                                      </div>
                                  </div>
                              </div>
                          </div>
                          <div className="col-md-7 detail-sec">

{'fraction_non_alphanumeric': 0.12982570451213551, 'fraction_numerical': 0.01400879622088288, 'mean_word_length': 1.1208981001727116, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4791614', 'n_tokens_mistral': 1620, 'n_tokens_neox': 1506, 'n_words': 306}