Fix Copy to Clipboard Snackbar
This commit is contained in:
@@ -27,3 +27,4 @@ export signerReducer from './signerReducer';
|
||||
export statusReducer from './statusReducer';
|
||||
export blockchainReducer from './blockchainReducer';
|
||||
export compilerReducer from './compilerReducer';
|
||||
export snackbarReducer from './snackbarReducer';
|
||||
|
||||
34
js/src/redux/providers/snackbarActions.js
Normal file
34
js/src/redux/providers/snackbarActions.js
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
export function showSnackbar (message, cooldown) {
|
||||
return (dispatch, getState) => {
|
||||
dispatch(openSnackbar(message, cooldown));
|
||||
};
|
||||
}
|
||||
|
||||
function openSnackbar (message, cooldown) {
|
||||
return {
|
||||
type: 'openSnackbar',
|
||||
message, cooldown
|
||||
};
|
||||
}
|
||||
|
||||
export function closeSnackbar () {
|
||||
return {
|
||||
type: 'closeSnackbar'
|
||||
};
|
||||
}
|
||||
44
js/src/redux/providers/snackbarReducer.js
Normal file
44
js/src/redux/providers/snackbarReducer.js
Normal file
@@ -0,0 +1,44 @@
|
||||
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
||||
// This file is part of Parity.
|
||||
|
||||
// Parity is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Parity is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { handleActions } from 'redux-actions';
|
||||
|
||||
const initialState = {
|
||||
open: false,
|
||||
message: '',
|
||||
cooldown: 1000
|
||||
};
|
||||
|
||||
export default handleActions({
|
||||
openSnackbar (state, action) {
|
||||
const { message, cooldown } = action;
|
||||
|
||||
return {
|
||||
...state,
|
||||
open: true,
|
||||
cooldown: cooldown || state.cooldown,
|
||||
message
|
||||
};
|
||||
},
|
||||
|
||||
closeSnackbar (state) {
|
||||
return {
|
||||
...state,
|
||||
open: false,
|
||||
cooldown: initialState.cooldown
|
||||
};
|
||||
}
|
||||
}, initialState);
|
||||
@@ -17,7 +17,7 @@
|
||||
import { combineReducers } from 'redux';
|
||||
import { routerReducer } from 'react-router-redux';
|
||||
|
||||
import { apiReducer, balancesReducer, blockchainReducer, compilerReducer, imagesReducer, personalReducer, signerReducer, statusReducer as nodeStatusReducer } from './providers';
|
||||
import { apiReducer, balancesReducer, blockchainReducer, compilerReducer, imagesReducer, personalReducer, signerReducer, statusReducer as nodeStatusReducer, snackbarReducer } from './providers';
|
||||
|
||||
import { errorReducer } from '../ui/Errors';
|
||||
import { settingsReducer } from '../views/Settings';
|
||||
@@ -37,6 +37,7 @@ export default function () {
|
||||
images: imagesReducer,
|
||||
nodeStatus: nodeStatusReducer,
|
||||
personal: personalReducer,
|
||||
signer: signerReducer
|
||||
signer: signerReducer,
|
||||
snackbar: snackbarReducer
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user