Moving comment and commentsList components into the cardDetail folder

This commit is contained in:
Jesús Espino 2021-03-29 13:01:52 +02:00
parent b4962c3b02
commit 8c285e5948
5 changed files with 20 additions and 18 deletions

View file

@ -12,8 +12,8 @@ import Editable from '../../widgets/editable'
import EmojiIcon from '../../widgets/icons/emoji' import EmojiIcon from '../../widgets/icons/emoji'
import BlockIconSelector from '../blockIconSelector' import BlockIconSelector from '../blockIconSelector'
import CommentsList from '../commentsList'
import CommentsList from './commentsList'
import CardDetailContents from './cardDetailContents' import CardDetailContents from './cardDetailContents'
import CardDetailContentsMenu from './cardDetailContentsMenu' import CardDetailContentsMenu from './cardDetailContentsMenu'
import CardDetailProperties from './cardDetailProperties' import CardDetailProperties from './cardDetailProperties'

View file

@ -3,15 +3,16 @@
import React, {FC, useEffect, useState} from 'react' import React, {FC, useEffect, useState} from 'react'
import {injectIntl, IntlShape} from 'react-intl' import {injectIntl, IntlShape} from 'react-intl'
import {IBlock} from '../blocks/block' import {IBlock} from '../../blocks/block'
import mutator from '../mutator' import mutator from '../../mutator'
import {Utils} from '../utils' import {Utils} from '../../utils'
import IconButton from '../widgets/buttons/iconButton' import IconButton from '../../widgets/buttons/iconButton'
import DeleteIcon from '../widgets/icons/delete' import DeleteIcon from '../../widgets/icons/delete'
import OptionsIcon from '../widgets/icons/options' import OptionsIcon from '../../widgets/icons/options'
import Menu from '../widgets/menu' import Menu from '../../widgets/menu'
import MenuWrapper from '../widgets/menuWrapper' import MenuWrapper from '../../widgets/menuWrapper'
import {UserCache} from '../userCache' import {UserCache} from '../../userCache'
import './comment.scss' import './comment.scss'
type Props = { type Props = {

View file

@ -1,16 +1,17 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information. // See LICENSE.txt for license information.
import React, {useState, useMemo} from 'react' import React, {useState} from 'react'
import {FormattedMessage, injectIntl, IntlShape} from 'react-intl' import {FormattedMessage, injectIntl, IntlShape} from 'react-intl'
import {CommentBlock, MutableCommentBlock} from '../blocks/commentBlock' import {CommentBlock, MutableCommentBlock} from '../../blocks/commentBlock'
import mutator from '../mutator' import mutator from '../../mutator'
import {Utils} from '../utils' import {Utils} from '../../utils'
import Button from '../widgets/buttons/button' import Button from '../../widgets/buttons/button'
import {MarkdownEditor} from '../markdownEditor'
import Comment from './comment' import Comment from './comment'
import './commentsList.scss' import './commentsList.scss'
import {MarkdownEditor} from './markdownEditor'
type Props = { type Props = {
comments: readonly CommentBlock[] comments: readonly CommentBlock[]
@ -22,7 +23,7 @@ type Props = {
const CommentsList = React.memo((props: Props) => { const CommentsList = React.memo((props: Props) => {
const [newComment, setNewComment] = useState('') const [newComment, setNewComment] = useState('')
const onSendClicked = useMemo(() => () => { const onSendClicked = () => {
const commentText = newComment const commentText = newComment
if (commentText) { if (commentText) {
const {rootId, cardId} = props const {rootId, cardId} = props
@ -36,7 +37,7 @@ const CommentsList = React.memo((props: Props) => {
mutator.insertBlock(comment, 'add comment') mutator.insertBlock(comment, 'add comment')
setNewComment('') setNewComment('')
} }
}, []) }
const {comments, intl} = props const {comments, intl} = props