Sidebar: showBoard
This commit is contained in:
parent
7791b885a6
commit
7668dea023
4 changed files with 17 additions and 3 deletions
|
@ -227,6 +227,16 @@ class BoardPage implements IPageController {
|
||||||
this.render()
|
this.render()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showBoard(boardId: string) {
|
||||||
|
if (this.boardTree.board.id === boardId) { return }
|
||||||
|
|
||||||
|
const newUrl = window.location.protocol + "//" + window.location.host + window.location.pathname + `?id=${encodeURIComponent(boardId)}`
|
||||||
|
window.history.pushState({ path: newUrl }, "", newUrl)
|
||||||
|
|
||||||
|
this.boardTree = new BoardTree(this.octo, boardId)
|
||||||
|
this.sync()
|
||||||
|
}
|
||||||
|
|
||||||
showView(viewId: string) {
|
showView(viewId: string) {
|
||||||
this.viewId = viewId
|
this.viewId = viewId
|
||||||
this.boardTree.setActiveView(this.viewId)
|
this.boardTree.setActiveView(this.viewId)
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import { Board } from "../board"
|
import { Board } from "../board"
|
||||||
import { Mutator } from "../mutator"
|
import { Mutator } from "../mutator"
|
||||||
|
import { IPageController } from "../octoTypes"
|
||||||
import { WorkspaceTree } from "../workspaceTree"
|
import { WorkspaceTree } from "../workspaceTree"
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
mutator: Mutator
|
mutator: Mutator
|
||||||
|
pageController: IPageController
|
||||||
workspaceTree: WorkspaceTree
|
workspaceTree: WorkspaceTree
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +37,8 @@ class Sidebar extends React.Component<Props> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boardClicked(board: Board) {
|
private boardClicked(board: Board) {
|
||||||
// TODO
|
const { pageController } = this.props
|
||||||
|
pageController.showBoard(board.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
async addBoardClicked() {
|
async addBoardClicked() {
|
||||||
|
|
|
@ -17,11 +17,11 @@ type Props = {
|
||||||
|
|
||||||
class WorkspaceComponent extends React.Component<Props> {
|
class WorkspaceComponent extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { mutator, workspaceTree } = this.props
|
const { mutator, workspaceTree, pageController } = this.props
|
||||||
|
|
||||||
const element =
|
const element =
|
||||||
<div className="octo-workspace">
|
<div className="octo-workspace">
|
||||||
<Sidebar mutator={mutator} workspaceTree={workspaceTree}></Sidebar>
|
<Sidebar mutator={mutator} pageController={pageController} workspaceTree={workspaceTree}></Sidebar>
|
||||||
{this.mainComponent()}
|
{this.mainComponent()}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ interface IBlock {
|
||||||
// These are methods exposed by the top-level page to components
|
// These are methods exposed by the top-level page to components
|
||||||
interface IPageController {
|
interface IPageController {
|
||||||
showCard(card: IBlock): Promise<void>
|
showCard(card: IBlock): Promise<void>
|
||||||
|
showBoard(boardId: string): void
|
||||||
showView(viewId: string): void
|
showView(viewId: string): void
|
||||||
showFilter(anchorElement?: HTMLElement): void
|
showFilter(anchorElement?: HTMLElement): void
|
||||||
setSearchText(text?: string): void
|
setSearchText(text?: string): void
|
||||||
|
|
Loading…
Reference in a new issue