Skip to content

Commit

Permalink
Merge pull request picovico#5 from aaeronn/gh-pages
Browse files Browse the repository at this point in the history
update
  • Loading branch information
acpmasquerade committed Apr 6, 2016
2 parents 1545236 + a887502 commit ab62091
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 64 deletions.
10 changes: 5 additions & 5 deletions actions/Facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function fetchUserInfo(router, accessToken){
}).then(function(response){
dispatch(list_video())
dispatch({type: types.FE_COMPLETE_AUTHENTICATING})
router.pushState(null, URL_PREFIX+'/videos')
router.pushState(null, URL_PREFIX+'videos')
})
})
}
Expand Down Expand Up @@ -277,7 +277,7 @@ export function handle_share(video ,history){

FB.getLoginStatus(function(response){
if(response.status != "connected"){
history.pushState(null, URL_PREFIX+'/login')
history.pushState(null, URL_PREFIX+'login')
}else{
var accessToken = response.authResponse.accessToken
FB.api(
Expand All @@ -294,7 +294,7 @@ export function handle_share(video ,history){
/* handle the result */
dispatch({type: types.FE_FB_VIDEO_SHARING_COMPLETE})
dispatch(complete_share())
history.pushState(null, URL_PREFIX+'/videos')
history.pushState(null, URL_PREFIX+'videos')
}else{
dispatch(complete_share())
localStorage.removeItem('pv_fb_token')
Expand All @@ -321,9 +321,9 @@ function handleLogin(router) {
dispatch(fetchUserInfo(router, accessToken))

} else if (response.status === 'not_authorized') {
router.pushState(null, URL_PREFIX+'/login')
router.pushState(null, URL_PREFIX+'login')
} else {
router.pushState(null, URL_PREFIX+'/login')
router.pushState(null, URL_PREFIX+'login')
}
}, {scope: ['user_photos', 'email', 'publish_actions']})
}
Expand Down
4 changes: 2 additions & 2 deletions components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class Header extends Component {
<img className={"img-responsive center-block"} src={"static/img/picovico.png"} />
</div>
<ul className={"nav nav-pills"}>
<li className={(this.state.activeClassKey == "videos") ? "active" : ""}><Link to={URL_PREFIX+"/videos"} onClick={this.handleClick.bind(this, "videos")}>My Videos</Link></li>
<li className={(this.state.activeClassKey == "albums") ? "active" : ""}><Link to={URL_PREFIX+"/create"} onClick={this.handleClick.bind(this, "albums")}>Select Album</Link></li>
<li className={(this.state.activeClassKey == "videos") ? "active" : ""}><Link to={URL_PREFIX+"videos"} onClick={this.handleClick.bind(this, "videos")}>My Videos</Link></li>
<li className={(this.state.activeClassKey == "albums") ? "active" : ""}><Link to={URL_PREFIX+"create"} onClick={this.handleClick.bind(this, "albums")}>Select Album</Link></li>
</ul>
</div>
</nav>
Expand Down
3 changes: 2 additions & 1 deletion components/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class List extends Component {
handleMouseEnter(id){
this.setState({'isMouseInsideID': id})
}

handleMouseLeave(){
this.setState({'isMouseInsideID': null})
}
Expand Down Expand Up @@ -48,7 +49,7 @@ class List extends Component {
{(this.state.isMouseInsideID === video.id) ? this.getBtn(video.id): null}
</div>
<div className={"panel-footer"}>
<div className={"album-name"}>{ video.name }</div>
<div className={"album-name"}>{video.name}</div>
</div>
</div>
</div>
Expand Down
33 changes: 28 additions & 5 deletions components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@ import cookie from 'react-cookie'

class Login extends Component{

componentDidMount(){
let facebook_helper = new FacebookHelper();
constructor(props){
super(props)
this.state = {'show_login_button': false}
}

componentDidMount(){
let self = this
let facebook_helper = new FacebookHelper()
facebook_helper.getLoginStatus(function(response){
self.setState({'show_login_button': true})
localStorage.removeItem('picovico')
})

}
componentWillUnmount(){
localStorage['picovico'] = JSON.stringify(this.props.login)
}
Expand Down Expand Up @@ -51,6 +61,21 @@ class Login extends Component{
}
}

show_login_button(actions){
var show_btn;
if (this.state.show_login_button){
show_btn = <div className={"col-sm-12 text-center"}>
<a><img className={"img-responsive center-block"} src={"static/img/facebook.png"} style={{marginTop: '50px',}} onClick={() => actions.handleLogin(history)} /></a>
</div>
return show_btn
}else{
show_btn = <div className={"col-sm-12 text-center"}>
<span className={"glyphicon glyphicon-refresh glyphicon-refresh-animate"} style={{marginTop: '50px',}}></span>&nbsp;Loading ..
</div>
return show_btn
}
}

render() {
const { login, actions, history } = this.props
return (
Expand All @@ -69,9 +94,7 @@ class Login extends Component{
<div className={"footer"}>
<div className={"container-fluid"}>
<div className={"row"}>
<div className={"col-sm-12 text-center"}>
<a><img className={"img-responsive center-block"} src={"static/img/facebook.png"} style={{marginTop: '50px',}} onClick={() => actions.handleLogin(history)} /></a>
</div>
{this.show_login_button(actions)}
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion components/album_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class AlbumList extends Component {
handleMouseEnter(id){
this.setState({'isMouseInsideID': id})
}

handleMouseLeave(){
this.setState({'isMouseInsideID': null})
}
Expand Down Expand Up @@ -49,7 +50,7 @@ class AlbumList extends Component {
{(this.state.isMouseInsideID === album.id) ? this.getBtn(album.photos.data.length, album.id): null}
</div>
<div className={"panel-footer"}>
<div className={"album-name"}>{ album.name }</div>
<div className={"album-name"}>{album.name}</div>
<div className={"photo-count"}>{album.photos.data.length} photo(s)</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion constants/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export const STYLE = "vanilla"
export const MUSIC = "https://s3-us-west-2.amazonaws.com/pv-audio-library/free-music/preview/Christmas/Kevin-MacLeod-Christmas-Rap.mp3"


export const URL_PREFIX = "/popcorn"
export const URL_PREFIX = "/popcorn/"
// export const URL_PREFIX = "/"
5 changes: 3 additions & 2 deletions containers/VideoCreateView.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ class VideoCreate extends Component {

componentWillMount(){
const {albums, history} = this.props
let facebook_helper = new FacebookHelper(history)
let facebook_helper = new FacebookHelper()
facebook_helper.getLoginStatus(function(response){
if(response.status != "connected"){
history.pushState(null, URL_PREFIX+'/login')
history.pushState(null, URL_PREFIX+'login')
}
})
}

componentWillUnmount(){
localStorage['picovico'] = JSON.stringify(this.props.albums)
}
Expand Down
8 changes: 4 additions & 4 deletions containers/VideoListView.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class VideoList extends Component {
this.state = {'play_video': null}
}

componentWillMount(){
componentDidMount(){
const {videos, history} = this.props

let facebook_helper = new FacebookHelper(history)
let facebook_helper = new FacebookHelper()
facebook_helper.getLoginStatus(function(response){
if(response.status != "connected"){
history.pushState(null, URL_PREFIX+'/login')
history.pushState(null, URL_PREFIX+'login')
}
})
}
Expand Down
Loading

0 comments on commit ab62091

Please sign in to comment.