forked from strapi/strapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
draft: bulk release injection zone added
- Loading branch information
1 parent
0c3bbf6
commit 2d9e887
Showing
7 changed files
with
70 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
packages/core/content-releases/admin/src/components/CMBulkRelease.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as React from 'react'; | ||
|
||
import { Button } from '@strapi/design-system'; | ||
import { useCMEditViewDataManager, CheckPermissions } from '@strapi/helper-plugin'; | ||
import { Common } from '@strapi/types'; | ||
import { useIntl } from 'react-intl'; | ||
|
||
import { PERMISSIONS } from '../constants'; | ||
|
||
import { AddActionToReleaseModal } from './CMReleasesContainer'; | ||
|
||
export const CMBulkRelease = () => { | ||
const [isModalOpen, setIsModalOpen] = React.useState(false); | ||
const { formatMessage } = useIntl(); | ||
//TODO: find a way to get entryIds and contentTypeUid | ||
const { | ||
initialData: { id: entryId }, | ||
slug, | ||
} = useCMEditViewDataManager(); | ||
|
||
const contentTypeUid = slug as Common.UID.ContentType; | ||
|
||
const toggleAddToReleaseDialog = () => { | ||
if (isModalOpen) { | ||
setIsModalOpen(false); | ||
} else { | ||
setIsModalOpen(true); | ||
} | ||
}; | ||
|
||
return ( | ||
<CheckPermissions permissions={PERMISSIONS.createAction}> | ||
<Button variant="tertiary" onClick={toggleAddToReleaseDialog}> | ||
{formatMessage({ | ||
id: 'content-releases.content-manager-list-view.add-to-release', | ||
defaultMessage: 'Add to release', | ||
})} | ||
</Button> | ||
{isModalOpen && ( | ||
<AddActionToReleaseModal | ||
handleClose={() => setIsModalOpen(false)} | ||
contentTypeUid={contentTypeUid} | ||
entryId={entryId} | ||
/> | ||
)} | ||
</CheckPermissions> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters