From f804e029a159a4cfe91f08a32301451b0aeca1f3 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Mon, 12 Sep 2022 19:00:38 -0400
Subject: open trails from trails menu on left hand side now.

---
 src/client/views/DashboardView.tsx | 74 ++++++++++++++++++++++++--------------
 1 file changed, 48 insertions(+), 26 deletions(-)

(limited to 'src/client/views/DashboardView.tsx')

diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx
index 982640266..beb067a9d 100644
--- a/src/client/views/DashboardView.tsx
+++ b/src/client/views/DashboardView.tsx
@@ -258,7 +258,7 @@ export class DashboardView extends React.Component {
     };
 
     public static createNewDashboard = (id?: string, name?: string) => {
-      //   const presentation = Doc.MakeCopy(Doc.UserDoc().emptyPresentation as Doc, true);
+        //   const presentation = Doc.MakeCopy(Doc.UserDoc().emptyPresentation as Doc, true);
         const dashboards = Doc.MyDashboards;
         const dashboardCount = DocListCast(dashboards.data).length + 1;
         const freeformOptions: DocumentOptions = {
@@ -285,35 +285,57 @@ export class DashboardView extends React.Component {
         Doc.ActiveDashboard = dashboardDoc;
         Doc.ActivePage = 'dashboard';
 
+        // this section is creating the button document itself  ===  myTrails = new Button
+        const reqdBtnOpts: DocumentOptions = {
+            _forceActive: true,
+            _width: 30,
+            _height: 30,
+            _stayInCollection: true,
+            _hideContextMenu: true,
+            title: 'New trail',
+            toolTip: 'Create new trail',
+            btnType: ButtonType.ClickButton,
+            buttonText: 'New trail',
+            icon: 'plus',
+            system: true,
+        };
+        const reqdBtnScript = { onClick: `createNewPresentation()` };
+        const myTrailsBtn = DocUtils.AssignScripts(Docs.Create.FontIconDocument(reqdBtnOpts), reqdBtnScript);
 
-       // this section is creating the button document itself  ===  myTrails = new Button
-       const reqdBtnOpts:DocumentOptions = { _forceActive: true, _width: 30, _height: 30,  _stayInCollection: true, _hideContextMenu: true, 
-           title: "New trail",  toolTip: "Create new trail", btnType: ButtonType.ClickButton, buttonText: "New trail", icon: "plus", system: true };
-       const reqdBtnScript = {onClick: `createNewPresentation()`};
-       const myTrailsBtn = DocUtils.AssignScripts(Docs.Create.FontIconDocument(reqdBtnOpts), reqdBtnScript);
-       
         //  createa a list of presentations (as a tree view collection) and store i on the new dashboard
-      // instead of assigninbg Doc.UserDoc().myrails we want to assign Doc.AxtiveDashboard.myTrails
-      // but we don't wanbt to create the list of trails here-- but rather in createDashbarod
-      // myTrail
-        const reqdOpts:DocumentOptions = {
-            title: "My Trails", _showTitle: "title", _height: 100,
-            treeViewHideTitle: true, _fitWidth: true, _gridGap: 5, _forceActive: true, childDropAction: "alias",
-            treeViewTruncateTitleWidth: 150, ignoreClick: true, buttonMenu: true, buttonMenuDoc: myTrailsBtn,
-            contextMenuIcons: new List<string>(["plus"]),
-            contextMenuLabels: new List<string>(["Create New Trail"]),
-            _lockedPosition: true, boxShadow: "0 0", childDontRegisterViews: true, targetDropAction: "same", system: true,
-            explainer: "All of the trails that you have created will appear here."
+        // instead of assigninbg Doc.UserDoc().myrails we want to assign Doc.AxtiveDashboard.myTrails
+        // but we don't wanbt to create the list of trails here-- but rather in createDashbarod
+        // myTrail
+        const reqdOpts: DocumentOptions = {
+            title: 'My Trails',
+            _showTitle: 'title',
+            _height: 100,
+            treeViewHideTitle: true,
+            _fitWidth: true,
+            _gridGap: 5,
+            _forceActive: true,
+            childDropAction: 'alias',
+            treeViewTruncateTitleWidth: 150,
+            ignoreClick: true,
+            buttonMenu: true,
+            buttonMenuDoc: myTrailsBtn,
+            contextMenuIcons: new List<string>(['plus']),
+            contextMenuLabels: new List<string>(['Create New Trail']),
+            _lockedPosition: true,
+            boxShadow: '0 0',
+            childDontRegisterViews: true,
+            targetDropAction: 'same',
+            system: true,
+            explainer: 'All of the trails that you have created will appear here.',
         };
-       const myTrails = Docs.Create.TreeDocument([], reqdOpts);
-
-       dashboardDoc.myTrails = myTrails;
-       console.log(myTrails)
-       const contextMenuScripts = [reqdBtnScript.onClick];
-       if (Cast(myTrails.contextMenuScripts, listSpec(ScriptField), null)?.length !== contextMenuScripts.length) {
-           myTrails.contextMenuScripts = new List<ScriptField>(contextMenuScripts.map(script => ScriptField.MakeFunction(script)!));
-       }
+        const myTrails = DocUtils.AssignScripts(Docs.Create.TreeDocument([], reqdOpts), { treeViewChildDoubleClick: 'openPresentation(documentView.rootDoc)' });
 
+        dashboardDoc.myTrails = myTrails;
+        console.log(myTrails);
+        const contextMenuScripts = [reqdBtnScript.onClick];
+        if (Cast(myTrails.contextMenuScripts, listSpec(ScriptField), null)?.length !== contextMenuScripts.length) {
+            myTrails.contextMenuScripts = new List<ScriptField>(contextMenuScripts.map(script => ScriptField.MakeFunction(script)!));
+        }
     };
 }
 
-- 
cgit v1.2.3-70-g09d2

