diff --git a/packages/core/src/renderer/components/+helm-charts/helm-chart-details.tsx b/packages/core/src/renderer/components/+helm-charts/helm-chart-details.tsx index 2004a8704c..15add2c2ea 100644 --- a/packages/core/src/renderer/components/+helm-charts/helm-chart-details.tsx +++ b/packages/core/src/renderer/components/+helm-charts/helm-chart-details.tsx @@ -71,7 +71,7 @@ class NonInjectedHelmChartDetails extends Component
diff --git a/packages/core/src/renderer/components/+helm-charts/helm-charts.tsx b/packages/core/src/renderer/components/+helm-charts/helm-charts.tsx index a8367aac23..dff8025de5 100644 --- a/packages/core/src/renderer/components/+helm-charts/helm-charts.tsx +++ b/packages/core/src/renderer/components/+helm-charts/helm-charts.tsx @@ -121,7 +121,7 @@ class NonInjectedHelmCharts extends Component { ]} renderTableContents={chart => [
- +
, chart.getName(), chart.getDescription(), diff --git a/packages/core/src/renderer/components/+helm-charts/icon.tsx b/packages/core/src/renderer/components/+helm-charts/icon.tsx index 78d5be7ed3..c06a7a0670 100644 --- a/packages/core/src/renderer/components/+helm-charts/icon.tsx +++ b/packages/core/src/renderer/components/+helm-charts/icon.tsx @@ -3,47 +3,50 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ +import { cssNames } from "@k8slens/utilities"; import React, { useState } from "react"; -import type { HelmChart } from "../../../common/k8s-api/endpoints/helm-charts.api"; export interface HelmChartIconProps { className?: string; - chart: HelmChart; + imageUrl?: string; } export const HelmChartIcon = ({ - chart, + imageUrl = "", className, }: HelmChartIconProps) => { - const [failedToLoad, setFailedToLoad] = useState(false); - const icon = chart.getIcon(); + const [isImageLoaded, setIsImageLoaded] = useState(false); + const backgroundImage = `url(${imageUrl})`; + const placeholderImageUrl = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzIyLjggNzAyIiB3aWR0aD0iNzIyLjAiIGhlaWdodD0iNzAyIiBmaWxsPSJjbHV...9lbiIgY2xhc3M9ImN1cnJlbnRDb2xvcnRlciI+PC9zdmc+Cg==" - if (!icon || failedToLoad) { - return ( -
- - - - - - - - - - - - - -
- ); - } + const handleImageLoad = () => { + setIsImageLoaded(true); + }; + + const isValidImage = () => { + return /^https?:\/\/.*(? evt.currentTarget.classList.add("visible")} - onError={() => setFailedToLoad(true)} - /> +
+ {isValidImage() && ( + + )} +
); };