Created
February 22, 2017 21:42
-
-
Save RubyRubenstahl/e4cc2ffb6449ebe2119220595357aa98 to your computer and use it in GitHub Desktop.
This file contains 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, { PropTypes } from 'react'; | |
import UsersNavBar from '../components/TranscriptsNavBar'; | |
import TranscriptEditContainer from './TranscriptEditContainer'; | |
const Screen = ({transcript={}, saveTranscript, params}) => { | |
return( | |
<div> | |
<UsersNavBar label="Transcripts" screen="transcriptEdit"/> | |
<TranscriptEditContainer | |
transcript={transcript} | |
transcriptId={params.id } | |
saveTranscript={saveTranscript} | |
/> | |
</div> | |
) | |
} | |
export default Screen; | |
This file contains 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
/** | |
* Created by Mike on 2/22/2017. | |
*/ | |
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
import { feathersServices } from '../../../feathers'; | |
import TranscriptEditor from './TranscriptEditor' | |
const getTranscript = (queryResult) => { | |
if(!queryResult) return {title: 'error'}; | |
return(queryResult.data); | |
} | |
const mapStateToProps = (state) =>{ | |
const queryResult = state.transcripts.queryResult || {}; | |
return({ | |
transcript: queryResult | |
}) | |
}; | |
const mapDispatchToProps = (dispatch, ownProps) => { | |
return { | |
loadTranscript: (id) => dispatch(feathersServices.transcripts.get(id)), | |
} | |
}; | |
export default connect(mapStateToProps, mapDispatchToProps)(TranscriptEditor ); | |
This file contains 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
/** | |
* Created by Mike on 2/22/2017. | |
*/ | |
/** | |
* Created by Mike on 2/21/2017. | |
*/ | |
import React, { PropTypes } from 'react'; | |
import {Card, CardTitle, CardText} from 'material-ui/Card'; | |
import {SubHeader } from 'material-ui/Subheader' | |
class TranscriptEditor extends React.Component{ | |
componentDidMount(){ | |
console.log(`Loading ${this.props.transcriptId}`); | |
this.props.loadTranscript(this.props.transcriptId); | |
} | |
render() { | |
const {transcript, transcriptId, saveTranscript} = this.props; | |
const {title, text, date} = transcript; | |
console.log(transcriptId) | |
return ( | |
<Card> | |
<CardTitle title={title}/> | |
<CardText>{text}</CardText> | |
</Card> | |
) | |
} | |
} | |
export default TranscriptEditor; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment