From 55bed223fe8350e8e3c449bd96abe02bf6dec52e Mon Sep 17 00:00:00 2001 From: celine Date: Thu, 5 Feb 2026 22:56:27 -0500 Subject: [PATCH] updated postListing design --- app/(home-pages)/reader/InboxContent.tsx | 78 ++++++-- app/(home-pages)/reader/page.tsx | 1 + components/ActionBar/NavigationButtons.tsx | 2 +- components/Icons/ShareTiny.tsx | 19 ++ components/InteractionsPreview.tsx | 2 +- components/Pages/useHasBackgroundImage.ts | 5 + components/PostListing.tsx | 219 +++++++++++++++------ components/ThemeManager/ThemeProvider.tsx | 41 ++-- 8 files changed, 274 insertions(+), 93 deletions(-) create mode 100644 components/Icons/ShareTiny.tsx create mode 100644 components/Pages/useHasBackgroundImage.ts diff --git a/app/(home-pages)/reader/InboxContent.tsx b/app/(home-pages)/reader/InboxContent.tsx index a2ea6e07..0770dbc4 100644 --- a/app/(home-pages)/reader/InboxContent.tsx +++ b/app/(home-pages)/reader/InboxContent.tsx @@ -4,9 +4,13 @@ import { DiscoverSmall } from "components/Icons/DiscoverSmall"; import type { Cursor, Post } from "./getReaderFeed"; import useSWRInfinite from "swr/infinite"; import { getReaderFeed } from "./getReaderFeed"; -import { useEffect, useRef } from "react"; +import { useEffect, useRef, useState } from "react"; import Link from "next/link"; import { PostListing } from "components/PostListing"; +import { SortSmall } from "components/Icons/SortSmall"; +import { Input } from "components/Input"; +import { useHasBackgroundImage } from "components/Pages/useHasBackgroundImage"; +import { InteractionDrawer } from "app/lish/[did]/[publication]/[rkey]/Interactions/InteractionDrawer"; export const InboxContent = (props: { posts: Post[]; @@ -60,27 +64,71 @@ export const InboxContent = (props: { return () => observer.disconnect(); }, [data, size, setSize, isValidating]); + let [searchValue, setSearchValue] = useState(""); + let [sort, setSort] = useState<"recent" | "popular">("popular"); const allPosts = data ? data.flatMap((page) => page.posts) : []; + const postTitles = allPosts.map((p) => { + p.documents.data?.title; + }); + const filteredPosts = allPosts + .filter((p) => + p.documents.data?.title.toLowerCase().includes(searchValue.toLowerCase()), + ) + .sort( + (a, b) => + new Date(b.documents.data?.publishedAt || 0).getTime() - + new Date(a.documents.data?.publishedAt || 0).getTime(), + ); if (allPosts.length === 0 && !isValidating) return ; + let hasBackgroundImage = useHasBackgroundImage(); + return ( -
- {allPosts.map((p) => ( - - ))} - {/* Trigger element for loading more posts */} -