Skip to content
Snippets Groups Projects
Commit 934f19a2 authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

Merge branch 'faraday-master' of gitlab.coko.foundation:xpub/xpub into faraday-master

parents 5ee79c38 762cea17
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
"peerDependencies": { "peerDependencies": {
"@pubsweet/logger": "^0.0.1", "@pubsweet/logger": "^0.0.1",
"pubsweet-server": "^1.0.1", "pubsweet-server": "^1.0.1",
"@pubsweet/component-aws-ses": "^0.1.0" "@pubsweet/component-send-email": "^0.1.0"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
......
const fs = require('fs') const fs = require('fs')
const handlebars = require('handlebars') const handlebars = require('handlebars')
const querystring = require('querystring') const querystring = require('querystring')
const SES = require('@pubsweet/component-aws-ses') const Email = require('@pubsweet/component-send-email')
const config = require('config') const config = require('config')
const resetUrl = config.get('invite-reset-password.url') const resetUrl = config.get('invite-reset-password.url')
...@@ -33,7 +33,7 @@ module.exports = { ...@@ -33,7 +33,7 @@ module.exports = {
const htmlBody = htmlTemplate(replacements) const htmlBody = htmlTemplate(replacements)
const textBody = textTemplate(replacements) const textBody = textTemplate(replacements)
SES.sendEmail(email, subject, textBody, htmlBody) Email.send(email, subject, textBody, htmlBody)
}, },
} }
......
require('dotenv').config() require('dotenv').config()
module.exports = require('./src/EmailBackend') module.exports = require('./src/SendEmail')
{ {
"name": "@pubsweet/component-aws-ses", "name": "@pubsweet/component-send-email",
"version": "0.2.0", "version": "0.2.0",
"description": "xpub aws ses configured for faraday", "description": "xpub aws ses configured for faraday",
"license": "MIT", "license": "MIT",
...@@ -13,17 +13,9 @@ ...@@ -13,17 +13,9 @@
"dependencies": { "dependencies": {
"aws-sdk": "^2.185.0", "aws-sdk": "^2.185.0",
"body-parser": "^1.17.2", "body-parser": "^1.17.2",
"node-mocks-http": "^1.6.6",
"nodemailer": "^4.4.2" "nodemailer": "^4.4.2"
}, },
"peerDependencies": { "peerDependencies": {
"@pubsweet/logger": "^0.0.1", "@pubsweet/logger": "^0.0.1"
"pubsweet": "^1.1.1",
"pubsweet-client": "^1.1.1",
"pubsweet-server": "^1.0.1"
},
"devDependencies": {
"jest": "^22.1.1",
"supertest": "^3.0.0"
} }
} }
const nodemailer = require('nodemailer') const nodemailer = require('nodemailer')
const config = require('config')
const logger = require('@pubsweet/logger') const logger = require('@pubsweet/logger')
const AWS = require('aws-sdk') const config = require('./config')
const mailerConfig = config.get('mailer')
module.exports = { module.exports = {
sendEmail: (toEmail, subject, textBody, htmlBody) => { send: (toEmail, subject, textBody, htmlBody) => {
const transporter = nodemailer.createTransport({ const mailerConfig = config.mailer
SES: new AWS.SES({ const transporter = nodemailer.createTransport(mailerConfig.transport)
secretAccessKey: process.env.AWS_SES_SECRET_KEY,
accessKeyId: process.env.AWS_SES_ACCESS_KEY,
region: process.env.AWS_SES_REGION,
}),
})
transporter.sendMail( transporter.sendMail(
{ {
from: mailerConfig.from, from: mailerConfig.from,
......
const AWS = require('aws-sdk')
module.exports = {
mailer: {
from: process.env.EMAIL_SENDER,
transport: {
SES: new AWS.SES({
accessKeyId: process.env.AWS_SES_ACCESS_KEY,
secretAccessKey: process.env.AWS_SES_SECRET_KEY,
region: process.env.AWS_SES_REGION,
}),
},
},
}
import React from 'react' import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { get, isEmpty } from 'lodash' import { get, isEmpty } from 'lodash'
import styled from 'styled-components' import styled, { css } from 'styled-components'
import { Button, Icon } from '@pubsweet/ui' import { Button, Icon } from '@pubsweet/ui'
import { compose, getContext } from 'recompose' import { compose, getContext } from 'recompose'
...@@ -118,15 +118,19 @@ const DashboardCard = ({ ...@@ -118,15 +118,19 @@ const DashboardCard = ({
export default compose(getContext({ journal: PropTypes.object }))(DashboardCard) export default compose(getContext({ journal: PropTypes.object }))(DashboardCard)
// #region styled-components // #region styled-components
const defaultText = css`
color: ${({ theme }) => theme.colorText};
font-family: ${({ theme }) => theme.fontReading};
font-size: ${({ theme }) => theme.fontSizeBaseSmall};
`
const PreviewContainer = styled.div` const PreviewContainer = styled.div`
display: flex; display: flex;
margin-top: 18px; margin-top: 18px;
` `
const AuthorList = styled.span` const AuthorList = styled.span`
color: #667080; ${defaultText};
font-family: Helvetica;
font-size: 14px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
text-align: left; text-align: left;
...@@ -143,9 +147,7 @@ const Authors = styled.div` ...@@ -143,9 +147,7 @@ const Authors = styled.div`
margin-top: 15px; margin-top: 15px;
span:first-child { span:first-child {
color: #667080; ${defaultText};
font-family: Helvetica;
font-size: 12px;
margin-right: 8px; margin-right: 8px;
text-align: left; text-align: left;
text-transform: uppercase; text-transform: uppercase;
...@@ -153,15 +155,12 @@ const Authors = styled.div` ...@@ -153,15 +155,12 @@ const Authors = styled.div`
` `
const ActionButtons = styled(Button)` const ActionButtons = styled(Button)`
${defaultText};
align-items: center; align-items: center;
background-color: #667080; background-color: #${({ theme }) => theme.colorPrimary};
display: flex; display: flex;
height: 20px;
padding: 4px 8px; padding: 4px 8px;
font-family: Helvetica;
font-size: 12px;
text-align: center; text-align: center;
color: #ffffff;
` `
const LeftDetails = styled.div` const LeftDetails = styled.div`
...@@ -186,26 +185,21 @@ const RightDetails = styled.div` ...@@ -186,26 +185,21 @@ const RightDetails = styled.div`
` `
const Label = styled.span` const Label = styled.span`
color: #667080; ${defaultText};
font-family: Helvetica;
font-size: 12px;
text-align: left; text-align: left;
text-transform: uppercase; text-transform: uppercase;
width: 150px; width: 150px;
` `
const JournalTitle = styled.span` const JournalTitle = styled.span`
color: #667080; ${defaultText};
font-family: Helvetica; font-size: ${({ theme }) => theme.fontSizeHeading6};
font-size: 14px;
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
` `
const Issue = styled.span` const Issue = styled.span`
color: #667080; ${defaultText};
font-family: Helvetica;
font-size: 14px;
text-align: left; text-align: left;
` `
...@@ -227,9 +221,7 @@ const ListView = styled.div` ...@@ -227,9 +221,7 @@ const ListView = styled.div`
` `
const ManuscriptId = styled.span` const ManuscriptId = styled.span`
color: #667080; ${defaultText};
font-family: Helvetica;
font-size: 12px;
margin-left: 8px; margin-left: 8px;
text-align: left; text-align: left;
text-decoration: underline; text-decoration: underline;
...@@ -237,18 +229,14 @@ const ManuscriptId = styled.span` ...@@ -237,18 +229,14 @@ const ManuscriptId = styled.span`
` `
const Version = styled.span` const Version = styled.span`
color: #667080; ${defaultText};
font-family: Helvetica;
font-size: 13px;
text-align: left; text-align: left;
` `
const Details = styled.div` const Details = styled.div`
align-items: center; align-items: center;
color: #667080;
cursor: pointer; cursor: pointer;
display: flex; display: flex;
font-family: Helvetica; ${defaultText};
font-size: 14px;
margin-left: 8px; margin-left: 8px;
text-decoration: underline; text-decoration: underline;
text-align: center; text-align: center;
...@@ -259,13 +247,14 @@ const ClickableIcon = styled.div` ...@@ -259,13 +247,14 @@ const ClickableIcon = styled.div`
margin: 0 7px; margin: 0 7px;
svg { svg {
stroke: ${({ disabled }) => (disabled ? '#eee' : '#667080')}; stroke: ${({ disabled, theme }) =>
disabled ? theme.colorBackgroundHue : theme.colorPrimary};
} }
` `
const Card = styled.div` const Card = styled.div`
align-items: center; align-items: center;
border: 1px solid #667080; border: ${({ theme }) => theme.borderDefault};
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
...@@ -282,7 +271,7 @@ const Right = styled.div` ...@@ -282,7 +271,7 @@ const Right = styled.div`
` `
const Left = styled.div` const Left = styled.div`
border-right: 1px solid #667080; border-right: ${({ theme }) => theme.borderDefault};
display: flex; display: flex;
flex-direction: column; flex-direction: column;
flex: 5; flex: 5;
...@@ -304,10 +293,8 @@ const ManuscriptInfo = styled.div` ...@@ -304,10 +293,8 @@ const ManuscriptInfo = styled.div`
` `
const ManuscriptType = styled.div` const ManuscriptType = styled.div`
border: 1px solid #667080; border: ${({ theme }) => theme.borderDefault};
color: #667080; ${defaultText};
font-family: Helvetica;
font-size: 12px;
font-weight: bold; font-weight: bold;
padding: 6px 4px; padding: 6px 4px;
margin-left: 10px; margin-left: 10px;
...@@ -316,28 +303,23 @@ const ManuscriptType = styled.div` ...@@ -316,28 +303,23 @@ const ManuscriptType = styled.div`
` `
const Title = styled.span` const Title = styled.span`
color: #667080; ${defaultText};
font-family: Helvetica; font-size: ${({ theme }) => theme.fontSizeHeading5};
font-size: 18px;
text-align: left; text-align: left;
` `
const Status = styled.div` const Status = styled.div`
border: 1px solid #667080; border: ${({ theme }) => theme.borderDefault};
color: #667080; ${defaultText};
font-family: Helvetica;
font-size: 12px;
font-weight: bold; font-weight: bold;
text-align: left;
margin: 0.5em 0; margin: 0.5em 0;
padding: 0.2em 0.5em; padding: 0.2em 0.5em;
text-align: left;
text-transform: uppercase; text-transform: uppercase;
` `
const DateField = styled.span` const DateField = styled.span`
color: #667080; ${defaultText};
font-family: Helvetica;
font-size: 13px;
margin: 0 8px; margin: 0 8px;
text-align: left; text-align: left;
` `
...@@ -349,9 +331,7 @@ const ClickableIconContainer = styled.div` ...@@ -349,9 +331,7 @@ const ClickableIconContainer = styled.div`
margin-right: 8px; margin-right: 8px;
span:last-child { span:last-child {
color: #667080; ${defaultText};
font-family: Helvetica;
font-size: 14px;
margin-left: 8px; margin-left: 8px;
text-align: left; text-align: left;
text-decoration: underline; text-decoration: underline;
......
...@@ -26,6 +26,7 @@ const theme = { ...@@ -26,6 +26,7 @@ const theme = {
gridUnit: '32px', // Base interface space measurement used by elements and typography gridUnit: '32px', // Base interface space measurement used by elements and typography
borderDefault: '1px solid #667080',
borderRadius: '2px', // Radius value applied to borders throughout the user interface borderRadius: '2px', // Radius value applied to borders throughout the user interface
borderWidth: '1px', // Width value applied to borders borderWidth: '1px', // Width value applied to borders
borderStyle: 'solid', // Style applied to borders (eg. solid, dashed) borderStyle: 'solid', // Style applied to borders (eg. solid, dashed)
......
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
"url": "https://gitlab.coko.foundation/xpub/xpub" "url": "https://gitlab.coko.foundation/xpub/xpub"
}, },
"dependencies": { "dependencies": {
"aws-sdk": "^2.197.0",
"@pubsweet/ui": "^2.0.0",
"@pubsweet/component-aws-s3": "^0.1.1", "@pubsweet/component-aws-s3": "^0.1.1",
"@pubsweet/ui": "^2.0.0",
"aws-sdk": "^2.197.0",
"babel-core": "^6.26.0", "babel-core": "^6.26.0",
"config": "^1.26.2", "config": "^1.26.2",
"dotenv": "^5.0.0", "dotenv": "^5.0.0",
"flavors": "^3.3.1",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"fs-extra": "^4.0.2", "fs-extra": "^4.0.2",
"history": "^4.7.2", "history": "^4.7.2",
...@@ -26,16 +27,16 @@ ...@@ -26,16 +27,16 @@
"pubsweet-client": "^2.1.0", "pubsweet-client": "^2.1.0",
"pubsweet-component-ink-backend": "^0.1.1", "pubsweet-component-ink-backend": "^0.1.1",
"pubsweet-component-ink-frontend": "^1.0.0", "pubsweet-component-ink-frontend": "^1.0.0",
"pubsweet-component-invite": "^0.0.1",
"pubsweet-component-login": "^1.0.1", "pubsweet-component-login": "^1.0.1",
"pubsweet-component-signup": "^1.0.0", "pubsweet-component-signup": "^1.0.0",
"pubsweet-component-xpub-manuscript": "^0.0.2", "pubsweet-component-xpub-manuscript": "^0.0.2",
"pubsweet-server": "^1.0.1", "pubsweet-server": "^1.0.1",
"pubsweet-component-invite": "^0.0.1",
"react": "^16.2.0", "react": "^16.2.0",
"react-dom": "^16.2.0",
"react-router-dom": "^4.2.2",
"react-dnd": "^2.5.4", "react-dnd": "^2.5.4",
"react-dnd-html5-backend": "^2.5.4", "react-dnd-html5-backend": "^2.5.4",
"react-dom": "^16.2.0",
"react-router-dom": "^4.2.2",
"recompose": "^0.26.0", "recompose": "^0.26.0",
"redux": "^3.6.0", "redux": "^3.6.0",
"redux-form": "^7.0.3", "redux-form": "^7.0.3",
......
...@@ -2981,6 +2981,10 @@ deep-is@~0.1.3: ...@@ -2981,6 +2981,10 @@ deep-is@~0.1.3:
version "0.1.3" version "0.1.3"
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
deepmerge@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-2.0.1.tgz#25c1c24f110fb914f80001b925264dd77f3f4312"
default-require-extensions@^1.0.0: default-require-extensions@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8" resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-1.0.0.tgz#f37ea15d3e13ffd9b437d33e1a75b5fb97874cb8"
...@@ -4257,6 +4261,12 @@ flatten@^1.0.2: ...@@ -4257,6 +4261,12 @@ flatten@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782" resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
flavors@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/flavors/-/flavors-3.3.1.tgz#352baa433b4d6875474509612596ca95b9b7c81d"
dependencies:
deepmerge "^2.0.1"
flush-write-stream@^1.0.0: flush-write-stream@^1.0.0:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.2.tgz#c81b90d8746766f1a609a46809946c45dd8ae417" resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.0.2.tgz#c81b90d8746766f1a609a46809946c45dd8ae417"
...@@ -11717,10 +11727,22 @@ typeface-fira-sans@^0.0.43: ...@@ -11717,10 +11727,22 @@ typeface-fira-sans@^0.0.43:
version "0.0.43" version "0.0.43"
resolved "https://registry.yarnpkg.com/typeface-fira-sans/-/typeface-fira-sans-0.0.43.tgz#f9c026ae5b7ad5f1fb727f9947bd1e10e13702e6" resolved "https://registry.yarnpkg.com/typeface-fira-sans/-/typeface-fira-sans-0.0.43.tgz#f9c026ae5b7ad5f1fb727f9947bd1e10e13702e6"
typeface-noto-sans@0.0.54:
version "0.0.54"
resolved "https://registry.yarnpkg.com/typeface-noto-sans/-/typeface-noto-sans-0.0.54.tgz#16989ef56a5220b0503495ab8c1036f66b517b55"
typeface-noto-serif@0.0.54:
version "0.0.54"
resolved "https://registry.yarnpkg.com/typeface-noto-serif/-/typeface-noto-serif-0.0.54.tgz#26a552df3557c54f2f0c7f9bdbd28a95c9aab06b"
typeface-open-sans@0.0.35: typeface-open-sans@0.0.35:
version "0.0.35" version "0.0.35"
resolved "https://registry.yarnpkg.com/typeface-open-sans/-/typeface-open-sans-0.0.35.tgz#170dc36bbbd63829c9ea64b991c2b0fd65017708" resolved "https://registry.yarnpkg.com/typeface-open-sans/-/typeface-open-sans-0.0.35.tgz#170dc36bbbd63829c9ea64b991c2b0fd65017708"
typeface-ubuntu-mono@0.0.54:
version "0.0.54"
resolved "https://registry.yarnpkg.com/typeface-ubuntu-mono/-/typeface-ubuntu-mono-0.0.54.tgz#773582617ff60dc252acbaaeb22880ba7f559fe6"
typeface-vollkorn@^0.0.43: typeface-vollkorn@^0.0.43:
version "0.0.43" version "0.0.43"
resolved "https://registry.yarnpkg.com/typeface-vollkorn/-/typeface-vollkorn-0.0.43.tgz#4ee1a03f90000b0be3ebd8cac360ee777456465b" resolved "https://registry.yarnpkg.com/typeface-vollkorn/-/typeface-vollkorn-0.0.43.tgz#4ee1a03f90000b0be3ebd8cac360ee777456465b"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment