diff --git a/app/javascript/components/Comments/Comment.tsx b/app/javascript/components/Comments/Comment.tsx
index b489fe18..647fa6da 100644
--- a/app/javascript/components/Comments/Comment.tsx
+++ b/app/javascript/components/Comments/Comment.tsx
@@ -20,6 +20,8 @@ interface Props {
handleToggleCommentReply(): void;
handleCommentReplyBodyChange(e: FormEvent): void;
handleSubmitComment(body: string, parentId: number): void;
+
+ isLoggedIn: boolean;
}
const Comment = ({
@@ -34,6 +36,8 @@ const Comment = ({
handleToggleCommentReply,
handleCommentReplyBodyChange,
handleSubmitComment,
+
+ isLoggedIn,
}: Props) => (
@@ -52,8 +56,11 @@ const Comment = ({
:
null
diff --git a/app/javascript/components/Comments/CommentList.tsx b/app/javascript/components/Comments/CommentList.tsx
index 674409f1..f2b3fe4e 100644
--- a/app/javascript/components/Comments/CommentList.tsx
+++ b/app/javascript/components/Comments/CommentList.tsx
@@ -15,6 +15,8 @@ interface Props {
toggleCommentReply(commentId: number): void;
setCommentReplyBody(commentId: number, body: string): void;
handleSubmitComment(body: string, parentId: number): void;
+
+ isLoggedIn: boolean;
}
const CommentList = ({
@@ -26,6 +28,8 @@ const CommentList = ({
toggleCommentReply,
setCommentReplyBody,
handleSubmitComment,
+
+ isLoggedIn,
}: Props) => (
{comments.map((comment, i) => {
@@ -43,6 +47,8 @@ const CommentList = ({
}
handleSubmitComment={handleSubmitComment}
{...comment}
+
+ isLoggedIn={isLoggedIn}
/>
);
diff --git a/app/javascript/components/Comments/CommentsP.tsx b/app/javascript/components/Comments/CommentsP.tsx
index 4efd3c5f..58fcb7c6 100644
--- a/app/javascript/components/Comments/CommentsP.tsx
+++ b/app/javascript/components/Comments/CommentsP.tsx
@@ -11,6 +11,7 @@ import { CommentRepliesState } from '../../reducers/commentRepliesReducer';
interface Props {
postId: number;
+ isLoggedIn: boolean;
authenticityToken: string;
comments: Array
;
@@ -45,6 +46,8 @@ class CommentsP extends React.Component {
render() {
const {
+ isLoggedIn,
+
comments,
replies,
areLoading,
@@ -55,17 +58,22 @@ class CommentsP extends React.Component {
submitComment,
} = this.props;
+ const postReply = replies.find(reply => reply.commentId === -1);
+
return (
reply.commentId === -1) && replies.find(reply => reply.commentId === -1).body}
+ body={postReply && postReply.body}
parentId={null}
+ isSubmitting={postReply && postReply.isSubmitting}
handleChange={
(e: FormEvent) => (
setCommentReplyBody(-1, (e.target as HTMLTextAreaElement).value)
)
}
handleSubmit={this._handleSubmitComment}
+
+ isLoggedIn={isLoggedIn}
/>
{ areLoading ? : null }
@@ -83,6 +91,7 @@ class CommentsP extends React.Component {
handleSubmitComment={this._handleSubmitComment}
parentId={null}
level={1}
+ isLoggedIn={isLoggedIn}
/>
);
diff --git a/app/javascript/components/Comments/NewComment.tsx b/app/javascript/components/Comments/NewComment.tsx
index 31494522..f6f230b1 100644
--- a/app/javascript/components/Comments/NewComment.tsx
+++ b/app/javascript/components/Comments/NewComment.tsx
@@ -2,32 +2,46 @@ import * as React from 'react';
import { FormEvent } from 'react';
import Button from '../shared/Button';
+import Spinner from '../shared/Spinner';
interface Props {
body: string;
parentId: number;
+ isSubmitting: boolean;
handleChange(e: FormEvent): void;
handleSubmit(body: string, parentId: number): void;
+
+ isLoggedIn: boolean;
}
const NewComment = ({
body,
parentId,
+ isSubmitting,
handleChange,
handleSubmit,
+
+ isLoggedIn,
}: Props) => (
-
-
+ {
+ isLoggedIn ?
+
+
+
+
+ :
+
You need to log in to post comments.
+ }
);
diff --git a/app/javascript/components/Post/PostP.tsx b/app/javascript/components/Post/PostP.tsx
index ada2766e..c09d7d8a 100644
--- a/app/javascript/components/Post/PostP.tsx
+++ b/app/javascript/components/Post/PostP.tsx
@@ -36,6 +36,7 @@ class PostP extends React.Component {
post,
postStatuses,
+ isLoggedIn,
isPowerUser,
authenticityToken,
@@ -73,6 +74,7 @@ class PostP extends React.Component {
diff --git a/app/javascript/components/shared/Button.tsx b/app/javascript/components/shared/Button.tsx
index d4b79522..43a74b74 100644
--- a/app/javascript/components/shared/Button.tsx
+++ b/app/javascript/components/shared/Button.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { FormEvent } from 'react';
interface Props {
- children: string;
+ children: any;
onClick(e: FormEvent): void;
className?: string;
outline?: boolean;
diff --git a/app/javascript/components/shared/Spinner.tsx b/app/javascript/components/shared/Spinner.tsx
index 603b0d10..a21164ca 100644
--- a/app/javascript/components/shared/Spinner.tsx
+++ b/app/javascript/components/shared/Spinner.tsx
@@ -1,7 +1,7 @@
import * as React from 'react';
const Spinner = () => (
-
+
Loading...
);
diff --git a/app/javascript/stylesheets/general/_components.scss b/app/javascript/stylesheets/general/_components.scss
index e361eb40..478bb5b6 100644
--- a/app/javascript/stylesheets/general/_components.scss
+++ b/app/javascript/stylesheets/general/_components.scss
@@ -1,3 +1,9 @@
+a {
+ color: #333;
+
+ &:hover { color: inherit; }
+}
+
.card {
@extend .card;
diff --git a/app/javascript/stylesheets/general/_index.scss b/app/javascript/stylesheets/general/_index.scss
index 494e78e2..fea8515e 100644
--- a/app/javascript/stylesheets/general/_index.scss
+++ b/app/javascript/stylesheets/general/_index.scss
@@ -19,4 +19,8 @@
margin-top: auto;
margin-bottom: auto;
margin-right: 4px;
+}
+
+.loginInfo {
+ text-decoration: underline;
}
\ No newline at end of file