Improved pages.meet loading UX

This commit is contained in:
Niko 2022-02-14 16:55:44 +01:00
parent 351e1a20b1
commit b9bded862e
1 changed files with 10 additions and 3 deletions

View File

@ -1,9 +1,9 @@
app.pages.meet = { app.pages.meet = {
load: function(args) { load: function(args) {
document.querySelector('#page-meet').removeAttribute('style');
http.get('/api/v1/feed/meet', {}, function(json) { http.get('/api/v1/feed/meet', {}, function(json) {
if (json === undefined) return; if (json === undefined) return;
app.template.loadMany(['meet.item','meet.item_actions'], function(_) { app.template.loadMany(['meet.item','meet.item_actions'], function(_) {
document.querySelector('#page-meet').removeAttribute('style');
var _; var _;
_ = function () { _ = function () {
const dom = document.querySelector('#page-meet #content'); const dom = document.querySelector('#page-meet #content');
@ -30,7 +30,10 @@ app.pages.meet = {
var tpl = app.template.get('meet.item_actions'); var tpl = app.template.get('meet.item_actions');
dom.innerHTML += tpl; dom.innerHTML += tpl;
}; _(); }; _();
app.pages.meet.carousel.set(0); var index = app.storage.get('status_meet_index');
if (index === undefined)
index = 0;
app.pages.meet.carousel.set(parseInt(index));
}); });
}); });
}, },
@ -43,7 +46,11 @@ app.pages.meet = {
_parent: function() { return document.querySelector('#page-meet #content') }, _parent: function() { return document.querySelector('#page-meet #content') },
_elements: function() { return app.pages.meet.carousel._parent().querySelectorAll('.meet.item') }, _elements: function() { return app.pages.meet.carousel._parent().querySelectorAll('.meet.item') },
_size: function() { return app.pages.meet.carousel._elements().length }, _size: function() { return app.pages.meet.carousel._elements().length },
_onSetEvent: function() { app.pages.meet.carousel.setDragEvent() }, _onSetEvent: function() {
app.storage.set('status_meet_index',
app.pages.meet.carousel._current);
app.pages.meet.carousel.setDragEvent();
},
set: function(i) { return app.carousel.set(app.pages.meet.carousel, i) }, set: function(i) { return app.carousel.set(app.pages.meet.carousel, i) },
next: function() { return app.carousel.next(app.pages.meet.carousel) }, next: function() { return app.carousel.next(app.pages.meet.carousel) },
prev: function() { return app.carousel.prev(app.pages.meet.carousel) }, prev: function() { return app.carousel.prev(app.pages.meet.carousel) },