mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Leading topbar home button to welcome page (#6218)
This commit is contained in:
1 parent
9d571b0639
commit
e3703dbf26
16 files changed
+47
-84
No files matched your search
@@ -14,9 +14,6 @@ import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import type { TopBarRegistration } from "./top-bar-registration";
|
||||
import isLinuxInjectable from "../../../../common/vars/is-linux.injectable";
|
||||
import isWindowsInjectable from "../../../../common/vars/is-windows.injectable";
|
||||
import type { NavigateToCatalog } from "../../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
import navigateToCatalogInjectable from "../../../../common/front-end-routing/routes/catalog/navigate-to-catalog.injectable";
|
||||
import catalogRouteInjectable from "../../../../common/front-end-routing/routes/catalog/catalog-route.injectable";
|
||||
import routeIsActiveInjectable from "../../../routes/route-is-active.injectable";
|
||||
import { UpdateButton } from "../../update-button";
|
||||
import topBarPrevEnabledInjectable from "./prev-enabled.injectable";
|
||||
@@ -28,10 +25,12 @@ import closeWindowInjectable from "./close-window.injectable";
|
||||
import maximizeWindowInjectable from "./maximize-window.injectable";
|
||||
import toggleMaximizeWindowInjectable from "./toggle-maximize-window.injectable";
|
||||
import watchHistoryStateInjectable from "../../../remote-helpers/watch-history-state.injectable";
|
||||
import welcomeRouteInjectable from "../../../../common/front-end-routing/routes/welcome/welcome-route.injectable";
|
||||
import navigateToWelcomeInjectable from "../../../../common/front-end-routing/routes/welcome/navigate-to-welcome.injectable";
|
||||
|
||||
interface Dependencies {
|
||||
navigateToCatalog: NavigateToCatalog;
|
||||
catalogRouteIsActive: IComputedValue<boolean>;
|
||||
navigateToWelcomePage: () => void;
|
||||
welcomeRouteIsActive: IComputedValue<boolean>;
|
||||
items: IComputedValue<TopBarRegistration[]>;
|
||||
isWindows: boolean;
|
||||
isLinux: boolean;
|
||||
@@ -48,8 +47,8 @@ interface Dependencies {
|
||||
|
||||
const NonInjectedTopBar = observer(({
|
||||
items,
|
||||
navigateToCatalog,
|
||||
catalogRouteIsActive,
|
||||
navigateToWelcomePage,
|
||||
welcomeRouteIsActive,
|
||||
isWindows,
|
||||
isLinux,
|
||||
prevEnabled,
|
||||
@@ -65,7 +64,7 @@ const NonInjectedTopBar = observer(({
|
||||
const elem = useRef<HTMLDivElement | null>(null);
|
||||
|
||||
const goHome = () => {
|
||||
navigateToCatalog();
|
||||
navigateToWelcomePage();
|
||||
};
|
||||
|
||||
const windowSizeToggle = (evt: React.MouseEvent) => {
|
||||
@@ -103,7 +102,7 @@ const NonInjectedTopBar = observer(({
|
||||
data-testid="home-button"
|
||||
material="home"
|
||||
onClick={goHome}
|
||||
disabled={catalogRouteIsActive.get()}
|
||||
disabled={welcomeRouteIsActive.get()}
|
||||
/>
|
||||
<Icon
|
||||
data-testid="history-back"
|
||||
@@ -182,15 +181,15 @@ const renderRegisteredItems = (items: TopBarRegistration[]) => (
|
||||
|
||||
export const TopBar = withInjectables<Dependencies>(NonInjectedTopBar, {
|
||||
getProps: (di) => ({
|
||||
navigateToCatalog: di.inject(navigateToCatalogInjectable),
|
||||
navigateToWelcomePage: di.inject(navigateToWelcomeInjectable),
|
||||
items: di.inject(topBarItemsInjectable),
|
||||
isLinux: di.inject(isLinuxInjectable),
|
||||
isWindows: di.inject(isWindowsInjectable),
|
||||
prevEnabled: di.inject(topBarPrevEnabledInjectable),
|
||||
nextEnabled: di.inject(topBarNextEnabledInjectable),
|
||||
catalogRouteIsActive: di.inject(
|
||||
welcomeRouteIsActive: di.inject(
|
||||
routeIsActiveInjectable,
|
||||
di.inject(catalogRouteInjectable),
|
||||
di.inject(welcomeRouteInjectable),
|
||||
),
|
||||
openAppContextMenu: di.inject(openAppContextMenuInjectable),
|
||||
goBack: di.inject(goBackInjectable),
|
||||
|
||||
Reference in new issue
Block a user