Add button upload trads

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-02-19 09:27:06 +01:00
parent a085c87cc1
commit f179b9cf5d
2 changed files with 18 additions and 3 deletions

View File

@ -15,12 +15,14 @@ import pluginId from '../../pluginId';
import stepper from './utils/stepper';
import init from './init';
import reducer, { initialState } from './reducer';
import getTrad from '../../utils/getTrad';
const ModalStepper = ({ isOpen, onToggle }) => {
const { formatMessage } = useGlobalContext();
const [reducerState, dispatch] = useReducer(reducer, initialState, init);
const { currentStep, filesToUpload } = reducerState.toJS();
const { Component, headerTradId, next, prev } = stepper[currentStep];
const filesToUploadLength = filesToUpload.length;
const addFilesToUpload = ({ target: { value } }) => {
dispatch({
@ -134,9 +136,20 @@ const ModalStepper = ({ isOpen, onToggle }) => {
<Button type="button" color="cancel" onClick={onToggle}>
{formatMessage({ id: 'app.components.Button.cancel' })}
</Button>
<Button type="button" color="success" onClick={handleUploadFiles}>
{formatMessage({ id: 'app.components.Button.cancel' })}
</Button>
{currentStep === 'upload' && (
<Button type="button" color="success" onClick={handleUploadFiles}>
{formatMessage(
{
id: getTrad(
`modal.upload-list.footer.button.${
filesToUploadLength > 1 ? 'plural' : 'singular'
}`
),
},
{ number: filesToUploadLength }
)}
</Button>
)}
</section>
</ModalFooter>
</Modal>

View File

@ -16,6 +16,8 @@
"modal.upload-list.sub-header-title.singular": "{number} asset selected",
"modal.upload-list.sub-header-subtitle": "Manage the assets before adding them to the Media Library",
"modal.upload-list.sub-header.button": "Add more assets",
"modal.upload-list.footer.button.singular": "Upload {number} asset to the library",
"modal.upload-list.footer.button.plural": "Upload {number} assets to the library",
"plugin.name": "Media Library",
"plugin.description.long": "Media file management.",
"plugin.description.short": "Media file management.",