Skip to content

Commit

Permalink
avoid circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaskikutis committed Oct 28, 2024
1 parent 555342c commit 8741a9d
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions client/utils/confirmAddingRelatedItems.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import {Spacer, Modal, Button} from 'superdesk-ui-framework/react';
import {superdeskApi} from '../superdeskApi';
import {ConfirmationModal} from '../components';

export function confirmAddingRelatedItems(
warnings: Array<string>,
Expand Down Expand Up @@ -51,30 +50,35 @@ export function confirmAddingRelatedItems(
);
} else {
return (
<ConfirmationModal
handleHide={closeAndReject}
modalProps={{
// if warnings exist, but some items can still be added, then {{total}} is >= 2
// thus gettextPlural doesn't need to be used
title: gettext(
<Modal
visible
onHide={closeAndReject}
headerTemplate={
gettext(
'{{some}} of {{total}} items can not be added as related',
{
total: attemptedToAdd,
some: attemptedToAdd - canBeAdded,
},
),

body: issuesJSX,
onCancel: closeAndReject,
cancelText: gettext('Cancel'),
okText: gettextPlural(canBeAdded, 'Add 1 item', 'Add {{n}} items', {n: canBeAdded}),
action: () => {
options.closeModal();
)
}
footerTemplate={(
<Spacer h gap="4" justifyContent="end" noWrap>
<Button text={gettext('Cancel')} onClick={() => closeAndReject()} />
<Button
text={gettextPlural(canBeAdded, 'Add 1 item', 'Add {{n}} items', {n: canBeAdded})}
type="primary"
onClick={() => {
options.closeModal();

resolve();
},
}}
/>
resolve();
}}
/>
</Spacer>
)}
>
{issuesJSX}
</Modal>
);
}
});
Expand Down

0 comments on commit 8741a9d

Please sign in to comment.