import React from "react" import { Archiver } from "../archiver" import { Block } from "../block" import { BlockIcons } from "../blockIcons" import { IPropertyOption } from "../board" import { BoardTree } from "../boardTree" import { CardFilter } from "../cardFilter" import { Constants } from "../constants" import Menu from "../widgets/menu" import { Menu as OldMenu } from "../menu" import { Mutator } from "../mutator" import { IBlock, IPageController } 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" type ViewMenuProps = { mutator: Mutator, boardTree?: BoardTree pageController: IPageController, board: Board, onClose: () => void, } function ViewMenu({board, onClose, boardTree, mutator, pageController}: ViewMenuProps) { const handleDeleteView = async (id: string) => { 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) } const handleViewClick = (id: string) => { Utils.log(`view ` + id) const view = boardTree.views.find(o => o.id === id) pageController.showView(view.id) } const handleAddViewBoard = async (id: string) => { Utils.log(`addview-board`) const view = new BoardView() view.title = "Board View" view.viewType = "board" view.parentId = board.id const oldViewId = boardTree.activeView.id await mutator.insertBlock( view, "add view", async () => { pageController.showView(view.id) }, async () => { pageController.showView(oldViewId) }) } const handleAddViewTable = async (id: string) => { 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 await mutator.insertBlock( view, "add view", async () => { pageController.showView(view.id) }, async () => { pageController.showView(oldViewId) }) } return (
); } type Props = { mutator: Mutator, boardTree?: BoardTree pageController: IPageController } type State = { isHoverOnCover: boolean isSearching: boolean viewMenu: boolean } class BoardComponent extends React.Component