mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Go to extension page from extension list
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
9ece3618ad
commit
ca07904fa9
@ -20,10 +20,11 @@ interface Dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
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;
|
const { name, version, totalNumberOfInstallations, shortDescription, publisher, githubRepositoryUrl, appIconUrl } = extension;
|
||||||
|
|
||||||
function onInstall() {
|
function onInstall() {
|
||||||
@ -31,7 +32,7 @@ function NonInjectedExtensionCard({ extension, extensionInstallationStateStore,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.extensionCard}>
|
<div className={styles.extensionCard} onClick={onClick}>
|
||||||
<div className={styles.icon} style={{ backgroundImage: `url(${appIconUrl})` }}/>
|
<div className={styles.icon} style={{ backgroundImage: `url(${appIconUrl})` }}/>
|
||||||
<div className={styles.contents}>
|
<div className={styles.contents}>
|
||||||
<div className={styles.head}>
|
<div className={styles.head}>
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { useHistory } from "react-router-dom";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { SearchInput } from "../input";
|
import { SearchInput } from "../input";
|
||||||
import { Spinner } from "../spinner";
|
import { Spinner } from "../spinner";
|
||||||
@ -45,16 +46,24 @@ export function Install() {
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<h2 style={{ marginTop: "30px", display: "flex", alignItems: "center" }}><Icon material="star" small style={{ opacity: ".3" }}/> Featured Extensions</h2>
|
<h2 style={{ marginTop: "30px", display: "flex", alignItems: "center" }}><Icon material="star" small style={{ opacity: ".3" }}/> Featured Extensions</h2>
|
||||||
{renderExtensionsOrSpinner()}
|
{renderExtensionsOrSpinner()}
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ExtensionList({ extensions }: { extensions: Extension[] }) {
|
function ExtensionList({ extensions }: { extensions: Extension[] }) {
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
|
function handleClick(extensionId: string) {
|
||||||
|
history.push(`extension/${extensionId}`);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{extensions.map(extension => <ExtensionCard key={extension.id} extension={extension}/>)}
|
{extensions.map(extension => (
|
||||||
|
<ExtensionCard key={extension.id} extension={extension} onClick={() => handleClick(extension.id)}/>
|
||||||
|
))}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import {
|
|||||||
terminalURL,
|
terminalURL,
|
||||||
installURL,
|
installURL,
|
||||||
installRoute,
|
installRoute,
|
||||||
|
extensionPageURL,
|
||||||
} from "../../../common/routes";
|
} from "../../../common/routes";
|
||||||
import { navigateWithoutHistoryChange, navigation } from "../../navigation";
|
import { navigateWithoutHistoryChange, navigation } from "../../navigation";
|
||||||
import { SettingLayout } from "../layout/setting-layout";
|
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 type { RegisteredAppPreference } from "./app-preferences/app-preference-registration";
|
||||||
import appPreferencesInjectable from "./app-preferences/app-preferences.injectable";
|
import appPreferencesInjectable from "./app-preferences/app-preferences.injectable";
|
||||||
import { Install } from "./install";
|
import { Install } from "./install";
|
||||||
|
import { ExtensionPage } from "./extension-page";
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
appPreferenceItems: IComputedValue<RegisteredAppPreference[]>
|
appPreferenceItems: IComputedValue<RegisteredAppPreference[]>
|
||||||
@ -93,6 +95,7 @@ const NonInjectedPreferences: React.FC<Dependencies> = ({ appPreferenceItems })
|
|||||||
<Route path={telemetryURL()} component={Telemetry}/>
|
<Route path={telemetryURL()} component={Telemetry}/>
|
||||||
<Route path={extensionURL()} component={Extensions}/>
|
<Route path={extensionURL()} component={Extensions}/>
|
||||||
<Route path={installURL()} component={Install}/>
|
<Route path={installURL()} component={Install}/>
|
||||||
|
<Route path={extensionPageURL()} component={ExtensionPage}/>
|
||||||
<Redirect exact from={`${preferencesURL()}/`} to={appURL()}/>
|
<Redirect exact from={`${preferencesURL()}/`} to={appURL()}/>
|
||||||
</Switch>
|
</Switch>
|
||||||
</SettingLayout>
|
</SettingLayout>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user