UNPKG

@localazy/strapi-plugin

Version:

The official Strapi Plugin by Localazy.

52 lines (51 loc) 1.82 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const jsxRuntime = require("react/jsx-runtime"); const React = require("react"); const entryExclusionService = require("./entry-exclusion-service-bm-lp4za.js"); require("./i18n-0dV2P-Hm.js"); const useTranslation = require("./useTranslation-BdIl-aLe.js"); const LocalazyStatusColumn = ({ data, model }) => { const { t } = useTranslation.useTranslation(); const [isExcluded, setIsExcluded] = React.useState(null); const [isLoading, setIsLoading] = React.useState(true); React.useEffect(() => { const checkStatus = async () => { if (!data?.documentId || !model) { setIsLoading(false); return; } try { const excluded = await entryExclusionService.default.getEntryExclusion(model, data.documentId); setIsExcluded(excluded); } catch (error) { console.error("Error checking Localazy status:", error); setIsExcluded(null); } finally { setIsLoading(false); } }; checkStatus(); }, [data?.documentId, model]); if (isLoading) { return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#666", fontSize: "12px" }, children: "..." }); } if (isExcluded === null) { return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#666", fontSize: "12px" }, children: "-" }); } return /* @__PURE__ */ jsxRuntime.jsx( "span", { style: { padding: "4px 8px", borderRadius: "4px", fontSize: "12px", fontWeight: "bold", backgroundColor: isExcluded ? "#ff6b6b" : "#51cf66", color: "white" }, children: isExcluded ? t("plugin_settings.status_excluded") : t("plugin_settings.status_included") } ); }; exports.default = LocalazyStatusColumn;