This commit is contained in:
notnull 2019-04-08 01:39:00 -04:00
parent 7bcb0e0e30
commit 9b77e8c168
6 changed files with 52 additions and 28 deletions

4
dist/css/style.css vendored
View File

@ -21,6 +21,7 @@ html, body, .app {
background-color: rgba(0,0,0, 0.5); background-color: rgba(0,0,0, 0.5);
} }
.popup_inner { .popup_inner {
z-index: 6
position: absolute; position: absolute;
left: 25%; left: 25%;
right: 25%; right: 25%;
@ -33,9 +34,8 @@ html, body, .app {
.comment_icon { .comment_icon {
width: 20px; width: 20px;
height: 20px; height: 20px;
background-image: url("/img/anarchybang.jpg"); background-image: url("/img/abang.png");
background-size: cover; background-size: cover;
background-color: #000
} }
.footer { .footer {

View File

@ -14,7 +14,7 @@ app.use(require('body-parser').text())
app.use(express.static(path.join(__dirname, 'dist'))) app.use(express.static(path.join(__dirname, 'dist')))
//http://localhost:31337 //http://localhost:1337
app.use(proxy('/api', { target: 'http://localhost:1337' })) app.use(proxy('/api', { target: 'http://localhost:1337' }))
app.get('*', (req, res) => { app.get('*', (req, res) => {

View File

@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import {Tooltip, Image, Button, Card, Overlay} from 'react-bootstrap' import {Tooltip, Overlay} from 'react-bootstrap'
class Example extends React.Component { class Example extends React.Component {
constructor() { constructor() {
@ -13,22 +13,20 @@ class Example extends React.Component {
toggleShow() { toggleShow() {
this.setState({show: !this.state.show}) this.setState({show: !this.state.show})
} }
render() { render() {
const { show, target } = this.state const { show, target } = this.state
return ( return (
<> <div
<div className = "comment_icon"
className = "comment_icon" ref={this.attachRef}
ref={this.attachRef} style={{position: 'absolute', top: 180, left: this.props.commentLoc + '%'}}
style={{position: 'absolute', top: 180, left: this.props.commentLoc + '%'}} onClick={this.toggleShow} >
onClick={this.toggleShow} />
<Overlay target={target} show={show} placement="bottom" > <Overlay target={target} show={show} placement="bottom" >
<Tooltip> <Tooltip>
{this.props.text} {this.props.text}
</Tooltip> </Tooltip>
</Overlay> </Overlay>
</> </div>
) )
} }
} }

View File

@ -3,7 +3,6 @@ import {Card, Form, Row, Col, Button} from 'react-bootstrap'
const Popup = props => { const Popup = props => {
console.log('POPUP PROPS!', props)
return ( return (
<div className='popup text-center'> <div className='popup text-center'>
<div className='popup_inner'> <div className='popup_inner'>
@ -23,7 +22,7 @@ const Popup = props => {
<Form.Control as="textarea" rows="3" value={props.commentText} onChange={props.updateCommentText}/> <Form.Control as="textarea" rows="3" value={props.commentText} onChange={props.updateCommentText}/>
</Form.Group> </Form.Group>
<Button variant="dark" type='submit'>Close</Button> <Button variant="dark" type='submit'>Submit Comment</Button>
</Form> </Form>
</Card.Body> </Card.Body>
</Card> </Card>

View File

@ -0,0 +1,29 @@
import React from 'react'
import {Table} from 'react-bootstrap'
const CommentTable = props => {
const {comments } = props
return (
<Table striped bordered hover variant="dark">
<thead>
<tr>
<th>Time</th>
<th>Nick</th>
<th>Text</th>
</tr>
</thead>
<tbody>
{comments.map(comment=>{
<tr>
<td>{comment.secs}</td>
<td>anon</td>
<td>{comment.text}</td>
</tr>
})}
</tbody>
</Table>
)
}
export default CommentTable

View File

@ -1,12 +1,12 @@
import React, { Component } from 'react' import React, { Component } from 'react'
import Waveform from 'react-audio-waveform' import Waveform from 'react-audio-waveform'
import {connect} from 'react-redux' import {connect} from 'react-redux'
const config = require('./audio/loneDigger.json')
import ReactAudioPlayer from 'react-audio-player' import ReactAudioPlayer from 'react-audio-player'
import CommentPopup from './CommentPopup' import CommentPopup from './CommentPopup'
import Comment from './Comment' import Comment from './Comment'
import {fetchAllComments, addComment} from '../../store' import {fetchAllComments, addComment} from '../../store'
import {Container, Row, Col} from 'react-bootstrap' import {Button, Container, Row, Col} from 'react-bootstrap'
const config = require('./audio/loneDigger.json')
const parseTime = secs => { const parseTime = secs => {
var hours = Math.floor(secs / 3600) var hours = Math.floor(secs / 3600)
@ -19,7 +19,6 @@ const parseTime = secs => {
return minutes+':'+seconds return minutes+':'+seconds
} }
class Player extends Component { class Player extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -35,7 +34,7 @@ class Player extends Component {
showComments: true, showComments: true,
comments: [{id: 1, commentSecs: 132}] comments: [{id: 1, commentSecs: 132}]
} }
//this.getCommentSecs = this.getCommentSecs.bind(this)
this.getPlayerSize = this.getPlayerSize.bind(this) this.getPlayerSize = this.getPlayerSize.bind(this)
this.submitComment = this.submitComment.bind(this) this.submitComment = this.submitComment.bind(this)
this.openCommentPopup = this.openCommentPopup.bind(this) this.openCommentPopup = this.openCommentPopup.bind(this)
@ -52,10 +51,6 @@ class Player extends Component {
this.fetchData() this.fetchData()
} }
// getCommentSecs (commentSecs) {
// this.setState({commentSecs})
// }
getPlayerSize(e) { getPlayerSize(e) {
if(e){ if(e){
this.setState({playerSize: e.getBoundingClientRect()}) this.setState({playerSize: e.getBoundingClientRect()})
@ -70,8 +65,9 @@ class Player extends Component {
this.setState({showPopup: false, showComments: true}) this.setState({showPopup: false, showComments: true})
} }
openCommentPopup(commentSecs) { openCommentPopup() {
this.setState({commentSecs, showPopup: true, showComments: false}) console.log(this.state)
this.setState({ showPopup: true, showComments: false})
this.rap.audioEl.pause() this.rap.audioEl.pause()
} }
@ -110,8 +106,8 @@ class Player extends Component {
commentLoc = {(comment.commentSecs / this.state.duration) * 100} commentLoc = {(comment.commentSecs / this.state.duration) * 100}
text={comment.text} text={comment.text}
/> />
) : null} )
: null}
</Col> </Col>
</Row> </Row>
</div> </div>
@ -126,11 +122,13 @@ class Player extends Component {
onListen={()=>this.setState({songSecs:this.rap.audioEl.currentTime})} onListen={()=>this.setState({songSecs:this.rap.audioEl.currentTime})}
/> />
</Col> </Col>
<Col>
<Button variant="dark" onClick={() => this.openCommentPopup(this.state.pos)}>Add Comment</Button>
</Col>
</Row> </Row>
{this.state.showPopup ? {this.state.showPopup ?
<CommentPopup <CommentPopup
commentSecs = {parseTime(this.state.commentSecs)} commentSecs = {parseTime(this.state.songSecs)}
commentText={this.state.commentText} commentText={this.state.commentText}
submitComment={this.submitComment} submitComment={this.submitComment}
updateCommentText={this.updateCommentText} updateCommentText={this.updateCommentText}