import React, { useState, useEffect } from 'react';
import { useIntl } from 'react-intl';
import { Box, Typography, Divider } from '@strapi/design-system';
import Action from '../Action';
import { getTrad } from '../../utils/getTrad';
import { useSettings } from '../../hooks/useSettings';
import {
unstable_useDocument as useDocument,
unstable_useContentManagerContext as useContentManagerContext,
} from '@strapi/strapi/admin';
const actionModes = ['publish', 'unpublish'];
const ActionManagerComponent = ({ document, entity }) => {
const { formatMessage } = useIntl();
const [showActions, setShowActions] = useState(false);
const { getSettings } = useSettings();
const { isLoading, data, isRefetching } = getSettings();
useEffect(() => {
if (!isLoading && !isRefetching) {
if (!data.contentTypes?.length || data.contentTypes?.find((uid) => uid === entity.slug)) {
setShowActions(true);
}
}
}, [isLoading, isRefetching]);
if (!showActions) {
return null;
}
return (
<>