extracts Chest module, pulling out Route and Utils
This commit is contained in:
493
main.js
493
main.js
@@ -5334,14 +5334,14 @@ var $elm$core$Task$perform = F2(
|
||||
A2($elm$core$Task$map, toMessage, task)));
|
||||
});
|
||||
var $elm$browser$Browser$application = _Browser_application;
|
||||
var $author$project$Main$Model = F7(
|
||||
function (state, player, claims, notification, loot, groupLoot, merchantItems) {
|
||||
return {claims: claims, groupLoot: groupLoot, loot: loot, merchantItems: merchantItems, notification: notification, player: player, state: state};
|
||||
var $author$project$Main$Model = F8(
|
||||
function (state, player, chest, claims, notification, loot, groupLoot, merchantItems) {
|
||||
return {chest: chest, claims: claims, groupLoot: groupLoot, loot: loot, merchantItems: merchantItems, notification: notification, player: player, state: state};
|
||||
});
|
||||
var $author$project$Main$PlayerChest = {$: 'PlayerChest'};
|
||||
var $author$project$Main$State = F6(
|
||||
function (navKey, route, error, menuOpen, selection, activeMode) {
|
||||
return {activeMode: activeMode, error: error, menuOpen: menuOpen, navKey: navKey, route: route, selection: selection};
|
||||
var $author$project$Route$PlayerChest = {$: 'PlayerChest'};
|
||||
var $author$project$Main$State = F5(
|
||||
function (navKey, route, error, menuOpen, activeMode) {
|
||||
return {activeMode: activeMode, error: error, menuOpen: menuOpen, navKey: navKey, route: route};
|
||||
});
|
||||
var $author$project$Api$Player = F4(
|
||||
function (id, name, debt, wealth) {
|
||||
@@ -6285,10 +6285,77 @@ var $author$project$Main$fetchInitialData = function (playerId) {
|
||||
$author$project$Api$fetchLoot($author$project$Api$OfGroup))
|
||||
]));
|
||||
};
|
||||
var $author$project$Chest$init = {items: _List_Nil, selection: $elm$core$Maybe$Nothing};
|
||||
var $author$project$Route$GroupLoot = {$: 'GroupLoot'};
|
||||
var $author$project$Route$Merchant = {$: 'Merchant'};
|
||||
var $author$project$Route$NewLoot = {$: 'NewLoot'};
|
||||
var $elm$url$Url$Parser$Parser = function (a) {
|
||||
return {$: 'Parser', a: a};
|
||||
};
|
||||
var $elm$url$Url$Parser$State = F5(
|
||||
function (visited, unvisited, params, frag, value) {
|
||||
return {frag: frag, params: params, unvisited: unvisited, value: value, visited: visited};
|
||||
});
|
||||
var $elm$url$Url$Parser$mapState = F2(
|
||||
function (func, _v0) {
|
||||
var visited = _v0.visited;
|
||||
var unvisited = _v0.unvisited;
|
||||
var params = _v0.params;
|
||||
var frag = _v0.frag;
|
||||
var value = _v0.value;
|
||||
return A5(
|
||||
$elm$url$Url$Parser$State,
|
||||
visited,
|
||||
unvisited,
|
||||
params,
|
||||
frag,
|
||||
func(value));
|
||||
});
|
||||
var $elm$url$Url$Parser$map = F2(
|
||||
function (subValue, _v0) {
|
||||
var parseArg = _v0.a;
|
||||
return $elm$url$Url$Parser$Parser(
|
||||
function (_v1) {
|
||||
var visited = _v1.visited;
|
||||
var unvisited = _v1.unvisited;
|
||||
var params = _v1.params;
|
||||
var frag = _v1.frag;
|
||||
var value = _v1.value;
|
||||
return A2(
|
||||
$elm$core$List$map,
|
||||
$elm$url$Url$Parser$mapState(value),
|
||||
parseArg(
|
||||
A5($elm$url$Url$Parser$State, visited, unvisited, params, frag, subValue)));
|
||||
});
|
||||
});
|
||||
var $elm$core$List$append = F2(
|
||||
function (xs, ys) {
|
||||
if (!ys.b) {
|
||||
return xs;
|
||||
} else {
|
||||
return A3($elm$core$List$foldr, $elm$core$List$cons, ys, xs);
|
||||
}
|
||||
});
|
||||
var $elm$core$List$concat = function (lists) {
|
||||
return A3($elm$core$List$foldr, $elm$core$List$append, _List_Nil, lists);
|
||||
};
|
||||
var $elm$core$List$concatMap = F2(
|
||||
function (f, list) {
|
||||
return $elm$core$List$concat(
|
||||
A2($elm$core$List$map, f, list));
|
||||
});
|
||||
var $elm$url$Url$Parser$oneOf = function (parsers) {
|
||||
return $elm$url$Url$Parser$Parser(
|
||||
function (state) {
|
||||
return A2(
|
||||
$elm$core$List$concatMap,
|
||||
function (_v0) {
|
||||
var parser = _v0.a;
|
||||
return parser(state);
|
||||
},
|
||||
parsers);
|
||||
});
|
||||
};
|
||||
var $elm$url$Url$Parser$getFirstMatch = function (states) {
|
||||
getFirstMatch:
|
||||
while (true) {
|
||||
@@ -6404,72 +6471,6 @@ var $elm$url$Url$Parser$parse = F2(
|
||||
url.fragment,
|
||||
$elm$core$Basics$identity)));
|
||||
});
|
||||
var $author$project$Main$GroupLoot = {$: 'GroupLoot'};
|
||||
var $author$project$Main$Merchant = {$: 'Merchant'};
|
||||
var $author$project$Main$NewLoot = {$: 'NewLoot'};
|
||||
var $elm$url$Url$Parser$Parser = function (a) {
|
||||
return {$: 'Parser', a: a};
|
||||
};
|
||||
var $elm$url$Url$Parser$mapState = F2(
|
||||
function (func, _v0) {
|
||||
var visited = _v0.visited;
|
||||
var unvisited = _v0.unvisited;
|
||||
var params = _v0.params;
|
||||
var frag = _v0.frag;
|
||||
var value = _v0.value;
|
||||
return A5(
|
||||
$elm$url$Url$Parser$State,
|
||||
visited,
|
||||
unvisited,
|
||||
params,
|
||||
frag,
|
||||
func(value));
|
||||
});
|
||||
var $elm$url$Url$Parser$map = F2(
|
||||
function (subValue, _v0) {
|
||||
var parseArg = _v0.a;
|
||||
return $elm$url$Url$Parser$Parser(
|
||||
function (_v1) {
|
||||
var visited = _v1.visited;
|
||||
var unvisited = _v1.unvisited;
|
||||
var params = _v1.params;
|
||||
var frag = _v1.frag;
|
||||
var value = _v1.value;
|
||||
return A2(
|
||||
$elm$core$List$map,
|
||||
$elm$url$Url$Parser$mapState(value),
|
||||
parseArg(
|
||||
A5($elm$url$Url$Parser$State, visited, unvisited, params, frag, subValue)));
|
||||
});
|
||||
});
|
||||
var $elm$core$List$append = F2(
|
||||
function (xs, ys) {
|
||||
if (!ys.b) {
|
||||
return xs;
|
||||
} else {
|
||||
return A3($elm$core$List$foldr, $elm$core$List$cons, ys, xs);
|
||||
}
|
||||
});
|
||||
var $elm$core$List$concat = function (lists) {
|
||||
return A3($elm$core$List$foldr, $elm$core$List$append, _List_Nil, lists);
|
||||
};
|
||||
var $elm$core$List$concatMap = F2(
|
||||
function (f, list) {
|
||||
return $elm$core$List$concat(
|
||||
A2($elm$core$List$map, f, list));
|
||||
});
|
||||
var $elm$url$Url$Parser$oneOf = function (parsers) {
|
||||
return $elm$url$Url$Parser$Parser(
|
||||
function (state) {
|
||||
return A2(
|
||||
$elm$core$List$concatMap,
|
||||
function (_v0) {
|
||||
var parser = _v0.a;
|
||||
return parser(state);
|
||||
},
|
||||
parsers);
|
||||
});
|
||||
};
|
||||
var $elm$url$Url$Parser$s = function (str) {
|
||||
return $elm$url$Url$Parser$Parser(
|
||||
function (_v0) {
|
||||
@@ -6501,39 +6502,45 @@ var $elm$url$Url$Parser$top = $elm$url$Url$Parser$Parser(
|
||||
return _List_fromArray(
|
||||
[state]);
|
||||
});
|
||||
var $author$project$Main$routeParser = $elm$url$Url$Parser$oneOf(
|
||||
_List_fromArray(
|
||||
[
|
||||
A2(
|
||||
$elm$url$Url$Parser$map,
|
||||
$author$project$Main$GroupLoot,
|
||||
$elm$url$Url$Parser$s('coffre')),
|
||||
A2($elm$url$Url$Parser$map, $author$project$Main$PlayerChest, $elm$url$Url$Parser$top),
|
||||
A2(
|
||||
$elm$url$Url$Parser$map,
|
||||
$author$project$Main$Merchant,
|
||||
$elm$url$Url$Parser$s('marchand')),
|
||||
A2(
|
||||
$elm$url$Url$Parser$map,
|
||||
$author$project$Main$NewLoot,
|
||||
$elm$url$Url$Parser$s('nouveau-tresor'))
|
||||
]));
|
||||
var $author$project$Route$routeParser = function (url) {
|
||||
return A2(
|
||||
$elm$url$Url$Parser$parse,
|
||||
$elm$url$Url$Parser$oneOf(
|
||||
_List_fromArray(
|
||||
[
|
||||
A2(
|
||||
$elm$url$Url$Parser$map,
|
||||
$author$project$Route$GroupLoot,
|
||||
$elm$url$Url$Parser$s('coffre')),
|
||||
A2($elm$url$Url$Parser$map, $author$project$Route$PlayerChest, $elm$url$Url$Parser$top),
|
||||
A2(
|
||||
$elm$url$Url$Parser$map,
|
||||
$author$project$Route$Merchant,
|
||||
$elm$url$Url$Parser$s('marchand')),
|
||||
A2(
|
||||
$elm$url$Url$Parser$map,
|
||||
$author$project$Route$NewLoot,
|
||||
$elm$url$Url$Parser$s('nouveau-tresor'))
|
||||
])),
|
||||
url);
|
||||
};
|
||||
var $author$project$Main$init = F3(
|
||||
function (flags, url, key) {
|
||||
var route = function () {
|
||||
var _v0 = A2($elm$url$Url$Parser$parse, $author$project$Main$routeParser, url);
|
||||
var _v0 = $author$project$Route$routeParser(url);
|
||||
if (_v0.$ === 'Just') {
|
||||
var r = _v0.a;
|
||||
return r;
|
||||
} else {
|
||||
return $author$project$Main$PlayerChest;
|
||||
return $author$project$Route$PlayerChest;
|
||||
}
|
||||
}();
|
||||
return _Utils_Tuple2(
|
||||
A7(
|
||||
A8(
|
||||
$author$project$Main$Model,
|
||||
A6($author$project$Main$State, key, route, '', false, $elm$core$Maybe$Nothing, $elm$core$Maybe$Nothing),
|
||||
A5($author$project$Main$State, key, route, '', false, $elm$core$Maybe$Nothing),
|
||||
$author$project$Api$blankPlayer,
|
||||
$author$project$Chest$init,
|
||||
_List_Nil,
|
||||
$elm$core$Maybe$Nothing,
|
||||
$elm$core$Maybe$Nothing,
|
||||
@@ -6550,6 +6557,9 @@ var $author$project$Modes$Add = {$: 'Add'};
|
||||
var $author$project$Main$ModeSwitched = function (a) {
|
||||
return {$: 'ModeSwitched', a: a};
|
||||
};
|
||||
var $author$project$Chest$SetSelection = function (a) {
|
||||
return {$: 'SetSelection', a: a};
|
||||
};
|
||||
var $elm$core$List$filter = F2(
|
||||
function (isGood, list) {
|
||||
return A3(
|
||||
@@ -6654,7 +6664,7 @@ var $elm$core$Set$member = F2(
|
||||
var dict = _v0.a;
|
||||
return A2($elm$core$Dict$member, key, dict);
|
||||
});
|
||||
var $author$project$Main$itemInSelection = F2(
|
||||
var $author$project$Chest$itemInSelection = F2(
|
||||
function (selection, item) {
|
||||
return A2(
|
||||
$elm$core$Maybe$withDefault,
|
||||
@@ -6664,7 +6674,6 @@ var $author$project$Main$itemInSelection = F2(
|
||||
$elm$core$Set$member(item.id),
|
||||
selection));
|
||||
});
|
||||
var $elm$core$Debug$log = _Debug_log;
|
||||
var $elm$core$Platform$Cmd$none = $elm$core$Platform$Cmd$batch(_List_Nil);
|
||||
var $elm$browser$Browser$Navigation$pushUrl = _Browser_pushUrl;
|
||||
var $author$project$Api$GotActionResult = function (a) {
|
||||
@@ -6917,29 +6926,6 @@ var $author$project$Main$setNotification = F2(
|
||||
model,
|
||||
{notification: notification});
|
||||
});
|
||||
var $elm$core$Set$remove = F2(
|
||||
function (key, _v0) {
|
||||
var dict = _v0.a;
|
||||
return $elm$core$Set$Set_elm_builtin(
|
||||
A2($elm$core$Dict$remove, key, dict));
|
||||
});
|
||||
var $author$project$Main$switchSelectionState = F2(
|
||||
function (id, selection) {
|
||||
if (selection.$ === 'Just') {
|
||||
var s = selection.a;
|
||||
return $elm$core$Maybe$Just(
|
||||
function () {
|
||||
var _v1 = A2($elm$core$Set$member, id, s);
|
||||
if (_v1) {
|
||||
return A2($elm$core$Set$remove, id, s);
|
||||
} else {
|
||||
return A2($elm$core$Set$insert, id, s);
|
||||
}
|
||||
}());
|
||||
} else {
|
||||
return A2($elm$core$Debug$log, 'ignore switchSelectionState', $elm$core$Maybe$Nothing);
|
||||
}
|
||||
});
|
||||
var $author$project$Main$targetItemsFor = F2(
|
||||
function (mode, model) {
|
||||
switch (mode.$) {
|
||||
@@ -7010,6 +6996,50 @@ var $author$project$Api$undoLastAction = function (id) {
|
||||
url: 'http://localhost:8088/api/players/' + ($elm$core$String$fromInt(id) + '/events/last')
|
||||
});
|
||||
};
|
||||
var $elm$core$Debug$log = _Debug_log;
|
||||
var $elm$core$Set$remove = F2(
|
||||
function (key, _v0) {
|
||||
var dict = _v0.a;
|
||||
return $elm$core$Set$Set_elm_builtin(
|
||||
A2($elm$core$Dict$remove, key, dict));
|
||||
});
|
||||
var $author$project$Chest$switchSelectionState = F2(
|
||||
function (id, selection) {
|
||||
if (selection.$ === 'Just') {
|
||||
var s = selection.a;
|
||||
return $elm$core$Maybe$Just(
|
||||
function () {
|
||||
var _v1 = A2($elm$core$Set$member, id, s);
|
||||
if (_v1) {
|
||||
return A2($elm$core$Set$remove, id, s);
|
||||
} else {
|
||||
return A2($elm$core$Set$insert, id, s);
|
||||
}
|
||||
}());
|
||||
} else {
|
||||
return A2($elm$core$Debug$log, 'ignore switchSelectionState', $elm$core$Maybe$Nothing);
|
||||
}
|
||||
});
|
||||
var $author$project$Chest$update = F2(
|
||||
function (msg, model) {
|
||||
if (msg.$ === 'SwitchSelectionState') {
|
||||
var id = msg.a;
|
||||
return _Utils_Tuple2(
|
||||
_Utils_update(
|
||||
model,
|
||||
{
|
||||
selection: A2($author$project$Chest$switchSelectionState, id, model.selection)
|
||||
}),
|
||||
$elm$core$Platform$Cmd$none);
|
||||
} else {
|
||||
var _new = msg.a;
|
||||
return _Utils_Tuple2(
|
||||
_Utils_update(
|
||||
model,
|
||||
{selection: _new}),
|
||||
$elm$core$Platform$Cmd$none);
|
||||
}
|
||||
});
|
||||
var $author$project$Main$update = F2(
|
||||
function (msg, model) {
|
||||
update:
|
||||
@@ -7034,7 +7064,7 @@ var $author$project$Main$update = F2(
|
||||
case 'UrlChanged':
|
||||
var url = msg.a;
|
||||
var state = model.state;
|
||||
var route = A2($elm$url$Url$Parser$parse, $author$project$Main$routeParser, url);
|
||||
var route = $author$project$Route$routeParser(url);
|
||||
if (route.$ === 'Just') {
|
||||
var page = route.a;
|
||||
return A2(
|
||||
@@ -7067,6 +7097,15 @@ var $author$project$Main$update = F2(
|
||||
model,
|
||||
{player: $author$project$Api$blankPlayer}),
|
||||
$author$project$Main$initPlayer(newId));
|
||||
case 'ChestMsg':
|
||||
var chestMsg = msg.a;
|
||||
var _v4 = A2($author$project$Chest$update, chestMsg, model.chest);
|
||||
var chest = _v4.a;
|
||||
return _Utils_Tuple2(
|
||||
_Utils_update(
|
||||
model,
|
||||
{chest: chest}),
|
||||
$elm$core$Platform$Cmd$none);
|
||||
case 'ApiMsg':
|
||||
var apiMsg = msg.a;
|
||||
switch (apiMsg.$) {
|
||||
@@ -7179,23 +7218,6 @@ var $author$project$Main$update = F2(
|
||||
$elm$core$Platform$Cmd$none);
|
||||
}
|
||||
}
|
||||
case 'LootViewItemSwitched':
|
||||
var id = msg.a;
|
||||
var state = model.state;
|
||||
return _Utils_Tuple2(
|
||||
_Utils_update(
|
||||
model,
|
||||
{
|
||||
state: _Utils_update(
|
||||
state,
|
||||
{
|
||||
selection: A2(
|
||||
$elm$core$Debug$log,
|
||||
'new selection',
|
||||
A2($author$project$Main$switchSelectionState, id, state.selection))
|
||||
})
|
||||
}),
|
||||
$elm$core$Platform$Cmd$none);
|
||||
case 'ModeSwitched':
|
||||
var newMode = msg.a;
|
||||
var state = model.state;
|
||||
@@ -7203,46 +7225,52 @@ var $author$project$Main$update = F2(
|
||||
_Utils_update(
|
||||
model,
|
||||
{
|
||||
chest: function () {
|
||||
var _v11 = A2(
|
||||
$author$project$Chest$update,
|
||||
$author$project$Chest$SetSelection(
|
||||
function () {
|
||||
if (newMode.$ === 'Nothing') {
|
||||
return $elm$core$Maybe$Nothing;
|
||||
} else {
|
||||
if (newMode.a.$ === 'Grab') {
|
||||
var _v13 = newMode.a;
|
||||
return $elm$core$Maybe$Just(
|
||||
$elm$core$Set$fromList(
|
||||
A2(
|
||||
$elm$core$List$map,
|
||||
function (c) {
|
||||
return c.loot_id;
|
||||
},
|
||||
model.claims)));
|
||||
} else {
|
||||
var others = newMode.a;
|
||||
return $elm$core$Maybe$Just($elm$core$Set$empty);
|
||||
}
|
||||
}
|
||||
}()),
|
||||
model.chest);
|
||||
var newChest = _v11.a;
|
||||
return newChest;
|
||||
}(),
|
||||
state: _Utils_update(
|
||||
state,
|
||||
{
|
||||
activeMode: newMode,
|
||||
selection: function () {
|
||||
if (newMode.$ === 'Nothing') {
|
||||
return $elm$core$Maybe$Nothing;
|
||||
} else {
|
||||
if (newMode.a.$ === 'Grab') {
|
||||
var _v11 = newMode.a;
|
||||
return $elm$core$Maybe$Just(
|
||||
$elm$core$Set$fromList(
|
||||
A2(
|
||||
$elm$core$List$map,
|
||||
function (c) {
|
||||
return c.loot_id;
|
||||
},
|
||||
model.claims)));
|
||||
} else {
|
||||
var others = newMode.a;
|
||||
return $elm$core$Maybe$Just($elm$core$Set$empty);
|
||||
}
|
||||
}
|
||||
}()
|
||||
})
|
||||
{activeMode: newMode})
|
||||
}),
|
||||
$elm$core$Platform$Cmd$none);
|
||||
case 'ConfirmAction':
|
||||
var _v12 = model.state.activeMode;
|
||||
if (_v12.$ === 'Nothing') {
|
||||
var _v14 = model.state.activeMode;
|
||||
if (_v14.$ === 'Nothing') {
|
||||
var $temp$msg = $author$project$Main$ModeSwitched($elm$core$Maybe$Nothing),
|
||||
$temp$model = model;
|
||||
msg = $temp$msg;
|
||||
model = $temp$model;
|
||||
continue update;
|
||||
} else {
|
||||
var mode = _v12.a;
|
||||
var mode = _v14.a;
|
||||
var items = A2(
|
||||
$elm$core$List$filter,
|
||||
$author$project$Main$itemInSelection(model.state.selection),
|
||||
$author$project$Chest$itemInSelection(model.chest.selection),
|
||||
A2($author$project$Main$targetItemsFor, mode, model));
|
||||
return _Utils_Tuple2(
|
||||
model,
|
||||
@@ -7271,6 +7299,9 @@ var $author$project$Main$update = F2(
|
||||
}
|
||||
}
|
||||
});
|
||||
var $author$project$Main$ChestMsg = function (a) {
|
||||
return {$: 'ChestMsg', a: a};
|
||||
};
|
||||
var $author$project$Main$UndoLastAction = {$: 'UndoLastAction'};
|
||||
var $elm$html$Html$button = _VirtualDom_node('button');
|
||||
var $elm$json$Json$Encode$string = _Json_wrap;
|
||||
@@ -7407,37 +7438,10 @@ var $author$project$Main$controlsWhenRoute = function (route) {
|
||||
}
|
||||
};
|
||||
var $elm$html$Html$hr = _VirtualDom_node('hr');
|
||||
var $elm$core$List$any = F2(
|
||||
function (isOkay, list) {
|
||||
any:
|
||||
while (true) {
|
||||
if (!list.b) {
|
||||
return false;
|
||||
} else {
|
||||
var x = list.a;
|
||||
var xs = list.b;
|
||||
if (isOkay(x)) {
|
||||
return true;
|
||||
} else {
|
||||
var $temp$isOkay = isOkay,
|
||||
$temp$list = xs;
|
||||
isOkay = $temp$isOkay;
|
||||
list = $temp$list;
|
||||
continue any;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
var $author$project$Main$itemInClaims = F2(
|
||||
function (claims, item) {
|
||||
return A2(
|
||||
$elm$core$List$any,
|
||||
function (c) {
|
||||
return _Utils_eq(c.loot_id, item.id);
|
||||
},
|
||||
claims);
|
||||
});
|
||||
var $author$project$Main$renderIcon = F2(
|
||||
var $elm$virtual_dom$VirtualDom$map = _VirtualDom_map;
|
||||
var $elm$html$Html$map = $elm$virtual_dom$VirtualDom$map;
|
||||
var $elm$html$Html$section = _VirtualDom_node('section');
|
||||
var $author$project$Utils$renderIcon = F2(
|
||||
function (name, size) {
|
||||
return A2(
|
||||
$elm$html$Html$span,
|
||||
@@ -7456,17 +7460,17 @@ var $author$project$Main$renderIcon = F2(
|
||||
_List_Nil)
|
||||
]));
|
||||
});
|
||||
var $author$project$Main$renderIfClaimed = F2(
|
||||
function (isClaimed, item) {
|
||||
var _v0 = isClaimed(item);
|
||||
var $author$project$Chest$claimedItemRenderer = F2(
|
||||
function (isSelected, item) {
|
||||
var _v0 = isSelected(item);
|
||||
if (_v0) {
|
||||
return A2($author$project$Main$renderIcon, 'fas fa-praying-hands', '1x');
|
||||
return A2($author$project$Utils$renderIcon, 'fas fa-praying-hands', '1x');
|
||||
} else {
|
||||
return $elm$html$Html$text('');
|
||||
}
|
||||
});
|
||||
var $author$project$Main$LootViewItemSwitched = function (a) {
|
||||
return {$: 'LootViewItemSwitched', a: a};
|
||||
var $author$project$Chest$SwitchSelectionState = function (a) {
|
||||
return {$: 'SwitchSelectionState', a: a};
|
||||
};
|
||||
var $author$project$Modes$canSelectIn = function (mode) {
|
||||
switch (mode.$) {
|
||||
@@ -7509,8 +7513,8 @@ var $elm$html$Html$Events$onCheck = function (tagger) {
|
||||
A2($elm$json$Json$Decode$map, tagger, $elm$html$Html$Events$targetChecked));
|
||||
};
|
||||
var $elm$html$Html$Attributes$type_ = $elm$html$Html$Attributes$stringProperty('type');
|
||||
var $author$project$Main$rowControlsForMode = F3(
|
||||
function (mode, isSelected, item) {
|
||||
var $author$project$Chest$rowControlsForMode = F3(
|
||||
function (isSelected, mode, item) {
|
||||
var itemInfo = function () {
|
||||
switch (mode.$) {
|
||||
case 'Buy':
|
||||
@@ -7582,13 +7586,12 @@ var $author$project$Main$rowControlsForMode = F3(
|
||||
isSelected(item)),
|
||||
$elm$html$Html$Events$onCheck(
|
||||
function (v) {
|
||||
return $author$project$Main$LootViewItemSwitched(item.id);
|
||||
return $author$project$Chest$SwitchSelectionState(item.id);
|
||||
})
|
||||
]),
|
||||
_List_Nil)
|
||||
]) : _List_Nil));
|
||||
});
|
||||
var $elm$html$Html$section = _VirtualDom_node('section');
|
||||
var $elm$html$Html$table = _VirtualDom_node('table');
|
||||
var $elm$html$Html$tbody = _VirtualDom_node('tbody');
|
||||
var $elm$html$Html$th = _VirtualDom_node('th');
|
||||
@@ -7614,7 +7617,7 @@ var $elm$core$List$singleton = function (value) {
|
||||
};
|
||||
var $elm$html$Html$td = _VirtualDom_node('td');
|
||||
var $elm$html$Html$tr = _VirtualDom_node('tr');
|
||||
var $author$project$Main$viewItemTableRow = F3(
|
||||
var $author$project$Chest$viewItemTableRow = F3(
|
||||
function (isSelected, rowControls, item) {
|
||||
return A2(
|
||||
$elm$html$Html$tr,
|
||||
@@ -7674,8 +7677,23 @@ var $author$project$Main$viewItemTableRow = F3(
|
||||
]))
|
||||
]));
|
||||
});
|
||||
var $author$project$Main$viewChest = F3(
|
||||
function (isSelected, rowControls, items) {
|
||||
var $author$project$Chest$view = F3(
|
||||
function (mode, route, model) {
|
||||
var isSelected = $author$project$Chest$itemInSelection(model.selection);
|
||||
var rowControls = function () {
|
||||
if (mode.$ === 'Just') {
|
||||
var m = mode.a;
|
||||
return $elm$core$Maybe$Just(
|
||||
A2($author$project$Chest$rowControlsForMode, isSelected, m));
|
||||
} else {
|
||||
if (route.$ === 'GroupLoot') {
|
||||
return $elm$core$Maybe$Just(
|
||||
$author$project$Chest$claimedItemRenderer(isSelected));
|
||||
} else {
|
||||
return $elm$core$Maybe$Nothing;
|
||||
}
|
||||
}
|
||||
}();
|
||||
return A2(
|
||||
$elm$html$Html$table,
|
||||
_List_fromArray(
|
||||
@@ -7705,8 +7723,8 @@ var $author$project$Main$viewChest = F3(
|
||||
_List_Nil,
|
||||
A2(
|
||||
$elm$core$List$map,
|
||||
A2($author$project$Main$viewItemTableRow, isSelected, rowControls),
|
||||
items))
|
||||
A2($author$project$Chest$viewItemTableRow, isSelected, rowControls),
|
||||
model.items))
|
||||
]));
|
||||
});
|
||||
var $author$project$Main$stackedIcon = function (name) {
|
||||
@@ -7866,7 +7884,7 @@ var $author$project$Main$viewDebugSection = function (model) {
|
||||
_List_fromArray(
|
||||
[
|
||||
$elm$html$Html$text(
|
||||
'Selection : ' + $elm$core$Debug$toString(model.state.selection))
|
||||
'Selection : ' + $elm$core$Debug$toString(model.chest.selection))
|
||||
])),
|
||||
A2(
|
||||
$elm$html$Html$p,
|
||||
@@ -7924,7 +7942,7 @@ var $author$project$Main$viewHeaderBar = function (model) {
|
||||
]),
|
||||
_List_fromArray(
|
||||
[
|
||||
A2($author$project$Main$renderIcon, 'fab fa-d-and-d', '2x'),
|
||||
A2($author$project$Utils$renderIcon, 'fab fa-d-and-d', '2x'),
|
||||
A2(
|
||||
$elm$html$Html$span,
|
||||
_List_Nil,
|
||||
@@ -7989,7 +8007,7 @@ var $author$project$Main$viewHeaderBar = function (model) {
|
||||
]),
|
||||
_List_fromArray(
|
||||
[
|
||||
A2($author$project$Main$renderIcon, 'fas fa-store-alt', '1x'),
|
||||
A2($author$project$Utils$renderIcon, 'fas fa-store-alt', '1x'),
|
||||
A2(
|
||||
$elm$html$Html$span,
|
||||
_List_Nil,
|
||||
@@ -8008,7 +8026,7 @@ var $author$project$Main$viewHeaderBar = function (model) {
|
||||
]),
|
||||
_List_fromArray(
|
||||
[
|
||||
A2($author$project$Main$renderIcon, 'fas fa-gem', '1x'),
|
||||
A2($author$project$Utils$renderIcon, 'fas fa-gem', '1x'),
|
||||
A2(
|
||||
$elm$html$Html$span,
|
||||
_List_Nil,
|
||||
@@ -8230,7 +8248,18 @@ var $author$project$Main$viewSearchBar = A2(
|
||||
]),
|
||||
_List_Nil);
|
||||
var $author$project$Main$view = function (model) {
|
||||
var isSelected = $author$project$Main$itemInSelection(model.state.selection);
|
||||
var headerControls = function () {
|
||||
var _v2 = model.state.activeMode;
|
||||
if (_v2.$ === 'Just') {
|
||||
var mode = _v2.a;
|
||||
return $author$project$Main$controlsWhenModeActive(mode);
|
||||
} else {
|
||||
return A2(
|
||||
$elm$core$List$cons,
|
||||
A4($author$project$Main$actionButton, $author$project$Main$UndoLastAction, 'Annuler action', 'backspace', 'danger'),
|
||||
$author$project$Main$controlsWhenRoute(model.state.route));
|
||||
}
|
||||
}();
|
||||
var _v0 = function () {
|
||||
var _v1 = model.state.route;
|
||||
switch (_v1.$) {
|
||||
@@ -8252,34 +8281,6 @@ var $author$project$Main$view = function (model) {
|
||||
}();
|
||||
var header = _v0.a;
|
||||
var shownLoot = _v0.b;
|
||||
var _v2 = function () {
|
||||
var _v3 = model.state.activeMode;
|
||||
if (_v3.$ === 'Just') {
|
||||
var mode = _v3.a;
|
||||
return _Utils_Tuple2(
|
||||
$author$project$Main$controlsWhenModeActive(mode),
|
||||
$elm$core$Maybe$Just(
|
||||
A2($author$project$Main$rowControlsForMode, mode, isSelected)));
|
||||
} else {
|
||||
return _Utils_Tuple2(
|
||||
A2(
|
||||
$elm$core$List$cons,
|
||||
A4($author$project$Main$actionButton, $author$project$Main$UndoLastAction, 'Annuler action', 'backspace', 'danger'),
|
||||
$author$project$Main$controlsWhenRoute(model.state.route)),
|
||||
function () {
|
||||
var _v4 = model.state.route;
|
||||
if (_v4.$ === 'GroupLoot') {
|
||||
return $elm$core$Maybe$Just(
|
||||
$author$project$Main$renderIfClaimed(
|
||||
$author$project$Main$itemInClaims(model.claims)));
|
||||
} else {
|
||||
return $elm$core$Maybe$Nothing;
|
||||
}
|
||||
}());
|
||||
}
|
||||
}();
|
||||
var headerControls = _v2.a;
|
||||
var rowControls = _v2.b;
|
||||
return {
|
||||
body: _List_fromArray(
|
||||
[
|
||||
@@ -8293,6 +8294,7 @@ var $author$project$Main$view = function (model) {
|
||||
]),
|
||||
_List_fromArray(
|
||||
[
|
||||
$author$project$Main$viewNotification(model.notification),
|
||||
A2(
|
||||
$elm$html$Html$p,
|
||||
_List_fromArray(
|
||||
@@ -8304,7 +8306,10 @@ var $author$project$Main$view = function (model) {
|
||||
$elm$html$Html$text(header)
|
||||
])),
|
||||
$author$project$Main$viewSearchBar,
|
||||
A3($author$project$Main$viewChest, isSelected, rowControls, shownLoot)
|
||||
A2(
|
||||
$elm$html$Html$map,
|
||||
$author$project$Main$ChestMsg,
|
||||
A3($author$project$Chest$view, model.state.activeMode, model.state.route, model.chest))
|
||||
])),
|
||||
A2($elm$html$Html$hr, _List_Nil, _List_Nil),
|
||||
A2(
|
||||
|
||||
Reference in New Issue
Block a user