[Glitch] Add dropdown for boost privacy in boost confirmation modal
Port 07b46cb332
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@ -31,6 +31,8 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
|
||||
title: PropTypes.string,
|
||||
value: PropTypes.string,
|
||||
onChange: PropTypes.func,
|
||||
noModal: PropTypes.bool,
|
||||
container: PropTypes.func,
|
||||
};
|
||||
|
||||
state = {
|
||||
@ -42,10 +44,10 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
|
||||
|
||||
// Toggles opening and closing the dropdown.
|
||||
handleToggle = ({ target, type }) => {
|
||||
const { onModalOpen } = this.props;
|
||||
const { onModalOpen, noModal } = this.props;
|
||||
const { open } = this.state;
|
||||
|
||||
if (isUserTouching()) {
|
||||
if (!noModal && isUserTouching()) {
|
||||
if (this.state.open) {
|
||||
this.props.onModalClose();
|
||||
} else {
|
||||
@ -183,6 +185,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
|
||||
items,
|
||||
onChange,
|
||||
value,
|
||||
container,
|
||||
} = this.props;
|
||||
const { open, placement } = this.state;
|
||||
const computedClass = classNames('composer--options--dropdown', {
|
||||
@ -219,6 +222,7 @@ export default class ComposerOptionsDropdown extends React.PureComponent {
|
||||
placement={placement}
|
||||
show={open}
|
||||
target={this}
|
||||
container={container}
|
||||
>
|
||||
<DropdownMenu
|
||||
items={items}
|
||||
|
@ -53,12 +53,13 @@ class PrivacyDropdown extends React.PureComponent {
|
||||
value: PropTypes.string.isRequired,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
noDirect: PropTypes.bool,
|
||||
noModal: PropTypes.bool,
|
||||
container: PropTypes.func,
|
||||
intl: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
render () {
|
||||
const { value, onChange, onModalOpen, onModalClose, disabled, intl } = this.props;
|
||||
const { value, onChange, onModalOpen, onModalClose, disabled, noDirect, noModal, container, intl } = this.props;
|
||||
|
||||
// We predefine our privacy items so that we can easily pick the
|
||||
// dropdown icon later.
|
||||
@ -89,7 +90,11 @@ class PrivacyDropdown extends React.PureComponent {
|
||||
},
|
||||
};
|
||||
|
||||
const items = [privacyItems.public, privacyItems.unlisted, privacyItems.private, privacyItems.direct];
|
||||
const items = [privacyItems.public, privacyItems.unlisted, privacyItems.private];
|
||||
|
||||
if (!noDirect) {
|
||||
items.push(privacyItems.direct);
|
||||
}
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
@ -100,6 +105,8 @@ class PrivacyDropdown extends React.PureComponent {
|
||||
onModalClose={onModalClose}
|
||||
onModalOpen={onModalOpen}
|
||||
title={intl.formatMessage(messages.change_privacy)}
|
||||
container={container}
|
||||
noModal={noModal}
|
||||
value={value}
|
||||
/>
|
||||
);
|
||||
|
Reference in New Issue
Block a user