import * as React from 'react'; import { observable, action, configure, reaction, computed, ObservableMap, runInAction } from 'mobx'; import { observer } from "mobx-react"; import './WorkspacesMenu.css'; import { EditableView } from '../../../client/views/EditableView'; import { Doc, Id } from '../../../new_fields/Doc'; import { StrCast } from '../../../new_fields/Types'; export interface WorkspaceMenuProps { active: Doc | undefined; open: (workspace: Doc) => void; new: () => void; allWorkspaces: Doc[]; isShown: () => boolean; toggle: () => void; } @observer export class WorkspacesMenu extends React.Component { constructor(props: WorkspaceMenuProps) { super(props); this.addNewWorkspace = this.addNewWorkspace.bind(this); } @action addNewWorkspace() { this.props.new(); this.props.toggle(); } render() { return (
{this.props.allWorkspaces.map((s, i) =>
{ e.preventDefault(); this.props.open(s); }} style={{ marginTop: 10, color: s === this.props.active ? "red" : "black" }} > {i + 1} - StrCast(s.title)} SetValue={(title: string): boolean => { s.title = title; return true; }} contents={s.Title} height={20} />
)}
); } }