Show recent maps; name maps
This commit is contained in:
parent
6b02b73b9b
commit
e6a51f162d
6 changed files with 268 additions and 50 deletions
184
app.js
184
app.js
|
@ -5160,15 +5160,19 @@ var $elm$core$Task$perform = F2(
|
|||
});
|
||||
var $elm$browser$Browser$document = _Browser_document;
|
||||
var $elm$json$Json$Decode$decodeValue = _Json_run;
|
||||
var $author$project$App$Flags = F3(
|
||||
function (emoji, markers, map_id) {
|
||||
return {emoji: emoji, map_id: map_id, markers: markers};
|
||||
var $author$project$App$Flags = F5(
|
||||
function (emoji, markers, map_id, map_ids, map_name) {
|
||||
return {emoji: emoji, map_id: map_id, map_ids: map_ids, map_name: map_name, markers: markers};
|
||||
});
|
||||
var $elm$json$Json$Decode$field = _Json_decodeField;
|
||||
var $elm$json$Json$Decode$at = F2(
|
||||
function (fields, decoder) {
|
||||
return A3($elm$core$List$foldr, $elm$json$Json$Decode$field, decoder, fields);
|
||||
});
|
||||
var $author$project$App$Emoji = F2(
|
||||
function (emoji, description) {
|
||||
return {description: description, emoji: emoji};
|
||||
});
|
||||
var $elm$json$Json$Decode$field = _Json_decodeField;
|
||||
var $elm$json$Json$Decode$string = _Json_decodeString;
|
||||
var $author$project$App$decode_emoji = A3(
|
||||
$elm$json$Json$Decode$map2,
|
||||
|
@ -5198,19 +5202,37 @@ var $author$project$App$decode_marker = A5(
|
|||
A2($elm$json$Json$Decode$field, 'name', $elm$json$Json$Decode$string),
|
||||
A2($elm$json$Json$Decode$field, 'note', $elm$json$Json$Decode$string));
|
||||
var $elm$json$Json$Decode$list = _Json_decodeList;
|
||||
var $elm$json$Json$Decode$map3 = _Json_map3;
|
||||
var $author$project$App$decode_flags = A4(
|
||||
$elm$json$Json$Decode$map3,
|
||||
var $elm$json$Json$Decode$map5 = _Json_map5;
|
||||
var $author$project$App$decode_flags = A6(
|
||||
$elm$json$Json$Decode$map5,
|
||||
$author$project$App$Flags,
|
||||
A2(
|
||||
$elm$json$Json$Decode$field,
|
||||
'emoji',
|
||||
$elm$json$Json$Decode$list($author$project$App$decode_emoji)),
|
||||
A2(
|
||||
$elm$json$Json$Decode$field,
|
||||
'markers',
|
||||
$elm$json$Json$Decode$at,
|
||||
_List_fromArray(
|
||||
['data', 'markers']),
|
||||
$elm$json$Json$Decode$list($author$project$App$decode_marker)),
|
||||
A2($elm$json$Json$Decode$field, 'map_id', $elm$json$Json$Decode$string));
|
||||
A2($elm$json$Json$Decode$field, 'map_id', $elm$json$Json$Decode$string),
|
||||
A2(
|
||||
$elm$json$Json$Decode$field,
|
||||
'map_ids',
|
||||
$elm$json$Json$Decode$list(
|
||||
A3(
|
||||
$elm$json$Json$Decode$map2,
|
||||
F2(
|
||||
function (name, id) {
|
||||
return {id: id, name: name};
|
||||
}),
|
||||
A2($elm$json$Json$Decode$field, 'name', $elm$json$Json$Decode$string),
|
||||
A2($elm$json$Json$Decode$field, 'id', $elm$json$Json$Decode$string)))),
|
||||
A2(
|
||||
$elm$json$Json$Decode$at,
|
||||
_List_fromArray(
|
||||
['data', 'name']),
|
||||
$elm$json$Json$Decode$string));
|
||||
var $author$project$App$CurrentPositionCentre = {$: 'CurrentPositionCentre'};
|
||||
var $author$project$App$NoSelection = {$: 'NoSelection'};
|
||||
var $author$project$App$blank_marker = {
|
||||
|
@ -5228,6 +5250,8 @@ var $author$project$App$init_model = {
|
|||
current_position: {lat: 55.04, lon: -1.46},
|
||||
emoji: _List_Nil,
|
||||
map_id: '',
|
||||
map_ids: _List_Nil,
|
||||
map_name: '',
|
||||
markers: _List_Nil,
|
||||
new_marker: $author$project$App$blank_marker,
|
||||
selection: $author$project$App$NoSelection
|
||||
|
@ -5247,7 +5271,7 @@ var $author$project$App$init = function (vflags) {
|
|||
var flags = _v0.a;
|
||||
return _Utils_update(
|
||||
$author$project$App$init_model,
|
||||
{emoji: flags.emoji, map_id: flags.map_id, markers: flags.markers});
|
||||
{emoji: flags.emoji, map_id: flags.map_id, map_ids: flags.map_ids, map_name: flags.map_name, markers: flags.markers});
|
||||
}
|
||||
}());
|
||||
};
|
||||
|
@ -5567,20 +5591,29 @@ var $author$project$App$save = function (model) {
|
|||
'type',
|
||||
$elm$json$Json$Encode$string('save')),
|
||||
_Utils_Tuple2(
|
||||
'markers',
|
||||
A2(
|
||||
$elm$json$Json$Encode$list,
|
||||
$elm$core$Basics$identity,
|
||||
A2(
|
||||
$elm$core$List$indexedMap,
|
||||
F2(
|
||||
function (i, m) {
|
||||
return A2(
|
||||
$author$project$App$encode_marker,
|
||||
$elm$core$String$fromInt(i),
|
||||
m);
|
||||
}),
|
||||
model.markers)))
|
||||
'data',
|
||||
$elm$json$Json$Encode$object(
|
||||
_List_fromArray(
|
||||
[
|
||||
_Utils_Tuple2(
|
||||
'markers',
|
||||
A2(
|
||||
$elm$json$Json$Encode$list,
|
||||
$elm$core$Basics$identity,
|
||||
A2(
|
||||
$elm$core$List$indexedMap,
|
||||
F2(
|
||||
function (i, m) {
|
||||
return A2(
|
||||
$author$project$App$encode_marker,
|
||||
$elm$core$String$fromInt(i),
|
||||
m);
|
||||
}),
|
||||
model.markers))),
|
||||
_Utils_Tuple2(
|
||||
'name',
|
||||
$elm$json$Json$Encode$string(model.map_name))
|
||||
])))
|
||||
]))));
|
||||
};
|
||||
var $elm$core$Basics$always = F2(
|
||||
|
@ -5712,11 +5745,19 @@ var $author$project$App$update = F2(
|
|||
markers: A2($elm_community$list_extra$List$Extra$removeAt, i, model.markers),
|
||||
selection: $author$project$App$NoSelection
|
||||
}));
|
||||
default:
|
||||
case 'ClickCurrentPosition':
|
||||
return $author$project$App$nocmd(
|
||||
_Utils_update(
|
||||
model,
|
||||
{centre: $author$project$App$CurrentPositionCentre, selection: $author$project$App$NoSelection}));
|
||||
case 'SetMapName':
|
||||
var name = msg.a;
|
||||
return $author$project$App$nocmd(
|
||||
_Utils_update(
|
||||
model,
|
||||
{map_name: name}));
|
||||
default:
|
||||
return $author$project$App$save(model);
|
||||
}
|
||||
});
|
||||
var $author$project$App$AddMarker = {$: 'AddMarker'};
|
||||
|
@ -5727,6 +5768,10 @@ var $author$project$App$EditMarker = F2(
|
|||
var $author$project$App$RemoveMarker = function (a) {
|
||||
return {$: 'RemoveMarker', a: a};
|
||||
};
|
||||
var $author$project$App$Save = {$: 'Save'};
|
||||
var $author$project$App$SetMapName = function (a) {
|
||||
return {$: 'SetMapName', a: a};
|
||||
};
|
||||
var $author$project$App$UpdateExistingMarker = F2(
|
||||
function (a, b) {
|
||||
return {$: 'UpdateExistingMarker', a: a, b: b};
|
||||
|
@ -5761,10 +5806,6 @@ var $elm$html$Html$datalist = _VirtualDom_node('datalist');
|
|||
var $author$project$App$MapClicked = function (a) {
|
||||
return {$: 'MapClicked', a: a};
|
||||
};
|
||||
var $elm$json$Json$Decode$at = F2(
|
||||
function (fields, decoder) {
|
||||
return A3($elm$core$List$foldr, $elm$json$Json$Decode$field, decoder, fields);
|
||||
});
|
||||
var $author$project$App$decode_map_click = A2(
|
||||
$elm$json$Json$Decode$map,
|
||||
$author$project$App$MapClicked,
|
||||
|
@ -5845,6 +5886,7 @@ var $elm$html$Html$form = _VirtualDom_node('form');
|
|||
var $elm$core$String$fromFloat = _String_fromNumber;
|
||||
var $elm$html$Html$h1 = _VirtualDom_node('h1');
|
||||
var $elm$html$Html$h2 = _VirtualDom_node('h2');
|
||||
var $elm$html$Html$h3 = _VirtualDom_node('h3');
|
||||
var $elm$html$Html$Attributes$href = function (url) {
|
||||
return A2(
|
||||
$elm$html$Html$Attributes$stringProperty,
|
||||
|
@ -6011,6 +6053,7 @@ var $elm$core$Tuple$second = function (_v0) {
|
|||
var y = _v0.b;
|
||||
return y;
|
||||
};
|
||||
var $elm$html$Html$small = _VirtualDom_node('small');
|
||||
var $elm$core$List$sortBy = _List_sortBy;
|
||||
var $author$project$App$space = $elm$html$Html$text(' ');
|
||||
var $elm$html$Html$span = _VirtualDom_node('span');
|
||||
|
@ -6378,6 +6421,32 @@ var $author$project$App$view = function (model) {
|
|||
$elm$html$Html$text('Closest markers')
|
||||
])),
|
||||
A2(
|
||||
$elm$html$Html$p,
|
||||
_List_Nil,
|
||||
_List_fromArray(
|
||||
[
|
||||
$elm$html$Html$text('🗺️ '),
|
||||
A2(
|
||||
$elm$html$Html$form,
|
||||
_List_fromArray(
|
||||
[
|
||||
$elm$html$Html$Events$onSubmit($author$project$App$Save),
|
||||
$elm$html$Html$Attributes$id('name-form')
|
||||
]),
|
||||
_List_fromArray(
|
||||
[
|
||||
A2(
|
||||
$elm$html$Html$input,
|
||||
_List_fromArray(
|
||||
[
|
||||
$elm$html$Html$Attributes$type_('text'),
|
||||
$elm$html$Html$Events$onInput($author$project$App$SetMapName),
|
||||
$elm$html$Html$Attributes$value(model.map_name)
|
||||
]),
|
||||
_List_Nil)
|
||||
]))
|
||||
])),
|
||||
A2(
|
||||
$elm$html$Html$ul,
|
||||
_List_Nil,
|
||||
A2(
|
||||
|
@ -6409,6 +6478,61 @@ var $author$project$App$view = function (model) {
|
|||
[
|
||||
$elm$html$Html$text('🔗 Link to this map')
|
||||
]))
|
||||
])),
|
||||
A2(
|
||||
$elm$html$Html$h3,
|
||||
_List_Nil,
|
||||
_List_fromArray(
|
||||
[
|
||||
$elm$html$Html$text('Recently-used maps')
|
||||
])),
|
||||
A2(
|
||||
$elm$html$Html$ul,
|
||||
_List_Nil,
|
||||
A2(
|
||||
$elm$core$List$map,
|
||||
function (d) {
|
||||
return A2(
|
||||
$elm$html$Html$li,
|
||||
_List_Nil,
|
||||
_List_fromArray(
|
||||
[
|
||||
A2(
|
||||
$elm$html$Html$a,
|
||||
_List_fromArray(
|
||||
[
|
||||
$elm$html$Html$Attributes$href('?map=' + d.id)
|
||||
]),
|
||||
_List_fromArray(
|
||||
[
|
||||
$elm$html$Html$text(d.name),
|
||||
$elm$html$Html$text(' '),
|
||||
A2(
|
||||
$elm$html$Html$small,
|
||||
_List_Nil,
|
||||
_List_fromArray(
|
||||
[
|
||||
$elm$html$Html$text(d.id)
|
||||
]))
|
||||
]))
|
||||
]));
|
||||
},
|
||||
model.map_ids)),
|
||||
A2(
|
||||
$elm$html$Html$p,
|
||||
_List_Nil,
|
||||
_List_fromArray(
|
||||
[
|
||||
A2(
|
||||
$elm$html$Html$a,
|
||||
_List_fromArray(
|
||||
[
|
||||
$elm$html$Html$Attributes$href('?')
|
||||
]),
|
||||
_List_fromArray(
|
||||
[
|
||||
$elm$html$Html$text('New map')
|
||||
]))
|
||||
]))
|
||||
]));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue