moar
This commit is contained in:
parent
5dbf348327
commit
f9582aeb8b
@ -17,11 +17,18 @@ function CrypList({ cryps, selectedCryps, setSelectedCryps }) {
|
||||
// redux limitation + suggested workaround
|
||||
// so much for dumb components
|
||||
function selectCryp(id) {
|
||||
if (selectedCryps.length < 3) {
|
||||
selectedCryps.push(id);
|
||||
// remove
|
||||
const i = selectedCryps.findIndex(sid => sid === id);
|
||||
if (i > -1) {
|
||||
selectedCryps[i] = null;
|
||||
return setSelectedCryps(selectedCryps);
|
||||
}
|
||||
return false;
|
||||
|
||||
// window insert
|
||||
const insert = selectedCryps.findIndex(j => j === null);
|
||||
if (insert === -1) return setSelectedCryps([id, null, null]);
|
||||
selectedCryps[insert] = id;
|
||||
return setSelectedCryps(selectedCryps);
|
||||
}
|
||||
|
||||
const crypPanels = cryps.sort(idSort).map(cryp => {
|
||||
|
||||
@ -50,7 +50,7 @@ function instanceReducer(state = defaultInstance, action) {
|
||||
}
|
||||
}
|
||||
|
||||
const defaultSelectedCryps = [];
|
||||
const defaultSelectedCryps = [null, null, null];
|
||||
function selectedCrypsReducer(state = defaultSelectedCryps, action) {
|
||||
switch (action.type) {
|
||||
case actions.SET_SELECTED_CRYPS:
|
||||
|
||||
@ -254,7 +254,7 @@ function createSocket(events) {
|
||||
ws.addEventListener('open', () => {
|
||||
toast.info({
|
||||
message: 'connected',
|
||||
position: 'topRight',
|
||||
position: 'topCenter',
|
||||
});
|
||||
|
||||
// if (!account) events.loginPrompt();
|
||||
@ -278,7 +278,7 @@ function createSocket(events) {
|
||||
console.error('WebSocket closed', event);
|
||||
toast.warning({
|
||||
message: 'disconnected',
|
||||
position: 'topRight',
|
||||
position: 'topCenter',
|
||||
});
|
||||
return setTimeout(connect, 5000);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user