Procházet zdrojové kódy

fix js error in dashboard related to contentTypeBtn.jsx

Skylsmoi před 6 roky
rodič
revize
fb60467992
1 změnil soubory, kde provedl 8 přidání a 8 odebrání
  1. 8 8
      frontend/src/container/Dashboard.jsx

+ 8 - 8
frontend/src/container/Dashboard.jsx Zobrazit soubor

@@ -237,15 +237,15 @@ class Dashboard extends React.Component {
237 237
             </div>
238 238
 
239 239
             <div className='dashboard__calltoaction justify-content-xl-center'>
240
-              {props.contentType.map(ct =>
240
+              {props.appList.map(app =>
241 241
                 <ContentTypeBtn
242 242
                   customClass='dashboard__calltoaction__button'
243
-                  hexcolor={ct.hexcolor}
244
-                  label={ct.label}
245
-                  faIcon={ct.faIcon}
246
-                  creationLabel={ct.creationLabel}
247
-                  onClickBtn={() => props.history.push(PAGE.WORKSPACE.NEW(props.curWs.id, ct.slug))}
248
-                  key={ct.label}
243
+                  hexcolor={app.hexcolor}
244
+                  label={app.label}
245
+                  faIcon={app.faIcon}
246
+                  creationLabel={(props.contentType.find(ct => app.slug.includes(ct.slug)) || {creationLabel: ''}).creationLabel}
247
+                  onClickBtn={() => props.history.push(PAGE.WORKSPACE.NEW(props.curWs.id, app.slug))}
248
+                  key={app.label}
249 249
                 />
250 250
               )}
251 251
             </div>
@@ -293,5 +293,5 @@ class Dashboard extends React.Component {
293 293
   }
294 294
 }
295 295
 
296
-const mapStateToProps = ({ user, contentType, currentWorkspace }) => ({ user, contentType, curWs: currentWorkspace })
296
+const mapStateToProps = ({ user, contentType, appList, currentWorkspace }) => ({ user, contentType, appList, curWs: currentWorkspace })
297 297
 export default connect(mapStateToProps)(translate()(Dashboard))