11import { useSelector , useDispatch } from 'react-redux'
22
3- import React , { useEffect } from 'react' ;
3+ import React , { useEffect , useState } from 'react' ;
44import { makeStyles } from '@material-ui/core/styles' ;
55import AppBar from '@material-ui/core/AppBar' ;
66import Toolbar from '@material-ui/core/Toolbar' ;
@@ -11,6 +11,9 @@ import MenuItem from '@material-ui/core/MenuItem';
1111import FormHelperText from '@material-ui/core/FormHelperText' ;
1212import FormControl from '@material-ui/core/FormControl' ;
1313import Select from '@material-ui/core/Select' ;
14+ import Tooltip from '@material-ui/core/Tooltip' ;
15+
16+ import AboutDialog from './AboutDialog' ;
1417
1518import { setProfile , setInputLang } from './../actions' ;
1619import { allowedInputLanguage } from './../util' ;
@@ -23,6 +26,7 @@ const useStyles = makeStyles((theme) => ({
2326
2427function Header ( ) {
2528 const classes = useStyles ( ) ;
29+ const [ isOpen , setOpen ] = useState ( false )
2630 const [ currentUser , inputLanguage ] = useSelector ( s => [ s . currentUser , s . inputLanguage ] )
2731 const dispatch = useDispatch ( )
2832
@@ -35,45 +39,50 @@ function Header() {
3539 } , [ dispatch ] )
3640
3741 return (
38- < AppBar position = "static" style = { { lineHeight : 'normal' } } >
39- < Toolbar >
40- < div style = { { display : 'flex' , flexDirection : 'column' } } >
41- < Typography variant = "h4" style = { { padding : 0 } } >
42- < a href = "/" style = { { color : 'white' , textDecoration : 'none' } } > बोध</ a >
43- </ Typography >
44- < span style = { { fontSize : '0.7rem' , margin : 0 , padding : 0 } } > A tool that adds statements to lexemes, senses and forms.</ span >
45- </ div >
46- < div style = { { marginLeft : 'auto' } } >
47- { currentUser ?
48- < >
49- < Typography style = { { display : "inline" } } > Logged in as { currentUser } </ Typography >
42+ < >
43+ < AppBar position = "static" style = { { lineHeight : 'normal' } } >
44+ < Toolbar >
45+ < div style = { { display : 'flex' , flexDirection : 'column' } } >
46+ < Typography variant = "h4" style = { { padding : 0 } } >
47+ < a href = "/" style = { { color : 'white' , textDecoration : 'none' } } > बोध</ a >
48+ </ Typography >
49+ < span style = { { fontSize : '0.7rem' , margin : 0 , padding : 0 } } > A tool that adds statements to lexemes, senses and forms.</ span >
50+ </ div >
51+ < div style = { { marginLeft : 'auto' } } >
52+ { currentUser ?
53+ < >
54+ < Typography style = { { display : "inline" } } > Logged in as { currentUser } </ Typography >
55+ < Button variant = "contained" color = "secondary" style = { { backgroundColor : 'orange' } } >
56+ < a href = "https://bodh-backend.toolforge.org/logout" style = { { color : 'white' } } > Logout</ a >
57+ </ Button >
58+ </ >
59+ :
5060 < Button variant = "contained" color = "secondary" style = { { backgroundColor : 'orange' } } >
51- < a href = "https://bodh-backend.toolforge.org/logout " style = { { color : 'white' } } > Logout </ a >
61+ < a href = "https://bodh-backend.toolforge.org/login " style = { { color : 'white' } } > Login </ a >
5262 </ Button >
53- </ >
54- :
55- < Button variant = "contained" color = "secondary" style = { { backgroundColor : 'orange' } } >
56- < a href = "https://bodh-backend.toolforge.org/login" style = { { color : 'white' } } > Login</ a >
57- </ Button >
58- }
59- </ div >
60- < div >
61- < Button href = "https://www.wikidata.org/wiki/Wikidata:bodh" target = "_blank" >
62- < GroupIcon style = { { color : 'white' } } />
63- </ Button >
64- </ div >
65- { currentUser ?
66- < FormControl >
67- < Select className = { classes . clrWhite } value = { inputLanguage } onChange = { handleInputLangChange } >
68- { allowedInputLanguage ( ) . map ( ( lang ) => {
69- return < MenuItem value = { lang } > { lang } </ MenuItem >
70- } ) }
71- </ Select >
72- < FormHelperText className = { classes . clrWhite } > Input language</ FormHelperText >
73- </ FormControl >
74- : null }
75- </ Toolbar >
76- </ AppBar >
63+ }
64+ </ div >
65+ < div >
66+ < Tooltip title = "About" placement = "bottom" >
67+ < Button onClick = { ( ) => setOpen ( true ) } >
68+ < GroupIcon style = { { color : 'white' } } />
69+ </ Button >
70+ </ Tooltip >
71+ </ div >
72+ { currentUser ?
73+ < FormControl >
74+ < Select className = { classes . clrWhite } value = { inputLanguage } onChange = { handleInputLangChange } >
75+ { allowedInputLanguage ( ) . map ( ( lang ) => {
76+ return < MenuItem value = { lang } > { lang } </ MenuItem >
77+ } ) }
78+ </ Select >
79+ < FormHelperText className = { classes . clrWhite } > Input language</ FormHelperText >
80+ </ FormControl >
81+ : null }
82+ </ Toolbar >
83+ </ AppBar >
84+ < AboutDialog isOpen = { isOpen } setOpen = { setOpen } />
85+ </ >
7786 )
7887
7988}
0 commit comments