Trying to fix ban user dialog.

This commit is contained in:
gaba
2016-12-02 06:35:55 -08:00
parent c83f8eb188
commit 29f547d268
4 changed files with 17 additions and 21 deletions
+8 -3
View File
@@ -1,10 +1,15 @@
import actions from '../constants/users';
/**
* Action disptacher related to users
*/
// Dialog Actions
export const showBanUserDialog = () => ({type: 'SHOW_BANUSER_DIALOG'});
export const hideBanUserDialog = () => ({type: 'HIDE_BANUSER_DIALOG'});
// Dialog Actions
export const showBanUserDialog = () => (dispatch) => {
dispatch({type: actions.SHOW_BANUSER_DIALOG});
};
export const hideBanUserDialog = () => (dispatch) => {
dispatch({type: actions.HIDE_BANUSER_DIALOG});
};
export const banUser = (status, id, author_id) => (dispatch) => {
dispatch({type: 'USER_STATUS_UPDATE', id, author_id, status});
@@ -4,11 +4,10 @@ import styles from './BanUserDialog.css';
import BanUserDialogContent from './BanUserDialogContent';
const BanUserDialog = ({view, handleClose, ...props}) => (
<Dialog className={styles.dialog}>
const BanUserDialog = ({open, handleClose, ...props}) => (
<Dialog className={styles.dialog} open={open}>
<span className={styles.close} onClick={handleClose}>×</span>
{view === 'Ban' && <BanUserDialogContent {...props} />}
<BanUserDialogContent {...props} />
</Dialog>
);
export default BanUserDialog;
@@ -5,7 +5,7 @@ import I18n from 'coral-framework/modules/i18n/i18n';
import translations from '../translations';
const lang = new I18n(translations);
const BanUserDialogContent = ({...props}) => (
export const BanUserDialogContent = ({...props}) => (
<div>
<div className={styles.header}>
<h1>
@@ -30,5 +30,3 @@ const BanUserDialogContent = ({...props}) => (
</div>
</div>
);
export default BanUserDialogContent;
+5 -11
View File
@@ -6,14 +6,12 @@ import translations from '../translations.json';
import Linkify from 'react-linkify';
import {Icon} from 'react-mdl';
import {FabButton, Button} from 'coral-ui';
import BanUserDialog from './BanUserDialog';
// import {showBanUserDialog, hideBanUserDialog} from '../actions/users';
const linkify = new Linkify();
//
// const mapDispatchToProps = dispatch => ({
// showBanUserDialog: () => dispatch(showBanUserDialog()),
// handleClose: () => dispatch(hideBanUserDialog()),
// showBanUserDialog: () => actions.dispatch(showBanUserDialog(),
// handleClose: () => actions.hideBanUserDialog(),
// });
// handleClose() {
@@ -73,18 +71,14 @@ const getActionButton = (action, i, props) => {
// {...props.author.get('status') === 'banned' ? 'disabled' : 'raised'}
// key={i}
// onClick={() => props.onClickAction(props.actionsMap[action].status, props.comment.get('id'), props.author.get('id'))}>{lang.t('comment.ban_user')}</Button>
<div>
<Button
{...props.author.get('status') === 'banned' ? 'disabled' : 'raised'}
<div key={i}>
<Button {...props.author.get('status') === 'banned' ? 'disabled' : 'raised'}
cStyle="black"
onClick={props.showBanUserDialog}
key={i}
{...this.props} >
{...props} >
{lang.t('comment.ban_user')}
</Button>
<BanUserDialog
view='Ban'
/>
</div>
);
}