diff --git a/src/renderer/components/+preferences/extension-card.module.scss b/src/renderer/components/+preferences/extension-card.module.scss index 587ca76c59..888b46ff0c 100644 --- a/src/renderer/components/+preferences/extension-card.module.scss +++ b/src/renderer/components/+preferences/extension-card.module.scss @@ -83,6 +83,7 @@ background-repeat: no-repeat; background-clip: content-box; background-color: #3a404c; + background-size: 50px; } .install button { @@ -139,4 +140,10 @@ position: absolute; right: 0; } + + &.disabledButton { + &:after { + background-color: #ad7c0c; + } + } } \ No newline at end of file diff --git a/src/renderer/components/+preferences/extension-card.tsx b/src/renderer/components/+preferences/extension-card.tsx index 3e30d9ff7c..455f15d36a 100644 --- a/src/renderer/components/+preferences/extension-card.tsx +++ b/src/renderer/components/+preferences/extension-card.tsx @@ -21,6 +21,7 @@ import enableExtensionInjectable from "../+extensions/enable-extension/enable-ex import userExtensionsInjectable from "../+extensions/user-extensions/user-extensions.injectable"; import type { InstalledExtension } from "../../../extensions/extension-discovery/extension-discovery"; import type { LensExtensionId } from "../../../extensions/lens-extension"; +import { cssNames } from "../../utils"; interface Dependencies { installFromInput: (input: string) => Promise; @@ -41,16 +42,16 @@ function NonInjectedExtensionCard({ extensionInstallationStateStore: store, installFromInput, onClick, - // confirmUninstallExtension, - // enableExtension, - // disableExtension, - // userExtensions, + confirmUninstallExtension, + enableExtension, + disableExtension, + userExtensions, }: Props & Dependencies) { - const { name, version, totalNumberOfInstallations, shortDescription, publisher, githubRepositoryUrl, appIconUrl } = extension; - // const installedExtension = userExtensions.get().find(installed => installed.manifest.name == name); + const { name, version, totalNumberOfInstallations, shortDescription, publisher, githubRepositoryUrl, appIconUrl, installationName, rating } = extension; + const installedExtension = userExtensions.get().find(installed => installed.manifest.name == installationName); const [waiting, setWaiting] = useState(false); - const installed = true; - const rating = name.toLowerCase().includes("space") ? 5 : Math.floor(Math.random() * 5) + 1; + const installed = Boolean(installedExtension); + const rate = rating || 4; useEffect(() => { if (!store.anyPreInstallingOrInstalling) { @@ -64,20 +65,20 @@ function NonInjectedExtensionCard({ installFromInput(extension.binaryUrl); } - // function onUninstall(evt: React.MouseEvent, extension: InstalledExtension) { - // evt.stopPropagation(); - // confirmUninstallExtension(extension); - // } + function onUninstall(evt: React.MouseEvent) { + evt.stopPropagation(); + confirmUninstallExtension(installedExtension); + } - // function onStatusToggle(evt: React.MouseEvent, extension: InstalledExtension) { - // evt.stopPropagation(); + function onStatusToggle(evt: React.MouseEvent) { + evt.stopPropagation(); - // if (extension.isEnabled) { - // disableExtension(extension.id); - // } else { - // enableExtension(extension.id); - // } - // } + if (installedExtension.isEnabled) { + disableExtension(installedExtension.id); + } else { + enableExtension(installedExtension.id); + } + } return (
@@ -87,7 +88,7 @@ function NonInjectedExtensionCard({
{name} - +
{version}
@@ -117,17 +118,17 @@ function NonInjectedExtensionCard({
) : (