ari/DynamicPageLoads #2
3 changed files with 3 additions and 12 deletions
|
@ -16,7 +16,7 @@
|
|||
});
|
||||
});
|
||||
// Infinite loading function
|
||||
const onInfinite = ({ detail: { loaded, complete } }) => {
|
||||
const onInfinite = ({ detail: { loaded, complete } } : { detail : { loaded : () => void, complete : () => void}}) => {
|
||||
getNextPosts().then((newPosts) => {
|
||||
if (newPosts.length > 0) {
|
||||
posts = [...posts, ...newPosts];
|
||||
|
@ -53,11 +53,7 @@
|
|||
<PostComponent post={postObject as Post} />
|
||||
{/each}
|
||||
<InfiniteLoading on:infinite={onInfinite}
|
||||
id="infiniteLoading"
|
||||
distance={0}
|
||||
threshold={0}
|
||||
useWindow={false}
|
||||
forceUseWindow={false}
|
||||
/>
|
||||
<div id="spacer"></div>
|
||||
</div>
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
<div id="carouselControls">
|
||||
<button
|
||||
id="prevBtn"
|
||||
on:click={prevImage}
|
||||
onclick={prevImage}
|
||||
disabled={currentImageIndex === 0}>←</button
|
||||
>
|
||||
<div id="carouselIndicators">
|
||||
|
@ -125,7 +125,7 @@
|
|||
</div>
|
||||
<button
|
||||
id="nextBtn"
|
||||
on:click={nextImage}
|
||||
onclick={nextImage}
|
||||
disabled={currentImageIndex === post.imagesCid.length - 1}
|
||||
>→</button
|
||||
>
|
||||
|
|
|
@ -215,7 +215,6 @@ const getCutoffDate = (postAccounts: PostsAcc[]) => {
|
|||
}
|
||||
});
|
||||
if (cutoffDate) {
|
||||
console.log("Cutoff date:", cutoffDate);
|
||||
return cutoffDate;
|
||||
} else {
|
||||
return new Date(now);
|
||||
|
@ -303,7 +302,6 @@ const getNextPosts = async () => {
|
|||
return postDate <= now;
|
||||
});
|
||||
}
|
||||
// append the new posts to the existing posts
|
||||
|
||||
const newPosts = records.map((record) => {
|
||||
const account = accountsMetadata.find(
|
||||
|
@ -316,14 +314,11 @@ const getNextPosts = async () => {
|
|||
}
|
||||
return new Post(record, account);
|
||||
});
|
||||
console.log("Fetched posts:", newPosts);
|
||||
console.log("Metadata:", accountsMetadata);
|
||||
return newPosts;
|
||||
};
|
||||
|
||||
const fetchPostsForUser = async (did: At.Did, cursor: string | null) => {
|
||||
try {
|
||||
console.log("Fetching posts for user:", did, "with Cursor: ", cursor);
|
||||
const { data } = await rpc.get("com.atproto.repo.listRecords", {
|
||||
params: {
|
||||
repo: did as At.Identifier,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue