Remove unused imports and add some types

This commit is contained in:
riggraz
2019-09-26 11:00:32 +02:00
parent e38027f9ae
commit 322c8e51cf
19 changed files with 27 additions and 45 deletions

View File

@@ -1,5 +1,4 @@
import * as React from 'react';
import { FormEvent } from 'react';
import NewComment from './NewComment';
import Separator from '../shared/Separator';
@@ -12,14 +11,12 @@ import friendlyDate from '../../helpers/friendlyDate';
interface Props {
id: number;
body: string;
parentId: number;
userFullName: string;
updatedAt: string;
level: number;
reply: CommentRepliesState;
handleToggleCommentReply(): void;
handleCommentReplyBodyChange(e: FormEvent): void;
handleCommentReplyBodyChange(e: React.FormEvent): void;
handleSubmitComment(body: string, parentId: number): void;
isLoggedIn: boolean;
@@ -29,11 +26,9 @@ interface Props {
const Comment = ({
id,
body,
parentId,
userFullName,
updatedAt,
level,
reply,
handleToggleCommentReply,
handleCommentReplyBodyChange,

View File

@@ -1,5 +1,4 @@
import * as React from 'react';
import { FormEvent } from 'react';
import Comment from './Comment';
@@ -39,11 +38,10 @@ const CommentList = ({
return (
<div className="commentList" key={i}>
<Comment
level={level}
reply={replies.find(reply => reply.commentId === comment.id)}
handleToggleCommentReply={() => toggleCommentReply(comment.id)}
handleCommentReplyBodyChange={
(e: FormEvent) => (
(e: React.FormEvent) => (
setCommentReplyBody(comment.id, (e.target as HTMLTextAreaElement).value)
)
}

View File

@@ -1,10 +1,9 @@
import * as React from 'react';
import { FormEvent } from 'react';
import NewComment from './NewComment';
import CommentList from './CommentList';
import Spinner from '../shared/Spinner';
import { DangerText, UppercaseText } from '../shared/CustomTexts';
import { DangerText } from '../shared/CustomTexts';
import IComment from '../../interfaces/IComment';
import { CommentRepliesState } from '../../reducers/commentRepliesReducer';
@@ -36,7 +35,7 @@ class CommentsP extends React.Component<Props> {
this.props.requestComments(this.props.postId);
}
_handleSubmitComment = (body, parentId) => {
_handleSubmitComment = (body: string, parentId: number) => {
this.props.submitComment(
this.props.postId,
body,
@@ -57,7 +56,6 @@ class CommentsP extends React.Component<Props> {
toggleCommentReply,
setCommentReplyBody,
submitComment,
} = this.props;
const postReply = replies.find(reply => reply.commentId === -1);
@@ -69,7 +67,7 @@ class CommentsP extends React.Component<Props> {
parentId={null}
isSubmitting={postReply && postReply.isSubmitting}
handleChange={
(e: FormEvent) => (
(e: React.FormEvent) => (
setCommentReplyBody(-1, (e.target as HTMLTextAreaElement).value)
)
}

View File

@@ -1,5 +1,4 @@
import * as React from 'react';
import { FormEvent } from 'react';
import Button from '../shared/Button';
import Spinner from '../shared/Spinner';
@@ -8,7 +7,7 @@ interface Props {
body: string;
parentId: number;
isSubmitting: boolean;
handleChange(e: FormEvent): void;
handleChange(e: React.FormEvent): void;
handleSubmit(body: string, parentId: number): void;
isLoggedIn: boolean;