mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 11:47:56 +01:00
Add gravatar image to new comment form
This commit is contained in:
@@ -23,6 +23,7 @@ interface Props {
|
|||||||
|
|
||||||
isLoggedIn: boolean;
|
isLoggedIn: boolean;
|
||||||
isPowerUser: boolean;
|
isPowerUser: boolean;
|
||||||
|
currentUserEmail: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Comment = ({
|
const Comment = ({
|
||||||
@@ -39,6 +40,7 @@ const Comment = ({
|
|||||||
|
|
||||||
isLoggedIn,
|
isLoggedIn,
|
||||||
isPowerUser,
|
isPowerUser,
|
||||||
|
currentUserEmail,
|
||||||
}: Props) => (
|
}: Props) => (
|
||||||
<div className="comment">
|
<div className="comment">
|
||||||
<div className="commentHeader">
|
<div className="commentHeader">
|
||||||
@@ -73,6 +75,7 @@ const Comment = ({
|
|||||||
handleSubmit={handleSubmitComment}
|
handleSubmit={handleSubmitComment}
|
||||||
|
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
|
userEmail={currentUserEmail}
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
null
|
null
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ interface Props {
|
|||||||
|
|
||||||
isLoggedIn: boolean;
|
isLoggedIn: boolean;
|
||||||
isPowerUser: boolean;
|
isPowerUser: boolean;
|
||||||
|
userEmail: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CommentList = ({
|
const CommentList = ({
|
||||||
@@ -31,6 +32,7 @@ const CommentList = ({
|
|||||||
|
|
||||||
isLoggedIn,
|
isLoggedIn,
|
||||||
isPowerUser,
|
isPowerUser,
|
||||||
|
userEmail,
|
||||||
}: Props) => (
|
}: Props) => (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{comments.map((comment, i) => {
|
{comments.map((comment, i) => {
|
||||||
@@ -50,6 +52,7 @@ const CommentList = ({
|
|||||||
|
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
isPowerUser={isPowerUser}
|
isPowerUser={isPowerUser}
|
||||||
|
currentUserEmail={userEmail}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CommentList
|
<CommentList
|
||||||
@@ -64,6 +67,7 @@ const CommentList = ({
|
|||||||
|
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
isPowerUser={isPowerUser}
|
isPowerUser={isPowerUser}
|
||||||
|
userEmail={userEmail}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ interface Props {
|
|||||||
postId: number;
|
postId: number;
|
||||||
isLoggedIn: boolean;
|
isLoggedIn: boolean;
|
||||||
isPowerUser: boolean;
|
isPowerUser: boolean;
|
||||||
|
userEmail: string;
|
||||||
authenticityToken: string;
|
authenticityToken: string;
|
||||||
|
|
||||||
comments: Array<IComment>;
|
comments: Array<IComment>;
|
||||||
@@ -48,6 +49,7 @@ class CommentsP extends React.Component<Props> {
|
|||||||
const {
|
const {
|
||||||
isLoggedIn,
|
isLoggedIn,
|
||||||
isPowerUser,
|
isPowerUser,
|
||||||
|
userEmail,
|
||||||
|
|
||||||
comments,
|
comments,
|
||||||
replyForms,
|
replyForms,
|
||||||
@@ -75,6 +77,7 @@ class CommentsP extends React.Component<Props> {
|
|||||||
handleSubmit={this._handleSubmitComment}
|
handleSubmit={this._handleSubmitComment}
|
||||||
|
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
|
userEmail={userEmail}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{ areLoading ? <Spinner /> : null }
|
{ areLoading ? <Spinner /> : null }
|
||||||
@@ -94,6 +97,7 @@ class CommentsP extends React.Component<Props> {
|
|||||||
level={1}
|
level={1}
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
isPowerUser={isPowerUser}
|
isPowerUser={isPowerUser}
|
||||||
|
userEmail={userEmail}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import Gravatar from 'react-gravatar';
|
||||||
|
|
||||||
import Button from '../shared/Button';
|
import Button from '../shared/Button';
|
||||||
import Spinner from '../shared/Spinner';
|
import Spinner from '../shared/Spinner';
|
||||||
@@ -13,6 +14,7 @@ interface Props {
|
|||||||
handleSubmit(body: string, parentId: number): void;
|
handleSubmit(body: string, parentId: number): void;
|
||||||
|
|
||||||
isLoggedIn: boolean;
|
isLoggedIn: boolean;
|
||||||
|
userEmail: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NewComment = ({
|
const NewComment = ({
|
||||||
@@ -24,12 +26,14 @@ const NewComment = ({
|
|||||||
handleSubmit,
|
handleSubmit,
|
||||||
|
|
||||||
isLoggedIn,
|
isLoggedIn,
|
||||||
|
userEmail,
|
||||||
}: Props) => (
|
}: Props) => (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<div className="newCommentForm">
|
<div className="newCommentForm">
|
||||||
{
|
{
|
||||||
isLoggedIn ?
|
isLoggedIn ?
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
<Gravatar email={userEmail} size={36} className="currentUserAvatar" />
|
||||||
<textarea
|
<textarea
|
||||||
value={body}
|
value={body}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ class PostP extends React.Component<Props> {
|
|||||||
postId={this.props.postId}
|
postId={this.props.postId}
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
isPowerUser={isPowerUser}
|
isPowerUser={isPowerUser}
|
||||||
|
userEmail={userEmail}
|
||||||
authenticityToken={authenticityToken}
|
authenticityToken={authenticityToken}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,6 +4,13 @@
|
|||||||
.d-flex,
|
.d-flex,
|
||||||
.my-3;
|
.my-3;
|
||||||
|
|
||||||
|
.currentUserAvatar {
|
||||||
|
@extend
|
||||||
|
.gravatar,
|
||||||
|
.align-self-end,
|
||||||
|
.mr-2;
|
||||||
|
}
|
||||||
|
|
||||||
.newCommentBody {
|
.newCommentBody {
|
||||||
@extend
|
@extend
|
||||||
.form-control,
|
.form-control,
|
||||||
|
|||||||
Reference in New Issue
Block a user