blob: b264f4d9ec6b6793d7b5a651bc67ae4fabb6cc3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import React from 'react'
// import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { Link } from 'react-router-dom'
import actions from 'app/actions'
import PlayButton from 'app/views/align/components/player/playButton.component'
import './nav.css'
function Header(props) {
if (props.router.location && props.router.location.pathname.match("/viewer")) {
return null
}
return (
<header>
<PlayButton playing={props.playing} />
<div>
<Link to="/align">Timeline</Link>
<Link to="/paragraph">Transcript</Link>
<Link to="/media">Media</Link>
<Link to="/episode">Episodes</Link>
<Link to="/venue">Venues</Link>
<Link to="/viewer">Viewer</Link>
{props.currentUser.is_admin && <Link to="/user">Users</Link>}
<a href="#" onClick={actions.auth.logout}>
Logout
</a>
</div>
</header>
)
}
// const changeUsername = () => {
// const username = prompt("Please enter your username:", session('username'))
// if (username && username.length) {
// session.set('username', username)
// document.querySelector('Header div span').innerText = ' → ' + username // very naughty
// }
// }
const mapStateToProps = (state) => ({
currentUser: state.auth.user,
site: state.site,
router: state.router,
playing: state.audio.playing,
// username: session.get('username'),
// isAuthenticated: state.auth.isAuthenticated,
})
const mapDispatchToProps = (dispatch) => ({
})
export default connect(mapStateToProps, mapDispatchToProps)(React.memo(Header))
|