From 545c782d37e22851c0c914df3e99f5576d08e6c9 Mon Sep 17 00:00:00 2001 From: Local Administrator Date: Fri, 26 Jun 2026 17:32:57 +0000 Subject: [PATCH] Industry News: remove author search filter --- src/app/home-page/components/ArticleFeed.tsx | 58 +++----------------- 1 file changed, 7 insertions(+), 51 deletions(-) diff --git a/src/app/home-page/components/ArticleFeed.tsx b/src/app/home-page/components/ArticleFeed.tsx index ebb0395..5368e8b 100644 --- a/src/app/home-page/components/ArticleFeed.tsx +++ b/src/app/home-page/components/ArticleFeed.tsx @@ -47,19 +47,6 @@ type FeedMode = "pagination" | "infinite"; type SortOrder = "recent" | "trending" | "most-commented"; const ARTICLES_PER_PAGE = 15; -// Derive unique authors from all articles (static + imported merged at runtime) -function getUniqueAuthors(articles: ArticleItem[]): string[] { - const seen = new Set(); - const authors: string[] = []; - for (const a of articles) { - if (a.author && !seen.has(a.author)) { - seen.add(a.author); - authors.push(a.author); - } - } - return authors.sort(); -} - // Parse "Month DD, YYYY" → Date object for comparison function parseArticleDate(dateStr: string): Date | null { const d = new Date(dateStr); @@ -79,7 +66,6 @@ export default function ArticleFeed() { const [sortOrder, setSortOrder] = useState("recent"); // Advanced filters const [showAdvanced, setShowAdvanced] = useState(false); - const [authorFilter, setAuthorFilter] = useState("All"); const [dateFrom, setDateFrom] = useState(""); const [dateTo, setDateTo] = useState(""); const searchRef = useRef(null); @@ -138,15 +124,12 @@ export default function ArticleFeed() { // Merge: interleave imported posts with static (imported first by recency, then static) const allArticles: ArticleItem[] = [...wpPosts]; - const uniqueAuthors = getUniqueAuthors(allArticles); - - const hasAdvancedActive = authorFilter !== "All" || dateFrom !== "" || dateTo !== ""; + const hasAdvancedActive = dateFrom !== "" || dateTo !== ""; const clearAllFilters = () => { setSearchQuery(""); setActiveCategory("All"); setSourceFilter("All"); - setAuthorFilter("All"); setDateFrom(""); setDateTo(""); setPage(1); @@ -162,8 +145,7 @@ export default function ArticleFeed() { (sourceFilter === "Imported" && a.source === "imported") || (sourceFilter === "Live" && a.source === "live"); const q = searchQuery.toLowerCase(); - const matchSearch = !q || a.title.toLowerCase().includes(q) || a.excerpt.toLowerCase().includes(q) || a.author.toLowerCase().includes(q); - const matchAuthor = authorFilter === "All" || a.author === authorFilter; + const matchSearch = !q || a.title.toLowerCase().includes(q) || a.excerpt.toLowerCase().includes(q); // Date range filtering let matchDate = true; if (dateFrom || dateTo) { @@ -180,7 +162,7 @@ export default function ArticleFeed() { } } } - return matchCat && matchSource && matchSearch && matchAuthor && matchDate; + return matchCat && matchSource && matchSearch && matchDate; }); // Sort filtered articles based on sortOrder. For every order we honor @@ -244,7 +226,7 @@ export default function ArticleFeed() { // Reset infinite count when filters change useEffect(() => { setInfiniteCount(ARTICLES_PER_PAGE); - }, [searchQuery, activeCategory, sourceFilter, authorFilter, dateFrom, dateTo, sortOrder]); + }, [searchQuery, activeCategory, sourceFilter, dateFrom, dateTo, sortOrder]); // Arrow key navigation for filter chips const handleFilterKeyDown = (e: React.KeyboardEvent, index: number) => { @@ -363,7 +345,7 @@ export default function ArticleFeed() { {sortedFiltered.length?.toLocaleString()} article{sortedFiltered.length !== 1 ? "s" : ""} - {/* Filters — topic chips + date range visible by default, advanced (author + source) behind toggle */} + {/* Filters — date range visible by default, advanced (source) behind toggle */}
{/* Row: date range + advanced toggle */}
@@ -426,31 +408,6 @@ export default function ArticleFeed() { className="bg-[#F8FAFC] border border-[#DCE6F2] rounded-sm p-3 space-y-3" role="group" aria-label="Advanced filters"> -
- {/* Author filter (category + date moved out to the always-visible row) */} -
- -
- - -
-
-
- {/* Source filter inside advanced panel */}
Source @@ -485,7 +442,7 @@ export default function ArticleFeed() {
@@ -499,7 +456,7 @@ export default function ArticleFeed() { selection now. */} {/* Results count */} - {(searchQuery || activeCategory !== "All" || sourceFilter !== "All" || authorFilter !== "All" || dateFrom || dateTo) && ( + {(searchQuery || activeCategory !== "All" || sourceFilter !== "All" || dateFrom || dateTo) && (