-
Notifications
You must be signed in to change notification settings - Fork 37
/
Home.jsx
55 lines (49 loc) · 1.89 KB
/
Home.jsx
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
55
import React from 'react'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
import { translate } from 'react-i18next'
import appFactory from '../appFactory.js'
import {
workspaceConfig
} from '../helper.js'
import Card from '../component/common/Card/Card.jsx'
import CardHeader from '../component/common/Card/CardHeader.jsx'
import CardBody from '../component/common/Card/CardBody.jsx'
import HomeNoWorkspace from '../component/Home/HomeNoWorkspace.jsx'
import HomeHasWorkspace from '../component/Home/HomeHasWorkspace.jsx'
export class Home extends React.Component {
handleClickCreateWorkspace = e => {
e.preventDefault()
const { props } = this
props.renderAppPopupCreation(workspaceConfig, props.user, null, null)
}
render () {
const { props } = this
if (!props.system.workspaceListLoaded) return null
return (
<div className='tracim__content fullWidthFullHeight'>
<div className='tracim__content-scrollview fullWidthFullHeight'>
<section
className='homepage'
style={{ backgroundColor: props.workspaceList.length === 0 ? 'gray' : 'white' }}
>
<Card customClass='homepagecard'>
<CardHeader displayHeader={false} />
<CardBody formClass='homepagecard__body'>
{props.workspaceList.length > 0
? <HomeHasWorkspace user={props.user} />
: <HomeNoWorkspace
canCreateWorkspace={props.canCreateWorkspace}
onClickCreateWorkspace={this.handleClickCreateWorkspace}
/>
}
</CardBody>
</Card>
</section>
</div>
</div>
)
}
}
const mapStateToProps = ({ user, workspaceList, system }) => ({ user, workspaceList, system })
export default connect(mapStateToProps)(withRouter(appFactory(translate()(Home))))