From a9c9aa25f78fd3a48523eb7c257c6f6aafecffa6 Mon Sep 17 00:00:00 2001 From: Florian Barbin Date: Wed, 24 Jan 2024 16:37:55 +0100 Subject: [PATCH] [3004] Fix warning because of props transfer to children Bug: https://github.com/eclipse-sirius/sirius-web/issues/3004 Signed-off-by: Florian Barbin --- package.json | 2 +- src/components/Lane/LaneHeader.js | 40 +++++++++++++++++++++---------- src/components/NewLaneSection.js | 2 +- src/controllers/BoardContainer.js | 29 +++++++++++++++------- src/controllers/Lane.js | 36 +++++++++++++++++++++------- src/styles/Base.js | 4 ++-- 6 files changed, 79 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index 3f26d5e10..9fb13352e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ObeoNetwork/react-trello", - "version": "2.4.1", + "version": "2.4.2", "description": "Pluggable components to add a trello like kanban board to your application", "main": "dist/index.js", "files": [ diff --git a/src/components/Lane/LaneHeader.js b/src/components/Lane/LaneHeader.js index 907fa1785..3e088a637 100644 --- a/src/components/Lane/LaneHeader.js +++ b/src/components/Lane/LaneHeader.js @@ -1,27 +1,43 @@ -import React from 'react' import PropTypes from 'prop-types' +import React from 'react' +import {LaneHeader, RightContent, Title} from 'rt/styles/Base' import InlineInput from 'rt/widgets/InlineInput' -import {Title, LaneHeader, RightContent } from 'rt/styles/Base' import LaneMenu from './LaneHeader/LaneMenu' const LaneHeaderComponent = ({ - updateTitle, canAddLanes, onDelete, onDoubleClick, editLaneTitle, label, title, titleStyle, labelStyle, t, laneDraggable + updateTitle, + canAddLanes, + onDelete, + onDoubleClick, + editLaneTitle, + label, + title, + titleStyle, + labelStyle, + t, + laneDraggable }) => { - return ( - + - {editLaneTitle ? - <InlineInput value={title} border placeholder={t('placeholder.title')} resize='vertical' onSave={updateTitle} /> : - title - } + {editLaneTitle ? ( + <InlineInput + value={title} + border + placeholder={t('placeholder.title')} + resize="vertical" + onSave={updateTitle} + /> + ) : ( + title + )} {label && ( {label} - )} - {canAddLanes && } + )} + {canAddLanes && } ) } @@ -44,4 +60,4 @@ LaneHeaderComponent.defaultProps = { canAddLanes: false } -export default LaneHeaderComponent; +export default LaneHeaderComponent diff --git a/src/components/NewLaneSection.js b/src/components/NewLaneSection.js index 26afa6155..5551cd876 100644 --- a/src/components/NewLaneSection.js +++ b/src/components/NewLaneSection.js @@ -4,6 +4,6 @@ import {AddLaneLink} from 'rt/styles/Elements' export default ({t, onClick}) => ( - {t('Add another lane')} + {t('Add another lane')} ) diff --git a/src/controllers/BoardContainer.js b/src/controllers/BoardContainer.js index 7603b8940..bf2be8bd7 100644 --- a/src/controllers/BoardContainer.js +++ b/src/controllers/BoardContainer.js @@ -1,13 +1,13 @@ +import isEqual from 'lodash/isEqual' +import pick from 'lodash/pick' +import PropTypes from 'prop-types' import React, {Component} from 'react' -import {bindActionCreators} from 'redux' +import {PopoverWrapper} from 'react-popopo' import {connect} from 'react-redux' +import {bindActionCreators} from 'redux' import Container from 'rt/dnd/Container' import Draggable from 'rt/dnd/Draggable' -import PropTypes from 'prop-types' -import pick from 'lodash/pick' -import isEqual from 'lodash/isEqual' import Lane from './Lane' -import { PopoverWrapper } from 'react-popopo' import * as boardActions from 'rt/actions/BoardActions' import * as laneActions from 'rt/actions/LaneActions' @@ -136,6 +136,15 @@ class BoardContainer extends Component { laneStyle, onCardMoveAcrossLanes, t, + handleLaneDragEnd, + handleDragStart, + handleDragEnd, + hideCardDeleteIcon, + collapsibleLanes, + cardDraggable, + cardDragClass, + editLaneTitle, + handleLaneDragStart, ...otherProps } = this.props @@ -204,8 +213,10 @@ class BoardContainer extends Component { {canAddLanes && ( - {editable && !addLaneMode ? : ( - addLaneMode && + {editable && !addLaneMode ? ( + + ) : ( + addLaneMode && )} )} @@ -250,11 +261,11 @@ BoardContainer.propTypes = { laneDragClass: PropTypes.string, laneDropClass: PropTypes.string, onCardMoveAcrossLanes: PropTypes.func.isRequired, - t: PropTypes.func.isRequired, + t: PropTypes.func.isRequired } BoardContainer.defaultProps = { - t: v=>v, + t: v => v, onDataChange: () => {}, handleDragStart: () => {}, handleDragEnd: () => {}, diff --git a/src/controllers/Lane.js b/src/controllers/Lane.js index 3a8303a81..2f157798a 100644 --- a/src/controllers/Lane.js +++ b/src/controllers/Lane.js @@ -1,11 +1,10 @@ -import React, {Component} from 'react' import classNames from 'classnames' +import cloneDeep from 'lodash/cloneDeep' +import isEqual from 'lodash/isEqual' import PropTypes from 'prop-types' -import {bindActionCreators} from 'redux' +import React, {Component} from 'react' import {connect} from 'react-redux' -import isEqual from 'lodash/isEqual' -import cloneDeep from 'lodash/cloneDeep' -import pick from 'lodash/pick' +import {bindActionCreators} from 'redux' import uuidv1 from 'uuid/v1' import Container from 'rt/dnd/Container' @@ -47,7 +46,7 @@ class Lane extends Component { sortCards(cards, sortFunction) { if (!cards) return [] if (!sortFunction) return cards - return cards.concat().sort(function (card1, card2) { + return cards.concat().sort(function(card1, card2) { return sortFunction(card1, card2) }) } @@ -190,7 +189,7 @@ class Lane extends Component { }) return ( - + onLaneClick && onLaneClick(id)} draggable={false} className={allClassNames}> - {this.renderHeader({id, cards, ...otherProps})} + {this.renderHeader({id, cards, labelStyle, titleStyle, canAddLanes, laneDraggable, t, ...otherProps})} {this.renderDragContainer(isDraggingOver)} {loading && } {showFooter && } @@ -328,4 +343,7 @@ const mapDispatchToProps = dispatch => ({ actions: bindActionCreators(laneActions, dispatch) }) -export default connect(null, mapDispatchToProps)(Lane) +export default connect( + null, + mapDispatchToProps +)(Lane) diff --git a/src/styles/Base.js b/src/styles/Base.js index c8ab5896a..26b9813e8 100644 --- a/src/styles/Base.js +++ b/src/styles/Base.js @@ -112,12 +112,12 @@ export const Section = styled.section` export const LaneHeader = styled(Header)` margin-bottom: 0px; ${props => - props.editLaneTitle && + props.editlanetitle && css` padding: 0px; line-height: 30px; `} ${props => - !props.editLaneTitle && + !props.editlanetitle && css` padding: 0px 5px; `};