diff --git a/.gitlab-ci.v2.yml b/.gitlab-ci.v2.yml deleted file mode 100644 index 7bf945c24b2810da8795d439d75df05c678d4e3c..0000000000000000000000000000000000000000 --- a/.gitlab-ci.v2.yml +++ /dev/null @@ -1,96 +0,0 @@ -variables: - IMAGE_TAG: latest - IMAGE_ORG: bogdandev - IMAGE_NAME: xpub-faraday - REV_BUCKET: faraday-rollback - CLUSTER_NAME: faraday-qa - CI_PROJECT_NAME: faraday-qa - REPO_URL: https://gitlab.coko.foundation/xpub/xpub-faraday - IMAGE_TAG: $CI_PROJECT_NAME:$CI_COMMIT_SHA - IMAGE_NAME: "$REPOSITORY_URL/$IMAGE_TAG" - -image: docker:stable -services: - - docker:dind - -stages: - - build - - deploy - - test - - rollback - -build: - stage: build - script: - # Setup - - export AWS_REGION="eu-west-1" - - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID - - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY - - export REPO=$REPOSITORY_URL - - apk update - - apk --no-cache add --update curl python python-dev py-pip - - pip install awscli --upgrade --user - - export PATH=~/.local/bin:/usr/bin/:$PATH - # AUTH - - CERT=`aws ecr get-login --no-include-email --region ${AWS_REGION}` - - ${CERT} - # Build - - docker build -t ${CI_PROJECT_NAME}:$CI_COMMIT_SHA . - - docker tag $CI_PROJECT_NAME:$CI_COMMIT_SHA $REPO:latest - - docker push $REPO:latest - environment: - name: staging - -deploy: - stage: deploy - script: - - export AWS_REGION="eu-west-1" - - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID - - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY - - apk --no-cache add --update python python-dev py-pip - - pip install ecs-deploy - # Deploy - - ecs deploy --region ${AWS_REGION} ${CLUSTER_NAME} ${CI_PROJECT_NAME} --tag ${CI_COMMIT_SHA} - environment: - name: staging - -test: - stage: test - script: - - export AWS_REGION="us-east-1" - - export AWS_ACCESS_KEY_ID=$aws_access_key_id - - export AWS_SECRET_ACCESS_KEY=$aws_secret_access_key - - apk --no-cache add --update curl python python-dev py-pip jq - - pip install awscli --upgrade --user - - export PATH=~/.local/bin:/usr/bin/:$PATH - # Discover the ALB name - - ALB=`aws elbv2 describe-load-balancers --region ${AWS_REGION} --names ${CI_PROJECT_NAME} | jq .LoadBalancers[0].DNSName` - # Test Keepalive - - /usr/bin/curl --fail http://${ALB//'"'}/keepalive - # IF Keepalive return 200... - # Retrieve & Store this revision as 'last known successful revision' in S3 Bucket - - REV=`aws ecs describe-services --region ${AWS_REGION} --cluster ${CLUSTER_NAME} --service ${CI_PROJECT_NAME} |jq -r '.services[0].deployments[0].taskDefinition'` - - echo successful revision is ${REV} Storing it in S3 Bucket - - echo ${REV} > /${CI_PROJECT_NAME} - # sync rev to S3 here - - aws s3 cp /${CI_PROJECT_NAME} s3://${REV_BUCKET} - environment: - name: staging - -rollback: - stage: rollback - script: - - export AWS_REGION="us-east-1" - - export AWS_ACCESS_KEY_ID=$aws_access_key_id - - export AWS_SECRET_ACCESS_KEY=$aws_secret_access_key - - apk --no-cache add --update curl python python-dev py-pip - - pip install awscli --upgrade --user - - export PATH=~/.local/bin:/usr/bin/:$PATH - - pip install ecs-deploy - - aws s3 cp s3://${REV_BUCKET}/${CI_PROJECT_NAME} ./ - - REV=`cat ./${CI_PROJECT_NAME}` - - echo rev is $REV - - ecs deploy --region ${AWS_REGION} ${CLUSTER_NAME} ${CI_PROJECT_NAME} --task ${REV} - environment: - name: staging - when: on_failure \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2794a64779c2d6089d54f626e5514219a70074c4..ef9eb44610b1c38c84cca2997353c38211416781 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,44 +1,36 @@ -variables: - IMAGE_ORG: bogdandev - IMAGE_NAME: xpub-faraday - REPO_URL: https://gitlab.coko.foundation/xpub/xpub-faraday +image: docker:stable stages: - build - test - - review - - docker - - demo - -build-aws: - image: docker:stable - stage: build - services: - - docker:dind - variables: - IMAGE_REPO: faraday-qa - before_script: - - apk add --no-cache curl jq python py-pip - - pip install awscli - script: - - eval $(aws ecr get-login --no-include-email --region eu-west-1 | sed 's|https://||') - - docker build -t $IMAGE_REPO:$CI_COMMIT_SHA . - - docker tag $IMAGE_REPO:$CI_COMMIT_SHA $REPOSITORY_URL:latest - - docker push $REPOSITORY_URL:latest + - deploy + - rollback build: - image: docker:stable stage: build script: - - docker version - - docker build -t $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA . - - if [ -z "$DOCKERHUB_USERNAME" ] || [ -z "$DOCKERHUB_PASSWORD" ]; then echo "Not pushing" && exit 0; fi - - docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD - - echo "Ignore warning! Cannot perform an interactive login from a non TTY device" - - docker push $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA + # Setup + - export AWS_REGION="eu-west-1" + - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID + - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY + - export REPO=$CI_ECR_URL + - apk update + - apk --no-cache add --update curl python python-dev py-pip + - pip install awscli --upgrade --user + - export PATH=~/.local/bin:/usr/bin/:$PATH + # AUTH + - CERT=`aws ecr get-login --no-include-email --region ${AWS_REGION}` + - ${CERT} + # Build + - docker build -t ${CI_PROJECT_NAME}:$CI_COMMIT_SHA . + - docker tag $CI_PROJECT_NAME:$CI_COMMIT_SHA $REPO:latest + - docker push $REPO:latest + environment: + name: qa + url: $CI_ALB_URL lint: - image: $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA + image: $CI_ECR_URL:latest stage: test variables: GIT_STRATEGY: none @@ -47,7 +39,7 @@ lint: - npm run lint test: - image: $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA + image: $CI_ECR_URL:latest stage: test variables: GIT_STRATEGY: none @@ -55,67 +47,117 @@ test: - cd ${HOME} - npm run test -# push:latest: -# image: docker:latest -# stage: docker -# script: -# - if [ -z "$DOCKERHUB_USERNAME" ] || [ -z "$DOCKERHUB_PASSWORD" ]; then echo "Not pushing" && exit 0; fi -# - docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD -# - echo "Ignore warning! Cannot perform an interactive login from a non TTY device" -# - docker build -t $IMAGE_ORG/$IMAGE_NAME:latest --label COMMIT_SHA=$CI_COMMIT_SHA . -# - docker push $IMAGE_ORG/$IMAGE_NAME:latest -# only: -# - master - -demo:qa: - image: $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA - stage: demo - when: manual - variables: - PACKAGE_NAME: xpub-faraday +create-rollback: + stage: test + only: + - master + script: + - export AWS_REGION="eu-west-1" + - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID + - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY + - apk --no-cache add --update curl python python-dev py-pip jq + - pip install awscli --upgrade --user + - export PATH=~/.local/bin:/usr/bin/:$PATH + # Discover the ALB name + - ALB=`aws elbv2 describe-load-balancers --region ${AWS_REGION} --names ${CI_ALB_NAME} | jq .LoadBalancers[0].DNSName` + # Test Keepalive + - /usr/bin/curl --fail http://${ALB//'"'}/keepalive + # IF Keepalive return 200... + # Retrieve & Store this revision as 'last known successful revision' in S3 Bucket + - REV=`aws ecs describe-services --region ${AWS_REGION} --cluster ${CI_CLUSTER_NAME} --service ${CI_SERVICE_NAME} |jq -r '.services[0].deployments[0].taskDefinition'` + - echo successful revision is ${REV} Storing it in S3 Bucket + - echo ${REV} > /${CI_SERVICE_NAME} + # sync rev to S3 here + - aws s3 cp /${CI_SERVICE_NAME} s3://${CI_REV_BUCKET} environment: - name: qa/$PACKAGE_NAME - url: https://xpub-faraday-qa.now.sh/ + name: qa + url: $CI_ALB_URL + +deploy: + stage: deploy + only: + - master script: - - npm i -g --unsafe-perm now - - cd ${HOME}/now - - echo "FROM ${IMAGE_ORG}/${IMAGE_NAME}:${CI_COMMIT_SHA}" >> Dockerfile - - now --public --docker --token $NOW_TOKEN -e AWS_S3_ACCESS_KEY=$AWS_S3_ACCESS_KEY -e AWS_S3_SECRET_KEY=$AWS_S3_SECRET_KEY -e AWS_S3_REGION=$AWS_S3_REGION -e AWS_S3_BUCKET=$AWS_S3_BUCKET -e AWS_SES_SECRET_KEY=$AWS_SES_SECRET_KEY -e AWS_SES_ACCESS_KEY=$AWS_SES_ACCESS_KEY -e AWS_SES_REGION=$AWS_SES_REGION -e EMAIL_SENDER=$EMAIL_SENDER -e secret=$SECRET -e DATABASE=$DATABASE -e DB_USER=$DB_USER -e DB_PASS=$DB_PASS -e DB_HOST=$DB_HOST - - now alias $NOW_URL xpub-faraday-qa --token $NOW_TOKEN + - export AWS_REGION="eu-west-1" + - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID + - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY + - apk --no-cache add --update python python-dev py-pip + - pip install ecs-deploy + # Deploy + - ecs deploy ${CI_CLUSTER_NAME} ${CI_SERVICE_NAME} --region ${AWS_REGION} --timeout 600 -e ${CI_CONTAINER_NAME} AWS_S3_ACCESS_KEY $AWS_S3_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_S3_SECRET_KEY $AWS_S3_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_S3_REGION $AWS_S3_REGION -e ${CI_CONTAINER_NAME} AWS_S3_BUCKET $AWS_S3_BUCKET -e ${CI_CONTAINER_NAME} AWS_SES_SECRET_KEY $AWS_SES_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_SES_ACCESS_KEY $AWS_SES_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_SES_REGION $AWS_SES_REGION -e ${CI_CONTAINER_NAME} EMAIL_SENDER $EMAIL_SENDER -e ${CI_CONTAINER_NAME} secret $SECRET -e ${CI_CONTAINER_NAME} DATABASE $DATABASE -e ${CI_CONTAINER_NAME} DB_USER $DB_USER -e ${CI_CONTAINER_NAME} DB_PASS $DB_PASS -e ${CI_CONTAINER_NAME} DB_HOST $DB_HOST + environment: + name: qa + url: $CI_ALB_URL -demo:aws-qa: - image: $REPOSITORY_URL:latest - stage: demo +aws-qa: + stage: deploy when: manual - variables: - PACKAGE_NAME: xpub-faraday - CLUSTER_NAME: faraday-cluster - environment: - name: qa/$PACKAGE_NAME - url: http://52.211.238.137/ + only: + - develop script: - export AWS_REGION="eu-west-1" - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY - - eval $(aws ecr get-login --no-include-email --region eu-west-1 | sed 's|https://||') - apk --no-cache add --update python python-dev py-pip - pip install ecs-deploy - - ecs deploy --region ${AWS_REGION} ${CLUSTER_NAME} ${IMAGE_REPO}:${CI_COMMIT_SHA} --tag ${CI_COMMIT_SHA} + # Deploy + - ecs deploy ${CI_CLUSTER_NAME} ${CI_SERVICE_NAME} --region ${AWS_REGION} --timeout 600 -e ${CI_CONTAINER_NAME} AWS_S3_ACCESS_KEY $AWS_S3_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_S3_SECRET_KEY $AWS_S3_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_S3_REGION $AWS_S3_REGION -e ${CI_CONTAINER_NAME} AWS_S3_BUCKET $AWS_S3_BUCKET -e ${CI_CONTAINER_NAME} AWS_SES_SECRET_KEY $AWS_SES_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_SES_ACCESS_KEY $AWS_SES_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_SES_REGION $AWS_SES_REGION -e ${CI_CONTAINER_NAME} EMAIL_SENDER $EMAIL_SENDER -e ${CI_CONTAINER_NAME} secret $SECRET -e ${CI_CONTAINER_NAME} DATABASE $DATABASE -e ${CI_CONTAINER_NAME} DB_USER $DB_USER -e ${CI_CONTAINER_NAME} DB_PASS $DB_PASS -e ${CI_CONTAINER_NAME} DB_HOST $DB_HOST + environment: + name: qa + url: $CI_ALB_URL -demo:staging: - image: $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA - stage: demo +now.sh: + image: $CI_ECR_URL:latest + stage: deploy when: manual - variables: - PACKAGE_NAME: xpub-faraday + script: + - npm i -g --unsafe-perm now + - cd ${HOME}/now + - echo "FROM ${CI_ECR_URL}:latest" >> Dockerfile + - now --public --docker --token $NOW_TOKEN -e AWS_S3_ACCESS_KEY=$AWS_S3_ACCESS_KEY -e AWS_S3_SECRET_KEY=$AWS_S3_SECRET_KEY -e AWS_S3_REGION=$AWS_S3_REGION -e AWS_S3_BUCKET=$AWS_S3_BUCKET -e AWS_SES_SECRET_KEY=$AWS_SES_SECRET_KEY -e AWS_SES_ACCESS_KEY=$AWS_SES_ACCESS_KEY -e AWS_SES_REGION=$AWS_SES_REGION -e EMAIL_SENDER=$EMAIL_SENDER -e secret=$SECRET -e DATABASE=$DATABASE -e DB_USER=$DB_USER -e DB_PASS=$DB_PASS -e DB_HOST=$DB_HOST + - now alias $NOW_URL xpub-faraday-qa --token $NOW_TOKEN + environment: + name: qa + url: https://xpub-faraday-qa.now.sh/ + +rollback: + stage: rollback + when: on_failure only: - master + script: + - export AWS_REGION="us-east-1" + - export AWS_ACCESS_KEY_ID=$aws_access_key_id + - export AWS_SECRET_ACCESS_KEY=$aws_secret_access_key + - apk --no-cache add --update curl python python-dev py-pip + - pip install awscli --upgrade --user + - export PATH=~/.local/bin:/usr/bin/:$PATH + - pip install ecs-deploy + - aws s3 cp s3://${CI_REV_BUCKET}/${CI_SERVICE_NAME} ./ + - REV=`cat ./${CI_SERVICE_NAME}` + - echo rev is $REV + - ecs deploy --region ${AWS_REGION} ${CLUSTER_NAME} ${CI_SERVICE_NAME} --task ${REV} -e ${CI_CONTAINER_NAME} AWS_S3_ACCESS_KEY $AWS_S3_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_S3_SECRET_KEY $AWS_S3_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_S3_REGION $AWS_S3_REGION -e ${CI_CONTAINER_NAME} AWS_S3_BUCKET $AWS_S3_BUCKET -e ${CI_CONTAINER_NAME} AWS_SES_SECRET_KEY $AWS_SES_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_SES_ACCESS_KEY $AWS_SES_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_SES_REGION $AWS_SES_REGION -e ${CI_CONTAINER_NAME} EMAIL_SENDER $EMAIL_SENDER -e ${CI_CONTAINER_NAME} secret $SECRET -e ${CI_CONTAINER_NAME} DATABASE $DATABASE -e ${CI_CONTAINER_NAME} DB_USER $DB_USER -e ${CI_CONTAINER_NAME} DB_PASS $DB_PASS -e ${CI_CONTAINER_NAME} DB_HOST $DB_HOST environment: - name: demo/$PACKAGE_NAME - url: https://xpub-faraday.now.sh/ + name: qa + url: $CI_ALB_URL + +rollback-qa: + stage: rollback + when: manual + only: + - develop script: - - npm i -g --unsafe-perm now - - cd ${HOME}/now - - echo "FROM ${IMAGE_ORG}/${IMAGE_NAME}:${CI_COMMIT_SHA}" >> Dockerfile - - now --public --docker --token $NOW_TOKEN -e AWS_S3_ACCESS_KEY=$AWS_S3_ACCESS_KEY -e AWS_S3_SECRET_KEY=$AWS_S3_SECRET_KEY -e AWS_S3_REGION=$AWS_S3_REGION -e AWS_S3_BUCKET=$AWS_S3_BUCKET -e AWS_SES_SECRET_KEY=$AWS_SES_SECRET_KEY -e AWS_SES_ACCESS_KEY=$AWS_SES_ACCESS_KEY -e AWS_SES_REGION=$AWS_SES_REGION -e EMAIL_SENDER=$EMAIL_SENDER -e secret=$SECRET -e DATABASE=$DATABASE_STAGING -e DB_USER=$DB_USER_STAGING -e DB_PASS=$DB_PASS_STAGING -e DB_HOST=$DB_HOST_STAGING - - now alias $NOW_URL xpub-faraday --token $NOW_TOKEN \ No newline at end of file + - export AWS_REGION="us-east-1" + - export AWS_ACCESS_KEY_ID=$aws_access_key_id + - export AWS_SECRET_ACCESS_KEY=$aws_secret_access_key + - apk --no-cache add --update curl python python-dev py-pip + - pip install awscli --upgrade --user + - export PATH=~/.local/bin:/usr/bin/:$PATH + - pip install ecs-deploy + - aws s3 cp s3://${CI_REV_BUCKET}/${CI_SERVICE_NAME} ./ + - REV=`cat ./${CI_SERVICE_NAME}` + - echo rev is $REV + - ecs deploy --region ${AWS_REGION} ${CLUSTER_NAME} ${CI_SERVICE_NAME} --task ${REV} -e ${CI_CONTAINER_NAME} AWS_S3_ACCESS_KEY $AWS_S3_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_S3_SECRET_KEY $AWS_S3_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_S3_REGION $AWS_S3_REGION -e ${CI_CONTAINER_NAME} AWS_S3_BUCKET $AWS_S3_BUCKET -e ${CI_CONTAINER_NAME} AWS_SES_SECRET_KEY $AWS_SES_SECRET_KEY -e ${CI_CONTAINER_NAME} AWS_SES_ACCESS_KEY $AWS_SES_ACCESS_KEY -e ${CI_CONTAINER_NAME} AWS_SES_REGION $AWS_SES_REGION -e ${CI_CONTAINER_NAME} EMAIL_SENDER $EMAIL_SENDER -e ${CI_CONTAINER_NAME} secret $SECRET -e ${CI_CONTAINER_NAME} DATABASE $DATABASE -e ${CI_CONTAINER_NAME} DB_USER $DB_USER -e ${CI_CONTAINER_NAME} DB_PASS $DB_PASS -e ${CI_CONTAINER_NAME} DB_HOST $DB_HOST + environment: + name: qa + url: $CI_ALB_URL \ No newline at end of file diff --git a/packages/component-wizard/package.json b/packages/component-wizard/package.json index 72de7cfb330156155dfd5e4f1e3c4d0a04f1dc8c..0808310bd41254332a5be4314b576b06da4f8e40 100644 --- a/packages/component-wizard/package.json +++ b/packages/component-wizard/package.json @@ -9,7 +9,8 @@ "dist" ], "dependencies": { - "@pubsweet/ui": "^3.1.0", + "@pubsweet/ui": "4.1.3", + "@pubsweet/ui-toolkit": "latest", "moment": "^2.20.1", "react-dnd": "^2.5.4", "react-dnd-html5-backend": "^2.5.4", diff --git a/packages/component-wizard/src/components/WizardStep.js b/packages/component-wizard/src/components/WizardStep.js index 869bbd53c983e36b04ef7f0edc7b7689a5fb5450..6846bee3fb582f14a2a89df9f44961796e912ecd 100644 --- a/packages/component-wizard/src/components/WizardStep.js +++ b/packages/component-wizard/src/components/WizardStep.js @@ -50,18 +50,19 @@ export default ({ return null } return ( - <ValidatedField - component={input => ( - <div data-test={fieldId}> - <Comp {...rest} {...input} {...dispatchFns} />{' '} - </div> - )} - format={format} - key={fieldId} - name={fieldId} - parse={parse} - validate={validate} - /> + <CustomValidatedField className="custom-field" key={fieldId}> + <ValidatedField + component={input => ( + <div data-test={fieldId}> + <Comp {...rest} {...input} {...dispatchFns} />{' '} + </div> + )} + format={format} + name={fieldId} + parse={parse} + validate={validate} + /> + </CustomValidatedField> ) }, )} @@ -90,6 +91,15 @@ export default ({ </Root> ) // #region styles + +const CustomValidatedField = styled.div` + div { + div:last-child { + margin-top: 0; + } + } +` + const Root = styled.div` align-items: stretch; background-color: ${th('colorTextReverse')}; diff --git a/packages/components-faraday/package.json b/packages/components-faraday/package.json index e6e08d40317a695c3aedff0b059a2a7a12eb7608..030679184f97ef574310dda6920ecfeaaf55f8bc 100644 --- a/packages/components-faraday/package.json +++ b/packages/components-faraday/package.json @@ -4,7 +4,8 @@ "main": "src", "license": "MIT", "dependencies": { - "@pubsweet/ui": "^3.1.0", + "@pubsweet/ui": "4.1.3", + "@pubsweet/ui-toolkit": "latest", "moment": "^2.22.1", "prop-types": "^15.5.10", "react": "^16.1.0", diff --git a/packages/components-faraday/src/components/Dashboard/DashboardCard.js b/packages/components-faraday/src/components/Dashboard/DashboardCard.js index 82f9a8698c43046994924dcc4e59c40b0a313043..f773064fb9af6d65f85921d6e28d653aa53a9e2a 100644 --- a/packages/components-faraday/src/components/Dashboard/DashboardCard.js +++ b/packages/components-faraday/src/components/Dashboard/DashboardCard.js @@ -1,8 +1,9 @@ import React from 'react' import { get } from 'lodash' -import { connect } from 'react-redux' import PropTypes from 'prop-types' -import { Button, Icon, th } from '@pubsweet/ui' +import { connect } from 'react-redux' +import { th } from '@pubsweet/ui-toolkit' +import { Button, Icon } from '@pubsweet/ui' import styled, { css, withTheme } from 'styled-components' import { compose, getContext, setDisplayName } from 'recompose' import { DateParser } from 'pubsweet-components-faraday/src/components' diff --git a/packages/components-faraday/src/components/Dashboard/EditorInChiefActions.js b/packages/components-faraday/src/components/Dashboard/EditorInChiefActions.js index 342f530f148193ab803f78ec8898578c08f3f878..271231414fed1b9f61e7970a0714075e1b12fbc7 100644 --- a/packages/components-faraday/src/components/Dashboard/EditorInChiefActions.js +++ b/packages/components-faraday/src/components/Dashboard/EditorInChiefActions.js @@ -170,6 +170,7 @@ const AssignButton = styled(Button)` background-color: ${th('colorPrimary')}; color: ${th('colorTextReverse')}; height: calc(${th('subGridUnit')} * 5); + padding: 0; text-align: center; text-transform: uppercase; ` diff --git a/packages/components-faraday/src/components/Dashboard/HandlingEditorSection.js b/packages/components-faraday/src/components/Dashboard/HandlingEditorSection.js index b48d96eb07e3fecd249ab622ef560a4e4bce97a5..0d9cd313fb96fed3b474da70f89dbec79131b5f1 100644 --- a/packages/components-faraday/src/components/Dashboard/HandlingEditorSection.js +++ b/packages/components-faraday/src/components/Dashboard/HandlingEditorSection.js @@ -37,7 +37,7 @@ const renderHE = (currentUser, project) => { const HandlingEditorSection = ({ currentUser, project }) => ( <Root> - <HEText>Handling Editor</HEText> + <HEText>Handling Editor?</HEText> {renderHE(currentUser, project)} </Root> ) diff --git a/packages/components-faraday/src/components/MakeDecision/DecisionForm.js b/packages/components-faraday/src/components/MakeDecision/DecisionForm.js index b7da20c1b2c2fcc4e7571a83a202f88150e0a1bc..0ee25326242815a4b6eda4ceda76ea215dedb75e 100644 --- a/packages/components-faraday/src/components/MakeDecision/DecisionForm.js +++ b/packages/components-faraday/src/components/MakeDecision/DecisionForm.js @@ -3,17 +3,10 @@ import { get } from 'lodash' import { connect } from 'react-redux' import { actions } from 'pubsweet-client' import { required } from 'xpub-validators' -import styled, { css } from 'styled-components' +import styled from 'styled-components' import { reduxForm, formValueSelector } from 'redux-form' import { compose, setDisplayName, withProps } from 'recompose' -import { - th, - Icon, - Button, - Spinner, - RadioGroup, - ValidatedField, -} from '@pubsweet/ui' +import { Icon, Button, Spinner, RadioGroup, ValidatedField } from '@pubsweet/ui' import { FormItems } from '../UIComponents' import { @@ -34,6 +27,8 @@ const { Subtitle, RootContainer, FormContainer, + CustomRadioGroup, + CustomValidatedField, } = FormItems const Form = RootContainer.withComponent(FormContainer) @@ -70,6 +65,7 @@ const DecisionForm = ({ <ValidatedField component={input => ( <CustomRadioGroup + className="custom-radio-group" justify={reason ? 'space-between' : 'space-around'} > <RadioGroup @@ -87,11 +83,13 @@ const DecisionForm = ({ <Row> <RowItem vertical> <Label>Comments for Handling Editor</Label> - <ValidatedField - component={input => <Textarea {...input} height={70} />} - name="messageToHE" - validate={[required]} - /> + <CustomValidatedField> + <ValidatedField + component={input => <Textarea {...input} height={70} />} + name="messageToHE" + validate={[required]} + /> + </CustomValidatedField> </RowItem> </Row> )} @@ -163,12 +161,6 @@ export default compose( )(DecisionForm) // #region styled-components -const defaultText = css` - color: ${th('colorText')}; - font-family: ${th('fontReading')}; - font-size: ${th('fontSizeBaseSmall')}; -` - const IconButton = styled.div` align-self: flex-end; cursor: pointer; @@ -185,17 +177,4 @@ const BoldSubtitle = Subtitle.extend` font-weight: bold; margin-left: 5px; ` - -const CustomRadioGroup = styled.div` - div { - flex-direction: row; - justify-content: ${({ justify }) => justify || 'space-between'}; - label { - span:last-child { - font-style: normal; - ${defaultText}; - } - } - } -` // #endregion diff --git a/packages/components-faraday/src/components/MakeRecommendation/StepOne.js b/packages/components-faraday/src/components/MakeRecommendation/StepOne.js index fc20adb61b276af9f16aabb22e81fec792d2f026..6185a09a1677c060032875ce80ebf83c4e1139be 100644 --- a/packages/components-faraday/src/components/MakeRecommendation/StepOne.js +++ b/packages/components-faraday/src/components/MakeRecommendation/StepOne.js @@ -5,7 +5,7 @@ import { RadioGroup, ValidatedField, Button } from '@pubsweet/ui' import { utils } from './' import { FormItems } from '../UIComponents' -const { RootContainer, Row, RowItem, Title } = FormItems +const { Row, Title, RowItem, RootContainer, CustomRadioGroup } = FormItems const StepOne = ({ hideModal, disabled, onSubmit }) => ( <RootContainer> @@ -14,11 +14,16 @@ const StepOne = ({ hideModal, disabled, onSubmit }) => ( <RowItem> <ValidatedField component={input => ( - <RadioGroup - name="decision" - options={utils.recommendationOptions} - {...input} - /> + <CustomRadioGroup + className="custom-radio-group" + justify="space-between" + > + <RadioGroup + name="decision" + options={utils.recommendationOptions} + {...input} + /> + </CustomRadioGroup> )} name="decision" /> diff --git a/packages/components-faraday/src/components/MakeRecommendation/StepTwo.js b/packages/components-faraday/src/components/MakeRecommendation/StepTwo.js index 2e554d6ccb2d8f863416d3711ebeb469c14a0109..ef6faf07e53e85ca29b23f1ba0e48b7b87ef17d5 100644 --- a/packages/components-faraday/src/components/MakeRecommendation/StepTwo.js +++ b/packages/components-faraday/src/components/MakeRecommendation/StepTwo.js @@ -26,6 +26,8 @@ const { Textarea, RootContainer, FormContainer, + CustomRadioGroup, + CustomValidatedField, } = FormItems const Form = RootContainer.withComponent(FormContainer) @@ -51,19 +53,23 @@ const StepTwo = ({ <Row> <RowItem vertical> <Label>Message for Editor in Chief (optional)</Label> - <ValidatedField - component={input => <Textarea {...input} height={70} />} - name="message.eic" - /> + <CustomValidatedField> + <ValidatedField + component={input => <Textarea {...input} height={70} />} + name="message.eic" + /> + </CustomValidatedField> </RowItem> </Row> <Row> <RowItem vertical> <Label>Message for Author (optional)</Label> - <ValidatedField - component={input => <Textarea {...input} height={70} />} - name="message.author" - /> + <CustomValidatedField> + <ValidatedField + component={input => <Textarea {...input} height={70} />} + name="message.author" + /> + </CustomValidatedField> </RowItem> </Row> {recommendationError && ( @@ -81,11 +87,13 @@ const StepTwo = ({ <Label>REVISION TYPE</Label> <ValidatedField component={input => ( - <RadioGroup - name="revision.revision-type" - {...input} - options={utils.revisionOptions} - /> + <CustomRadioGroup justify="flex-start"> + <RadioGroup + name="revision.revision-type" + {...input} + options={utils.revisionOptions} + /> + </CustomRadioGroup> )} name="revision.revisionType" validate={[required]} @@ -98,11 +106,13 @@ const StepTwo = ({ REASON & DETAILS <SubLabel>Required</SubLabel> </Label> - <ValidatedField - component={input => <Textarea {...input} />} - name="revision.reason" - validate={[required]} - /> + <CustomValidatedField> + <ValidatedField + component={input => <Textarea {...input} />} + name="revision.reason" + validate={[required]} + /> + </CustomValidatedField> </RowItem> </CustomRow> {!hasNote ? ( @@ -130,10 +140,12 @@ const StepTwo = ({ </CustomRow> <CustomRow> <RowItem> - <ValidatedField - component={input => <Textarea {...input} height={70} />} - name="revision.internal-note" - /> + <CustomValidatedField> + <ValidatedField + component={input => <Textarea {...input} height={70} />} + name="revision.internal-note" + /> + </CustomValidatedField> </RowItem> </CustomRow> </Fragment> @@ -210,6 +222,10 @@ const IconButton = styled.div` const CustomRowItem = RowItem.extend` align-items: center; justify-content: flex-end; + + & > div { + flex: 0; + } ` const CustomRow = Row.extend` diff --git a/packages/components-faraday/src/components/Reviewers/InviteReviewers.js b/packages/components-faraday/src/components/Reviewers/InviteReviewers.js index bee6e98b5d26856b85a9192f7b27375419abc06e..97b2382379f1649aaff31028ec022a80d467e655 100644 --- a/packages/components-faraday/src/components/Reviewers/InviteReviewers.js +++ b/packages/components-faraday/src/components/Reviewers/InviteReviewers.js @@ -193,6 +193,7 @@ const AssignButton = styled(Button)` background-color: ${th('colorPrimary')}; color: ${th('colorTextReverse')}; height: calc(${th('subGridUnit')} * 5); + padding: 0; text-align: center; ` // #endregion diff --git a/packages/components-faraday/src/components/UIComponents/FormItems.js b/packages/components-faraday/src/components/UIComponents/FormItems.js index 844b841f2b52b3847677e0859bccd95a470f9594..09c1b27992dc9d7b6b0b16729c5c40cbfd3d51e1 100644 --- a/packages/components-faraday/src/components/UIComponents/FormItems.js +++ b/packages/components-faraday/src/components/UIComponents/FormItems.js @@ -1,5 +1,11 @@ import { th } from '@pubsweet/ui' -import styled from 'styled-components' +import styled, { css } from 'styled-components' + +const defaultText = css` + color: ${th('colorText')}; + font-family: ${th('fontReading')}; + font-size: ${th('fontSizeBaseSmall')}; +` export const RootContainer = styled.div` background-color: ${th('backgroundColorReverse')}; @@ -52,6 +58,10 @@ export const RowItem = styled.div` flex-direction: ${({ vertical }) => (vertical ? 'column' : 'row')}; justify-content: ${({ centered }) => (centered ? 'center' : 'initial')}; margin: 0 ${th('subGridUnit')}; + + & > div { + flex: 1; + } ` export const Label = styled.div` @@ -76,7 +86,7 @@ export const Textarea = styled.textarea` hasError ? th('colorError') : th('colorPrimary')}; font-size: ${th('fontSizeBaseSmall')}; font-family: ${th('fontWriting')}; - padding: calc(${th('subGridUnit')}*2); + padding: ${th('subGridUnit')}; outline: none; transition: all 300ms linear; @@ -92,3 +102,27 @@ export const Textarea = styled.textarea` background-color: ${th('colorBackgroundHue')}; } ` + +export const CustomRadioGroup = styled.div` + div { + flex-direction: row; + justify-content: ${({ justify }) => justify || 'space-between'}; + label { + span:last-child { + font-style: normal; + ${defaultText}; + } + } + } + & ~ div { + margin-top: 0; + } +` + +export const CustomValidatedField = styled.div` + div { + div:last-child { + margin-top: 0; + } + } +` diff --git a/packages/xpub-faraday/app/config/journal/submit-wizard.js b/packages/xpub-faraday/app/config/journal/submit-wizard.js index 8654c6a2eb9b2222c089799fcc8501812d3b467e..5d56d7f9783070424ad3bf73eee328e3d30172b6 100644 --- a/packages/xpub-faraday/app/config/journal/submit-wizard.js +++ b/packages/xpub-faraday/app/config/journal/submit-wizard.js @@ -102,7 +102,7 @@ export default { label: 'Manuscript & Authors Details', title: '3. Manuscript & Authors Details', subtitle: - 'Please provide the details of all the authors of this manuscript, in the order that they appear on the manuscript. Your details are already pre-filled since, in order tu submit a manuscript you must be one of the authors', + 'Please provide the details of all the authors of this manuscript, in the order that they appear on the manuscript. Your details are already pre-filled since, in order tu submit a manuscript you must be one of the authors.', children: [ { fieldId: 'metadata.title', diff --git a/packages/xpub-faraday/package.json b/packages/xpub-faraday/package.json index ff555499ca38cc5796e800ee9956bdc6679b190b..af02408c9615982e86f1986419b55fa747fe99bd 100644 --- a/packages/xpub-faraday/package.json +++ b/packages/xpub-faraday/package.json @@ -8,7 +8,8 @@ "url": "https://gitlab.coko.foundation/xpub/xpub-faraday" }, "dependencies": { - "@pubsweet/ui": "^3.2.0", + "@pubsweet/ui": "4.1.3", + "@pubsweet/ui-toolkit": "latest", "@pubsweet/component-aws-s3": "^1.0.4", "aws-sdk": "^2.197.0", "babel-core": "^6.26.0", diff --git a/yarn.lock b/yarn.lock index 50f540d304096e6d8380f9142adddc0dd83b7c4c..13f78b9bf62e6523df4c8851f5ebbc1984b7a6b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -164,6 +164,14 @@ typeface-fira-sans-condensed "^0.0.43" typeface-vollkorn "^0.0.43" +"@pubsweet/ui-toolkit@latest": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@pubsweet/ui-toolkit/-/ui-toolkit-1.0.0.tgz#df05b54e7bbfabcb10c7afc2991752e1087d2298" + dependencies: + color "^3.0.0" + lodash "^4.17.4" + styled-components "^3.2.5" + "@pubsweet/ui@3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@pubsweet/ui/-/ui-3.0.0.tgz#b8915ce2b2729e66fd5628ecf7855f1d740270a5" @@ -186,6 +194,28 @@ redux-form "^7.0.3" styled-components "^2.4.0" +"@pubsweet/ui@4.1.3": + version "4.1.3" + resolved "https://registry.yarnpkg.com/@pubsweet/ui/-/ui-4.1.3.tgz#a8c65aa69618505a1e3777f4d18c3d676b800ee9" + dependencies: + babel-jest "^21.2.0" + classnames "^2.2.5" + enzyme "^3.2.0" + enzyme-adapter-react-16 "^1.1.1" + invariant "^2.2.3" + lodash "^4.17.4" + prop-types "^15.5.10" + react "^16.2.0" + react-dom "^16.2.0" + react-feather "^1.0.8" + react-redux "^5.0.2" + react-router-dom "^4.2.2" + react-tag-autocomplete "^5.5.0" + recompose "^0.26.0" + redux "^3.6.0" + redux-form "^7.0.3" + styled-components "^3.2.5" + "@pubsweet/ui@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@pubsweet/ui/-/ui-3.1.0.tgz#24c25c29fc36e34b9f654fe4378502232f8204fa" @@ -2145,7 +2175,7 @@ collapse-white-space@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/collapse-white-space/-/collapse-white-space-1.0.3.tgz#4b906f670e5a963a87b76b0e1689643341b6023c" -color-convert@^1.3.0, color-convert@^1.9.0: +color-convert@^1.3.0, color-convert@^1.9.0, color-convert@^1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" dependencies: @@ -2161,6 +2191,13 @@ color-string@^0.3.0: dependencies: color-name "^1.0.0" +color-string@^1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.5.2.tgz#26e45814bc3c9a7cbd6751648a41434514a773a9" + dependencies: + color-name "^1.0.0" + simple-swizzle "^0.2.2" + color@^0.11.0: version "0.11.4" resolved "https://registry.yarnpkg.com/color/-/color-0.11.4.tgz#6d7b5c74fb65e841cd48792ad1ed5e07b904d764" @@ -2169,6 +2206,13 @@ color@^0.11.0: color-convert "^1.3.0" color-string "^0.3.0" +color@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/color/-/color-3.0.0.tgz#d920b4328d534a3ac8295d68f7bd4ba6c427be9a" + dependencies: + color-convert "^1.9.1" + color-string "^1.5.2" + colormin@^1.0.5: version "1.1.2" resolved "https://registry.yarnpkg.com/colormin/-/colormin-1.1.2.tgz#ea2f7420a72b96881a38aae59ec124a6f7298133" @@ -4746,6 +4790,10 @@ is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" +is-arrayish@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.3.1.tgz#c2dfc386abaa0c3e33c48db3fe87059e69065efd" + is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" @@ -8793,6 +8841,12 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" +simple-swizzle@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" + dependencies: + is-arrayish "^0.3.1" + slash@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"