This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { List, fromJS } from 'immutable'; | |
/** | |
* make size 9 array of 0s | |
* @returns {Array} | |
*/ | |
function makeCountObject() { | |
const countObj = []; | |
for (let i = 0; i < 10; i += 1) countObj.push(0); | |
return countObj; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puzzle = [ | |
[cell, cell, cell, cell, cell, cell, cell, cell, cell], | |
[cell, cell, cell, cell, cell, cell, cell, cell, cell], | |
[cell, cell, cell, cell, cell, cell, cell, cell, cell], | |
[cell, cell, cell, cell, cell, cell, cell, cell, cell], | |
... | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getSelectedCell() { | |
const { board } = this.state | |
const selected = board.get('selected') | |
return selected && board.get('puzzle').getIn([selected.x,selected.y]) | |
} | |
renderCell(cell, x, y) { | |
const { board } = this.state | |
const selected = this.getSelectedCell() | |
const sameValue = selected && selected.get('value') && value === selected.get('value') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Game extends Compoent { | |
... | |
getSelectedCell() { | |
const { board } = this.state; | |
const selected = board.get('selected'); | |
return selected && board.get('puzzle').getIn([selected.x, selected.y]); | |
} | |
selectCell = (x, y) => { | |
let { board } = this.state |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cell = { | |
value: 9, | |
notes: Set([1,2,3]), | |
prefilled: false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Cell = (props) => { | |
const { | |
value, onClick, isPeer, isSelected, sameValue, prefilled, notes, conflict, | |
} = props; | |
const backgroundColor = getBackGroundColor({ | |
conflict, isPeer, sameValue, isSelected, | |
}); | |
const fontColor = getFontColor({ conflict, prefilled, value }); | |
return ( | |
<div className="cell" onClick={onClick}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debugger | |
console.log(document.cookie) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
import { fetchAudioFeaturesById } from '../actions'; | |
import Artist from '../Artist' | |
const mapStateToProps = ... | |
const mapDispatchToProps = ... | |
class ConnectedArtist extends React.Component { | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
import { fetchAudioFeaturesById } from '../actions'; | |
// stateless template for the display | |
import AudioFeatures from '../AudioFeatures' | |
const mapStateToProps = ({audioFeaturesById}, {trackId}) => ({ | |
audioFeatures: audioFeaturesById[trackId] | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
import withRedux from '../nextWithReduxWrapper'; | |
import { FETCH_PLAY_HISTORY } from '../actions'; | |
import PlayHistory from '../components/PlayHistory'; | |
const mapStateToProps = ({ history, artistsById, audioFeaturesById }) => { | |
return { history, artistsById, audioFeaturesById }; | |
}; |