From 80f9db47e32051b81895cc754f03ba68494a7071 Mon Sep 17 00:00:00 2001 From: Bogdan Cochior <bogdan.cochior@thinslices.com> Date: Tue, 21 Aug 2018 16:17:01 +0300 Subject: [PATCH] fix(dashboard): fix dashboard rediret --- packages/component-faraday-ui/src/Tag.js | 2 +- .../src/components/Dashboard/DashboardItems.js | 17 ++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/packages/component-faraday-ui/src/Tag.js b/packages/component-faraday-ui/src/Tag.js index e2d279938..ea8dca87d 100644 --- a/packages/component-faraday-ui/src/Tag.js +++ b/packages/component-faraday-ui/src/Tag.js @@ -12,7 +12,7 @@ export default styled.div` font-family: ${th('fontHeading')}; font-size: ${th('tag.fontSize')}; font-weight: ${th('tag.fontWeight')}; - padding: calc(${th('gridUnit')} / 4) calc(${th('gridUnit')} / 2); + padding: 0 calc(${th('gridUnit')} / 2); text-align: center; vertical-align: baseline; width: fit-content; diff --git a/packages/components-faraday/src/components/Dashboard/DashboardItems.js b/packages/components-faraday/src/components/Dashboard/DashboardItems.js index a978c0b0e..d6d5e398a 100644 --- a/packages/components-faraday/src/components/Dashboard/DashboardItems.js +++ b/packages/components-faraday/src/components/Dashboard/DashboardItems.js @@ -4,7 +4,7 @@ import { get, has } from 'lodash' import styled from 'styled-components' import { withRouter } from 'react-router-dom' import { ManuscriptCard, Row } from 'pubsweet-component-faraday-ui' -import { compose, setDisplayName, withHandlers, withProps } from 'recompose' +import { compose, setDisplayName, withHandlers } from 'recompose' import withVersion from './withVersion' @@ -30,17 +30,12 @@ const DashboardItems = ({ onClick, list, deleteProject, listView = true }) => ( export default compose( withRouter, - withProps(({ collection = {}, fragment = {} }) => ({ - hasDetails: get(collection, 'status', 'draft') !== 'draft', - isNotSubmitted: - get(collection, 'status', 'draft') === 'draft' || - !has(fragment, 'submitted'), - })), withHandlers({ - onClick: ({ history, hasDetails, isNotSubmitted }) => ( - collection, - fragment, - ) => { + onClick: ({ history }) => (collection, fragment) => { + const hasDetails = get(collection, 'status', 'draft') !== 'draft' + const isNotSubmitted = + get(collection, 'status', 'draft') === 'draft' && + !has(fragment, 'submitted') if (isNotSubmitted) { history.push( `/projects/${collection.id}/versions/${fragment.id}/submit`, -- GitLab