actions.js
/*Function specific to this layout, add a card at location 0, pop it to 1*/
Function specific to this layout, add a card at location 0, pop it to 1
Function specific to this layout add a card at location 0 pop it to 1
function addAndPopCard(card) {
    return (dispatch, getState) => {
        if(!canAddCard(card,getState().cards)) {
            return;
        }
        dispatch(dismissAtLocation(1));
        dispatch(addCard(card));
        let cardsArr = getState().cards.cards;
        if(cardsArr.length==0) { console.log("Warning: Could not pop card"); return; }
        let newCardId = cardsArr[cardsArr.length-1].id;
        dispatch(transitionCard(newCardId,1));
        setTimeout(() => {
            let newCard = getCardById(newCardId,getState());
            if(newCard && newCard.locationId === 1 && !newCard.transitioning) {
                dispatch(dismissCard(newCard.id));
            }
        },getState().cards.cardparms.cardTimeout)
    }   
}
function addAndPopCard ( card ) { return ( dispatch , getState ) => { if ( ! canAddCard ( card , getState ( ) . cards ) ) { return ; } dispatch ( dismissAtLocation ( 1 ) ) ; dispatch ( addCard ( card ) ) ; let cardsArr = getState ( ) . cards . cards ; if ( cardsArr . length == 0 ) { console . log ( "Warning: Could not pop card" ) ; return ; } let newCardId = cardsArr [ cardsArr . length - 1 ] . id ; dispatch ( transitionCard ( newCardId , 1 ) ) ; setTimeout ( ( ) => { let newCard = getCardById ( newCardId , getState ( ) ) ; if ( newCard && newCard . locationId === 1 && ! newCard . transitioning ) { dispatch ( dismissCard ( newCard . id ) ) ; } } , getState ( ) . cards . cardparms . cardTimeout ) } }
Function specific to this layout, add a card at location 0, pop it to 1
Function specific to this layout add a card at location 0 pop it to 1
// store.getState().cards.cards.filter(c => c.id === newCardId); /*if(matchedCards.length === 0) { return; }
            let newCard = matchedCards[0];*/