Browse Source

fixed merge conflict + fixed missing varaible name refactor

Skylsmoi 7 years ago
parent
commit
331873c0d7

+ 3 - 0
jsonserver/server.js View File

24
   if (req.body.login !== '' && req.body.password !== '') return res.jsonp(jsonDb.user_logged)
24
   if (req.body.login !== '' && req.body.password !== '') return res.jsonp(jsonDb.user_logged)
25
   else return res.jsonp('error')
25
   else return res.jsonp('error')
26
 })
26
 })
27
+
28
+server.get('/user/is_logged_in', (req, res) => res.jsonp(jsonDb.user_logged))
29
+
27
 server.get('/workspace/:id', (req, res) => res.jsonp(jsonDb.workspace_detail))
30
 server.get('/workspace/:id', (req, res) => res.jsonp(jsonDb.workspace_detail))
28
 
31
 
29
 server.use(router)
32
 server.use(router)

+ 8 - 6
jsonserver/static_db.json View File

1
 {
1
 {
2
-  "login": true,
3
   "user_logged": {
2
   "user_logged": {
4
-    "id": 5,
5
-    "username": "Smoi",
6
-    "firstname": "Côme",
7
-    "lastname": "Stoilenom",
8
-    "email": "osef@algoo.fr"
3
+    "logged": true,
4
+    "user": {
5
+      "id": 5,
6
+      "username": "Smoi",
7
+      "firstname": "Côme",
8
+      "lastname": "Stoilenom",
9
+      "email": "osef@algoo.fr"
10
+    }
9
   },
11
   },
10
   "workspace_detail": {
12
   "workspace_detail": {
11
     "id": 1,
13
     "id": 1,

+ 1 - 1
package.json View File

7
     "mockapi": "node jsonserver/server.js",
7
     "mockapi": "node jsonserver/server.js",
8
     "servdev": "NODE_ENV=development webpack-dev-server --watch --colors --inline --hot --progress",
8
     "servdev": "NODE_ENV=development webpack-dev-server --watch --colors --inline --hot --progress",
9
     "servdevwindoz": "webpack-dev-server --watch --colors --inline --hot --progress",
9
     "servdevwindoz": "webpack-dev-server --watch --colors --inline --hot --progress",
10
-    "servdev-dashboard": "NODE_ENV=development webpack-dashboard -- webpack-dev-server --watch --colors --inline --hot --progress",
10
+    "servdev-dashboard": "NODE_ENV=development webpack-dashboard -m -- webpack-dev-server --watch --colors --inline --hot --progress",
11
     "build": "NODE_ENV=production webpack -p",
11
     "build": "NODE_ENV=production webpack -p",
12
     "test": "echo \"Error: no test specified\" && exit 1"
12
     "test": "echo \"Error: no test specified\" && exit 1"
13
   },
13
   },

+ 2 - 2
src/action-creator.async.js View File

75
   if (fetchUserLogin.status === 200) dispatch(updateUserConnected(fetchUserLogin.json))
75
   if (fetchUserLogin.status === 200) dispatch(updateUserConnected(fetchUserLogin.json))
76
 }
76
 }
77
 
77
 
78
-export const getUserConnected = () => async dispatch => {
78
+export const getIsUserConnected = () => async dispatch => {
79
   const fetchUserLogged = await fetchWrapper({
79
   const fetchUserLogged = await fetchWrapper({
80
-    url: 'http://localhost:3001/user_logged',
80
+    url: 'http://localhost:3001/user/is_logged_in',
81
     param: {...FETCH_CONFIG, method: 'GET'},
81
     param: {...FETCH_CONFIG, method: 'GET'},
82
     actionName: USER_CONNECTED,
82
     actionName: USER_CONNECTED,
83
     dispatch
83
     dispatch

+ 0 - 7
src/component/common/Card/Card.jsx View File

14
 export default Card
14
 export default Card
15
 
15
 
16
 Card.propTypes = {
16
 Card.propTypes = {
17
-  // check https://stackoverflow.com/questions/27366077/only-allow-children-of-a-specific-type-in-a-react-component
18
-  // children: PropTypes.arrayOf( // children is an array
19
-  //   PropTypes.shape({ // of objects
20
-  //     type: PropTypes.oneOf([CardHeader, CardBody]) // that as an attribute 'type' equals to CardHeader or CardBody
21
-  //   })
22
-  // ),
23
-
24
   // from http://www.mattzabriskie.com/blog/react-validating-children
17
   // from http://www.mattzabriskie.com/blog/react-validating-children
25
   children: PropTypes.arrayOf((children, key, componentName /* , location, propFullName */) => {
18
   children: PropTypes.arrayOf((children, key, componentName /* , location, propFullName */) => {
26
     if (
19
     if (

+ 19 - 0
src/component/common/PopinFixed/PopinFixed.jsx View File

1
 import React from 'react'
1
 import React from 'react'
2
 import classnames from 'classnames'
2
 import classnames from 'classnames'
3
 import PropTypes from 'prop-types'
3
 import PropTypes from 'prop-types'
4
+import PopinFixedHeader from './PopinFixedHeader.jsx'
5
+import PopinFixedOption from './PopinFixedOption.jsx'
6
+import PopinFixedContent from './PopinFixedContent.jsx'
4
 
7
 
5
 const PopinFixed = props => {
8
 const PopinFixed = props => {
6
   return (
9
   return (
17
   visible: PropTypes.bool
20
   visible: PropTypes.bool
18
 }
21
 }
19
 
22
 
23
+PopinFixed.propTypes = {
24
+  // from http://www.mattzabriskie.com/blog/react-validating-children
25
+  children: PropTypes.arrayOf((children, key, componentName /* , location, propFullName */) => {
26
+    if (
27
+      children.length > 3 ||
28
+      children[0].type !== PopinFixedHeader ||
29
+      children[1].type !== PopinFixedOption ||
30
+      children[2].type !== PopinFixedContent
31
+    ) {
32
+      return new Error(`PropType Error: childrens of ${componentName} must be: 1 PopinFixedHeader, 1 PopinFixedOption and 1 PopinFixedContent.`)
33
+    }
34
+  }).isRequired,
35
+  customClass: PropTypes.string,
36
+  visible: PropTypes.bool
37
+}
38
+
20
 PopinFixed.defaultProps = {
39
 PopinFixed.defaultProps = {
21
   customClass: '',
40
   customClass: '',
22
   visible: true
41
   visible: true

src/container/PageText.jsx → src/container/FileType/PageHtml.jsx View File

1
 import React, { Component } from 'react'
1
 import React, { Component } from 'react'
2
-import PopinFixed from '../component/common/PopinFixed/PopinFixed'
3
-import PopinFixedHeader from '../component/common/PopinFixed/PopinFixedHeader.jsx'
4
-import PopinFixedOption from '../component/common/PopinFixed/PopinFixedOption.jsx'
5
-import PopinFixedContent from '../component/common/PopinFixed/PopinFixedContent.jsx'
6
-import Timeline from '../component/Timeline.jsx'
2
+import PopinFixed from '../../component/common/PopinFixed/PopinFixed'
3
+import PopinFixedHeader from '../../component/common/PopinFixed/PopinFixedHeader.jsx'
4
+import PopinFixedOption from '../../component/common/PopinFixed/PopinFixedOption.jsx'
5
+import PopinFixedContent from '../../component/common/PopinFixed/PopinFixedContent.jsx'
6
+import Timeline from '../../component/Timeline.jsx'
7
 
7
 
8
-class PageText extends Component {
8
+class PageHtml extends Component {
9
   render () {
9
   render () {
10
     return (
10
     return (
11
       <PopinFixed customClass={'wsFileText'}>
11
       <PopinFixed customClass={'wsFileText'}>
25
   }
25
   }
26
 }
26
 }
27
 
27
 
28
-export default PageText
28
+export default PageHtml
29
 
29
 
30
 /*
30
 /*
31
       <div className={classnames('wsFileText wsFileGeneric', {'visible': this.props.visible})}>
31
       <div className={classnames('wsFileText wsFileGeneric', {'visible': this.props.visible})}>

src/container/Thread.jsx → src/container/FileType/Thread.jsx View File

1
 import React, { Component } from 'react'
1
 import React, { Component } from 'react'
2
 import classnames from 'classnames'
2
 import classnames from 'classnames'
3
-import imgProfil from '../img/imgProfil.png'
3
+import imgProfil from '../../img/imgProfil.png'
4
 
4
 
5
 class Thread extends Component {
5
 class Thread extends Component {
6
   render () {
6
   render () {

+ 73 - 69
src/container/Login.jsx View File

1
 import React from 'react'
1
 import React from 'react'
2
 import { connect } from 'react-redux'
2
 import { connect } from 'react-redux'
3
+import { Redirect } from 'react-router'
3
 import LoginLogo from '../component/Login/LoginLogo.jsx'
4
 import LoginLogo from '../component/Login/LoginLogo.jsx'
4
 import LoginLogoImg from '../img/logoTracimWhite.svg'
5
 import LoginLogoImg from '../img/logoTracimWhite.svg'
5
 import { userLogin } from '../action-creator.async.js'
6
 import { userLogin } from '../action-creator.async.js'
25
   handleChangePassword = e => this.setState({inputPassword: e.target.value})
26
   handleChangePassword = e => this.setState({inputPassword: e.target.value})
26
   handleChangeRememberMe = () => this.setState(prev => ({inputRememberMe: !prev.inputRememberMe}))
27
   handleChangeRememberMe = () => this.setState(prev => ({inputRememberMe: !prev.inputRememberMe}))
27
 
28
 
28
-  handleClickSubmit = () => {
29
+  handleClickSubmit = async () => {
29
     const { history, dispatch } = this.props
30
     const { history, dispatch } = this.props
30
     const { inputLogin, inputPassword, inputRememberMe } = this.state
31
     const { inputLogin, inputPassword, inputRememberMe } = this.state
31
 
32
 
32
-    dispatch(userLogin(inputLogin, inputPassword, inputRememberMe))
33
-    .then(() => history.push('/'))
33
+    await dispatch(userLogin(inputLogin, inputPassword, inputRememberMe))
34
+    history.push('/')
34
   }
35
   }
35
 
36
 
36
   render () {
37
   render () {
37
-    return (
38
-      <section className='loginpage'>
39
-        <div className='container-fluid'>
40
-
41
-          <LoginLogo customClass='loginpage__logo' logoSrc={LoginLogoImg} />
42
-
43
-          <div className='row justify-content-center'>
44
-            <div className='col-12 col-sm-11 col-md-8 col-lg-6 col-xl-5'>
45
-
46
-              <Card customClass='loginpage__connection'>
47
-                <CardHeader customClass='connection__header text-center'>{'Connexion'}</CardHeader>
48
-
49
-                <CardBody formClass='connection__form'>
50
-                  <InputGroupText
51
-                    parentClassName='connection__form__groupemail'
52
-                    customClass='mb-3 mt-4'
53
-                    icon='fa-envelope-open-o'
54
-                    type='email'
55
-                    placeHolder='Adresse Email'
56
-                    invalidMsg='Email invalide.'
57
-                    value={this.state.inputLogin}
58
-                    onChange={this.handleChangeLogin}
59
-                  />
60
-
61
-                  <InputGroupText
62
-                    parentClassName='connection__form__groupepw'
63
-                    customClass=''
64
-                    icon='fa-lock'
65
-                    type='password'
66
-                    placeHolder='Mot de passe'
67
-                    invalidMsg='Mot de passe invalide.'
68
-                    value={this.state.inputPassword}
69
-                    onChange={this.handleChangePassword}
70
-                  />
71
-
72
-                  <div className='row mt-4 mb-4'>
73
-                    <div className='col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6'>
74
-                      <InputCheckbox
75
-                        parentClassName='connection__form__rememberme'
76
-                        customClass=''
77
-                        label='Se souvenir de moi'
78
-                        checked={this.state.inputRememberMe}
79
-                        onChange={this.handleChangeRememberMe}
80
-                      />
38
+    if (this.props.user.isLoggedIn) return <Redirect to={{pathname: '/'}} />
39
+    else {
40
+      return (
41
+        <section className='loginpage'>
42
+          <div className='container-fluid'>
43
+
44
+            <LoginLogo customClass='loginpage__logo' logoSrc={LoginLogoImg} />
45
+
46
+            <div className='row justify-content-center'>
47
+              <div className='col-12 col-sm-11 col-md-8 col-lg-6 col-xl-5'>
48
+
49
+                <Card customClass='loginpage__connection'>
50
+                  <CardHeader customClass='connection__header text-center'>{'Connexion'}</CardHeader>
51
+
52
+                  <CardBody formClass='connection__form'>
53
+                    <InputGroupText
54
+                      parentClassName='connection__form__groupemail'
55
+                      customClass='mb-3 mt-4'
56
+                      icon='fa-envelope-open-o'
57
+                      type='email'
58
+                      placeHolder='Adresse Email'
59
+                      invalidMsg='Email invalide.'
60
+                      value={this.state.inputLogin}
61
+                      onChange={this.handleChangeLogin}
62
+                    />
63
+
64
+                    <InputGroupText
65
+                      parentClassName='connection__form__groupepw'
66
+                      customClass=''
67
+                      icon='fa-lock'
68
+                      type='password'
69
+                      placeHolder='Mot de passe'
70
+                      invalidMsg='Mot de passe invalide.'
71
+                      value={this.state.inputPassword}
72
+                      onChange={this.handleChangePassword}
73
+                    />
74
+
75
+                    <div className='row mt-4 mb-4'>
76
+                      <div className='col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6'>
77
+                        <InputCheckbox
78
+                          parentClassName='connection__form__rememberme'
79
+                          customClass=''
80
+                          label='Se souvenir de moi'
81
+                          checked={this.state.inputRememberMe}
82
+                          onChange={this.handleChangeRememberMe}
83
+                        />
84
+                      </div>
85
+
86
+                      <div className='col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6 text-sm-right'>
87
+                        <LoginBtnForgotPw
88
+                          customClass='connection__form__pwforgot'
89
+                          label='Mot de passe oublié ?'
90
+                        />
91
+                      </div>
81
                     </div>
92
                     </div>
82
 
93
 
83
-                    <div className='col-12 col-sm-6 col-md-6 col-lg-6 col-xl-6 text-sm-right'>
84
-                      <LoginBtnForgotPw
85
-                        customClass='connection__form__pwforgot'
86
-                        label='Mot de passe oublié ?'
87
-                      />
88
-                    </div>
89
-                  </div>
90
-
91
-                  <Button
92
-                    htmlType='button'
93
-                    bootstrapType='primary'
94
-                    customClass='connection__form__btnsubmit'
95
-                    label='Connexion'
96
-                    onClick={this.handleClickSubmit}
97
-                  />
98
-                </CardBody>
99
-              </Card>
100
-
94
+                    <Button
95
+                      htmlType='button'
96
+                      bootstrapType='primary'
97
+                      customClass='connection__form__btnsubmit'
98
+                      label='Connexion'
99
+                      onClick={this.handleClickSubmit}
100
+                    />
101
+                  </CardBody>
102
+                </Card>
103
+
104
+              </div>
101
             </div>
105
             </div>
102
-          </div>
103
 
106
 
104
-        </div>
105
-      </section>
106
-    )
107
+          </div>
108
+        </section>
109
+      )
110
+    }
107
   }
111
   }
108
 }
112
 }
109
 
113
 

+ 0 - 16
src/container/Page.jsx View File

1
-import React from 'react'
2
-import { connect } from 'react-redux'
3
-
4
-class Page extends React.Component {
5
-  render () {
6
-    const { user } = this.props
7
-    return (
8
-      <div>
9
-        Page ! user Logged in : {user.isLoggedIn.toString()}
10
-      </div>
11
-    )
12
-  }
13
-}
14
-
15
-const mapStateToProps = ({ user }) => ({ user })
16
-export default connect(mapStateToProps)(Page)

+ 6 - 8
src/container/PrivateRoute.jsx View File

7
 
7
 
8
 // /!\ you shall destruct props.component otherwise you get a warning:
8
 // /!\ you shall destruct props.component otherwise you get a warning:
9
 // "You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored
9
 // "You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored
10
-const PrivateRoute = ({ component: Component, ...rest }) => {
11
-  return (
12
-    <Route {...rest} render={props => rest.user.isLoggedIn
13
-      ? <Component {...props} />
14
-      : <Redirect to={{pathname: '/login', state: {from: props.location}}} />
15
-    } />
16
-  )
17
-}
10
+const PrivateRoute = ({ component: Component, ...rest }) => (
11
+  <Route {...rest} render={props => rest.user.isLoggedIn
12
+    ? <Component {...props} />
13
+    : <Redirect to={{pathname: '/login', state: {from: props.location}}} />
14
+  } />
15
+)
18
 
16
 
19
 const mapStateToProps = ({ user }) => ({ user })
17
 const mapStateToProps = ({ user }) => ({ user })
20
 export default withRouter(connect(mapStateToProps)(PrivateRoute))
18
 export default withRouter(connect(mapStateToProps)(PrivateRoute))

+ 31 - 20
src/container/Tracim.jsx View File

4
 import Header from './Header.jsx'
4
 import Header from './Header.jsx'
5
 import Sidebar from './Sidebar.jsx'
5
 import Sidebar from './Sidebar.jsx'
6
 import Login from './Login.jsx'
6
 import Login from './Login.jsx'
7
-import Page from './Page.jsx'
8
 import WorkspaceContent from './WorkspaceContent.jsx'
7
 import WorkspaceContent from './WorkspaceContent.jsx'
9
 import {
8
 import {
10
   Route,
9
   Route,
11
   withRouter
10
   withRouter
12
 } from 'react-router-dom'
11
 } from 'react-router-dom'
13
 import PrivateRoute from './PrivateRoute.jsx'
12
 import PrivateRoute from './PrivateRoute.jsx'
14
-
15
-const SidebarWrapper = props => {
16
-  if (props.locationPath !== '/login') {
17
-    return (
18
-      <div className='sidebarpagecontainer'>
19
-        <Sidebar />
20
-        {props.children}
21
-      </div>
22
-    )
23
-  } else return props.children
24
-}
13
+import { getIsUserConnected } from '../action-creator.async.js'
25
 
14
 
26
 class Tracim extends React.Component {
15
 class Tracim extends React.Component {
16
+  componentDidMount = () => {
17
+    this.props.dispatch(getIsUserConnected())
18
+  }
19
+
27
   render () {
20
   render () {
28
-    const { location } = this.props
21
+    const { user, location } = this.props
22
+
23
+    const SidebarWrapper = props => {
24
+      if (props.locationPath !== '/login') {
25
+        return (
26
+          <div className='sidebarpagecontainer'>
27
+            <Sidebar />
28
+            {props.children}
29
+          </div>
30
+        )
31
+      } else return props.children
32
+    }
33
+
29
     return (
34
     return (
30
       <div>
35
       <div>
31
         <Header />
36
         <Header />
32
 
37
 
33
-        <Route path='/login' component={Login} />
38
+        { user.isLoggedIn === undefined
39
+          ? (<div />) // while we dont know if user is connected, display nothing but the header @TODO show loader
40
+          : (
41
+            <div>
42
+              <Route path='/login' component={Login} />
34
 
43
 
35
-        <SidebarWrapper locationPath={location.pathname}>
44
+              <SidebarWrapper locationPath={location.pathname}>
36
 
45
 
37
-          <PrivateRoute exact path='/' component={WorkspaceContent} />
38
-          <PrivateRoute path='/page' component={Page} />
46
+                <PrivateRoute exact path='/' component={WorkspaceContent} />
39
 
47
 
40
-        </SidebarWrapper>
48
+              </SidebarWrapper>
41
 
49
 
42
-        <Footer />
50
+              <Footer />
51
+            </div>
52
+          )
53
+        }
43
       </div>
54
       </div>
44
     )
55
     )
45
   }
56
   }
46
 }
57
 }
47
 
58
 
48
-const mapStateToProps = () => ({})
59
+const mapStateToProps = ({ user }) => ({ user })
49
 export default withRouter(connect(mapStateToProps)(Tracim))
60
 export default withRouter(connect(mapStateToProps)(Tracim))

+ 13 - 11
src/container/WorkspaceContent.jsx View File

3
 import Folder from '../component/Workspace/Folder.jsx'
3
 import Folder from '../component/Workspace/Folder.jsx'
4
 import FileItem from '../component/Workspace/FileItem.jsx'
4
 import FileItem from '../component/Workspace/FileItem.jsx'
5
 import FileItemHeader from '../component/Workspace/FileItemHeader.jsx'
5
 import FileItemHeader from '../component/Workspace/FileItemHeader.jsx'
6
-import Thread from './Thread.jsx'
7
-// import PageText from './PageText.jsx'
6
+// import Thread from './FileType/Thread.jsx'
7
+import PageHtml from './FileType/PageHtml.jsx'
8
 import PageWrapper from '../component/common/layout/PageWrapper.jsx'
8
 import PageWrapper from '../component/common/layout/PageWrapper.jsx'
9
 import PageTitle from '../component/common/layout/PageTitle.jsx'
9
 import PageTitle from '../component/common/layout/PageTitle.jsx'
10
 import PageContent from '../component/common/layout/PageContent.jsx'
10
 import PageContent from '../component/common/layout/PageContent.jsx'
43
 
43
 
44
             { workspace.content.map(c => c.type === 'folder'
44
             { workspace.content.map(c => c.type === 'folder'
45
               ? <Folder folderData={c} key={c.id} />
45
               ? <Folder folderData={c} key={c.id} />
46
-              : <FileItem
47
-                name={c.title}
48
-                type={c.type}
49
-                status={c.status}
50
-                onClickItem={() => this.setState({activeFileType: 'thread'})}
51
-                key={c.id}
52
-              />
46
+              : (
47
+                <FileItem
48
+                  name={c.title}
49
+                  type={c.type}
50
+                  status={c.status}
51
+                  onClickItem={() => this.setState({activeFileType: 'file'})}
52
+                  key={c.id}
53
+                />
54
+              )
53
             )}
55
             )}
54
           </div>
56
           </div>
55
 
57
 
56
           <DropdownCreateButton customClass='workspace__content__button mb-5' />
58
           <DropdownCreateButton customClass='workspace__content__button mb-5' />
57
 
59
 
58
-          <Thread visible={this.state.activeFileType === 'thread'} />
60
+          <PageHtml visible={this.state.activeFileType === 'file'} />
59
           {/*
61
           {/*
60
-          <PageText visible={this.state.activeFileType === 'file'} />
62
+          <Thread visible={this.state.activeFileType === 'chat'} />
61
           */}
63
           */}
62
         </PageContent>
64
         </PageContent>
63
 
65
 

+ 2 - 2
src/css/Header.styl View File

19
           color blue
19
           color blue
20
           font-size 16px
20
           font-size 16px
21
           &:hover
21
           &:hover
22
-            color dark-blue
22
+            color darkBlue
23
     &__rightside
23
     &__rightside
24
       display flex
24
       display flex
25
       margin-top 15px
25
       margin-top 15px
60
         &__btnquestion
60
         &__btnquestion
61
           margin-right 30px
61
           margin-right 30px
62
           .btnquestion__icon
62
           .btnquestion__icon
63
-            color dark-grey
63
+            color darkGrey
64
       &__itemprofil
64
       &__itemprofil
65
         &__profilgroup
65
         &__profilgroup
66
           .profilgroup__name
66
           .profilgroup__name

src/css/PageText.styl → src/css/PageHtml.styl View File


+ 3 - 3
src/css/Variable.styl View File

22
 blue = #2571fe
22
 blue = #2571fe
23
 lightBlue = #569EDE
23
 lightBlue = #569EDE
24
 
24
 
25
-btnCallAction = #28a745 // couleur des boutons call2action dans le contexte generale (tout contexte sauf celui d'un type de contenu particulier)
25
+// c2a btn color in general context ; meaning every context but specific one related to file type (file, pageHtml, issues, threads ...)
26
+btnCallAction = #28a745
26
 btnCallAction-hover = darken(btnCallAction, 15%)
27
 btnCallAction-hover = darken(btnCallAction, 15%)
27
 
28
 
28
 threadColor = #2674d3
29
 threadColor = #2674d3
41
 // calendarColor =
42
 // calendarColor =
42
 // dashboard =
43
 // dashboard =
43
 
44
 
44
-
45
 /*************************/
45
 /*************************/
46
 /**** BOX SHADOW ****/
46
 /**** BOX SHADOW ****/
47
 shadow-bottom = 0px 0px 5px 1px #606060
47
 shadow-bottom = 0px 0px 5px 1px #606060
48
 shadow-right = 2px 2px 5px 0px #404040
48
 shadow-right = 2px 2px 5px 0px #404040
49
 shadow-all = 1px 1px 5px 2px #ababab
49
 shadow-all = 1px 1px 5px 2px #ababab
50
-shadow-all-side-blue = 0px 0px 1px 1px light-blue
50
+shadow-all-side-blue = 0px 0px 1px 1px lightBlue
51
 shadow-all-side-green = 0 0 1px 2px green
51
 shadow-all-side-green = 0 0 1px 2px green
52
 
52
 
53
 /***********************/
53
 /***********************/

+ 1 - 1
src/css/index.styl View File

18
 @import 'Folder'
18
 @import 'Folder'
19
 
19
 
20
 @import 'Thread'
20
 @import 'Thread'
21
-@import 'PageText'
21
+@import 'PageHtml'
22
 @import 'Timeline'
22
 @import 'Timeline'

+ 12 - 2
src/reducer/user.js View File

3
   USER_DATA
3
   USER_DATA
4
 } from '../action-creator.sync.js'
4
 } from '../action-creator.sync.js'
5
 
5
 
6
+const serializeUser = data => ({
7
+  id: data.user.id,
8
+  isLoggedIn: data.logged,
9
+  username: data.user.username,
10
+  firstname: data.user.firstname,
11
+  lastname: data.user.lastname,
12
+  email: data.user.email
13
+})
14
+
6
 export default function user (state = {
15
 export default function user (state = {
7
-  isLoggedIn: false,
16
+  id: 0,
17
+  isLoggedIn: undefined,
8
   username: '',
18
   username: '',
9
   firstname: '',
19
   firstname: '',
10
   lastname: '',
20
   lastname: '',
12
 }, action) {
22
 }, action) {
13
   switch (action.type) {
23
   switch (action.type) {
14
     case `Update/${USER_CONNECTED}`:
24
     case `Update/${USER_CONNECTED}`:
15
-      return {...state, isLoggedIn: true, ...action.user}
25
+      return serializeUser(action.user)
16
 
26
 
17
     case `Update/${USER_DATA}`:
27
     case `Update/${USER_DATA}`:
18
       return {...state, ...action.data}
28
       return {...state, ...action.data}