UNPKG

@localazy/strapi-plugin

Version:

The official Strapi Plugin by Localazy.

52 lines (51 loc) 1.67 kB
import { jsx } from "react/jsx-runtime"; import { useState, useEffect } from "react"; import EntryExclusionService from "./entry-exclusion-service-BlyFqyBY.mjs"; import "./i18n-RoETLXdU.mjs"; import { u as useTranslation } from "./useTranslation-CZQ4lU1m.mjs"; const LocalazyStatusColumn = ({ data, model }) => { const { t } = useTranslation(); const [isExcluded, setIsExcluded] = useState(null); const [isLoading, setIsLoading] = useState(true); useEffect(() => { const checkStatus = async () => { if (!data?.documentId || !model) { setIsLoading(false); return; } try { const excluded = await EntryExclusionService.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__ */ jsx("span", { style: { color: "#666", fontSize: "12px" }, children: "..." }); } if (isExcluded === null) { return /* @__PURE__ */ jsx("span", { style: { color: "#666", fontSize: "12px" }, children: "-" }); } return /* @__PURE__ */ 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") } ); }; export { LocalazyStatusColumn as default };