diff --git a/webapp/src/components/boardComponent.tsx b/webapp/src/components/boardComponent.tsx index d30143ec4..fcc448223 100644 --- a/webapp/src/components/boardComponent.tsx +++ b/webapp/src/components/boardComponent.tsx @@ -21,6 +21,7 @@ import {CardDialog} from './cardDialog' import {Editable} from './editable' import RootPortal from './rootPortal' import ViewHeader from './viewHeader' +import ViewTitle from './viewTitle' type Props = { boardTree?: BoardTree @@ -32,7 +33,6 @@ type State = { isSearching: boolean shownCard?: Card viewMenu: boolean - isHoverOnCover: boolean selectedCards: Card[] showFilter: boolean } @@ -67,7 +67,6 @@ class BoardComponent extends React.Component { constructor(props: Props) { super(props) this.state = { - isHoverOnCover: false, isSearching: Boolean(this.props.boardTree?.getSearchText()), viewMenu: false, selectedCards: [], @@ -120,51 +119,7 @@ class BoardComponent extends React.Component { }
-
{ - this.setState({...this.state, isHoverOnCover: true}) - }} - onMouseLeave={() => { - this.setState({...this.state, isHoverOnCover: false}) - }} - > - -
- -
- {board.icon ? - -
{board.icon}
- - mutator.changeIcon(board, BlockIcons.shared.randomIcon())} - /> - mutator.changeIcon(board, undefined, 'remove icon')} - /> - -
: - undefined} - { - mutator.changeTitle(board, text) - }} - /> -
+
{ constructor(props: Props) { super(props) - this.state = {isHoverOnCover: false, isSearching: Boolean(this.props.boardTree?.getSearchText()), viewMenu: false, showFilter: false} + this.state = {isSearching: Boolean(this.props.boardTree?.getSearchText()), viewMenu: false, showFilter: false} } shouldComponentUpdate(): boolean { @@ -84,76 +81,7 @@ class TableComponent extends React.Component { /> }
-
{ - this.setState({...this.state, isHoverOnCover: true}) - }} - onMouseLeave={() => { - this.setState({...this.state, isHoverOnCover: false}) - }} - > - -
- -
- {board.icon && - -
{board.icon}
- - - {(text: string) => ( - mutator.changeIcon(board, BlockIcons.shared.randomIcon())} - /> - )} - - - {(text: string) => ( - mutator.changeIcon(board, undefined, 'remove icon')} - /> - )} - - -
} - - {(placeholder: string) => ( - { - mutator.changeTitle(board, text) - }} - /> - )} - -
+
{ + shouldComponentUpdate(): boolean { + return true + } + + constructor(props: Props) { + super(props) + this.state = {isHoverOnCover: false} + } + + render(): JSX.Element { + const {board} = this.props + + return ( + <> +
{ + this.setState({isHoverOnCover: true}) + }} + onMouseLeave={() => { + this.setState({isHoverOnCover: false}) + }} + > + +
+ +
+ {board.icon && + +
{board.icon}
+ + + {(text: string) => ( + mutator.changeIcon(board, BlockIcons.shared.randomIcon())} + /> + )} + + + {(text: string) => ( + mutator.changeIcon(board, undefined, 'remove icon')} + /> + )} + + +
} + + {(placeholder: string) => ( + { + mutator.changeTitle(board, text) + }} + /> + )} + +
+ + ) + } +} + +export default injectIntl(ViewTitle)