change some variables names on BulkACtionsBar

This commit is contained in:
Fernando Chavez 2023-05-03 13:57:17 +02:00 committed by Mark Kaylor
parent 41a69b07e2
commit a61b3cc902
2 changed files with 8 additions and 7 deletions

View File

@ -5,9 +5,10 @@ import { Check, ExclamationMarkCircle, Trash } from '@strapi/icons';
import { useIntl } from 'react-intl'; import { useIntl } from 'react-intl';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { useTracking } from '@strapi/helper-plugin'; import { useTracking } from '@strapi/helper-plugin';
import { listViewDomain } from '../../../pages/ListView/selectors'; import { useSelector } from 'react-redux';
import { getTrad } from '../../../utils'; import { getTrad } from '../../../utils';
import InjectionZoneList from '../../InjectionZoneList'; import InjectionZoneList from '../../InjectionZoneList';
import { listViewDomain } from '../../../pages/ListView/selectors';
const ConfirmBulkActionDialog = ({ onToggleDialog, isOpen, dialogBody, endAction }) => { const ConfirmBulkActionDialog = ({ onToggleDialog, isOpen, dialogBody, endAction }) => {
const { formatMessage } = useIntl(); const { formatMessage } = useIntl();
@ -191,9 +192,9 @@ const BulkActionsBar = ({
const [dialogToOpen, setDialogToOpen] = useState(null); const [dialogToOpen, setDialogToOpen] = useState(null);
const selectedEntriesObjects = data.filter((entry) => selectedEntries.includes(entry.id)); const selectedEntriesObjects = data.filter((entry) => selectedEntries.includes(entry.id));
const showPublishButton = const publishButtonIsShown =
showPublish && selectedEntriesObjects.some((entry) => !entry.publishedAt); showPublish && selectedEntriesObjects.some((entry) => !entry.publishedAt);
const showUnpublishButton = const unpublishButtonIsShown =
showPublish && selectedEntriesObjects.some((entry) => entry.publishedAt); showPublish && selectedEntriesObjects.some((entry) => entry.publishedAt);
const toggleDeleteModal = () => { const toggleDeleteModal = () => {
@ -242,7 +243,7 @@ const BulkActionsBar = ({
return ( return (
<> <>
{showPublishButton && ( {publishButtonIsShown && (
<> <>
<Button variant="tertiary" onClick={togglePublishModal}> <Button variant="tertiary" onClick={togglePublishModal}>
{formatMessage({ id: 'app.utils.publish', defaultMessage: 'Publish' })} {formatMessage({ id: 'app.utils.publish', defaultMessage: 'Publish' })}
@ -255,7 +256,7 @@ const BulkActionsBar = ({
/> />
</> </>
)} )}
{showUnpublishButton && ( {unpublishButtonIsShown && (
<> <>
<Button variant="tertiary" onClick={toggleUnpublishModal}> <Button variant="tertiary" onClick={toggleUnpublishModal}>
{formatMessage({ id: 'app.utils.unpublish', defaultMessage: 'Unpublish' })} {formatMessage({ id: 'app.utils.unpublish', defaultMessage: 'Unpublish' })}

View File

@ -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 () => { 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]);
}); });
}); });