diff options
author | bobzel <zzzman@gmail.com> | 2020-08-20 14:25:00 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2020-08-20 14:25:00 -0400 |
commit | a8e9d8baf117868e9498b56e2c3abc9ab17a32f3 (patch) | |
tree | 9ab4a7c175adf9df6fe30291c22ae31a1898abf7 /src | |
parent | aa626240bff72456dccc7f91e433135e393cb161 (diff) |
changed sidebar buttons to store references to the panels the bring up.
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/CurrentUserUtils.ts | 25 | ||||
-rw-r--r-- | src/client/views/MainView.tsx | 11 | ||||
-rw-r--r-- | src/client/views/search/SearchBox.tsx | 2 |
3 files changed, 17 insertions, 21 deletions
diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index a14786b5b..8dd7b033b 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -506,19 +506,19 @@ export class CurrentUserUtils { } static menuBtnDescriptions(doc: Doc): { - title: string, icon: string, click: string, watchedDocuments?: Doc + title: string, target: Doc, icon: string, click: string, watchedDocuments?: Doc }[] { this.setupSharingSidebar(doc); // sets up the right sidebar collection for mobile upload documents and sharing return [ - { title: "Sharing", icon: "users", click: 'selectMainMenu(self)', watchedDocuments: doc["sidebar-sharing"] as Doc }, - { title: "Workspace", icon: "desktop", click: 'selectMainMenu(self)' }, - { title: "Catalog", icon: "file", click: 'selectMainMenu(self)' }, - { title: "Archive", icon: "archive", click: 'selectMainMenu(self)' }, - { title: "Import", icon: "upload", click: 'selectMainMenu(self)' }, - { title: "Tools", icon: "wrench", click: 'selectMainMenu(self)' }, - { title: "Help", icon: "question-circle", click: 'selectMainMenu(self)' }, - { title: "Settings", icon: "cog", click: 'selectMainMenu(self)' }, - { title: "User Doc", icon: "address-card", click: 'selectMainMenu(self)' }, + { title: "Sharing", target: Cast(doc["sidebar-sharing"], Doc, null), icon: "users", click: 'selectMainMenu(self)', watchedDocuments: doc["sidebar-sharing"] as Doc }, + { title: "Workspace", target: Cast(doc["sidebar-workspaces"], Doc, null), icon: "desktop", click: 'selectMainMenu(self)' }, + { title: "Catalog", target: undefined as any, icon: "file", click: 'selectMainMenu(self)' }, + { title: "Archive", target: Cast(doc["sidebar-recentlyClosed"], Doc, null), icon: "archive", click: 'selectMainMenu(self)' }, + { title: "Import", target: Cast(doc["sidebar-import"], Doc, null), icon: "upload", click: 'selectMainMenu(self)' }, + { title: "Tools", target: Cast(doc["sidebar-tools"], Doc, null), icon: "wrench", click: 'selectMainMenu(self)' }, + { title: "Help", target: undefined as any, icon: "question-circle", click: 'selectMainMenu(self)' }, + { title: "Settings", target: undefined as any, icon: "cog", click: 'selectMainMenu(self)' }, + { title: "User Doc", target: Cast(doc["sidebar-userDoc"], Doc, null), icon: "address-card", click: 'selectMainMenu(self)' }, ]; } @@ -532,11 +532,12 @@ export class CurrentUserUtils { } static setupMenuPanel(doc: Doc) { if (doc.menuStack === undefined) { - const menuBtns = CurrentUserUtils.menuBtnDescriptions(doc).map(({ title, icon, click, watchedDocuments }) => + const menuBtns = CurrentUserUtils.menuBtnDescriptions(doc).map(({ title, target, icon, click, watchedDocuments }) => Docs.Create.FontIconDocument({ icon, iconShape: "square", title, + target, _backgroundColor: "black", dropAction: "alias", removeDropProperties: new List<string>(["dropAction"]), @@ -959,11 +960,11 @@ export class CurrentUserUtils { this.setupDocTemplates(doc); // sets up the template menu of templates this.setupImportSidebar(doc); this.setupActiveMobileMenu(doc); // sets up the current mobile menu for Dash Mobile - this.setupMenuPanel(doc); this.setupSearchPanel(doc); this.setupOverlays(doc); // documents in overlay layer this.setupDockedButtons(doc); // the bottom bar of font icons await this.setupSidebarButtons(doc); // the pop-out left sidebar of tools/panels + this.setupMenuPanel(doc); doc.globalLinkDatabase = Docs.Prototypes.MainLinkDocument(); doc.globalScriptDatabase = Docs.Prototypes.MainScriptDocument(); doc.globalGroupDatabase = Docs.Prototypes.MainGroupDocument(); diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index fbc843d53..6bbe09974 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -541,19 +541,14 @@ export class MainView extends React.Component { } else { let panelDoc: Doc | undefined; switch (this.panelContent = title) { - case "Tools": panelDoc = Doc.UserDoc()["sidebar-tools"] as Doc ?? undefined; break; - case "Workspace": panelDoc = Doc.UserDoc()["sidebar-workspaces"] as Doc ?? undefined; break; + case "Settings": SettingsManager.Instance.open(); break; case "Catalog": SearchBox.Instance._searchFullDB = "My Stuff"; SearchBox.Instance.newsearchstring = ""; SearchBox.Instance.enter(undefined); break; - // panelDoc = Doc.UserDoc()["sidebar-catalog"] as Doc ?? undefined; break; - case "Archive": panelDoc = Doc.UserDoc()["sidebar-recentlyClosed"] as Doc ?? undefined; break; - case "Settings": SettingsManager.Instance.open(); break; - case "Import": panelDoc = Doc.UserDoc()["sidebar-import"] as Doc ?? undefined; break; - case "Sharing": panelDoc = Doc.UserDoc()["sidebar-sharing"] as Doc ?? undefined; break; - case "User Doc": panelDoc = Doc.UserDoc()["sidebar-userDoc"] as Doc ?? undefined; break; + default: + panelDoc = button.target as any; break; } this.sidebarContent.proto = panelDoc; if (panelDoc) { diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 1b5f5c861..ed1dc6de6 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -522,7 +522,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc //this.gotoDocument(this.childDocs.indexOf(doc), NumCasst(this.layoutDoc._itemIndex)); } returnHeight = () => 31 + 31 * 6; - returnLength = () => 51 + 205 * Cast(this.props.Document._schemaHeaders, listSpec(SchemaHeaderField), []).length; + returnLength = () => Math.min(window.innerWidth, 51 + 205 * Cast(this.props.Document._schemaHeaders, listSpec(SchemaHeaderField), []).length); @action changeSearchScope = (scope: string) => { |