From ae670c8ea36f07e2e13f911258280e582c68bce7 Mon Sep 17 00:00:00 2001 From: Jerko Steiner Date: Wed, 13 Mar 2019 14:09:14 +0500 Subject: [PATCH] Fix compilation errors in @rondo/comments-client --- .../client/src/comments/CommentActions.ts | 104 ------------------ packages/client/src/comments/Comments.tsx | 47 -------- packages/client/src/index.ts | 1 + packages/client/tsconfig.json | 5 +- packages/tsconfig.json | 5 +- 5 files changed, 9 insertions(+), 153 deletions(-) delete mode 100644 packages/client/src/comments/CommentActions.ts delete mode 100644 packages/client/src/comments/Comments.tsx diff --git a/packages/client/src/comments/CommentActions.ts b/packages/client/src/comments/CommentActions.ts deleted file mode 100644 index c8e5314..0000000 --- a/packages/client/src/comments/CommentActions.ts +++ /dev/null @@ -1,104 +0,0 @@ -import {IHTTPClient} from '../http' -import {IComment, ICommentsAPIDef} from '@rondo/comments-common' - -export enum ICommentActionTypes { - VOTE_UP = 'VOTE_UP', - VOTE_DOWN = 'VOTE_DOWN', - COMMENTS_RETRIEVE = 'COMMENTS_RETRIEVE', - COMMENT_ADD = 'COMMENT_ADD', - COMMENT_EDIT = 'COMMENT_EDIT', - COMMENT_REMOVE = 'COMMENT_DELETE', - - SPAM_MARK = 'SPAM_MARK', - SPAM_UNMARK = 'SPAM_UNMARK', -} - -export class CommentActions { - constructor(protected readonly http: IHTTPClient) {} - - voteUp(comment: IComment) { - return { - payload: this.http.post('/comments/:commentId/vote', null, { - commentId: comment.id, - }), - type: ICommentActionTypes.VOTE_UP, - } - } - - voteDown(comment: IComment) { - return { - payload: this.http.delete('/comments/:commentId/vote', null, { - commentId: comment.id, - }), - type: ICommentActionTypes.VOTE_DOWN, - } - } - - getComments(storyId: number) { - return { - payload: this.http.get('/stories/:storyId/comments', null, { - storyId, - }), - type: ICommentActionTypes.COMMENTS_RETRIEVE, - } - } - - addComment(comment: IComment) { - if (!comment.parentId) { - // root comment - return { - payload: this.http.post('/stories/:storyId/comments', comment, { - storyId: comment.storyId, - }), - type: ICommentActionTypes.COMMENT_ADD, - } - } - - // nested comment - return { - payload: this.http - .post('/stories/:storyId/comments/:parentId', comment, { - storyId: comment.storyId, - parentId: comment.parentId, - }), - type: ICommentActionTypes.COMMENT_ADD, - } - } - - editComment(comment: IComment) { - return { - payload: this.http.put('/comments/:commentId', comment, { - commentId: comment.id, - }), - type: ICommentActionTypes.COMMENT_EDIT, - } - } - - removeComment(comment: IComment) { - return { - payload: this.http.delete('/comments/:commentId', null, { - commentId: comment.id, - }), - type: ICommentActionTypes.COMMENT_REMOVE, - } - } - - markAsSpam(comment: IComment) { - return { - payload: this.http.post('/comments/:commentId/spam', comment, { - commentId: comment.id, - }), - type: ICommentActionTypes.SPAM_MARK, - } - } - - unmarkAsSpam(comment: IComment) { - return { - payload: this.http.delete('/comments/:commentId/spam', null, { - commentId: comment.id, - }), - type: ICommentActionTypes.SPAM_UNMARK, - } - } - -} diff --git a/packages/client/src/comments/Comments.tsx b/packages/client/src/comments/Comments.tsx deleted file mode 100644 index c73e82e..0000000 --- a/packages/client/src/comments/Comments.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react' -import {IComment} from '@rondo/comments-common' - -export interface ICommentProps { - comment: IComment -} - -export class CommentVote extends React.PureComponent { - render() { - return 'vote' - } -} - -export class CommentButtons extends React.PureComponent { - render() { - return 'buttons' - } -} - -export class Comment extends React.PureComponent { - render() { - const {comment} = this.props - return ( -
- {comment.votes} -

{comment.message}

- - // TODO add comment children here -
- ) - } -} - -export interface ICommentsProps { - comments: IComment[] -} - -export class Comments extends React.PureComponent { - render() { - const {comments} = this.props - return ( -
- {comments.map(comment => )} -
- ) - } -} diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 95876e1..84aa6b5 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -1,6 +1,7 @@ export * from './actions' export * from './components' export * from './http' +export * from './login' export * from './middleware' export * from './redux' export * from './renderer' diff --git a/packages/client/tsconfig.json b/packages/client/tsconfig.json index caad41d..4003121 100644 --- a/packages/client/tsconfig.json +++ b/packages/client/tsconfig.json @@ -3,5 +3,8 @@ "compilerOptions": { "outDir": "lib", "rootDir": "src" - } + }, + "references": [ + {"path": "../common"} + ] } diff --git a/packages/tsconfig.json b/packages/tsconfig.json index 1f639ae..dd0bbd3 100644 --- a/packages/tsconfig.json +++ b/packages/tsconfig.json @@ -3,6 +3,9 @@ "references": [ {"path": "client"}, {"path": "common"}, - {"path": "server"} + {"path": "server"}, + {"path": "comments-client"}, + {"path": "comments-common"}, + {"path": "comments-server"} ] }