diff --git a/src/client/components/boardComponent.tsx b/src/client/components/boardComponent.tsx index c5616bf8b..510c37d54 100644 --- a/src/client/components/boardComponent.tsx +++ b/src/client/components/boardComponent.tsx @@ -5,16 +5,14 @@ import { BlockIcons } from "../blockIcons" import { IPropertyOption } from "../board" import { BoardTree } from "../boardTree" import { CardFilter } from "../cardFilter" -import { Constants } from "../constants" import ViewMenu from "../components/viewMenu" +import { Constants } from "../constants" import { Menu as OldMenu } from "../menu" import { Mutator } from "../mutator" import { IBlock } from "../octoTypes" import { OctoUtils } from "../octoUtils" import { Utils } from "../utils" import { BoardCard } from "./boardCard" -import { Board } from "../board" -import { BoardView } from "../boardView" import { BoardColumn } from "./boardColumn" import Button from "./button" import { Editable } from "./editable" @@ -106,7 +104,7 @@ class BoardComponent extends React.Component { onClose={() => this.setState({ viewMenu: false })} mutator={mutator} boardTree={boardTree} - pageController={pageController} + showView={showView} />}
diff --git a/src/client/components/rootPortal.tsx b/src/client/components/rootPortal.tsx index aa5ddce90..f646523aa 100644 --- a/src/client/components/rootPortal.tsx +++ b/src/client/components/rootPortal.tsx @@ -1,44 +1,44 @@ // Copyright (c) 2020-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React from 'react'; -import ReactDOM from 'react-dom'; -import PropTypes from 'prop-types'; +import React from 'react' +import ReactDOM from 'react-dom' +import PropTypes from 'prop-types' type Props = { - children: React.ReactNode + children: React.ReactNode } export default class RootPortal extends React.PureComponent { - el: HTMLDivElement + el: HTMLDivElement - static propTypes = { - children: PropTypes.node, - } + static propTypes = { + children: PropTypes.node, + } - constructor(props: Props) { - super(props); - this.el = document.createElement('div'); - } + constructor(props: Props) { + super(props) + this.el = document.createElement('div') + } - componentDidMount() { - const rootPortal = document.getElementById('root-portal'); - if (rootPortal) { - rootPortal.appendChild(this.el); - } - } + componentDidMount() { + const rootPortal = document.getElementById('root-portal') + if (rootPortal) { + rootPortal.appendChild(this.el) + } + } - componentWillUnmount() { - const rootPortal = document.getElementById('root-portal'); - if (rootPortal) { - rootPortal.removeChild(this.el); - } - } + componentWillUnmount() { + const rootPortal = document.getElementById('root-portal') + if (rootPortal) { + rootPortal.removeChild(this.el) + } + } - render() { - return ReactDOM.createPortal( - this.props.children, - this.el, - ); - } + render() { + return ReactDOM.createPortal( + this.props.children, + this.el, + ) + } } diff --git a/src/client/components/tableComponent.tsx b/src/client/components/tableComponent.tsx index a2a447fb6..a55508ae5 100644 --- a/src/client/components/tableComponent.tsx +++ b/src/client/components/tableComponent.tsx @@ -27,7 +27,7 @@ type Props = { type State = { isHoverOnCover: boolean isSearching: boolean - viewMenu: boolean + viewMenu: boolean } class TableComponent extends React.Component { @@ -38,7 +38,7 @@ class TableComponent extends React.Component { constructor(props: Props) { super(props) - this.state = { isHoverOnCover: false, isSearching: !!this.props.boardTree?.getSearchText(), viewMenu: false} + this.state = { isHoverOnCover: false, isSearching: !!this.props.boardTree?.getSearchText(), viewMenu: false } } componentDidUpdate(prevPros: Props, prevState: State) { @@ -90,21 +90,21 @@ class TableComponent extends React.Component {
{ mutator.changeTitle(activeView, text) }} /> -
this.setState({viewMenu: true})} - > - {this.state.viewMenu && - this.setState({viewMenu:false})} - mutator={mutator} - boardTree={boardTree} - pageController={pageController} - />} -
-
+
this.setState({ viewMenu: true })} + > + {this.state.viewMenu && + this.setState({ viewMenu: false })} + mutator={mutator} + boardTree={boardTree} + showView={showView} + />} +
+
{ this.propertiesClicked(e) }}>Properties
{ this.filterClicked(e) }}>Filter
diff --git a/src/client/components/viewMenu.tsx b/src/client/components/viewMenu.tsx index 50fe51347..e5b48c34f 100644 --- a/src/client/components/viewMenu.tsx +++ b/src/client/components/viewMenu.tsx @@ -1,85 +1,84 @@ import React from "react" - -import { Mutator } from "../mutator" -import Menu from "../widgets/menu" import { Board } from "../board" import { BoardTree } from "../boardTree" -import { IPageController } from "../octoTypes" -import { Utils } from "../utils" import { BoardView } from "../boardView" +import { Mutator } from "../mutator" +import { Utils } from "../utils" +import Menu from "../widgets/menu" type Props = { mutator: Mutator, boardTree?: BoardTree - pageController: IPageController, - board: Board, - onClose: () => void, + board: Board, + showView: (id: string) => void + onClose: () => void, } + export default class ViewMenu extends React.Component { - handleDeleteView = async (id: string) => { - const {board, boardTree, mutator, pageController} = this.props; - Utils.log(`deleteView`) - const view = boardTree.activeView - const nextView = boardTree.views.find(o => o !== view) - await mutator.deleteBlock(view, "delete view") - pageController.showView(nextView.id) - } + handleDeleteView = async (id: string) => { + const { board, boardTree, mutator, showView } = this.props + Utils.log(`deleteView`) + const view = boardTree.activeView + const nextView = boardTree.views.find(o => o !== view) + await mutator.deleteBlock(view, "delete view") + showView(nextView.id) + } - handleViewClick = (id: string) => { - const {boardTree, pageController} = this.props; - Utils.log(`view ` + id) - const view = boardTree.views.find(o => o.id === id) - pageController.showView(view.id) - } + handleViewClick = (id: string) => { + const { boardTree, showView } = this.props + Utils.log(`view ` + id) + const view = boardTree.views.find(o => o.id === id) + showView(view.id) + } - handleAddViewBoard = async (id: string) => { - const {board, boardTree, mutator, pageController} = this.props; - Utils.log(`addview-board`) - const view = new BoardView() - view.title = "Board View" - view.viewType = "board" - view.parentId = board.id + handleAddViewBoard = async (id: string) => { + const { board, boardTree, mutator, showView } = this.props + Utils.log(`addview-board`) + const view = new BoardView() + view.title = "Board View" + view.viewType = "board" + view.parentId = board.id - const oldViewId = boardTree.activeView.id + const oldViewId = boardTree.activeView.id - await mutator.insertBlock( - view, - "add view", - async () => { pageController.showView(view.id) }, - async () => { pageController.showView(oldViewId) }) - } + await mutator.insertBlock( + view, + "add view", + async () => { showView(view.id) }, + async () => { showView(oldViewId) }) + } - handleAddViewTable = async (id: string) => { - const {board, boardTree, mutator, pageController} = this.props; + handleAddViewTable = async (id: string) => { + const { board, boardTree, mutator, showView } = this.props - Utils.log(`addview-table`) - const view = new BoardView() - view.title = "Table View" - view.viewType = "table" - view.parentId = board.id - view.visiblePropertyIds = board.cardProperties.map(o => o.id) + Utils.log(`addview-table`) + const view = new BoardView() + view.title = "Table View" + view.viewType = "table" + view.parentId = board.id + view.visiblePropertyIds = board.cardProperties.map(o => o.id) - const oldViewId = boardTree.activeView.id + const oldViewId = boardTree.activeView.id - await mutator.insertBlock( - view, - "add view", - async () => { pageController.showView(view.id) }, - async () => { pageController.showView(oldViewId) }) - } + await mutator.insertBlock( + view, + "add view", + async () => { showView(view.id) }, + async () => { showView(oldViewId) }) + } - render() { - const {board, onClose, boardTree, mutator, pageController} = this.props; - return ( - - {boardTree.views.map((view) => ())} - - {boardTree.views.length > 1 && } - - - - - - ); - } + render() { + const { onClose, boardTree } = this.props + return ( + + {boardTree.views.map((view) => ())} + + {boardTree.views.length > 1 && } + + + + + + ) + } }