diff --git a/html-client/src/components/cryp.list.component.jsx b/html-client/src/components/cryp.list.component.jsx index b42a8789..dce35b9d 100644 --- a/html-client/src/components/cryp.list.component.jsx +++ b/html-client/src/components/cryp.list.component.jsx @@ -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 => { diff --git a/html-client/src/reducers.jsx b/html-client/src/reducers.jsx index 7f5c6258..e54c41a1 100644 --- a/html-client/src/reducers.jsx +++ b/html-client/src/reducers.jsx @@ -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: diff --git a/html-client/src/socket.jsx b/html-client/src/socket.jsx index a51093e4..cc77a7c9 100644 --- a/html-client/src/socket.jsx +++ b/html-client/src/socket.jsx @@ -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); });