From 11fe73b1f0ec63f7bf7d2341d787e3e20a66ab2b Mon Sep 17 00:00:00 2001 From: madelinegr Date: Tue, 26 Feb 2019 16:53:25 -0500 Subject: only bullets toggle clicks nowgit add . --- .../views/collections/CollectionTreeView.tsx | 50 ++++++++-------------- 1 file changed, 17 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx index 4075ff423..b6036b251 100644 --- a/src/client/views/collections/CollectionTreeView.tsx +++ b/src/client/views/collections/CollectionTreeView.tsx @@ -31,13 +31,16 @@ class TreeView extends React.Component { @observable collapsed: boolean = false; + // TODO this will eventually come with functions for what to attach to them renderBullet(type: BulletType) { + let onClicked = action(() => this.collapsed = !this.collapsed); + switch (type) { case BulletType.Collapsed: - return
+ return
case BulletType.Collapsible: - return
+ return
case BulletType.List: return
} @@ -53,13 +56,19 @@ class TreeView extends React.Component { let title = childDocument.GetT(KeyStore.Title, TextField); let onItemDown = setupDrag(reference, childDocument); - if (title && title != FieldWaiting) { + // if the title hasn't loaded, immediately return the div + if (!title || title === "") { + return
; + } + + // otherwise, check if it's a collection. + else if (children && children !== "") { // if it's not collapsed, then render the full TreeView. var subView = null; if (!this.collapsed) { subView = -
  • this.collapsed = true)} > +
  • {this.renderBullet(BulletType.Collapsible)} {title.Data}
      @@ -67,7 +76,7 @@ class TreeView extends React.Component {
  • } else { - subView =
  • this.collapsed = false)}> + subView =
  • {this.renderBullet(BulletType.Collapsed)} {title.Data}
  • @@ -76,48 +85,23 @@ class TreeView extends React.Component { return
    {subView}
    - - - // let subView = !children || this.collapsed || children === FieldWaiting ? (null) : - //
      - // - //
    ; - // return
    - //
  • this.collapsed = !this.collapsed)} > - // {title.Data} - // {subView} - //
  • - //
    - } - - // if the title hasn't loaded, immediately return the div - if (!title || title === "") { - return
    ; - } - - // otherwise, check if it's a collection. - else if (children && children !== "") { - } // finally, if it's a normal document, then render it as such. else { - return
  • + return
  • {this.renderBullet(BulletType.List)} { - let title = document.GetT(KeyStore.Title, TextField); + let title = childDocument.GetT(KeyStore.Title, TextField); if (title && title !== "") return title.Data; return ""; }} SetValue={(value: string) => { - document.SetData(KeyStore.Title, value, TextField); + childDocument.SetData(KeyStore.Title, value, TextField); return true; }}>
  • ; - - return (null); } } -- cgit v1.2.3-70-g09d2