import Image from "next/future/image"; import { Disclosure } from "@headlessui/react"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import Status from "./status"; import Widget from "./widget"; import Docker from "./widgets/service/docker"; import Dropdown from "./dropdown"; function resolveIcon(icon) { if (icon.startsWith("http")) { return `/api/proxy?url=${encodeURIComponent(icon)}`; } if (icon.startsWith("/")) { return icon; } if (icon.endsWith(".png")) { return `https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/${icon}`; } return `https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/${icon}.png`; } export default function Item({ service }) { const { t } = useTranslation(); const handleOnClick = () => { if (service.href && service.href !== "#") { window.open(service.href, "_blank").focus(); } }; const cmcValues = [ { label: t("coinmarketcap.1hour"), value: "1h" }, { label: t("coinmarketcap.1day"), value: "24h" }, { label: t("coinmarketcap.7days"), value: "7d" }, { label: t("coinmarketcap.30days"), value: "30d" }, ]; const [cmcV, cmcSet] = useState(cmcValues[0]); const states = { coinmarketcap: { value: cmcV, set: cmcSet }, }; const hasLink = service.href && service.href !== "#"; return (
  • {service.icon && (hasLink ? ( ) : (
    logo
    ))} {hasLink ? ( ) : (
    {service.name}

    {service.description}

    )} {service.container && ( )} {service?.widget?.type === "coinmarketcap" && }
    {service.widget && }
  • ); }