From 92ec2016a405f67eca73858ff94a0919b267039c Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 21 Sep 2022 11:41:57 -0400 Subject: fixed snapshots of dashbaords to have trails setup --- src/client/views/DashboardView.tsx | 76 ++++---- .../views/collections/CollectionDockingView.tsx | 3 +- src/client/views/topbar/TopBar.tsx | 193 ++++++++++----------- 3 files changed, 134 insertions(+), 138 deletions(-) (limited to 'src') diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx index ce442801f..68d975a17 100644 --- a/src/client/views/DashboardView.tsx +++ b/src/client/views/DashboardView.tsx @@ -92,35 +92,32 @@ export class DashboardView extends React.Component { const dashboardCount = DocListCast(Doc.MyDashboards.data).length + 1; const placeholder = `Dashboard ${dashboardCount}`; return ( -
-
Create New Dashboard
+
+
Create New Dashboard
Title this.setNewDashboardName((e.target as any).value)} />
Background - { - this.newDashboardColor = color; - }} /> + { + this.newDashboardColor = color; + }} + />
-
); @@ -163,20 +160,19 @@ export class DashboardView extends React.Component { <>
-
+
this.selectDashboardGroup(DashboardGroup.MyDashboards)}> My Dashboards @@ -214,18 +210,15 @@ export class DashboardView extends React.Component { e.stopPropagation(); this.onContextMenu(dashboard, e); }}> - } - /> + } />
); })} -
{ +
{ this.setNewDashboardName(''); }}> + @@ -324,6 +317,15 @@ export class DashboardView extends React.Component { Doc.AddDocToList(dashboards, 'data', dashboardDoc); + DashboardView.SetupDashboardTrails(dashboardDoc); + + // open this new dashboard + Doc.ActiveDashboard = dashboardDoc; + Doc.ActivePage = 'dashboard'; + Doc.ActivePresentation = undefined; + }; + + public static SetupDashboardTrails(dashboardDoc: Doc) { // this section is creating the button document itself === myTrails = new Button const reqdBtnOpts: DocumentOptions = { _forceActive: true, @@ -368,15 +370,11 @@ export class DashboardView extends React.Component { }; dashboardDoc.myTrails = new PrefetchProxy(DocUtils.AssignScripts(Docs.Create.TreeDocument([], reqdOpts), { treeViewChildDoubleClick: 'openPresentation(documentView.rootDoc)' })); - // open this new dashboard - Doc.ActiveDashboard = dashboardDoc; - Doc.ActivePage = 'dashboard'; - Doc.ActivePresentation = undefined; const contextMenuScripts = [reqdBtnScript.onClick]; if (Cast(Doc.MyTrails.contextMenuScripts, listSpec(ScriptField), null)?.length !== contextMenuScripts.length) { Doc.MyTrails.contextMenuScripts = new List(contextMenuScripts.map(script => ScriptField.MakeFunction(script)!)); } - }; + } } export function AddToList(MySharedDocs: Doc, arg1: string, dash: any) { diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx index 6435fdd0f..25fe5fe43 100644 --- a/src/client/views/collections/CollectionDockingView.tsx +++ b/src/client/views/collections/CollectionDockingView.tsx @@ -430,7 +430,8 @@ export class CollectionDockingView extends CollectionSubView() { return newtab; }); const copy = Docs.Create.DockDocument(newtabs, json, { title: incrementTitleCopy(StrCast(doc.title)) }); - return DashboardView.openDashboard(await copy); + DashboardView.SetupDashboardTrails(copy); + return DashboardView.openDashboard(copy); } @action diff --git a/src/client/views/topbar/TopBar.tsx b/src/client/views/topbar/TopBar.tsx index 2fe0c6e79..7bc7ba3ed 100644 --- a/src/client/views/topbar/TopBar.tsx +++ b/src/client/views/topbar/TopBar.tsx @@ -19,7 +19,6 @@ import { Borders, Colors } from '../global/globalEnums'; import { MainView } from '../MainView'; import './TopBar.scss'; - /** * ABOUT: This is the topbar in Dash, which included the current Dashboard as well as access to information on the user * and settings and help buttons. Future scope for this bar is to include the collaborators that are on the same Dashboard. @@ -44,88 +43,94 @@ export class TopBar extends React.Component { * - Tracking mode */ @computed get topbarLeft() { - return ( + return (
- {Doc.ActiveDashboard ? } isCircle={true} hoverStyle="gray" color={this.textColor} /> : -
- dash logo - browndash -
- } - {Doc.ActiveDashboard && !Doc.noviceMode &&
); } - /** + /** * Returns the center of the topbar * This part of the topbar contains everything related to the current dashboard including: * - Selection of dashboards * - Creating a new dashboard * - Taking a snapshot of a dashboard */ - @computed get topbarCenter() { - const myDashboards = DocListCast(Doc.MyDashboards.data); - const activeDashboard = Doc.ActiveDashboard; - // const dashboardItems = myDashboards.map(board => { - // const boardTitle = StrCast(board.title); - // console.log(boardTitle); - // return { - // text: boardTitle, - // onClick: () => DashboardView.openDashboard(board), - // val: board, - // }; - // }); - return activeDashboard ? ( -
-
- ) : null; - } - - /** - * Returns the right hand side of the topbar. - * This part of the topbar includes information about the current user, - * and allows the user to access their account settings etc. - */ - @computed get topbarRight() { - - return ( -
- ReportManager.Instance.open()} - icon={} - /> + /> + )} +
+ ) : null; + } + + /** + * Returns the right hand side of the topbar. + * This part of the topbar includes information about the current user, + * and allows the user to access their account settings etc. + */ + @computed get topbarRight() { + return ( +
+ ReportManager.Instance.open()} icon={} /> } /> {/*
- ); - } +
+ ); + } // render() { // const activeDashboard = Doc.ActiveDashboard; -- cgit v1.2.3-70-g09d2