diff --git a/src/comment-component.ts b/src/comment-component.ts index 64c0ca2..363ad54 100644 --- a/src/comment-component.ts +++ b/src/comment-component.ts @@ -19,7 +19,8 @@ export class CommentComponent { constructor( public comment: IssueComment, - private currentUser: string | null + private currentUser: string | null, + locked: boolean ) { const { user, html_url, created_at, body_html, author_association, reactions } = comment; this.element = document.createElement('article'); @@ -29,6 +30,17 @@ export class CommentComponent { } const association = displayAssociations[author_association]; const reactionCount = reactionTypes.reduce((sum, id) => sum + reactions[id], 0); + let headerReactionsMenu = ''; + let footerReactionsMenu = ''; + if (!locked) { + if (currentUser) { + headerReactionsMenu = getReactionsMenuHtml(comment.reactions.url, 'right'); + footerReactionsMenu = getReactionsMenuHtml(comment.reactions.url, 'center'); + } else { + headerReactionsMenu = getSignInToReactMenuHtml('right'); + footerReactionsMenu = getSignInToReactMenuHtml('center'); + } + } this.element.innerHTML = ` @${user.login}
${association ? `${association}` : ''} - ${currentUser ? getReactionsMenuHtml(comment.reactions.url, 'right') : getSignInToReactMenuHtml('right')} + ${headerReactionsMenu}
@@ -51,9 +63,9 @@ export class CommentComponent {
`; diff --git a/src/timeline-component.ts b/src/timeline-component.ts index 33540da..7b6efb0 100644 --- a/src/timeline-component.ts +++ b/src/timeline-component.ts @@ -53,7 +53,8 @@ export class TimelineComponent { public insertComment(comment: IssueComment, incrementCount: boolean) { const component = new CommentComponent( comment, - this.user ? this.user.login : null); + this.user ? this.user.login : null, + this.issue!.locked); const index = this.timeline.findIndex(x => x.comment.id >= comment.id); if (index === -1) {