From ca07904fa99d435c409a171577a98ea35d2e7e0f Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Tue, 8 Feb 2022 13:32:56 +0300 Subject: [PATCH] Go to extension page from extension list Signed-off-by: Alex Andreev --- .../components/+preferences/extension-card.tsx | 9 +++++---- src/renderer/components/+preferences/install.tsx | 13 +++++++++++-- .../components/+preferences/preferences.tsx | 3 +++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/+preferences/extension-card.tsx b/src/renderer/components/+preferences/extension-card.tsx index f89b1f0320..61b6127ecc 100644 --- a/src/renderer/components/+preferences/extension-card.tsx +++ b/src/renderer/components/+preferences/extension-card.tsx @@ -20,10 +20,11 @@ interface Dependencies { } interface Props { - extension: Extension + extension: Extension; + onClick?: () => void; } -function NonInjectedExtensionCard({ extension, extensionInstallationStateStore, installFromInput }: Props & Dependencies) { +function NonInjectedExtensionCard({ extension, extensionInstallationStateStore, installFromInput, onClick }: Props & Dependencies) { const { name, version, totalNumberOfInstallations, shortDescription, publisher, githubRepositoryUrl, appIconUrl } = extension; function onInstall() { @@ -31,7 +32,7 @@ function NonInjectedExtensionCard({ extension, extensionInstallationStateStore, } return ( -
+
@@ -60,7 +61,7 @@ function NonInjectedExtensionCard({ extension, extensionInstallationStateStore, waiting={extensionInstallationStateStore.anyPreInstallingOrInstalling} onClick={onInstall} > - + Install
diff --git a/src/renderer/components/+preferences/install.tsx b/src/renderer/components/+preferences/install.tsx index 95966e7483..4dfb30d20f 100644 --- a/src/renderer/components/+preferences/install.tsx +++ b/src/renderer/components/+preferences/install.tsx @@ -4,6 +4,7 @@ */ import React, { useEffect, useState } from "react"; +import { useHistory } from "react-router-dom"; import { Icon } from "../icon"; import { SearchInput } from "../input"; import { Spinner } from "../spinner"; @@ -45,16 +46,24 @@ export function Install() {
-

Featured Extensions

+

 Featured Extensions

{renderExtensionsOrSpinner()} ); } function ExtensionList({ extensions }: { extensions: Extension[] }) { + const history = useHistory(); + + function handleClick(extensionId: string) { + history.push(`extension/${extensionId}`); + } + return ( <> - {extensions.map(extension => )} + {extensions.map(extension => ( + handleClick(extension.id)}/> + ))} ); } diff --git a/src/renderer/components/+preferences/preferences.tsx b/src/renderer/components/+preferences/preferences.tsx index 9767455b90..367d939d40 100644 --- a/src/renderer/components/+preferences/preferences.tsx +++ b/src/renderer/components/+preferences/preferences.tsx @@ -26,6 +26,7 @@ import { terminalURL, installURL, installRoute, + extensionPageURL, } from "../../../common/routes"; import { navigateWithoutHistoryChange, navigation } from "../../navigation"; import { SettingLayout } from "../layout/setting-layout"; @@ -42,6 +43,7 @@ import { withInjectables } from "@ogre-tools/injectable-react"; import type { RegisteredAppPreference } from "./app-preferences/app-preference-registration"; import appPreferencesInjectable from "./app-preferences/app-preferences.injectable"; import { Install } from "./install"; +import { ExtensionPage } from "./extension-page"; interface Dependencies { appPreferenceItems: IComputedValue @@ -93,6 +95,7 @@ const NonInjectedPreferences: React.FC = ({ appPreferenceItems }) +