1
0
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:
Alex Andreev 2022-09-13 17:43:51 +03:00 committed by GitHub
parent 9d571b0639
commit e3703dbf26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 47 additions and 84 deletions

View File

@ -12,9 +12,8 @@ exports[`extension special characters in page registrations renders 1`] = `
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -12,9 +12,8 @@ exports[`navigate to extension page renders 1`] = `
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -12,9 +12,8 @@ exports[`add-cluster - navigation using application menu renders 1`] = `
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -13,9 +13,8 @@ exports[`force user to update when too long since update was downloaded when app
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -233,9 +232,8 @@ exports[`force user to update when too long since update was downloaded when app
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -500,9 +498,8 @@ exports[`force user to update when too long since update was downloaded when app
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -13,9 +13,8 @@ exports[`encourage user to update when sufficient time passed since update was d
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -233,9 +232,8 @@ exports[`encourage user to update when sufficient time passed since update was d
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -13,9 +13,8 @@ exports[`installing update using tray when started renders 1`] = `
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -215,9 +214,8 @@ exports[`installing update using tray when started when user checks for updates
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -417,9 +415,8 @@ exports[`installing update using tray when started when user checks for updates
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -619,9 +616,8 @@ exports[`installing update using tray when started when user checks for updates
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -839,9 +835,8 @@ exports[`installing update using tray when started when user checks for updates
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -1059,9 +1054,8 @@ exports[`installing update using tray when started when user checks for updates
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -13,9 +13,8 @@ exports[`installing update when started renders 1`] = `
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -215,9 +214,8 @@ exports[`installing update when started when user checks for updates renders 1`]
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -417,9 +415,8 @@ exports[`installing update when started when user checks for updates when new up
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -619,9 +616,8 @@ exports[`installing update when started when user checks for updates when new up
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -839,9 +835,8 @@ exports[`installing update when started when user checks for updates when new up
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -1059,9 +1054,8 @@ exports[`installing update when started when user checks for updates when no new
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -13,9 +13,8 @@ exports[`periodical checking of updates given updater is enabled and configurati
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -13,9 +13,8 @@ exports[`selection of update stability when started renders 1`] = `
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -40,9 +40,8 @@ exports[`Command Pallet: keyboard shortcut tests when on linux renders 1`] = `
</div>
</div>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -323,9 +322,8 @@ exports[`Command Pallet: keyboard shortcut tests when on linux when pressing ESC
</div>
</div>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -606,9 +604,8 @@ exports[`Command Pallet: keyboard shortcut tests when on linux when pressing SHI
</div>
</div>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -901,9 +898,8 @@ exports[`Command Pallet: keyboard shortcut tests when on linux when pressing SHI
</div>
</div>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -1157,9 +1153,8 @@ exports[`Command Pallet: keyboard shortcut tests when on macOS renders 1`] = `
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -1359,9 +1354,8 @@ exports[`Command Pallet: keyboard shortcut tests when on macOS when pressing ESC
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -1561,9 +1555,8 @@ exports[`Command Pallet: keyboard shortcut tests when on macOS when pressing SHI
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -1775,9 +1768,8 @@ exports[`Command Pallet: keyboard shortcut tests when on macOS when pressing SHI
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -12,9 +12,8 @@ exports[`extensions - navigation using application menu renders 1`] = `
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -12,9 +12,8 @@ exports[`preferences - navigation using application menu renders 1`] = `
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -13,9 +13,8 @@ exports[`show-about-using-tray renders 1`] = `
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -13,9 +13,8 @@ exports[`status-bar-items-originating-from-extensions when application starts wh
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -12,9 +12,8 @@ exports[`welcome - navigation using application menu renders 1`] = `
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"
@ -852,9 +851,8 @@ exports[`welcome - navigation using application menu when navigated somewhere el
class="items"
>
<i
class="Icon material interactive focusable"
class="Icon material interactive disabled focusable"
data-testid="home-button"
tabindex="0"
>
<span
class="icon"

View File

@ -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),