re-enable recycling, distribution, network on frontend

This commit is contained in:
Anton Dyudin 2016-08-11 23:43:34 -07:00
parent 786bce0a79
commit 0bcee08dc3

View File

@ -20,8 +20,8 @@ module.exports = {
tik: "~" + tick
}, (function(_this) {
return function(err, arg1) {
var status;
status = arg1.status;
var data, status;
status = arg1.status, data = arg1.data;
if (status !== 200) {
throw new Error("Server error: " + (JSON.stringify(data)));
}
@ -193,8 +193,8 @@ WombStore.dispatchToken = WombDispatcher.register(function(action) {
module.exports = WombStore;
},{"./Dispatcher.coffee":2,"./util.coffee":15,"events":17}],5:[function(require,module,exports){
var Actions, Balance, FromStore, History, Label, Mail, PassInput, Planets, SHOP, Scry, Shop, Stars, b, clas, code, div, h3, h6, name, p, recl, ref, rele, span;
},{"./Dispatcher.coffee":2,"./util.coffee":18,"events":20}],5:[function(require,module,exports){
var Actions, Balance, FromStore, History, InfoBox, Label, Mail, PassInput, Planets, Recycling, SHOP, Scry, Shop, Stars, b, clas, code, div, h3, h6, name, p, recl, ref, rele, span;
clas = require('classnames');
@ -204,10 +204,14 @@ FromStore = (Scry = require('./Scry.coffee')).FromStore;
Label = require('./Label.coffee');
InfoBox = require('./InfoBox.coffee');
Shop = require('./Shop.coffee');
PassInput = require('./PassInput.coffee');
Recycling = require('./Recycling.coffee');
recl = React.createClass;
rele = React.createElement;
@ -220,7 +224,7 @@ name = function(displayName, component) {
ref = React.DOM, div = ref.div, b = ref.b, h3 = ref.h3, h6 = ref.h6, p = ref.p, span = ref.span, code = ref.code;
SHOP = false;
SHOP = true;
if (!SHOP) {
Shop = function(type, length) {
@ -283,11 +287,11 @@ module.exports = name("Claim", FromStore("pass", function(arg) {
onInputPass: Actions.setPasscode
}), pass ? rele(Balance, {
pass: pass
}) : void 0);
}) : rele(InfoBox, {}, "What if I have an old ticket?", "Old tickets can be converted to a balance:", rele(Recycling, {})));
}));
},{"../Actions.coffee":1,"./Label.coffee":7,"./PassInput.coffee":9,"./Scry.coffee":10,"./Shop.coffee":13,"classnames":16}],6:[function(require,module,exports){
},{"../Actions.coffee":1,"./InfoBox.coffee":7,"./Label.coffee":8,"./PassInput.coffee":11,"./Recycling.coffee":12,"./Scry.coffee":13,"./Shop.coffee":16,"classnames":19}],6:[function(require,module,exports){
var Actions, ClaimButton, FromStore, Label, ShipInput, _ClaimButton, button, name, recl, rele;
Actions = require('../Actions.coffee');
@ -348,7 +352,42 @@ _ClaimButton = FromStore("claim/:ship", function(arg) {
module.exports = name("ClaimButton", ClaimButton);
},{"../Actions.coffee":1,"./Label.coffee":7,"./Scry.coffee":10,"./ShipInput.coffee":11}],7:[function(require,module,exports){
},{"../Actions.coffee":1,"./Label.coffee":8,"./Scry.coffee":13,"./ShipInput.coffee":14}],7:[function(require,module,exports){
var a, div, recl, ref,
slice = [].slice;
ref = React.DOM, a = ref.a, div = ref.div;
recl = React.createClass;
module.exports = recl({
displayName: "InfoBox",
getInitialState: function() {
return {
expanded: false
};
},
onClick: function() {
return this.setState({
expanded: !this.state.expanded
});
},
render: function() {
var contents, expanded, prompt, ref1;
expanded = this.state.expanded;
ref1 = this.props.children, prompt = ref1[0], contents = 2 <= ref1.length ? slice.call(ref1, 1) : [];
return div({
className: "info"
}, a({
onClick: this.onClick
}, prompt), expanded ? div.apply(null, [{
"info contents": "info contents"
}].concat(slice.call(contents))) : void 0);
}
});
},{}],8:[function(require,module,exports){
var span;
span = React.DOM.span;
@ -363,8 +402,38 @@ module.exports = function(s, type) {
};
},{}],8:[function(require,module,exports){
var Claim, NET, Ships, div, h3, ref, rele;
},{}],9:[function(require,module,exports){
var input, mailShape, name, recl;
mailShape = require('../util.coffee').mailShape;
input = React.DOM.input;
recl = React.createClass;
name = function(displayName, component) {
return _.extend(component, {
displayName: displayName
});
};
module.exports = name("MailInput", function(arg) {
var onInputMail;
onInputMail = arg.onInputMail;
return input({
placeholder: "me@example.com",
onChange: function(arg1) {
var mail, target;
target = arg1.target;
mail = target.value.trim();
return onInputMail((mailShape(mail) ? mail : void 0));
}
});
});
},{"../util.coffee":18}],10:[function(require,module,exports){
var Claim, NET, Ships, div, h3, h4, ref, rele;
Claim = require('./Claim.coffee');
@ -372,9 +441,9 @@ Ships = require('./Ships.coffee');
rele = React.createElement;
NET = false;
NET = true;
ref = React.DOM, div = ref.div, h3 = ref.h3;
ref = React.DOM, div = ref.div, h3 = ref.h3, h4 = ref.h4;
module.exports = function() {
return div({}, h3({
@ -386,7 +455,7 @@ module.exports = function() {
};
},{"./Claim.coffee":5,"./Ships.coffee":12}],9:[function(require,module,exports){
},{"./Claim.coffee":5,"./Ships.coffee":15}],11:[function(require,module,exports){
var input, name, recl, uvShape;
uvShape = require('../util.coffee').uvShape;
@ -421,7 +490,128 @@ module.exports = name("PassInput", function(arg) {
});
},{"../util.coffee":15}],10:[function(require,module,exports){
},{"../util.coffee":18}],12:[function(require,module,exports){
var Actions, Label, MailInput, RecycleButton, RecycleTicket, Recycling, Scry, ShipInput, a, button, div, name, recl, ref, rele, span;
Actions = require('../Actions.coffee');
Scry = require('./Scry.coffee');
Label = require('./Label.coffee');
ShipInput = require('./ShipInput.coffee');
MailInput = require('./MailInput.coffee');
ref = React.DOM, a = ref.a, div = ref.div, span = ref.span, button = ref.button;
recl = React.createClass;
rele = React.createElement;
name = function(displayName, component) {
return _.extend(component, {
displayName: displayName
});
};
RecycleButton = name("RecycleButton", function(arg) {
var disabled, onClick;
disabled = arg.disabled, onClick = arg.onClick;
if (!disabled) {
return button({
onClick: onClick
}, "Exchange");
} else {
return button({
disabled: disabled
}, "Exchange (email required)");
}
});
RecycleTicket = name("RecycleTicket", Scry("/ticket/~:ship/~:tick", function(arg) {
var doRecycle, mail, passcode, ref1, ship, status, tick;
ship = arg.ship, tick = arg.tick, mail = arg.mail, (ref1 = arg.ticket, passcode = ref1.passcode, status = ref1.status);
doRecycle = function() {
return Actions.recycleTicket({
ship: ship,
tick: tick,
mail: mail
}, passcode);
};
switch (status != null ? status : "fail") {
case "fail":
return Label("Bad ticket", "warning");
case "good":
return rele(RecycleButton, {
disabled: !mail,
onClick: doRecycle
});
case "used":
return span({}, a({
onClick: function() {
return Actions.setPasscode(passcode);
}
}, passcode), Label("Ticket exchanged", "info"));
default:
throw new Error("Bad ticket status: " + status);
}
}));
Recycling = recl({
getInitialState: function() {
return {
ship: "",
tick: "",
mail: ""
};
},
render: function() {
var getMail, getShip, getTick, mail, ref1, ship, tick;
getShip = rele(ShipInput, {
length: 14,
oldFormat: true,
onInputShip: (function(_this) {
return function(ship) {
return _this.setState({
ship: ship
});
};
})(this)
});
getTick = rele(ShipInput, {
length: 28,
oldFormat: true,
onInputShip: (function(_this) {
return function(tick) {
return _this.setState({
tick: tick
});
};
})(this)
});
getMail = rele(MailInput, {
onInputMail: (function(_this) {
return function(mail) {
return _this.setState({
mail: mail
});
};
})(this)
});
ref1 = this.state, ship = ref1.ship, tick = ref1.tick, mail = ref1.mail;
return div({}, div({}, "Planet", getShip, (ship ? Label("✓", "success") : void 0)), div({}, "Ticket", getTick, (tick ? Label("✓", "success") : void 0)), div({}, "Email", getMail, (mail ? Label("✓", "success") : void 0)), ship && tick ? rele(RecycleTicket, {
ship: ship,
tick: tick,
mail: mail
}) : void 0);
}
});
module.exports = name("Recycling", Recycling);
},{"../Actions.coffee":1,"./Label.coffee":8,"./MailInput.coffee":9,"./Scry.coffee":13,"./ShipInput.coffee":14}],13:[function(require,module,exports){
var Actions, FromStore, Scry, Store, div, i, recl, ref, rele;
Actions = require('../Actions.coffee');
@ -505,8 +695,12 @@ Scry = function(path, Child) {
display: "inline"
}
}, !this.props.loaded ? i({
key: "load"
}, "Fetching data...") : rele(Child, _.extend({}, this.props, {
key: "load",
style: {
marginTop: '1rem',
display: 'block'
}
}, "Loading...") : rele(Child, _.extend({}, this.props, {
key: "got"
}), this.props.children));
}
@ -518,7 +712,7 @@ module.exports = Scry;
module.exports.FromStore = FromStore;
},{"../Actions.coffee":1,"../Store.coffee":4}],11:[function(require,module,exports){
},{"../Actions.coffee":1,"../Store.coffee":4}],14:[function(require,module,exports){
var input, name, recl, shipShape;
shipShape = require('../util.coffee').shipShape;
@ -534,8 +728,8 @@ name = function(displayName, component) {
};
module.exports = name("ShipInput", function(arg) {
var defaultValue, length, onInputShip;
onInputShip = arg.onInputShip, length = arg.length, defaultValue = arg.defaultValue;
var defaultValue, length, oldFormat, onInputShip;
onInputShip = arg.onInputShip, length = arg.length, defaultValue = arg.defaultValue, oldFormat = arg.oldFormat;
return input({
defaultValue: defaultValue,
onChange: function(arg1) {
@ -545,13 +739,13 @@ module.exports = name("ShipInput", function(arg) {
if (ship[0] !== '~') {
ship = "~" + ship;
}
return onInputShip(((shipShape(ship)) && ship.length === length ? ship.slice(1) : void 0));
return onInputShip(((shipShape(ship, oldFormat)) && ship.length === length ? ship.slice(1) : void 0));
}
});
});
},{"../util.coffee":15}],12:[function(require,module,exports){
},{"../util.coffee":18}],15:[function(require,module,exports){
var Label, Scry, Stat, clas, code, div, labels, li, name, p, pre, recl, ref, rele, span, ul;
clas = require('classnames');
@ -620,7 +814,7 @@ Stat = name("Stat", function(arg) {
module.exports = Scry("/stats", Stat);
},{"./Label.coffee":7,"./Scry.coffee":10,"classnames":16}],13:[function(require,module,exports){
},{"./Label.coffee":8,"./Scry.coffee":13,"classnames":19}],16:[function(require,module,exports){
var ClaimButton, Scry, ShipInput, Shop, ShopShips, button, div, h6, li, recl, ref, rele, span, ul;
Scry = require('./Scry.coffee');
@ -697,7 +891,7 @@ Shop = function(type, length) {
module.exports = Shop;
},{"./ClaimButton.coffee":6,"./Scry.coffee":10,"./ShipInput.coffee":11}],14:[function(require,module,exports){
},{"./ClaimButton.coffee":6,"./Scry.coffee":13,"./ShipInput.coffee":14}],17:[function(require,module,exports){
var MainComponent, TreeActions;
MainComponent = require('./components/Main.coffee');
@ -707,13 +901,15 @@ TreeActions = window.tree.actions;
TreeActions.registerComponent("womb", MainComponent);
},{"./components/Main.coffee":8}],15:[function(require,module,exports){
var PO, SHIPSHAPE,
},{"./components/Main.coffee":10}],18:[function(require,module,exports){
var PO, PO_old, SHIPSHAPE,
slice = [].slice;
SHIPSHAPE = /^~?([a-z]{3}|[a-z]{6}(-[a-z]{6}){0,3}|[a-z]{6}(-[a-z]{6}){3}(--[a-z]{6}(-[a-z]{6}){3})+)$/;
PO = 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\nrigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\nholpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\nlosdilforpilramtirwintadbicdifrocwidbisdasmidlop\nrilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\nritpodmottamtolsavposnapnopsomfinfonbanporworsip\nronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\nsivtagpadsaldivdactansidfabtarmonranniswolmispal\nlasdismaprabtobrollatlonnodnavfignomnibpagsopral\nbilhaddocridmocpacravripfaltodtiltinhapmicfanpat\ntaclabmogsimsonpinlomrictapfirhasbosbatpochactid\nhavsaplindibhosdabbitbarracparloddosbortochilmac\ntomdigfilfasmithobharmighinradmashalraglagfadtop\nmophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\nnimlarfitwalrapsarnalmoslandondanladdovrivbacpol\nlaptalpitnambonrostonfodponsovnocsorlavmatmipfap\n\nzodnecbudwessevpersutletfulpensytdurwepserwylsun\nrypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\nlunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\npyldulhetmevruttylwydtepbesdexsefwycburderneppur\nrysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\nsecmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\nselrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\nsyptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\nlytdusnebrumtynseglyxpunresredfunrevrefmectedrus\nbexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\ntenlusnussyltecmexpubrymtucfyllepdebbermughuttun\nbylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\nwedducfurfexnulluclennerlexrupnedlecrydlydfenwel\nnydhusrelrudneshesfetdesretdunlernyrsebhulryllud\nremlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\nlyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes';
PO_old = 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\nrigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\nholpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\nlosdilforpilramtirwintadbicdifrocwidbisdasmidlop\nrilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\nritpodmottamtolsavposnapnopsomfinfonbanporworsip\nronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\nsivtagpadsaldivdactansidfabtarmonranniswolmispal\nlasdismaprabtobrollatlonnodnavfignomnibpagsopral\nbilhaddocridmocpacravripfaltodtiltinhapmicfanpat\ntaclabmogsimsonpinlomrictapfirhasbosbatpochactid\nhavsaplindibhosdabbitbarracparloddosbortochilmac\ntomdigfilfasmithobharmighinradmashalraglagfadtop\nmophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\nnimlarfitwalrapsarnalmoslandondanladdovrivbacpol\nlaptalpitnambonrostonfodponsovnocsorlavmatmipfap\n\nzodnecbudwessevpersutletfulpensytdurwepserwylsun\nrypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\nlunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\npyldulhetmevruttylwydtepbesdexsefwycburderneppur\nrysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\nsecmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\nselrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\nsyptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\nlytdusnebrumtynseglyxpunresredfunrevrefmectedrus\nbexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\ntenlusnussyltecmexpubrymtucfyllepdebbermughuttun\nbylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\nwedducfurfexnulluclennerlexrupnedlecrydlydfenwel\nnydhusrelrudneshesfetdesretdunlernyrsebhulryllud\nremlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\nlyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes';
PO = 'dozmarbinwansamlitsighidfidlissogdirwacsabwissib\nrigsoldopmodfoglidhopdardorlorhodfolrintogsilmir\nholpaslacrovlivdalsatlibtabhanticpidtorbolfosdot\nlosdilforpilramtirwintadbicdifrocwidbisdasmidlop\nrilnardapmolsanlocnovsitnidtipsicropwitnatpanmin\nritpodmottamtolsavposnapnopsomfinfonbandorworsip\nronnorbotwicsocwatdolmagpicdavbidbaltimtasmallig\nsivtagpadsaldivdactansidfabtarmonranniswolmispal\nlasdismaprabtobrollatlonnodnavfignomnibpagsopral\nbilhaddocridmocpacravripfaltodtiltinhapmicfanpat\ntaclabmogsimsonpinlomrictapfirhasbosbatpochactid\nhavsaplindibhosdabbitbarracparloddosbortochilmac\ntomdigfilfasmithobharmighinradmashalraglagfadtop\nmophabnilnosmilfopfamdatnoldinhatnacrisfotribhoc\nnimlarfitwalrapsarnalmoslandondanladdovrivbacpol\nlaptalpitnambonrostonfodponsovnocsorlavmatmipfip\n\nzodnecbudwessevpersutletfulpensytdurwepserwylsun\nrypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnex\nlunmeplutseppesdelsulpedtemledtulmetwenbynhexfeb\npyldulhetmevruttylwydtepbesdexsefwycburderneppur\nrysrebdennutsubpetrulsynregtydsupsemwynrecmegnet\nsecmulnymtevwebsummutnyxrextebfushepbenmuswyxsym\nselrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpel\nsyptermebsetdutdegtexsurfeltudnuxruxrenwytnubmed\nlytdusnebrumtynseglyxpunresredfunrevrefmectedrus\nbexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermer\ntenlusnussyltecmexpubrymtucfyllepdebbermughuttun\nbylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmyl\nwedducfurfexnulluclennerlexrupnedlecrydlydfenwel\nnydhusrelrudneshesfetdesretdunlernyrsebhulryllud\nremlysfynwerrycsugnysnyllyndyndemluxfedsedbecmun\nlyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes';
module.exports = {
unpackFrond: function(a) {
@ -727,9 +923,12 @@ module.exports = {
uvShape: function(a) {
return (a.slice(0, 2) === "0v") && /^[0-9a-v]{1,5}(\.[0-9a-v]{5})*$/.test(a.slice(2));
},
shipShape: function(a) {
shipShape: function(a, old) {
if (old == null) {
old = false;
}
return (SHIPSHAPE.test(a)) && _.all(a.match(/[a-z]{3}/g), function(b) {
return -1 !== PO.indexOf(b);
return -1 !== (old ? PO_old : PO).indexOf(b);
});
},
mailShape: function(a) {
@ -739,7 +938,7 @@ module.exports = {
};
},{}],16:[function(require,module,exports){
},{}],19:[function(require,module,exports){
/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
@ -789,7 +988,7 @@ module.exports = {
}
}());
},{}],17:[function(require,module,exports){
},{}],20:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@ -1089,4 +1288,4 @@ function isUndefined(arg) {
return arg === void 0;
}
},{}]},{},[14]);
},{}]},{},[17]);