Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug #166975032 fixing verify account bug #48

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Category.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class Category extends Component {
<div className="cardTitle">
<span className="articleTitle">{item.title} </span>
{/* <span className="articleDescription"> */}
{htmlReactParser(item.description)}
<span>{htmlReactParser(item.description)}</span>
<div className="likeAndBookMarkDiv">
<FontAwesomeIcon icon={faHeart} id="views" />
{item.views} Views
Expand Down
95 changes: 50 additions & 45 deletions src/components/article/AllArticlesComponents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,54 +110,59 @@ export class AllArticles extends Component {
<div className="container">
<div className="allArticlecontents">
{
(allArticle = arr.map(item => (
<Fragment key={item.id}>
<div className="card">
<img
className="image"
alt="articleImage"
src={this.handleImage(item)}
/>
<div className="contentDescription">
<a href={`/article/${item.slug}`}>
<div className="articleCardHeader">
<p>{reactParser(item.title)}</p>
</div>
<div className="articleDescription">
<p>{reactParser(item.description)}</p>
</div>
</a>
<div className="buttons">
{decodedToken !== undefined &&
decodedToken.id === item.authorid ? (
<div>
<button
type="submit"
className="redButton"
onClick={() => this.handleDelete(item.slug)}
id="submit-data"
data-test="submit-data"
>
Delete
</button>

<button
type="submit"
className="lightBlueButton"
>
<a href={`/articlesedit/${item.slug}/edit`}>
Edit
</a>
</button>
(allArticle = arr.map(item =>
decodedToken !== undefined &&
decodedToken.id === item.authorid ? (
<Fragment key={item.id}>
<div className="card">
<img
className="image"
alt="articleImage"
src={this.handleImage(item)}
/>
<div className="contentDescription">
<a href={`/article/${item.slug}`}>
<div className="articleCardHeader">
<p>{reactParser(item.title)}</p>
</div>
) : (
''
)}
<div className="articleDescription">
<p>{reactParser(item.description)}</p>
</div>
</a>
<div className="buttons">
{decodedToken !== undefined &&
decodedToken.id === item.authorid ? (
<div>
<button
type="submit"
className="redButton"
onClick={() => this.handleDelete(item.slug)}
id="submit-data"
data-test="submit-data"
>
Delete
</button>

<button
type="submit"
className="lightBlueButton"
>
<a href={`/articlesedit/${item.slug}/edit`}>
Edit
</a>
</button>
</div>
) : (
''
)}
</div>
</div>
</div>
</div>
</Fragment>
)))
</Fragment>
) : (
''
),
))
}
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/components/article/ArticleForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
38 changes: 29 additions & 9 deletions src/components/comment/commentForm.jsx
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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 => {
Expand All @@ -31,20 +37,34 @@ class CommentForm extends Component {
};

render() {
const decodedToken = decodeToken(localStorage.getItem('token'));
const { comment } = this.state;
const { buttonLabel } = this.props;

return (
<div className="comment-form">
<form onSubmit={this.handleSubmit}>
<TextArea
handleChange={this.handleChange}
placeholder="Add your comment"
name="comment"
value={comment}
/>
<SubmitButton type="submit" name="comment" value={buttonLabel} />
</form>
{decodedToken.verified !== true ? (
<form onSubmit={this.handleSubmit}>
<TextArea
id="disabledTexarea"
handleChange={this.handleChange}
placeholder="Add your comment"
name="comment"
value={comment}
/>
<SubmitButton type="submit" name="comment" value={buttonLabel} />
</form>
) : (
<form onSubmit={this.handleSubmit}>
<TextArea
handleChange={this.handleChange}
placeholder="Add your comment"
name="comment"
value={comment}
/>
<SubmitButton type="submit" name="comment" value={buttonLabel} />
</form>
)}
</div>
);
}
Expand Down
62 changes: 50 additions & 12 deletions src/components/homeNavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
import React, { Component } from 'react';
import decodeToken from 'jwt-decode';
import _ from 'lodash';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
Expand Down Expand Up @@ -140,6 +141,7 @@ export class HomeNavBar extends Component {
* @returns {*} NavBar component
*/
render() {
const decodedToken = decodeToken(localStorage.getItem('token'));
const {
categories,
popup,
Expand Down Expand Up @@ -245,18 +247,54 @@ export class HomeNavBar extends Component {
<React.Fragment>
<div className="arrow-up-profile-back" />
<div className="arrow-up-profile" />
<Link
className="profile-style user-menu"
to={`/${username}`}
>
Profile
</Link>
<Link
className="profile-style user-menu"
to="/article/create"
>
Create Article
</Link>
{decodedToken.verified !== true ? (
<Link
className="disabled profile-style user-menu"
to={`/${username}`}
>
Profile
</Link>
) : (
<Link
className="profile-style user-menu"
to={`/${username}`}
>
Profile
</Link>
)}

{decodedToken.verified !== true ? (
<Link
className="disabled profile-style user-menu"
to="/article/create"
>
Create Article
</Link>
) : (
<Link
className="profile-style user-menu"
to="/article/create"
>
Create Article
</Link>
)}

{decodedToken.verified !== true ? (
<Link
className="disabled profile-style user-menu"
to="/articles"
>
Manage articles
</Link>
) : (
<Link
className="profile-style user-menu"
to="/articles"
>
Manage articles
</Link>
)}

{role === 'Admin' && (
<Link
className="profile-style user-menu"
Expand Down
9 changes: 7 additions & 2 deletions src/css/Home-styles/home-style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/css/Home-styles/home-style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ $color: (
body {
background-color: #fff !important;
}

.home-navigation {
width: 100%;
background-color: colors(form);
Expand Down Expand Up @@ -99,6 +100,7 @@ body {
border-radius: 4px;
background-color: white;
box-shadow: 1px 1px 5px 1px #888888;

.notification-style {
position: relative;
width: 300px;
Expand Down Expand Up @@ -152,6 +154,7 @@ body {
text-align: center;
width: 100%;
}

.user-menu:hover {
color: #147aee;
background: rgba(123, 179, 253, 0.02);
Expand All @@ -168,6 +171,7 @@ body {
text-decoration: none;
color: black;
}

.notification-time {
font-size: 11px;
color: #0000008c;
Expand All @@ -176,13 +180,15 @@ body {
font-family: sans-serif;
}
}

.notifications {
padding: 30px;

.notification-article-link {
text-decoration: none;
color: black;
}

.notification-time {
font-size: 11px;
color: #ccc;
Expand Down Expand Up @@ -267,3 +273,7 @@ body {
}
}
}

.disabled .profile-style .user-menu {
pointer-events: none;
}
Loading