Merge branch 'develop' of ssh://mnml.gg:40022/~/mnml into develop
This commit is contained in:
commit
b03afb41b2
@ -1,8 +1,25 @@
|
|||||||
const { connect } = require('preact-redux');
|
const { connect } = require('preact-redux');
|
||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
|
const toast = require('izitoast');
|
||||||
|
|
||||||
const actions = require('./../actions');
|
const actions = require('./../actions');
|
||||||
|
|
||||||
|
const balanceError = () =>
|
||||||
|
toast.error({
|
||||||
|
theme: 'dark',
|
||||||
|
color: 'black',
|
||||||
|
timeout: false,
|
||||||
|
drag: false,
|
||||||
|
position: 'center',
|
||||||
|
maxWidth: window.innerWidth / 2,
|
||||||
|
close: false,
|
||||||
|
buttons: [
|
||||||
|
['<button type="submit">OK</button>',
|
||||||
|
(instance, thisToast) => instance.hide({ transitionOut: 'fadeOut' }, thisToast)],
|
||||||
|
],
|
||||||
|
message: 'Insufficient Balance',
|
||||||
|
});
|
||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
const {
|
const {
|
||||||
@ -23,8 +40,11 @@ const addState = connect(
|
|||||||
},
|
},
|
||||||
|
|
||||||
function receiveDispatch(dispatch) {
|
function receiveDispatch(dispatch) {
|
||||||
function setMtxActive(mtx) {
|
function setMtxActive(mtx, balance) {
|
||||||
|
if (balance === 0) return balanceError();
|
||||||
|
dispatch(actions.setConstructRename(null));
|
||||||
dispatch(actions.setMtxActive(mtx));
|
dispatch(actions.setMtxActive(mtx));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -37,7 +57,6 @@ function Inventory(args) {
|
|||||||
const {
|
const {
|
||||||
account,
|
account,
|
||||||
shop,
|
shop,
|
||||||
|
|
||||||
setMtxActive,
|
setMtxActive,
|
||||||
mtxBuy,
|
mtxBuy,
|
||||||
} = args;
|
} = args;
|
||||||
@ -45,7 +64,7 @@ function Inventory(args) {
|
|||||||
if (!shop) return false;
|
if (!shop) return false;
|
||||||
|
|
||||||
const useMtx = (item, i) => (
|
const useMtx = (item, i) => (
|
||||||
<figure key={i} onClick={() => setMtxActive(item)} >
|
<figure key={i} onClick={() => setMtxActive(item, account.balance)} >
|
||||||
<figcaption>{item}</figcaption>
|
<figcaption>{item}</figcaption>
|
||||||
<button>¤1</button>
|
<button>¤1</button>
|
||||||
</figure>
|
</figure>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
const { connect } = require('preact-redux');
|
const { connect } = require('preact-redux');
|
||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
|
|
||||||
const { stringSort, NULL_UUID, COLOURS } = require('./../utils');
|
const { stringSort } = require('./../utils');
|
||||||
const { ConstructAvatar } = require('./construct');
|
const { ConstructAvatar } = require('./construct');
|
||||||
const actions = require('./../actions');
|
const actions = require('./../actions');
|
||||||
const InstanceCreateForm = require('./instance.create.buttons');
|
const InstanceCreateForm = require('./instance.create.buttons');
|
||||||
@ -17,7 +17,6 @@ const addState = connect(
|
|||||||
constructRename,
|
constructRename,
|
||||||
team,
|
team,
|
||||||
instanceList,
|
instanceList,
|
||||||
account,
|
|
||||||
mtxActive,
|
mtxActive,
|
||||||
} = state;
|
} = state;
|
||||||
|
|
||||||
@ -28,16 +27,11 @@ const addState = connect(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendInstanceState(instance) {
|
|
||||||
return ws.sendInstanceState(instance.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendInstanceList() {
|
function sendInstanceList() {
|
||||||
return ws.sendInstanceList();
|
return ws.sendInstanceList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendConstructAvatarReroll(id) {
|
function sendConstructAvatarReroll(id) {
|
||||||
if (!mtxActive) return false;
|
|
||||||
console.log('using', mtxActive, 'on', id);
|
console.log('using', mtxActive, 'on', id);
|
||||||
return ws.sendMtxApply(id, mtxActive, '');
|
return ws.sendMtxApply(id, mtxActive, '');
|
||||||
}
|
}
|
||||||
@ -47,7 +41,6 @@ const addState = connect(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
account,
|
|
||||||
constructs,
|
constructs,
|
||||||
instanceList,
|
instanceList,
|
||||||
mtxActive,
|
mtxActive,
|
||||||
@ -55,7 +48,6 @@ const addState = connect(
|
|||||||
team,
|
team,
|
||||||
sendConstructRename,
|
sendConstructRename,
|
||||||
sendInstanceJoin,
|
sendInstanceJoin,
|
||||||
sendInstanceState,
|
|
||||||
sendInstanceList,
|
sendInstanceList,
|
||||||
sendConstructAvatarReroll,
|
sendConstructAvatarReroll,
|
||||||
};
|
};
|
||||||
@ -81,14 +73,12 @@ const addState = connect(
|
|||||||
|
|
||||||
function List(args) {
|
function List(args) {
|
||||||
const {
|
const {
|
||||||
account,
|
|
||||||
team,
|
team,
|
||||||
constructs,
|
constructs,
|
||||||
constructRename,
|
constructRename,
|
||||||
clearMtxRename,
|
clearMtxRename,
|
||||||
setConstructRename,
|
setConstructRename,
|
||||||
sendConstructRename,
|
sendConstructRename,
|
||||||
sendInstanceState,
|
|
||||||
sendInstanceJoin,
|
sendInstanceJoin,
|
||||||
sendInstanceList,
|
sendInstanceList,
|
||||||
instanceList,
|
instanceList,
|
||||||
@ -134,10 +124,6 @@ function List(args) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <div class="controls">
|
|
||||||
// <button>⚙</button>
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
const constructPanels = constructs
|
const constructPanels = constructs
|
||||||
.filter(c => team.includes(c.id))
|
.filter(c => team.includes(c.id))
|
||||||
.sort(idSort)
|
.sort(idSort)
|
||||||
@ -164,14 +150,13 @@ function List(args) {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!mtxActive) return false;
|
if (!mtxActive) return false;
|
||||||
if (mtxActive === 'Rename') return setConstructRename(construct.id);
|
if (mtxActive === 'Rename') return setConstructRename(construct.id);
|
||||||
sendConstructAvatarReroll(construct.id);
|
return sendConstructAvatarReroll(construct.id);
|
||||||
}}
|
}}
|
||||||
class="menu-construct" >
|
class="menu-construct" >
|
||||||
<ConstructAvatar construct={construct} />
|
<ConstructAvatar construct={construct} />
|
||||||
{constructName}
|
{constructName}
|
||||||
{confirm}
|
{confirm}
|
||||||
{cancel}
|
{cancel}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user