From e8b27ee6a571f41c88ca6aa08c422c16aefbdb6f Mon Sep 17 00:00:00 2001 From: Janne Savolainen Date: Thu, 13 Oct 2022 15:13:17 +0300 Subject: [PATCH] Switch to using competition for application preferences Co-authored-by: Mikko Aspiala Signed-off-by: Janne Savolainen --- .../navigate-to-app-preferences.injectable.ts | 20 -- .../navigate-to-preferences.injectable.ts | 4 +- .../closing-preferences.test.tsx.snap | 290 +----------------- .../preferences/closing-preferences.test.tsx | 99 ++++-- ...e-to-application-preferences.injectable.ts | 20 ++ .../preferences-catalog-entity.injectable.ts | 10 +- .../preferences-route.injectable.ts | 2 +- ...ent-preference-tab-composite.injectable.ts | 2 +- .../preferences-route-component.injectable.ts | 2 +- ...-preferences-navigation-item.injectable.ts | 16 +- .../navigate-to-preference-tab.injectable.ts | 25 ++ .../preference-tab-is-active.injectable.ts | 30 ++ 12 files changed, 170 insertions(+), 350 deletions(-) delete mode 100644 src/common/front-end-routing/routes/preferences/app/navigate-to-app-preferences.injectable.ts create mode 100644 src/features/preferences/common/navigate-to-application-preferences.injectable.ts rename src/{common/catalog-entities/general-catalog-entities/implementations => features/preferences/common}/preferences-catalog-entity.injectable.ts (67%) rename src/features/preferences/{renderer => common}/preferences-route.injectable.ts (93%) create mode 100644 src/renderer/components/+preferences/preferences-navigation/navigate-to-preference-tab/navigate-to-preference-tab.injectable.ts create mode 100644 src/renderer/components/+preferences/preferences-navigation/navigate-to-preference-tab/preference-tab-is-active.injectable.ts diff --git a/src/common/front-end-routing/routes/preferences/app/navigate-to-app-preferences.injectable.ts b/src/common/front-end-routing/routes/preferences/app/navigate-to-app-preferences.injectable.ts deleted file mode 100644 index 4f83d47dec..0000000000 --- a/src/common/front-end-routing/routes/preferences/app/navigate-to-app-preferences.injectable.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) OpenLens Authors. All rights reserved. - * Licensed under MIT License. See LICENSE in root directory for more information. - */ -import { getInjectable } from "@ogre-tools/injectable"; -import appPreferencesRouteInjectable from "./app-preferences-route.injectable"; -import { navigateToRouteInjectionToken } from "../../../navigate-to-route-injection-token"; - -const navigateToAppPreferencesInjectable = getInjectable({ - id: "navigate-to-app-preferences", - - instantiate: (di) => { - const navigateToRoute = di.inject(navigateToRouteInjectionToken); - const route = di.inject(appPreferencesRouteInjectable); - - return () => navigateToRoute(route); - }, -}); - -export default navigateToAppPreferencesInjectable; diff --git a/src/common/front-end-routing/routes/preferences/navigate-to-preferences.injectable.ts b/src/common/front-end-routing/routes/preferences/navigate-to-preferences.injectable.ts index 545751d7c3..249fe52458 100644 --- a/src/common/front-end-routing/routes/preferences/navigate-to-preferences.injectable.ts +++ b/src/common/front-end-routing/routes/preferences/navigate-to-preferences.injectable.ts @@ -3,12 +3,12 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { getInjectable } from "@ogre-tools/injectable"; -import navigateToAppPreferencesInjectable from "./app/navigate-to-app-preferences.injectable"; +import navigateToApplicationPreferencesInjectable from "../../../../features/preferences/common/navigate-to-application-preferences.injectable"; const navigateToPreferencesInjectable = getInjectable({ id: "navigate-to-preferences", - instantiate: (di) => di.inject(navigateToAppPreferencesInjectable), + instantiate: (di) => di.inject(navigateToApplicationPreferencesInjectable), }); export default navigateToPreferencesInjectable; diff --git a/src/features/preferences/__snapshots__/closing-preferences.test.tsx.snap b/src/features/preferences/__snapshots__/closing-preferences.test.tsx.snap index 14108e700e..65c18e1f5a 100644 --- a/src/features/preferences/__snapshots__/closing-preferences.test.tsx.snap +++ b/src/features/preferences/__snapshots__/closing-preferences.test.tsx.snap @@ -743,6 +743,7 @@ exports[`preferences - closing-preferences given accessing preferences directly />