mirror of
https://github.com/wassname/talk.git
synced 2026-07-18 12:40:13 +08:00
Show notification on success
This commit is contained in:
@@ -38,7 +38,7 @@ export default class Snackbar {
|
||||
}
|
||||
|
||||
alert(message) {
|
||||
const [type, text] = message.split('|');
|
||||
const {type, text} = JSON.parse(message);
|
||||
this.el.style.transform = 'translate(-50%, 20px)';
|
||||
this.el.style.opacity = 0;
|
||||
this.el.className = `coral-notif-${type}`;
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
*/
|
||||
export function createNotificationService(pym) {
|
||||
return {
|
||||
success(msg) {
|
||||
pym.sendMessage('coral-alert', `success|${msg}`);
|
||||
success(text) {
|
||||
pym.sendMessage('coral-alert', JSON.stringify({kind: 'success', text}));
|
||||
},
|
||||
error(msg) {
|
||||
pym.sendMessage('coral-alert', `error|${msg}`);
|
||||
error(text) {
|
||||
pym.sendMessage('coral-alert', JSON.stringify({kind: 'error', text}));
|
||||
},
|
||||
info(msg) {
|
||||
pym.sendMessage('coral-alert', `info|${msg}`);
|
||||
info(text) {
|
||||
pym.sendMessage('coral-alert', JSON.stringify({kind: 'info', text}));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export {addNotification} from 'coral-framework/actions/notification';
|
||||
export {notify} from 'coral-framework/actions/notification';
|
||||
|
||||
@@ -4,11 +4,14 @@ import {compose, gql} from 'react-apollo';
|
||||
import {connect, withFragments, withIgnoreUser} from 'plugin-api/beta/client/hocs';
|
||||
import {bindActionCreators} from 'redux';
|
||||
import {closeMenu} from 'plugins/talk-plugin-author-menu/client/actions';
|
||||
import {notify} from 'plugin-api/beta/client/actions/notification';
|
||||
import {t} from 'plugin-api/beta/client/services';
|
||||
|
||||
class IgnoreUserConfirmationContainer extends React.Component {
|
||||
|
||||
ignoreUser = () => {
|
||||
this.props.ignoreUser(this.props.comment.user.id);
|
||||
this.props.notify('success', t('talk-plugin-ignore-user.notify_success', this.props.comment.user.username));
|
||||
this.props.closeMenu();
|
||||
};
|
||||
|
||||
@@ -28,6 +31,7 @@ class IgnoreUserConfirmationContainer extends React.Component {
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
bindActionCreators({
|
||||
closeMenu,
|
||||
notify,
|
||||
}, dispatch);
|
||||
|
||||
const withIgnoreUserConfirmationFragments = withFragments({
|
||||
|
||||
@@ -5,5 +5,7 @@ en:
|
||||
confirmation: |
|
||||
When you ignore a user, all comments they wrote on the site will be hidden from you. You can
|
||||
undo this later from My Profile.
|
||||
notify_success: |
|
||||
You are now ignoring {0}. You can undo this action from My Profile.
|
||||
es:
|
||||
talk-plugin-ignore-user:
|
||||
|
||||
Reference in New Issue
Block a user