<commit_before>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import Snackbar from 'material-ui/Snackbar';
import CircularProgress from 'material-ui/CircularProgress';
import AppHeader from '../../AppHeader';
import AppFooter from '../../AppFooter';
import PinList from './pinList';
import PinWallSelector from './pinWallSelector';
import PinLogin from './pinLogin';
import pinAdd from './PinAdd';
import PinView from './pinViewer';
import '../../../../Assets/stylesheets/pinsApp.scss';

class PinContainer extends Component{

    constructor(props){
        super(props);
        this.state={
            isadding:false,
            isImageView:false,
            selectedImage:{},
            hideShowLogin:false,
            snackMessage:'',
            snackOpen:false
        };
       
    }
    showHideLogin=()=>{
        this.setState({hideShowLogin:!this.state.hideShowLogin});
    }
    onresetError=()=>{
        this.props.resetErrorApp();
    }
    voteImage=value=>{
        this.props.castImageVote(value);
        this.setState({snackOpen:!this.state.snackOpen, snackMessage:'The vote was cast on the image'});
    }
    handleCloseSnack=()=>{
        this.setState({snackOpen:!this.state.snackOpen});
    }
    
    getAllWalls=()=>{
        this.props.getAllWalls();
    }
    wallSelector=value=>{
        this.props.selectWall(value);
    }
    pinAdd=()=>{
        this.setState({isadding:true});
    }
    cancelAdd=()=>{
        this.setState({isadding:false});
    }
    injectPin=(value)=>{
        this.props.addPinUserWall(value);
    }
    enableDummyUser=()=>{
        this.props.setDummyLogin();
    }
    handleImagePreview=value=>{
        
        this.setState({isImageView:true,selectedImage:value});
    }
    handleExitViewer=()=>{
        this.setState({isImageView:false,selectedImage:{}});
    }
    removePinData=value=>{
        this.props.deletePin(value);
    }
    renderNormal(){
        const {isadding,isImageView,selectedImage,snackOpen,snackMessage,hideShowLogin}=this.state;
        const {isLoggedIn,pindata,selectedWall,pinUserInfo}= this.props;

        if (isadding){
            return (
                <pinAdd userInfo={pinUserInfo.id} cancelAdd={this.cancelAdd} addPin={this.injectPin}/>
            );
        }
        if (isImageView){
            return (
                <PinView 
                    isUserLogged={isLoggedIn}<commit_msg>fumbled the fumbles....no more booze for me<commit_after>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import Snackbar from 'material-ui/Snackbar';
import CircularProgress from 'material-ui/CircularProgress';
import AppHeader from '../../AppHeader';
import AppFooter from '../../AppFooter';
import PinList from './pinList';
import PinWallSelector from './pinWallSelector';
import PinLogin from './pinLogin';
import PinAdd from './PinAdd';
import PinView from './pinViewer';
import '../../../../Assets/stylesheets/pinsApp.scss';

class PinContainer extends Component{

    constructor(props){
        super(props);
        this.state={
            isadding:false,
            isImageView:false,
            selectedImage:{},
            hideShowLogin:false,
            snackMessage:'',
            snackOpen:false
        };
       
    }
    showHideLogin=()=>{
        this.setState({hideShowLogin:!this.state.hideShowLogin});
    }
    onresetError=()=>{
        this.props.resetErrorApp();
    }
    voteImage=value=>{
        this.props.castImageVote(value);
        this.setState({snackOpen:!this.state.snackOpen, snackMessage:'The vote was cast on the image'});
    }
    handleCloseSnack=()=>{
        this.setState({snackOpen:!this.state.snackOpen});
    }
    
    getAllWalls=()=>{
        this.props.getAllWalls();
    }
    wallSelector=value=>{
        this.props.selectWall(value);
    }
    pinAdd=()=>{
        this.setState({isadding:true});
    }
    cancelAdd=()=>{
        this.setState({isadding:false});
    }
    injectPin=(value)=>{
        this.props.addPinUserWall(value);
    }
    enableDummyUser=()=>{
        this.props.setDummyLogin();
    }
    handleImagePreview=value=>{
        
        this.setState({isImageView:true,selectedImage:value});
    }
    handleExitViewer=()=>{
        this.setState({isImageView:false,selectedImage:{}});
    }
    removePinData=value=>{
        this.props.deletePin(value);
    }
    renderNormal(){
        const {isadding,isImageView,selectedImage,snackOpen,snackMessage,hideShowLogin}=this.state;
        const {isLoggedIn,pindata,selectedWall,pinUserInfo}= this.props;

        if (isadding){
            return (
                <PinAdd userInfo={pinUserInfo.id} cancelAdd={this.cancelAdd} addPin={this.injectPin}/>
            );
        }
        if (isImageView){
            return (
                <PinView 
                    isUserLogged={isLoggedIn}
{'fraction_non_alphanumeric': 0.14218196140212683, 'fraction_numerical': 0.0, 'mean_word_length': 2.609808102345416, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 31, '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': '6000307', 'n_tokens_mistral': 1522, 'n_tokens_neox': 1508, 'n_words': 245}