fix: ui fixes
This commit is contained in:
@@ -9,8 +9,9 @@
|
||||
* • Infinite scroll: 10 posts per page, fetched as a bottom sentinel nears
|
||||
* the viewport. The server orders not-yet-liked posts from people you
|
||||
* follow first, then everyone else — seamless, no visible boundary.
|
||||
* • When the feed is exhausted, a "new on the platform" strip (≤5 accounts
|
||||
* that joined in the last 24h) caps it off — hidden if there are none.
|
||||
* • A "new on the platform" strip (≤5 accounts that joined in the last 24h)
|
||||
* sits at the TOP of the scroll flow, so it scrolls out of view as you go
|
||||
* down — hidden entirely if there are none.
|
||||
*
|
||||
* The card's Follow / Follow back affordance is enabled here (enableFollow);
|
||||
* the server hydrates each post's viewer↔author relationship.
|
||||
@@ -49,11 +50,6 @@ export function HomeFeed() {
|
||||
});
|
||||
if (rows.length < PAGE) {
|
||||
setHasMore(false);
|
||||
// Feed exhausted → load the discovery strip once.
|
||||
feed
|
||||
.newUsers()
|
||||
.then((u) => setNewUsers(u ?? []))
|
||||
.catch(() => setNewUsers([]));
|
||||
}
|
||||
} catch {
|
||||
setHasMore(false);
|
||||
@@ -67,6 +63,15 @@ export function HomeFeed() {
|
||||
void loadPage();
|
||||
}, [loadPage]);
|
||||
|
||||
// Discovery strip (new accounts) loads upfront — it sits at the top of the
|
||||
// scroll flow, not at the end.
|
||||
useEffect(() => {
|
||||
feed
|
||||
.newUsers()
|
||||
.then((u) => setNewUsers(u ?? []))
|
||||
.catch(() => setNewUsers([]));
|
||||
}, []);
|
||||
|
||||
// The window virtualiser needs `scrollMargin` = how far down the document the
|
||||
// list begins, to map window scroll → which items are visible. `.offsetTop`
|
||||
// is relative to the offsetParent (wrong inside the page layout), so measure
|
||||
@@ -135,6 +140,11 @@ export function HomeFeed() {
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Top of the scroll flow — scrolls out of view as the feed advances. */}
|
||||
<div className="pb-4">
|
||||
<NewUsersStrip users={newUsers} />
|
||||
</div>
|
||||
|
||||
<div
|
||||
ref={parentRef}
|
||||
className="relative w-full"
|
||||
@@ -162,9 +172,7 @@ export function HomeFeed() {
|
||||
<div ref={sentinelRef} className="flex justify-center py-6">
|
||||
<Loader2 className="size-5 animate-spin text-muted-foreground" />
|
||||
</div>
|
||||
) : (
|
||||
<NewUsersStrip users={newUsers} />
|
||||
)}
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user