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