aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/infinite_scroll_trigger.php10
-rw-r--r--templates/timeline.php1
2 files changed, 11 insertions, 0 deletions
diff --git a/templates/infinite_scroll_trigger.php b/templates/infinite_scroll_trigger.php
new file mode 100644
index 0000000..dce1343
--- /dev/null
+++ b/templates/infinite_scroll_trigger.php
@@ -0,0 +1,10 @@
+<?php if ($isEnd): ?>
+ <div id="infiniteScroll" hx-swap-oob="true">
+ <?php call_template('placeholder_text', ['count' => 0]); ?>
+ </div>
+<?php else: ?>
+ <div id="infiniteScroll" hx-trigger="intersect" hx-get="/feed/<?= $kind ?>?page=<?= $nextPage ?>&infinite=true"
+ hx-target="previous #timelineItems" hx-swap="beforeend" <?= ($isUpdate ?? false) ? 'hx-swap-oob="true"' : '' ?>>
+ <?php call_template('placeholder_text', ['message' => 'Loading more…']); ?>
+ </div>
+<?php endif; ?> \ No newline at end of file
diff --git a/templates/timeline.php b/templates/timeline.php
index a65b4ce..a517c6f 100644
--- a/templates/timeline.php
+++ b/templates/timeline.php
@@ -17,4 +17,5 @@
$item->getObject()->renderAsHtml();
}
echo '</div>';
+ call_template('infinite_scroll_trigger', ['kind' => $kind, 'nextPage' => 1]);
}); \ No newline at end of file