@@ -199,6 +243,7 @@ export class HomePage extends React.PureComponent {
}
HomePage.propTypes = {
+ getArticles: PropTypes.func.isRequired,
homePage: PropTypes.object.isRequired,
onChange: PropTypes.func.isRequired,
plugins: PropTypes.object.isRequired,
@@ -213,6 +258,7 @@ const mapStateToProps = createStructuredSelector({
function mapDispatchToProps(dispatch) {
return bindActionCreators(
{
+ getArticles,
onChange,
submit,
},
diff --git a/packages/strapi-admin/admin/src/containers/HomePage/reducer.js b/packages/strapi-admin/admin/src/containers/HomePage/reducer.js
index 335b0b611c..bcbc3cc66d 100644
--- a/packages/strapi-admin/admin/src/containers/HomePage/reducer.js
+++ b/packages/strapi-admin/admin/src/containers/HomePage/reducer.js
@@ -3,11 +3,12 @@
* HomePage reducer
*/
-import { fromJS, Map } from 'immutable';
+import { fromJS, List, Map } from 'immutable';
-import { ON_CHANGE, SUBMIT_SUCCEEDED } from './constants';
+import { GET_ARTICLES_SUCCEEDED, ON_CHANGE, SUBMIT_SUCCEEDED } from './constants';
const initialState = fromJS({
+ articles: List([]),
body: Map({
email: '',
}),
@@ -15,6 +16,8 @@ const initialState = fromJS({
function homePageReducer(state = initialState, action) {
switch (action.type) {
+ case GET_ARTICLES_SUCCEEDED:
+ return state.update('articles', () => List(action.articles));
case ON_CHANGE:
return state.updateIn(['body', 'email'], () => action.value);
case SUBMIT_SUCCEEDED:
diff --git a/packages/strapi-admin/admin/src/containers/HomePage/saga.js b/packages/strapi-admin/admin/src/containers/HomePage/saga.js
index e5704f14ea..d4086e6f8d 100644
--- a/packages/strapi-admin/admin/src/containers/HomePage/saga.js
+++ b/packages/strapi-admin/admin/src/containers/HomePage/saga.js
@@ -1,3 +1,6 @@
+import 'whatwg-fetch';
+import { dropRight, take } from 'lodash';
+import removeMd from 'remove-markdown';
import {
call,
fork,
@@ -8,10 +11,33 @@ import {
import request from 'utils/request';
-import { submitSucceeded } from './actions';
-import { SUBMIT } from './constants';
+import { getArticlesSucceeded, submitSucceeded } from './actions';
+import { GET_ARTICLES, SUBMIT } from './constants';
import { makeSelectBody } from './selectors';
+function* getArticles() {
+ try {
+ const articles = yield call(fetchArticles);
+ const posts = articles.posts.reduce((acc, curr) => {
+ // Limit to 200 characters and remove last word.
+ const content = dropRight(take(removeMd(curr.markdown), 250).join('').split(' ')).join(' ');
+
+ acc.push({
+ title: curr.title,
+ link: curr.slug,
+ content: `${content} [...]`,
+ });
+
+ return acc;
+ }, []);
+
+ yield put(getArticlesSucceeded(posts));
+ } catch(err) {
+ // Silent
+ }
+}
+
+
function* submit() {
try {
const body = yield select(makeSelectBody());
@@ -26,6 +52,14 @@ function* submit() {
function* defaultSaga() {
yield fork(takeLatest, SUBMIT, submit);
+ yield fork(takeLatest, GET_ARTICLES, getArticles);
}
+
+function fetchArticles() {
+ return fetch('https://blog.strapi.io/ghost/api/v0.1/posts/?client_id=ghost-frontend&client_secret=1f260788b4ec&limit=2', {})
+ .then(resp => {
+ return resp.json ? resp.json() : resp;
+ });
+}
export default defaultSaga;
diff --git a/packages/strapi-admin/admin/src/containers/HomePage/styles.scss b/packages/strapi-admin/admin/src/containers/HomePage/styles.scss
index 504c0d137f..6e09318d2c 100644
--- a/packages/strapi-admin/admin/src/containers/HomePage/styles.scss
+++ b/packages/strapi-admin/admin/src/containers/HomePage/styles.scss
@@ -173,6 +173,32 @@
}
}
+.homePageBlogButton {
+ position: relative;
+ height: 34px;
+ margin-top: 17px;
+ margin-bottom: 1px;
+ padding-left: 40px;
+ padding-right: 20px;
+ background: #333740;
+ color: white;
+ font-size: 13px;
+ font-weight: 800;
+ line-height: 33px;
+ letter-spacing: 0.46px;
+ text-align: left;
+ &:before {
+ content: '\f105';
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 20px;
+ font-size: 22px;
+ margin-right: 10px;
+ font-family: 'FontAwesome';
+ }
+}
+
.iconWave {
position: absolute;
top: 24px;
@@ -237,6 +263,6 @@
.welcomeContentP {
display: block;
- max-width: 49rem !important;
+ max-width: 55rem !important;
margin-bottom: 31px;
}
diff --git a/packages/strapi-admin/admin/src/translations/en.json b/packages/strapi-admin/admin/src/translations/en.json
index 4ac03eb36d..9c21951945 100755
--- a/packages/strapi-admin/admin/src/translations/en.json
+++ b/packages/strapi-admin/admin/src/translations/en.json
@@ -9,18 +9,21 @@
"app.components.DownloadInfo.text": "This could take a minute. Thanks for your patience.",
"app.components.HomePage.welcome": "Welcome on board!",
+ "app.components.HomePage.welcome.again": "Welcome ",
"app.components.HomePage.cta": "CONFIRM",
"app.components.HomePage.community": "Find the community on the web",
"app.components.HomePage.newsLetter": "Subscribe to the newsletter to get in touch about Strapi",
"app.components.HomePage.community.content": "Discuss with team members, contributors and developers on different channels.",
"app.components.HomePage.create": "Create your first Content Type",
"app.components.HomePage.welcomeBlock.content": "We are happy to have you as one of community member. We are constantly looking for feedback so feel free to send us DM on\u0020",
+ "app.components.HomePage.welcomeBlock.content.again": "We hope you are making progress on your project... Feel free to read the latest new about Strapi. We are giving our best to improve the product based on your feedback.",
"app.components.HomePage.welcomeBlock.content.issues": "issues.",
"app.components.HomePage.welcomeBlock.content.raise": "\u0020or raise\u0020",
"app.components.HomePage.createBlock.content.first": "The\u0020",
"app.components.HomePage.createBlock.content.second": "\u0020plugin will help you to define the data structure of your models. If you’re new here, we highly recommend you to follow our\u0020",
"app.components.HomePage.createBlock.content.tutorial": "\u0020tutorial.",
"app.components.HomePage.button.quickStart": "START THE QUICK START TUTORIAL",
+ "app.components.HomePage.button.blog": "SEE MORE ON THE BLOG",
"app.components.HomePage.support": "SUPPORT US",
"app.components.HomePage.support.content": "By buying the T-shirt (25€), it will allow us to continue our work on the project to give you the best possible experience!",
"app.components.HomePage.support.link": "GET YOUR T-SHIRT NOW",
diff --git a/packages/strapi-admin/admin/src/translations/fr.json b/packages/strapi-admin/admin/src/translations/fr.json
index 231f10362b..4f66325c1e 100755
--- a/packages/strapi-admin/admin/src/translations/fr.json
+++ b/packages/strapi-admin/admin/src/translations/fr.json
@@ -9,17 +9,20 @@
"app.components.DownloadInfo.text": "Cela peut prendre une minute. Merci de patienter.",
"app.components.HomePage.welcome": "Bienvenue Ă bord!",
+ "app.components.HomePage.welcome.again": "Bienvenue ",
"app.components.HomePage.cta": "CONFIRMEZ",
"app.components.HomePage.community": "Rejoignez la communauté",
"app.components.HomePage.community.content": "Discutez avec les membres de l'équipe, contributeurs et développeurs sur différent supports.",
"app.components.HomePage.create": "Créez votre premier Content Type",
"app.components.HomePage.welcomeBlock.content": "Nous sommes heureux de vous compter parmi nos membres. Nous sommes à l'écoute de vos retours alors, n'hésitez pas à nous envoyer des DM sur\u0020",
+ "app.components.HomePage.welcomeBlock.content.again": "Nous espérons que votre projet avance bien... Découvrez les derniers articles à propos de Strapi. Nous faisons de notre mieux pour améliorer le produit selon vos retours.",
"app.components.HomePage.welcomeBlock.content.issues": "issues",
"app.components.HomePage.welcomeBlock.content.raise": "\u0020ou soumetez des\u0020",
"app.components.HomePage.createBlock.content.first": "Le\u0020",
"app.components.HomePage.createBlock.content.second": "\u0020plugin vous permet de définir la structure de vos modèles. Nous vous conseillons fortement de suivre notre\u0020",
"app.components.HomePage.createBlock.content.tutorial": "\u0020tutoriel.",
"app.components.HomePage.button.quickStart": "VOIR LE QUICK START TUTORIEL",
+ "app.components.HomePage.button.blog": "VOIR PLUS D'ARTICLES SUR LE BLOG",
"app.components.HomePage.support": "SUPPORT US",
"app.components.HomePage.support.content": "En achetant notre T-shirt (25€), vous nous aidez à poursuivre à maintenir le projet pour que nous puissions vous donner la meilleure expérience possible!",
"app.components.HomePage.support.link": "OBTENEZ VOTRE T-SHIRT!",
diff --git a/packages/strapi-admin/package.json b/packages/strapi-admin/package.json
index fcefa77963..6ef3a01991 100755
--- a/packages/strapi-admin/package.json
+++ b/packages/strapi-admin/package.json
@@ -24,6 +24,7 @@
},
"dependencies": {
"react-ga": "^2.4.1",
+ "remove-markdown": "^0.2.2",
"shelljs": "^0.7.8"
},
"devDependencies": {