aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/TempTreeView.tsx
blob: 5bb44fde2afb4c97e5a8f4080811ab46924fee9c (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
48
49
50
51
52
import { observable, computed } from "mobx";
import React = require("react");
import { observer } from "mobx-react";
import { Document } from "../../fields/Document";
import { ListField } from "../../fields/ListField";
import "./TempTreeView.scss"
import { DocumentManager } from "./DocumentManager";

export interface IProps {
    mainCollection: Array<Document>;
}

@observer
export class TempTreeView extends React.Component<IProps>{

    onClick(doc: Document) {
        let view = DocumentManager.Instance.getDocumentView(doc);
        if (view != null) {
            console.log(view.Id)
            console.log(view.props.GetTransform().TranslateX)

            console.log(view.props.Document.Title)
            if (view.props.ContainingCollectionView != undefined) {
                //console.log(view.props.ContainingCollectionView.Id)
                // view.props.ContainingCollectionView
            }
            else {
                console.log("containing collection is undefined")
            }

            view.switchColor();
        }
    }

    render() {
        return (
            <div className="tempTree">
                <div className="list">
                    {this.props.mainCollection.map(doc => {
                        return (
                            <div key={doc.Id} onClick={() => { this.onClick(doc) }}>
                                {doc.Title}
                            </div>
                        )
                    }
                    )}
                </div>
            </div>
        );
    }

}