From 17990afd5d5ae55fe44a4703294c510dd5886a39 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Tue, 27 Feb 2024 22:39:20 -0800 Subject: [PATCH] Add the logo back to the revamped sidebar, fix regressions from last PR (#353) * Fix logo not being visible in auxiliary views when sidebar is collapsed * Refactor auxiliary views into MainView component * fix contents formatting * Need a better-centered version of the logo for the sidebar * Add logo back to the sidebar * revert root.less change * Fix regressions from last pr * zero out subtractor if sidebar is collapsed * remove unnecessary var --- src/app/bookmarks/bookmarks.tsx | 7 +- src/app/clientsettings/clientsettings.tsx | 11 +- src/app/common/elements/mainview.tsx | 10 +- src/app/connections/connections.tsx | 7 +- src/app/history/history.tsx | 7 +- src/app/sidebar/sidebar.less | 116 +++------------------- src/app/sidebar/sidebar.tsx | 15 ++- 7 files changed, 54 insertions(+), 119 deletions(-) diff --git a/src/app/bookmarks/bookmarks.tsx b/src/app/bookmarks/bookmarks.tsx index 31177134..e3c21d2c 100644 --- a/src/app/bookmarks/bookmarks.tsx +++ b/src/app/bookmarks/bookmarks.tsx @@ -180,6 +180,11 @@ class Bookmark extends React.Component { @mobxReact.observer class BookmarksView extends React.Component<{}, {}> { + @boundMethod + handleClose() { + GlobalModel.bookmarksModel.closeView(); + } + render() { const isHidden = GlobalModel.activeMainView.get() != "bookmarks"; if (isHidden) { @@ -188,7 +193,7 @@ class BookmarksView extends React.Component<{}, {}> { let bookmarks = GlobalModel.bookmarksModel.bookmarks; let bookmark: BookmarkType = null; return ( - +
diff --git a/src/app/clientsettings/clientsettings.tsx b/src/app/clientsettings/clientsettings.tsx index 3403a960..5763e529 100644 --- a/src/app/clientsettings/clientsettings.tsx +++ b/src/app/clientsettings/clientsettings.tsx @@ -129,6 +129,11 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove return clientData?.clientopts?.globalshortcut ?? ""; } + @boundMethod + handleClose() { + GlobalModel.clientSettingsViewModel.closeView(); + } + render() { const isHidden = GlobalModel.activeMainView.get() != "clientsettings"; if (isHidden) { @@ -145,11 +150,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove const curFontFamily = GlobalModel.getTermFontFamily(); return ( - +
Term Font Size
diff --git a/src/app/common/elements/mainview.tsx b/src/app/common/elements/mainview.tsx index de15d3c5..75c13f03 100644 --- a/src/app/common/elements/mainview.tsx +++ b/src/app/common/elements/mainview.tsx @@ -16,11 +16,13 @@ class MainView extends React.Component<{ children: React.ReactNode; }> { render() { - // TODO: This is a workaround for History view not honoring the sidebar width. This is rooted in the table width for the history view, which uses `calc(100%-20px)`. To properly fix this, History view needs a full overhaul. - const width = window.innerWidth - 6 - GlobalModel.mainSidebarModel.getWidth(); - + const sidebarModel = GlobalModel.mainSidebarModel; + const maxWidthSubtractor = sidebarModel.getCollapsed() ? 0 : sidebarModel.getWidth(); return ( -
+
{this.props.title}
diff --git a/src/app/connections/connections.tsx b/src/app/connections/connections.tsx index fa1dd532..f5c715b8 100644 --- a/src/app/connections/connections.tsx +++ b/src/app/connections/connections.tsx @@ -98,6 +98,11 @@ class ConnectionsView extends React.Component<{ model: RemotesModel }, { hovered } } + @boundMethod + handleClose() { + GlobalModel.connectionViewModel.closeView(); + } + componentDidMount() { if (this.tableRef.current != null) { this.tableRszObs = new ResizeObserver(this.handleTableResize.bind(this)); @@ -126,7 +131,7 @@ class ConnectionsView extends React.Component<{ model: RemotesModel }, { hovered let item: RemoteType = null; return ( - + { })(); } + @boundMethod + handleClose() { + GlobalModel.historyViewModel.closeView(); + } + render() { let isHidden = GlobalModel.activeMainView.get() != "history"; if (isHidden) { @@ -408,7 +413,7 @@ class HistoryView extends React.Component<{}, {}> { let remoteId: string = null; return ( - +
{ } render() { - const mainSidebar = GlobalModel.mainSidebarModel; - const isCollapsed = mainSidebar.getCollapsed(); + const sidebarWidth = GlobalModel.mainSidebarModel.getWidth(); + return ( { {(toggleCollapse) => (
+
+ 215}> + + + + + +