toasts
This commit is contained in:
parent
a222d87830
commit
c44d2d7d14
@ -4,6 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.1.0/js/all.js"></script>
|
||||
<link rel="stylesheet" href="./node_modules/izitoast/dist/css/iziToast.min.css"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
const toast = require('izitoast');
|
||||
|
||||
function registerEvents(registry, events) {
|
||||
function setCryps(cryps) {
|
||||
console.log('setting cryps');
|
||||
|
||||
@ -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: [
|
||||
['<input type="text">', 'keyup', function (instance, toast, input, e) {
|
||||
console.info(input.value);
|
||||
}, true], // true to focus
|
||||
['<input type="text">', 'change', function (instance, toast, select, e) {
|
||||
console.info(select.options[select.selectedIndex].value);
|
||||
}]
|
||||
],
|
||||
buttons: [
|
||||
['<button><b>Confirm</b></button>', 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' } });
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user