import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { action, computed, observable } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; import { Doc } from '../../fields/Doc'; import { DocCast, StrCast } from '../../fields/Types'; import { addStyleSheet } from '../../Utils'; import { LightboxView } from '../views/LightboxView'; import { MainViewModal } from '../views/MainViewModal'; import './CaptureManager.scss'; import { LinkManager } from './LinkManager'; import { SelectionManager } from './SelectionManager'; @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) { LinkManager.Links(doc).forEach((l, i) => order.push(
{i}
{StrCast(DocCast(l.link_anchor_1)?.title)}
) ); } return (
Links
{order}
); } @computed get closeButtons() { return (
{ LightboxView.Instance.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 ( ); } }