Browse Source

[wip] integration of PopupCreateContent

Skylsmoi 6 years ago
parent
commit
f84ea3fd2b

+ 0 - 44
src/component/PopupContent/FileContent.jsx View File

@@ -1,44 +0,0 @@
1
-import React, { Component } from 'react'
2
-
3
-class fileContent extends Component {
4
-  render () {
5
-    return (
6
-      <div className='filecontent p-3'>
7
-        <div className='filecontent__close d-flex justify-content-end'>
8
-          <i className='fa fa-times' />
9
-        </div>
10
-        <div className='filecontent__contentname d-flex align-items-center mb-4'>
11
-          <div className='filecontent__contentname__icon mr-3'>
12
-            <i className='fa fa-file-text-o' />
13
-          </div>
14
-          <div className='filecontent__contentname__title'>
15
-            Fichier de prévisualisation
16
-          </div>
17
-        </div>
18
-
19
-        <div className='filecontent__text'>Importer votre fichier :</div>
20
-        <div className='filecontent__form mb-4' drop='true'>
21
-          <div className='filecontent__form__icon d-flex justify-content-center'>
22
-            <label htmlFor='filecontentUpload' type='file'>
23
-              <i className='fa fa-download' />
24
-            </label>
25
-            <input type='file' className='d-none' id='filecontentUpload' />
26
-          </div>
27
-          <div className='filecontent__form__instruction text-center'>
28
-            Glisser votre fichier ici
29
-          </div>
30
-          <div className='filecontent__form__text text-center'>
31
-            Vous pouvez également importer votre fichier en cliquant sur l'icon
32
-          </div>
33
-        </div>
34
-        <div className='filecontent__button d-flex justify-content-end'>
35
-          <button className='filecontent__form__button btn btn-outline-primary'>
36
-            Créer et Valider
37
-          </button>
38
-        </div>
39
-      </div>
40
-    )
41
-  }
42
-}
43
-
44
-export default fileContent

+ 0 - 33
src/component/PopupContent/GenericContent.jsx View File

@@ -1,33 +0,0 @@
1
-import React, { Component } from 'react'
2
-
3
-class GenericContent extends Component {
4
-  render () {
5
-    return (
6
-      <div className='genericcontent p-3'>
7
-        <div className='genericcontent__close d-flex justify-content-end'>
8
-          <i className='fa fa-times' />
9
-        </div>
10
-        <div className='genericcontent__contentname d-flex align-items-center mb-4'>
11
-          <div className='genericcontent__contentname__icon mr-3'>
12
-            <i className='fa fa-file-word-o' />
13
-          </div>
14
-          <div className='genericcontent__contentname__title'>
15
-            Fichier Texte
16
-          </div>
17
-        </div>
18
-        <form className='genericcontent__form'>
19
-          <div className='genericcontent__form__input mb-2'>
20
-            <input type='text' placeholder='Titre du document' />
21
-          </div>
22
-          <div className='genericcontent__form__button d-flex justify-content-end p-3'>
23
-            <button className='genericcontent__form__button btn btn-outline-primary' type='submit'>
24
-              Créer et Valider
25
-            </button>
26
-          </div>
27
-        </form>
28
-      </div>
29
-    )
30
-  }
31
-}
32
-
33
-export default GenericContent

+ 0 - 30
src/component/PopupContent/WksContent.jsx View File

@@ -1,30 +0,0 @@
1
-import React, { Component } from 'react'
2
-
3
-class wksContent extends Component {
4
-  render () {
5
-    return (
6
-      <div className='wkscontent p-3'>
7
-        <div className='wkscontent__close d-flex justify-content-end'>
8
-          <i className='fa fa-times' />
9
-        </div>
10
-        <div className='wkscontent__contentname d-flex align-items-center mb-4'>
11
-          <div className='wkscontent__contentname__title'>
12
-            Création d'un espace de travail
13
-          </div>
14
-        </div>
15
-        <form className='wkscontent__form'>
16
-          <div className='wkscontent__form__input mb-2'>
17
-            <input type='text' placeholder='Titre du document' />
18
-          </div>
19
-          <div className='wkscontent__form__button d-flex justify-content-end p-3'>
20
-            <button className='wkscontent__form__button btn btn-outline-primary' type='submit'>
21
-              Créer et Valider
22
-            </button>
23
-          </div>
24
-        </form>
25
-      </div>
26
-    )
27
-  }
28
-}
29
-
30
-export default wksContent

+ 51 - 0
src/component/PopupCreateContent/ContentType/FileContent.jsx View File

@@ -0,0 +1,51 @@
1
+import React from 'react'
2
+
3
+require('./FileContent.styl')
4
+
5
+const FileContent = props => {
6
+  return (
7
+    <div className='filecontent p-3'>
8
+      <div className='filecontent__close d-flex justify-content-end'>
9
+        <i className='fa fa-times' />
10
+      </div>
11
+
12
+      <div className='filecontent__contentname d-flex align-items-center mb-4'>
13
+        <div className='filecontent__contentname__icon mr-3'>
14
+          <i className='fa fa-file-text-o' />
15
+        </div>
16
+
17
+        <div className='filecontent__contentname__title'>
18
+          Fichier de prévisualisation
19
+        </div>
20
+      </div>
21
+
22
+      <div className='filecontent__text'>Importer votre fichier :</div>
23
+
24
+      <div className='filecontent__form mb-4' drop='true'>
25
+        <div className='filecontent__form__icon d-flex justify-content-center'>
26
+          <label htmlFor='filecontentUpload' type='file'>
27
+            <i className='fa fa-download' />
28
+          </label>
29
+
30
+          <input type='file' className='d-none' id='filecontentUpload' />
31
+        </div>
32
+
33
+        <div className='filecontent__form__instruction text-center'>
34
+          Glisser votre fichier ici
35
+        </div>
36
+
37
+        <div className='filecontent__form__text text-center'>
38
+          Vous pouvez également importer votre fichier en cliquant sur l'icon
39
+        </div>
40
+      </div>
41
+
42
+      <div className='filecontent__button d-flex justify-content-end'>
43
+        <button className='filecontent__form__button btn btn-outline-primary'>
44
+          Créer et Valider
45
+        </button>
46
+      </div>
47
+    </div>
48
+  )
49
+}
50
+
51
+export default FileContent

src/css/FileContent.styl → src/component/PopupCreateContent/ContentType/FileContent.styl View File


+ 37 - 0
src/component/PopupCreateContent/ContentType/GenericContent.jsx View File

@@ -0,0 +1,37 @@
1
+import React from 'react'
2
+
3
+require('./GenericContent.styl')
4
+
5
+const GenericContent = props => {
6
+  return (
7
+    <div className='genericcontent p-3'>
8
+      <div className='genericcontent__close d-flex justify-content-end'>
9
+        <i className='fa fa-times' />
10
+      </div>
11
+
12
+      <div className='genericcontent__contentname d-flex align-items-center mb-4'>
13
+        <div className='genericcontent__contentname__icon mr-3'>
14
+          <i className='fa fa-file-word-o' />
15
+        </div>
16
+
17
+        <div className='genericcontent__contentname__title'>
18
+          Fichier Texte
19
+        </div>
20
+      </div>
21
+
22
+      <form className='genericcontent__form'>
23
+        <div className='genericcontent__form__input mb-2'>
24
+          <input type='text' placeholder='Titre du document' />
25
+        </div>
26
+
27
+        <div className='genericcontent__form__button d-flex justify-content-end p-3'>
28
+          <button className='genericcontent__form__button btn btn-outline-primary' type='submit'>
29
+            Créer et Valider
30
+          </button>
31
+        </div>
32
+      </form>
33
+    </div>
34
+  )
35
+}
36
+
37
+export default GenericContent

+ 16 - 0
src/component/PopupCreateContent/ContentType/GenericContent.styl View File

@@ -0,0 +1,16 @@
1
+.genericcontent
2
+  &__close
3
+    cursor pointer
4
+  &__contentname
5
+    &__icon
6
+      font-size 30px
7
+    &__title
8
+      font-size 20px
9
+      color htmlColor
10
+  &__form
11
+    &__input
12
+      & > input
13
+        border: 1px solid grey;
14
+        border-radius: 5px;
15
+        padding: 5px;
16
+        width: 353PX;

+ 33 - 0
src/component/PopupCreateContent/ContentType/WsContent.jsx View File

@@ -0,0 +1,33 @@
1
+import React from 'react'
2
+
3
+require('./WsContent.styl')
4
+
5
+const WsContent = props => {
6
+  return (
7
+    <div className='wscontent p-3'>
8
+      <div className='wscontent__close d-flex justify-content-end'>
9
+        <i className='fa fa-times' />
10
+      </div>
11
+
12
+      <div className='wscontent__contentname d-flex align-items-center mb-4'>
13
+        <div className='wscontent__contentname__title'>
14
+          Création d'un espace de travail
15
+        </div>
16
+      </div>
17
+
18
+      <form className='wscontent__form'>
19
+        <div className='wscontent__form__input mb-2'>
20
+          <input type='text' placeholder='Titre du document' />
21
+        </div>
22
+
23
+        <div className='wscontent__form__button d-flex justify-content-end p-3'>
24
+          <button className='wscontent__form__button btn btn-outline-primary' type='submit'>
25
+            Créer et Valider
26
+          </button>
27
+        </div>
28
+      </form>
29
+    </div>
30
+  )
31
+}
32
+
33
+export default WsContent

src/css/WksContent.styl → src/component/PopupCreateContent/ContentType/WsContent.styl View File

@@ -1,4 +1,4 @@
1
-.wkscontent
1
+.wscontent
2 2
   &__close
3 3
     cursor pointer
4 4
   &__contentname

+ 47 - 0
src/component/PopupCreateContent/PopupCreateContainer.jsx View File

@@ -0,0 +1,47 @@
1
+import React from 'react'
2
+import PropTypes from 'prop-types'
3
+import CardPopup from '../common/CardPopup/CardPopup.jsx'
4
+import GenericContent from './ContentType/GenericContent.jsx'
5
+import FileContent from './ContentType/FileContent.jsx'
6
+import WsContent from './ContentType/WsContent.jsx'
7
+
8
+require('./PopupCreateContainer.styl')
9
+
10
+const PopupCreateContainer = props => {
11
+  const FormCreateContent = (() => {
12
+    switch (props.type) {
13
+      case 'Workspace':
14
+        return <WsContent />
15
+      case 'File':
16
+        return <FileContent />
17
+      case 'folder':
18
+        return <GenericContent />
19
+      default:
20
+        return <GenericContent />
21
+    }
22
+  })()
23
+
24
+  // return (
25
+  //   <div className='popupcontent'>
26
+  //     <div className='popupcontent__container card'>
27
+  //       <div className='popupcontent__container__header' />
28
+  //       <div className='card-body nopadding'>
29
+  //         { FormCreateContent }
30
+  //       </div>
31
+  //     </div>
32
+  //   </div>
33
+  // )
34
+  return (
35
+    <CardPopup customClass='popupCreateContent' onClose={props.onClose}>
36
+      { FormCreateContent }
37
+    </CardPopup>
38
+  )
39
+}
40
+
41
+export default PopupCreateContainer
42
+
43
+PopupCreateContainer.propTypes = {
44
+  type: PropTypes.string.isRequired,
45
+  folder: PropTypes.object,
46
+  onClose: PropTypes.func.isRequired
47
+}

+ 23 - 0
src/component/PopupCreateContent/PopupCreateContainer.styl View File

@@ -0,0 +1,23 @@
1
+@import '../../css/Variable.styl'
2
+
3
+.popupCreateContent
4
+  position fixed
5
+  top 0
6
+  left 0
7
+  display flex
8
+  justify-content center
9
+  width 100%
10
+  z-index 5
11
+  .cardPopup__container
12
+    margin-top 120px
13
+    border 0
14
+    border-radius 10px
15
+    width 400px
16
+    background lightGrey
17
+    box-shadow shadow-all
18
+  &__header
19
+    border-top-right-radius 10px
20
+    border-top-left-radius 10px
21
+    width 100%
22
+    height 8px
23
+    background-color fileColor

+ 12 - 13
src/component/Workspace/Folder.jsx View File

@@ -19,9 +19,9 @@ class Folder extends React.Component {
19 19
     this.setState({open: !this.state.open})
20 20
   }
21 21
 
22
-  handleClickNewFile = e => {
22
+  handleClickCreateContent = (e, folder, type) => {
23 23
     e.stopPropagation() // because we have a link inside a link (togler and newFile)
24
-    console.log('new file') // @TODO
24
+    this.props.onClickCreateContent(folder, type)
25 25
   }
26 26
 
27 27
   render () {
@@ -53,16 +53,15 @@ class Folder extends React.Component {
53 53
 
54 54
           <div className='folder__header__button'>
55 55
 
56
-            <div
57
-              className='folder__header__button__addbtn'
58
-              onClick={this.handleClickNewFile}
59
-            >
56
+            <div className='folder__header__button__addbtn'>
60 57
               <button className='addbtn__text btn btn-outline-primary dropdown-toggle' type='button' id='dropdownMenuButton' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>
61 58
                 {t('Folder.create')} ...
62 59
               </button>
63 60
 
61
+              {/* @TODO generate the subdropdown with available app from redux */}
62
+
64 63
               <div className='addbtn__subdropdown dropdown-menu' aria-labelledby='dropdownMenuButton'>
65
-                <div className='subdropdown__link dropdown-item'>
64
+                <div className='subdropdown__link dropdown-item' onClick={e => this.handleClickCreateContent(e, folderData, 'folder')}>
66 65
                   <div className='subdropdown__link__folder d-flex align-items-center'>
67 66
                     <div className='subdropdown__link__folder__icon mr-3'>
68 67
                       <i className='fa fa-fw fa-folder-o' />
@@ -72,7 +71,7 @@ class Folder extends React.Component {
72 71
                     </div>
73 72
                   </div>
74 73
                 </div>
75
-                <div className='subdropdown__link dropdown-item'>
74
+                <div className='subdropdown__link dropdown-item' onClick={e => this.handleClickCreateContent(e, folderData, 'PageHtml')}>
76 75
                   <div className='subdropdown__link__apphtml d-flex align-items-center'>
77 76
                     <div className='subdropdown__link__apphtml__icon mr-3'>
78 77
                       <i className='fa fa-fw fa-file-text-o' />
@@ -82,7 +81,7 @@ class Folder extends React.Component {
82 81
                     </div>
83 82
                   </div>
84 83
                 </div>
85
-                <div className='subdropdown__link dropdown-item'>
84
+                <div className='subdropdown__link dropdown-item' onClick={e => this.handleClickCreateContent(e, folderData, 'File')}>
86 85
                   <div className='subdropdown__link__appfile d-flex align-items-center'>
87 86
                     <div className='subdropdown__link__appfile__icon mr-3'>
88 87
                       <i className='fa fa-fw fa-file-image-o' />
@@ -92,7 +91,7 @@ class Folder extends React.Component {
92 91
                     </div>
93 92
                   </div>
94 93
                 </div>
95
-                <div className='subdropdown__link dropdown-item'>
94
+                <div className='subdropdown__link dropdown-item' onClick={e => this.handleClickCreateContent(e, folderData, 'PageMarkdown')}>
96 95
                   <div className='subdropdown__link__appmarkdown d-flex align-items-center'>
97 96
                     <div className='subdropdown__link__appmarkdown__icon mr-3'>
98 97
                       <i className='fa fa-fw fa-file-code-o' />
@@ -102,7 +101,7 @@ class Folder extends React.Component {
102 101
                     </div>
103 102
                   </div>
104 103
                 </div>
105
-                <div className='subdropdown__link dropdown-item'>
104
+                <div className='subdropdown__link dropdown-item' onClick={e => this.handleClickCreateContent(e, folderData, 'Thread')}>
106 105
                   <div className='subdropdown__link__appthread d-flex align-items-center'>
107 106
                     <div className='subdropdown__link__appthread__icon mr-3'>
108 107
                       <i className='fa fa-fw fa-comments-o' />
@@ -112,7 +111,7 @@ class Folder extends React.Component {
112 111
                     </div>
113 112
                   </div>
114 113
                 </div>
115
-                <div className='subdropdown__link dropdown-item'>
114
+                <div className='subdropdown__link dropdown-item' onClick={e => this.handleClickCreateContent(e, folderData, 'Task')}>
116 115
                   <div className='subdropdown__link__apptask d-flex align-items-center'>
117 116
                     <div className='subdropdown__link__apptask__icon mr-3'>
118 117
                       <i className='fa fa-fw fa-list-ul' />
@@ -122,7 +121,7 @@ class Folder extends React.Component {
122 121
                     </div>
123 122
                   </div>
124 123
                 </div>
125
-                <div className='subdropdown__link dropdown-item'>
124
+                <div className='subdropdown__link dropdown-item' onClick={e => this.handleClickCreateContent(e, folderData, 'Issue')}>
126 125
                   <div className='subdropdown__link__appissue d-flex align-items-center'>
127 126
                     <div className='subdropdown__link__appissue__icon mr-3'>
128 127
                       <i className='fa fa-fw fa-ticket' />

+ 1 - 18
src/component/common/CardPopup/CardPopup.jsx View File

@@ -16,18 +16,7 @@ const CardPopup = props => {
16 16
           </div>
17 17
 
18 18
           <div className='cardPopup__body'>
19
-            <div className='cardPopup__body__icon'>
20
-              <i className={props.icon} />
21
-            </div>
22
-
23
-            <div className='cardPopup__body__text'>
24
-              <div className='cardPopup__body__text__title'>
25
-                {props.title}
26
-              </div>
27
-              <div className='cardPopup__body__text__message'>
28
-                {props.message}
29
-              </div>
30
-            </div>
19
+            { props.children }
31 20
           </div>
32 21
         </div>
33 22
       </div>
@@ -39,16 +28,10 @@ export default CardPopup
39 28
 
40 29
 CardPopup.propTypes = {
41 30
   customClass: PropTypes.string,
42
-  title: PropTypes.string,
43
-  message: PropTypes.string,
44
-  icon: PropTypes.string,
45 31
   onClose: PropTypes.func
46 32
 }
47 33
 
48 34
 CardPopup.defaultProps = {
49 35
   customClass: 'defaultCustomClass',
50
-  title: 'Default title',
51
-  message: 'Default message',
52
-  icon: 'fa fa-times-circle',
53 36
   onClose: () => {}
54 37
 }

+ 0 - 54
src/container/PopupCreateContainer.jsx View File

@@ -1,54 +0,0 @@
1
-import React, { Component } from 'react'
2
-// import GenericContent from '../component/PopupContent/GenericContent.jsx'
3
-// import FileContent from '../component/PopupContent/FileContent.jsx'
4
-// import WksContent from '../component/PopupContent/WksContent.jsx'
5
-
6
-class PopupCreateContainer extends Component {
7
-  render () {
8
-    return (
9
-      <div className='popupcontent'>
10
-        <div className='popupcontent__container card'>
11
-          <div className='popupcontent__container__header' />
12
-          <div className='card-body nopadding'>
13
-            <div className='filecontent p-3'>
14
-              <div className='filecontent__close d-flex justify-content-end'>
15
-                <i className='fa fa-times' />
16
-              </div>
17
-              <div className='filecontent__contentname d-flex align-items-center mb-4'>
18
-                <div className='filecontent__contentname__icon mr-3'>
19
-                  <i className='fa fa-file-text-o' />
20
-                </div>
21
-                <div className='filecontent__contentname__title'>
22
-                  Fichier de prévisualisation
23
-                </div>
24
-              </div>
25
-
26
-              <div className='filecontent__text'>Importer votre fichier :</div>
27
-              <div className='filecontent__form mb-4' drop='true'>
28
-                <div className='filecontent__form__icon d-flex justify-content-center'>
29
-                  <label htmlFor='filecontentUpload' type='file'>
30
-                    <i className='fa fa-download' />
31
-                  </label>
32
-                  <input type='file' className='d-none' id='filecontentUpload' />
33
-                </div>
34
-                <div className='filecontent__form__instruction text-center'>
35
-                  Glisser votre fichier ici
36
-                </div>
37
-                <div className='filecontent__form__text text-center'>
38
-                  Vous pouvez également importer votre fichier en cliquant sur l'icon
39
-                </div>
40
-              </div>
41
-              <div className='filecontent__button d-flex justify-content-end'>
42
-                <button className='filecontent__form__button btn btn-outline-primary'>
43
-                  Créer et Valider
44
-                </button>
45
-              </div>
46
-            </div>
47
-          </div>
48
-        </div>
49
-      </div>
50
-    )
51
-  }
52
-}
53
-
54
-export default PopupCreateContainer

+ 1 - 1
src/container/WIPcomponent.jsx View File

@@ -1,6 +1,6 @@
1 1
 import React from 'react'
2 2
 import { connect } from 'react-redux'
3
-import PopupCreateContainer from './PopupCreateContainer.jsx'
3
+import PopupCreateContainer from '../component/PopupCreateContent/PopupCreateContainer.jsx'
4 4
 import ProgressBar from './ProgressBar.jsx'
5 5
 import Home from './Home.jsx'
6 6
 import CardPopup from '../component/common/CardPopup/CardPopup.jsx'

+ 52 - 14
src/container/WorkspaceContent.jsx View File

@@ -1,6 +1,7 @@
1 1
 import React from 'react'
2 2
 import { connect } from 'react-redux'
3 3
 import appFactory from '../appFactory.js'
4
+import { PAGE } from '../helper.js'
4 5
 import Sidebar from './Sidebar.jsx'
5 6
 import Folder from '../component/Workspace/Folder.jsx'
6 7
 import ContentItem from '../component/Workspace/ContentItem.jsx'
@@ -9,29 +10,41 @@ import PageWrapper from '../component/common/layout/PageWrapper.jsx'
9 10
 import PageTitle from '../component/common/layout/PageTitle.jsx'
10 11
 import PageContent from '../component/common/layout/PageContent.jsx'
11 12
 import DropdownCreateButton from '../component/common/Input/DropdownCreateButton.jsx'
13
+import PopupCreateContent from '../component/PopupCreateContent/PopupCreateContainer.jsx'
12 14
 import {
13 15
   getAppList,
14 16
   getWorkspaceContent,
15 17
   getFolderContent
16 18
 } from '../action-creator.async.js'
17
-import {newFlashMessage, setWorkspaceData} from '../action-creator.sync.js'
18
-import { PAGE } from '../helper.js'
19
+import {
20
+  newFlashMessage,
21
+  setWorkspaceData
22
+} from '../action-creator.sync.js'
19 23
 
20 24
 const qs = require('query-string')
21 25
 
22 26
 class WorkspaceContent extends React.Component {
27
+  constructor (props) {
28
+    super(props)
29
+    this.state = {
30
+      popupCreateContent: {
31
+        display: false,
32
+        type: undefined,
33
+        folder: undefined
34
+      }
35
+    }
36
+  }
37
+
23 38
   async componentDidMount () {
24 39
     const { workspaceList, app, match, location, dispatch } = this.props
25 40
 
26 41
     if (Object.keys(app).length === 0) dispatch(getAppList()) // async but no need await
27 42
 
28
-    const wsToLoad = (() => {
29
-      if (match.params.idws !== undefined) return match.params.idws
30
-      if (workspaceList.length > 0) return workspaceList[0].id // load first ws if none specified
31
-      return null
32
-    })()
43
+    let wsToLoad = null
44
+    if (match.params.idws !== undefined) wsToLoad = match.params.idws
45
+    else if (workspaceList.length > 0) wsToLoad = workspaceList[0].id // load first ws if none specified
33 46
 
34
-    if (wsToLoad === null) return
47
+    if (wsToLoad === null) return // ws already loaded
35 48
 
36 49
     const wsContent = await dispatch(getWorkspaceContent(wsToLoad))
37 50
     if (wsContent.status === 200) {
@@ -80,16 +93,32 @@ class WorkspaceContent extends React.Component {
80 93
     this.props.dispatch(getFolderContent(this.props.workspace.id, folderId))
81 94
   }
82 95
 
83
-  filterWorkspaceContent = (contentList, filter) => filter.length === 0
84
-    ? contentList
85
-    : contentList.filter(c => c.type === 'folder' || filter.includes(c.type)) // keep unfiltered files and folders
86
-      .map(c => c.type !== 'folder' ? c : {...c, content: this.filterWorkspaceContent(c.content, filter)}) // recursively filter folder content
87
-      // .filter(c => c.type !== 'folder' || c.content.length > 0) // remove empty folder => 2018/05/21 - since we load only one lvl of content, don't remove empty folders
96
+  handleClickCreateContent = (folder, contentType) => this.setState({
97
+    popupCreateContent: {
98
+      display: true,
99
+      type: contentType,
100
+      folder: folder
101
+    }
102
+  })
103
+
104
+  handleClosePopupCreateContent = () => this.setState({
105
+    popupCreateContent: {
106
+      display: false,
107
+      type: undefined,
108
+      folder: undefined
109
+    }
110
+  })
88 111
 
89 112
   render () {
90 113
     const { workspace, app } = this.props
91 114
 
92
-    const filteredWorkspaceContent = this.filterWorkspaceContent(workspace.content, workspace.filter)
115
+    const filterWorkspaceContent = (contentList, filter) => filter.length === 0
116
+      ? contentList
117
+      : contentList.filter(c => c.type === 'folder' || filter.includes(c.type)) // keep unfiltered files and folders
118
+        .map(c => c.type !== 'folder' ? c : {...c, content: this.filterWorkspaceContent(c.content, filter)}) // recursively filter folder content
119
+    // .filter(c => c.type !== 'folder' || c.content.length > 0) // remove empty folder => 2018/05/21 - since we load only one lvl of content, don't remove empty folders
120
+
121
+    const filteredWorkspaceContent = filterWorkspaceContent(workspace.content, workspace.filter)
93 122
 
94 123
     return (
95 124
       <div className='sidebarpagecontainer'>
@@ -105,6 +134,14 @@ class WorkspaceContent extends React.Component {
105 134
           </PageTitle>
106 135
 
107 136
           <PageContent parentClass='workspace__content'>
137
+            { this.state.popupCreateContent.display &&
138
+              <PopupCreateContent
139
+                type={this.state.popupCreateContent.type}
140
+                folder={this.state.popupCreateContent.folder}
141
+                onClose={this.handleClosePopupCreateContent}
142
+              />
143
+            }
144
+
108 145
             <div className='workspace__content__fileandfolder folder__content active'>
109 146
               <ContentItemHeader />
110 147
 
@@ -122,6 +159,7 @@ class WorkspaceContent extends React.Component {
122 159
                       delete: this.handleClickDeleteContentItem
123 160
                     }}
124 161
                     onClickFolder={this.handleClickFolder}
162
+                    onClickCreateContent={this.handleClickCreateContent}
125 163
                     isLast={i === filteredWorkspaceContent.length - 1}
126 164
                     key={c.id}
127 165
                   />

+ 0 - 18
src/css/Generic.styl View File

@@ -184,21 +184,3 @@
184 184
       border 1px solid grey
185 185
       border-radius 10px
186 186
       padding 15px 25px
187
-
188
-.genericcontent
189
-  &__close
190
-    cursor pointer
191
-  &__contentname
192
-    &__icon
193
-      font-size 30px
194
-    &__title
195
-      font-size 20px
196
-      color htmlColor
197
-  &__form
198
-    &__input
199
-      & > input
200
-        border: 1px solid grey;
201
-        border-radius: 5px;
202
-        padding: 5px;
203
-        width: 353PX;
204
-

+ 0 - 19
src/css/PopupCreateContainer.styl View File

@@ -1,19 +0,0 @@
1
-.popupcontent
2
-  position fixed
3
-  display flex
4
-  justify-content center
5
-  width 100%
6
-  z-index 3
7
-  &__container
8
-    margin-top 120px
9
-    border 0
10
-    border-radius 10px
11
-    width 400px
12
-    background lightGrey
13
-    box-shadow shadow-all
14
-    &__header
15
-      border-top-right-radius 10px
16
-      border-top-left-radius 10px
17
-      width 100%
18
-      height 8px
19
-      background-color fileColor

+ 0 - 4
src/css/index.styl View File

@@ -28,10 +28,6 @@ html, body, #content
28 28
 
29 29
 @import 'FlashMessage'
30 30
 
31
-@import 'PopupCreateContainer'
32
-@import 'FileContent'
33
-@import 'WksContent'
34
-
35 31
 @import 'Homepage'
36 32
 @import 'HomepageCard'
37 33