Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0658134
commit 4317c44
Showing
11 changed files
with
219 additions
and
45 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Row, Col, Card } from 'react-bootstrap' | ||
import React, { Fragment } from 'react' | ||
|
||
const Stream = ({ stream }) => { | ||
return ( | ||
<Fragment> | ||
<Row> | ||
<Col lg={12}> | ||
<Card> | ||
<div>{stream[id].name}</div> | ||
</Card> | ||
{!!stream.blocks && | ||
Object.keys(stream.blocks).map((id, _) => { | ||
return ( | ||
<Card key={id}> | ||
<div>block {id}</div> | ||
</Card> | ||
) | ||
})} | ||
</Col> | ||
</Row> | ||
</Fragment> | ||
) | ||
} | ||
|
||
export default Stream |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React, { useEffect } from 'react' | ||
import Link from 'next/link' | ||
import PropTypes from 'prop-types' | ||
import { connect } from 'react-redux' | ||
import { | ||
changedStreamInput, | ||
requestedStream, | ||
requestedStreamSuccess, | ||
requestedStreamError, | ||
} from '../../store/actions' | ||
import { streamService } from '../../lib/streamService.js' | ||
|
||
const View = ({ | ||
requestedStream, | ||
requestedStreamSuccess, | ||
requestedStreamError, | ||
id, | ||
streams, | ||
}) => { | ||
useEffect(() => { | ||
const getStreams = async () => { | ||
requestedStream() | ||
try { | ||
const stream = await streamService.get(id) | ||
requestedStreamSuccess(stream) | ||
} catch (error) { | ||
requestedStreamError(error) | ||
} | ||
} | ||
getStreams() | ||
}, [id, requestedStream, requestedStreamError, requestedStreamSuccess]) | ||
return ( | ||
<div> | ||
<Link href="/">home</Link> | ||
stream {streams.items[id] ? streams.items[id].name : '...'} | ||
</div> | ||
) | ||
} | ||
|
||
View.getInitialProps = ({ query: { id } }) => { | ||
return { id: id } | ||
} | ||
|
||
View.propTypes = { | ||
requestedStream: PropTypes.func.isRequired, | ||
requestedStreamSuccess: PropTypes.func.isRequired, | ||
requestedStreamError: PropTypes.func.isRequired, | ||
} | ||
|
||
View.defaultProps = { | ||
profile: {}, | ||
} | ||
|
||
const mapStateToProps = ({ peers, forms, streams }) => ({ | ||
peers, | ||
forms, | ||
streams, | ||
}) | ||
|
||
export default connect( | ||
mapStateToProps, | ||
{ | ||
changedStreamInput, | ||
requestedStream, | ||
requestedStreamSuccess, | ||
requestedStreamError, | ||
} | ||
)(View) |
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
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
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
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
Oops, something went wrong.