From 2990f48f1d49ff8152c7ff3613a3a466943eab29 Mon Sep 17 00:00:00 2001 From: Nkunzi Innocent Date: Fri, 28 Jun 2019 12:39:44 +0200 Subject: [PATCH] fixing verify account bug --- src/components/Category.jsx | 2 +- .../article/AllArticlesComponents.jsx | 95 +- src/components/article/ArticleForm.jsx | 4 + src/components/comment/commentForm.jsx | 38 +- src/components/homeNavBar.jsx | 62 +- src/css/Home-styles/home-style.css | 9 +- src/css/Home-styles/home-style.scss | 10 + src/styles/css/article.css | 515 +++++++---- src/styles/scss/article.scss | 837 +++++++++--------- .../__snapshots__/commentForm.test.js.snap | 2 +- .../__snapshots__/homeNavBar.test.js.snap | 2 +- src/tests/commentForm.test.js | 8 + 12 files changed, 935 insertions(+), 649 deletions(-) diff --git a/src/components/Category.jsx b/src/components/Category.jsx index 45021ed..cad7600 100644 --- a/src/components/Category.jsx +++ b/src/components/Category.jsx @@ -69,7 +69,7 @@ export class Category extends Component {
{item.title} {/* */} - {htmlReactParser(item.description)} + {htmlReactParser(item.description)}
{item.views} Views diff --git a/src/components/article/AllArticlesComponents.jsx b/src/components/article/AllArticlesComponents.jsx index 215c45e..d88b877 100644 --- a/src/components/article/AllArticlesComponents.jsx +++ b/src/components/article/AllArticlesComponents.jsx @@ -110,54 +110,59 @@ export class AllArticles extends Component {
{ - (allArticle = arr.map(item => ( - -
- articleImage -
- -
-

{reactParser(item.title)}

-
-
-

{reactParser(item.description)}

-
-
-
- {decodedToken !== undefined && - decodedToken.id === item.authorid ? ( -
- - - + (allArticle = arr.map(item => + decodedToken !== undefined && + decodedToken.id === item.authorid ? ( + +
+ articleImage +
+ +
+

{reactParser(item.title)}

- ) : ( - '' - )} +
+

{reactParser(item.description)}

+
+
+
+ {decodedToken !== undefined && + decodedToken.id === item.authorid ? ( +
+ + + +
+ ) : ( + '' + )} +
-
- - ))) + + ) : ( + '' + ), + )) }
diff --git a/src/components/article/ArticleForm.jsx b/src/components/article/ArticleForm.jsx index 5a632bf..3c80bb9 100644 --- a/src/components/article/ArticleForm.jsx +++ b/src/components/article/ArticleForm.jsx @@ -9,6 +9,7 @@ /* eslint-disable dot-notation */ /* eslint-disable no-return-assign */ import React from 'react'; +// import decodeToken from 'jwt-decode'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faImage } from '@fortawesome/free-solid-svg-icons'; import { connect } from 'react-redux'; @@ -197,6 +198,9 @@ export class Editor extends React.Component { * @returns {*} editor */ render() { + // const token = localStorage.getItem('token'); + // const decode = decodeToken(token); + // console.log(decode); const { tagInputs } = this.state; let id = 1; const { articleCategory } = this.props.articleCategories; diff --git a/src/components/comment/commentForm.jsx b/src/components/comment/commentForm.jsx index 58abc3c..fe73049 100644 --- a/src/components/comment/commentForm.jsx +++ b/src/components/comment/commentForm.jsx @@ -1,5 +1,6 @@ /* eslint-disable require-jsdoc */ import React, { Component } from 'react'; +import decodeToken from 'jwt-decode'; import TextArea from '../common/textArea'; import SubmitButton from '../common/SubmitButton'; @@ -16,7 +17,12 @@ class CommentForm extends Component { } handleChange = e => { + // const desabledTextarea = document.getElementById('disabledTexarea'); + // if (desabledTextarea) { + // desabledTextarea.desabled = true; + // } else { this.setState({ [e.target.name]: e.target.value }); + // } }; handleSubmit = e => { @@ -31,20 +37,34 @@ class CommentForm extends Component { }; render() { + const decodedToken = decodeToken(localStorage.getItem('token')); const { comment } = this.state; const { buttonLabel } = this.props; return (
-
-