mirror of
https://github.com/strapi/strapi.git
synced 2025-10-29 00:49:49 +00:00
change some variables names on BulkACtionsBar
This commit is contained in:
parent
41a69b07e2
commit
a61b3cc902
@ -5,9 +5,10 @@ import { Check, ExclamationMarkCircle, Trash } from '@strapi/icons';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useTracking } from '@strapi/helper-plugin';
|
||||
import { listViewDomain } from '../../../pages/ListView/selectors';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { getTrad } from '../../../utils';
|
||||
import InjectionZoneList from '../../InjectionZoneList';
|
||||
import { listViewDomain } from '../../../pages/ListView/selectors';
|
||||
|
||||
const ConfirmBulkActionDialog = ({ onToggleDialog, isOpen, dialogBody, endAction }) => {
|
||||
const { formatMessage } = useIntl();
|
||||
@ -191,9 +192,9 @@ const BulkActionsBar = ({
|
||||
const [dialogToOpen, setDialogToOpen] = useState(null);
|
||||
|
||||
const selectedEntriesObjects = data.filter((entry) => selectedEntries.includes(entry.id));
|
||||
const showPublishButton =
|
||||
const publishButtonIsShown =
|
||||
showPublish && selectedEntriesObjects.some((entry) => !entry.publishedAt);
|
||||
const showUnpublishButton =
|
||||
const unpublishButtonIsShown =
|
||||
showPublish && selectedEntriesObjects.some((entry) => entry.publishedAt);
|
||||
|
||||
const toggleDeleteModal = () => {
|
||||
@ -242,7 +243,7 @@ const BulkActionsBar = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
{showPublishButton && (
|
||||
{publishButtonIsShown && (
|
||||
<>
|
||||
<Button variant="tertiary" onClick={togglePublishModal}>
|
||||
{formatMessage({ id: 'app.utils.publish', defaultMessage: 'Publish' })}
|
||||
@ -255,7 +256,7 @@ const BulkActionsBar = ({
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{showUnpublishButton && (
|
||||
{unpublishButtonIsShown && (
|
||||
<>
|
||||
<Button variant="tertiary" onClick={toggleUnpublishModal}>
|
||||
{formatMessage({ id: 'app.utils.unpublish', defaultMessage: 'Unpublish' })}
|
||||
|
||||
@ -117,7 +117,7 @@ describe('BulkActionsBar', () => {
|
||||
);
|
||||
});
|
||||
|
||||
expect(onConfirmPublishAll).toHaveBeenCalledWith([]);
|
||||
expect(onConfirmPublishAll).toHaveBeenCalledWith([1, 2]);
|
||||
});
|
||||
|
||||
it('should show unpublish modal if unpublish button is clicked', async () => {
|
||||
@ -131,6 +131,6 @@ describe('BulkActionsBar', () => {
|
||||
);
|
||||
});
|
||||
|
||||
expect(onConfirmUnpublishAll).toHaveBeenCalledWith([]);
|
||||
expect(onConfirmUnpublishAll).toHaveBeenCalledWith([1, 2]);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user