Create EditFederationModal

This commit is contained in:
Alex Gleason 2021-07-26 15:07:35 -05:00
parent 846b73eb9d
commit 6c4be4a515
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
3 changed files with 59 additions and 0 deletions

View file

@ -0,0 +1,51 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import { SimpleForm, Checkbox } from 'soapbox/features/forms';
import { makeGetRemoteInstance } from 'soapbox/selectors';
const getRemoteInstance = makeGetRemoteInstance();
const mapStateToProps = (state, { host }) => {
return {
remoteInstance: getRemoteInstance(state, host),
};
};
export default @connect(mapStateToProps)
class EditFederationModal extends React.PureComponent {
static propTypes = {
host: PropTypes.string.isRequired,
remoteInstance: ImmutablePropTypes.map,
};
render() {
const { remoteInstance } = this.props;
const {
avatar_removal,
banner_removal,
federated_timeline_removal,
followers_only,
media_nsfw,
media_removal,
reject,
} = remoteInstance.get('federation').toJS();
return (
<div className='modal-root__modal edit-federation-modal'>
<h3>{remoteInstance.get('host')}</h3>
<SimpleForm>
<Checkbox label='reject' checked={reject} />
<Checkbox label='media removal' checked={avatar_removal && banner_removal && media_removal} />
<Checkbox label='force nsfw' checked={media_nsfw} />
<Checkbox label='unlisted' checked={federated_timeline_removal} />
<Checkbox label='followers only' checked={followers_only} />
</SimpleForm>
</div>
);
}
}

View file

@ -15,6 +15,7 @@ import HotkeysModal from './hotkeys_modal';
import ComposeModal from './compose_modal';
import UnauthorizedModal from './unauthorized_modal';
import CryptoDonateModal from './crypto_donate_modal';
import EditFederationModal from './edit_federation_modal';
import {
MuteModal,
@ -41,6 +42,7 @@ const MODAL_COMPONENTS = {
'COMPOSE': () => Promise.resolve({ default: ComposeModal }),
'UNAUTHORIZED': () => Promise.resolve({ default: UnauthorizedModal }),
'CRYPTO_DONATE': () => Promise.resolve({ default: CryptoDonateModal }),
'EDIT_FEDERATION': () => Promise.resolve({ default: EditFederationModal }),
};
export default class ModalRoot extends React.PureComponent {

View file

@ -63,3 +63,9 @@
}
}
}
.edit-federation-modal {
background: var(--foreground-color);
border-radius: 8px;
padding: 20px;
}