diff --git a/client/index.html b/client/index.html index eebdb5ff..0b63e453 100644 --- a/client/index.html +++ b/client/index.html @@ -4,6 +4,7 @@ +
diff --git a/client/package.json b/client/package.json index 4a07d6cb..5bb82290 100755 --- a/client/package.json +++ b/client/package.json @@ -14,8 +14,8 @@ "dependencies": { "@orange-games/phaser-input": "^2.0.5", "borc": "^2.0.3", - "bulma-toast": "^1.2.0", "docco": "^0.7.0", + "izitoast": "^1.4.0", "jdenticon": "^2.1.0", "key": "^0.1.11", "keymaster": "^1.6.2", diff --git a/client/src/events.js b/client/src/events.js index b1692fcd..19d922cd 100644 --- a/client/src/events.js +++ b/client/src/events.js @@ -1,3 +1,5 @@ +const toast = require('izitoast'); + function registerEvents(registry, events) { function setCryps(cryps) { console.log('setting cryps'); diff --git a/client/src/socket.js b/client/src/socket.js index 5f5c2a21..469dc043 100644 --- a/client/src/socket.js +++ b/client/src/socket.js @@ -1,14 +1,13 @@ -const { toast } = require('bulma-toast'); +const toast = require('izitoast'); const cbor = require('borc'); const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://cryps.gg/ws' : 'ws://localhost:40000'; function errorToast(err) { console.error(err); - return toast({ + return toast.error({ + title: 'Error', message: err, - type: 'is-warning', - duration: 5000, }); } @@ -40,6 +39,36 @@ function createSocket(events) { // Connection opened ws.addEventListener('open', (event) => { + // toast.info({ + // message: 'connected', + // }); + + iziToast.question({ + drag: false, + close: false, + overlay: true, + title: 'Login', + message: 'Enter login details', + position: 'center', + inputs: [ + ['', 'keyup', function (instance, toast, input, e) { + console.info(input.value); + }, true], // true to focus + ['', 'change', function (instance, toast, select, e) { + console.info(select.options[select.selectedIndex].value); + }] + ], + buttons: [ + ['', function (instance, toast, button, e, inputs) { + + alert('First field: ' + inputs[0].value) + alert('Second field: ' + inputs[1].options[inputs[1].selectedIndex].value) + + instance.hide({ transitionOut: 'fadeOut' }, toast, 'button'); + }, false], // true to focus + ] + }); + send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } }); });