Create board view with new boards

This commit is contained in:
Chen-I Lim 2020-11-12 13:24:17 -08:00
parent d405f46114
commit a463f6e1be
3 changed files with 30 additions and 14 deletions

View file

@ -6,7 +6,6 @@
"BoardComponent.delete": "Delete",
"BoardComponent.hidden-columns": "Hidden Columns",
"BoardComponent.hide": "Hide",
"BoardComponent.loading": "Loading...",
"BoardComponent.neww": "+ New",
"BoardComponent.no-property": "No {property}",
"BoardComponent.no-property-title": "Items with an empty {property} property will go here. This column cannot be removed.",
@ -16,10 +15,8 @@
"CardDetail.add-property": "+ Add a property",
"CardDetail.image": "Image",
"CardDetail.new-comment-placeholder": "Add a comment...",
"CardDetail.pick-icon": "Pick Icon",
"CardDetail.random-icon": "Random",
"CardDetail.remove-icon": "Remove Icon",
"CardDetail.text": "Text",
"CardDialog.editing-template": "You're editing a template",
"Comment.delete": "Delete",
"CommentsList.send": "Send",
"Filter.includes": "includes",
@ -31,6 +28,7 @@
"Sidebar.add-board": "+ Add Board",
"Sidebar.dark-theme": "Dark Theme",
"Sidebar.delete-board": "Delete Board",
"Sidebar.duplicate-board": "Duplicate Board",
"Sidebar.english": "English",
"Sidebar.export-archive": "Export Archive",
"Sidebar.import-archive": "Import Archive",
@ -44,7 +42,6 @@
"Sidebar.untitled-board": "(Untitled Board)",
"Sidebar.untitled-view": "(Untitled View)",
"TableComponent.add-icon": "Add Icon",
"TableComponent.loading": "Loading...",
"TableComponent.name": "Name",
"TableComponent.plus-new": "+ New",
"TableHeaderMenu.delete": "Delete",
@ -55,6 +52,12 @@
"TableHeaderMenu.sort-ascending": "Sort ascending",
"TableHeaderMenu.sort-descending": "Sort descending",
"TableRow.open": "Open",
"View.NewBoardTitle": "Board View",
"View.NewTableTitle": "Table View",
"ViewHeader.add-template": "+ New template",
"ViewHeader.delete-template": "Delete",
"ViewHeader.edit-template": "Edit",
"ViewHeader.empty-card": "Empty card",
"ViewHeader.export-board-archive": "Export Board Archive",
"ViewHeader.export-csv": "Export to CSV",
"ViewHeader.filter": "Filter",
@ -63,10 +66,13 @@
"ViewHeader.properties": "Properties",
"ViewHeader.search": "Search",
"ViewHeader.search-text": "Search text",
"ViewHeader.select-a-template": "Select a template",
"ViewHeader.sort": "Sort",
"ViewHeader.test-add-100-cards": "TEST: Add 100 cards",
"ViewHeader.test-add-1000-cards": "TEST: Add 1,000 cards",
"ViewHeader.test-distribute-cards": "TEST: Distribute cards",
"ViewHeader.test-randomize-icons": "TEST: Randomize icons",
"ViewHeader.untitled": "Untitled",
"ViewTitle.pick-icon": "Pick Icon",
"ViewTitle.random-icon": "Random",
"ViewTitle.remove-icon": "Remove Icon",

View file

@ -19,7 +19,7 @@ import DotIcon from '../widgets/icons/dot'
import IconButton from '../widgets/buttons/iconButton'
import Button from '../widgets/buttons/button'
import {WorkspaceTree} from '../viewModel/workspaceTree'
import {BoardView} from '../blocks/boardView'
import {BoardView, MutableBoardView} from '../blocks/boardView'
import './sidebar.scss'
@ -272,12 +272,17 @@ class Sidebar extends React.Component<Props, State> {
}
private addBoardClicked = async () => {
const {showBoard} = this.props
const {showBoard, intl} = this.props
const oldBoardId = this.props.activeBoardId
const board = new MutableBoard()
await mutator.insertBlock(
board,
const view = new MutableBoardView()
view.viewType = 'board'
view.parentId = board.id
view.title = intl.formatMessage({id: 'View.NewBoardTitle', defaultMessage: 'Board View'})
await mutator.insertBlocks(
[board, view],
'add board',
async () => {
showBoard(board.id)

View file

@ -2,6 +2,8 @@
// See LICENSE.txt for license information.
import React from 'react'
import {injectIntl, IntlShape} from 'react-intl'
import {Board} from '../blocks/board'
import {MutableBoardView} from '../blocks/boardView'
import {BoardTree} from '../viewModel/boardTree'
@ -14,9 +16,10 @@ type Props = {
boardTree: BoardTree
board: Board,
showView: (id: string) => void
intl: IntlShape
}
export default class ViewMenu extends React.Component<Props> {
export class ViewMenu extends React.Component<Props> {
handleDeleteView = async () => {
const {boardTree, showView} = this.props
Utils.log('deleteView')
@ -34,10 +37,10 @@ export default class ViewMenu extends React.Component<Props> {
}
handleAddViewBoard = async () => {
const {board, boardTree, showView} = this.props
const {board, boardTree, showView, intl} = this.props
Utils.log('addview-board')
const view = new MutableBoardView()
view.title = 'Board View'
view.title = intl.formatMessage({id: 'View.NewBoardTitle', defaultMessage: 'Board View'})
view.viewType = 'board'
view.parentId = board.id
@ -55,11 +58,11 @@ export default class ViewMenu extends React.Component<Props> {
}
handleAddViewTable = async () => {
const {board, boardTree, showView} = this.props
const {board, boardTree, showView, intl} = this.props
Utils.log('addview-table')
const view = new MutableBoardView()
view.title = 'Table View'
view.title = intl.formatMessage({id: 'View.NewTableTitle', defaultMessage: 'Table View'})
view.viewType = 'table'
view.parentId = board.id
view.visiblePropertyIds = board.cardProperties.map((o) => o.id)
@ -115,3 +118,5 @@ export default class ViewMenu extends React.Component<Props> {
)
}
}
export default injectIntl(ViewMenu)