import { useTranslation } from "react-i18next"; import { PluginIcon } from "@/lib/plugin-icon"; import { cn } from "@/lib/utils"; import { capabilityRisk, formatCount, isSevere } from "./plugin-model"; export function PluginIconBox({ name, size = "md", muted, }: { name?: string; size?: "sm" | "md" | "lg"; muted?: boolean; }) { const box = size === "lg" ? "size-10" : size === "sm" ? "size-7" : "size-9"; const glyph = size === "lg" ? "size-5" : size === "sm" ? "size-3.5" : "size-4"; return (
); } /** One capability as its consequence, with a mark only on the severe ones. */ export function CapabilityRow({ capability, showId, className, }: { capability: string; showId?: boolean; className?: string; }) { const { t } = useTranslation(); const severe = isSevere(capability); return (
{severe && ( ! )}
{t(`plugins.capabilities.${capability}.title`, { defaultValue: capability, nsSeparator: false, })} {t(`plugins.capabilities.${capability}.consequence`, { defaultValue: "", nsSeparator: false, })}
{showId && ( {capability} )}
); } /** Permanent mark on anything installed without a registry signature. */ export function UnverifiedBadge() { const { t } = useTranslation(); return ( {t("plugins.manager.unverified")} ); } /** Marks a plugin from the community registry or a custom one. */ export function SourceBadge({ source, registryName, }: { source: string; registryName?: string | null; }) { const { t } = useTranslation(); if (source !== "community" && source !== "custom") return null; const label = source === "community" ? t("plugins.manager.registries.communityBadge") : (registryName ?? t("plugins.manager.registries.customBadge")); return ( {label} ); } export function BetaBadge() { const { t } = useTranslation(); return ( {t("plugins.manager.beta.badge")} ); } /** How often the plugin's release files were downloaded. */ export function DownloadCount({ count }: { count: number | null }) { const { t } = useTranslation(); if (count === null || count <= 0) return null; return ( {t("plugins.manager.count.downloads", { count, formatted: formatCount(count), })} ); }