aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/selectedDoc/SelectedDocView.tsx
blob: 955a4a17461e32fc7153e073a0b67c1d0215e684 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React = require('react');
import { Doc } from "../../../fields/Doc";
import { observer } from "mobx-react";
import { computed } from "mobx";
import { StrCast } from "../../../fields/Types";
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Colors, ListBox } from 'browndash-components';
import { DocumentManager } from '../../util/DocumentManager';
import { DocFocusOptions } from '../nodes/DocumentView';

export interface SelectedDocViewProps {
    selectedDocs: Doc[];
}

@observer
export class SelectedDocView extends React.Component<SelectedDocViewProps> {

    @computed get selectedDocs() {
        return this.props.selectedDocs;
    }
    

    render() {
        return <div className={`selectedDocView-container`}>
            <ListBox
                items={this.selectedDocs.map((doc) => {
                    const icon = Doc.toIcon(doc);
                    const iconEle = <FontAwesomeIcon size={'1x'} icon={icon} />;
                    const text = StrCast(doc.title)
                    const finished = () => {
                        
                    };
                    const options: DocFocusOptions = {
                        playAudio: false,
                    };
                    return {
                        text: text,
                        val: StrCast(doc._id),
                        icon: iconEle,
                        onClick: () => {DocumentManager.Instance.showDocument(doc, options, finished);}
                    }
                })}
                color={StrCast(Doc.UserDoc().userColor)}
            />
        </div>
    }
}