import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { action, computed, observable, runInAction } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; import { convertToObject } from 'typescript'; import { Doc, DocListCast } from '../../fields/Doc'; import { BoolCast, StrCast, Cast } from '../../fields/Types'; import { addStyleSheet, addStyleSheetRule, Utils } from '../../Utils'; import { LightboxView } from '../views/LightboxView'; import { MainViewModal } from '../views/MainViewModal'; import './CaptureManager.scss'; import { SelectionManager } from './SelectionManager'; import { undoBatch } from './UndoManager'; const higflyout = require('@hig/flyout'); export const { anchorPoints } = higflyout; export const Flyout = higflyout.default; @observer export class CaptureManager extends React.Component<{}> { public static Instance: CaptureManager; static _settingsStyle = addStyleSheet(); @observable _document: any; @observable isOpen: boolean = false; // whether the CaptureManager is to be displayed or not. constructor(props: {}) { super(props); CaptureManager.Instance = this; } public close = action(() => (this.isOpen = false)); public open = action((doc: Doc) => { this.isOpen = true; this._document = doc; }); @computed get visibilityContent() { return (
Visibility
Private
Public
); } @computed get linksContent() { const doc = this._document; const order: JSX.Element[] = []; if (doc) { console.log('title', doc.title); console.log('links', doc.links); const linkDocs = DocListCast(doc.links); const firstDocs = linkDocs.filter(linkDoc => Doc.AreProtosEqual(linkDoc.anchor1 as Doc, doc) || Doc.AreProtosEqual((linkDoc.anchor1 as Doc).annotationOn as Doc, doc)); // link docs where 'doc' is anchor1 const secondDocs = linkDocs.filter(linkDoc => Doc.AreProtosEqual(linkDoc.anchor2 as Doc, doc) || Doc.AreProtosEqual((linkDoc.anchor2 as Doc).annotationOn as Doc, doc)); // link docs where 'doc' is anchor2 linkDocs.forEach((l, i) => { if (l) { console.log(i, (l.anchor1 as Doc).title); console.log(i, (l.anchor2 as Doc).title); order.push(
{i}
{StrCast((l.anchor1 as Doc).title)}
); } }); } return (
Links
{order}
); } @computed get closeButtons() { return (
{ LightboxView.SetLightboxDoc(this._document); this.close(); }}> Save
{ const selected = SelectionManager.Views().slice(); SelectionManager.DeselectAll(); selected.map(dv => dv.props.removeDocument?.(dv.props.Document)); this.close(); }}> Cancel
); } private get captureInterface() { return (
Conversation Capture
{this.visibilityContent} {this.linksContent}
{this.closeButtons}
); } render() { return ( ); } }