diff --git a/src/app/gear/page.tsx b/src/app/gear/page.tsx index f515c5f..bcb7892 100644 --- a/src/app/gear/page.tsx +++ b/src/app/gear/page.tsx @@ -62,8 +62,12 @@ export default async function GearPage() {
- {article.date} - · + {article.category !== "Featured" && ( + <> + {article.date} + · + + )} {article.readTime}

diff --git a/src/app/home-page/page.tsx b/src/app/home-page/page.tsx index 8a7d84b..b179687 100644 --- a/src/app/home-page/page.tsx +++ b/src/app/home-page/page.tsx @@ -4,7 +4,6 @@ import Header from "@/components/Header"; import Footer from "@/components/Footer"; import FeaturedBentoFromDb from '@/components/FeaturedBentoFromDb'; import FeaturedCarouselServer from '@/components/FeaturedCarouselServer'; -import TrendsSidebar from '@/components/TrendsSidebar'; import LiveWireTicker from '@/components/LiveWireTicker'; import NewsTicker from "./components/NewsTicker"; import FeaturedBento from "./components/FeaturedBento"; @@ -179,7 +178,6 @@ export default function HomePage() { {/* Newsletter signup */} -
diff --git a/src/app/technology/page.tsx b/src/app/technology/page.tsx index 19b42c5..5f15387 100644 --- a/src/app/technology/page.tsx +++ b/src/app/technology/page.tsx @@ -105,7 +105,9 @@ export default async function TechnologyPage() {

{article.title}

- {article.date} + {article.category !== "Featured" && ( + {article.date} + )}
))} diff --git a/src/components/FeaturedBentoFromDb.tsx b/src/components/FeaturedBentoFromDb.tsx index 0146f9d..9cf636f 100644 --- a/src/components/FeaturedBentoFromDb.tsx +++ b/src/components/FeaturedBentoFromDb.tsx @@ -106,8 +106,6 @@ export default async function FeaturedBento() { )}
{hero.author_name || "Broadcast Beat"} - · - {ago(hero.wp_published_at)}
@@ -136,9 +134,6 @@ export default async function FeaturedBento() {

{r.title}

-
- {ago(r.wp_published_at)} -
))} diff --git a/src/components/TrendsSidebar.tsx b/src/components/TrendsSidebar.tsx deleted file mode 100644 index d895437..0000000 --- a/src/components/TrendsSidebar.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import { createClient } from "@supabase/supabase-js"; - -export const dynamic = "force-dynamic"; -export const revalidate = 21600; // 6h - -interface Article { - title: string; - excerpt: string | null; - tags: string[] | null; - published_at: string | null; -} - -function detectTrends(recent: Article[], baseline: Article[]) { - const recentCounts: Record = {}; - for (const a of recent) for (const t of a.tags || []) { - const k = t.toLowerCase(); - recentCounts[k] = (recentCounts[k] || 0) + 1; - } - const baseCounts: Record = {}; - for (const a of baseline) for (const t of a.tags || []) { - const k = t.toLowerCase(); - baseCounts[k] = (baseCounts[k] || 0) + 1; - } - const scored = Object.entries(recentCounts).map(([k, c]) => { - const baseline_per_day = (baseCounts[k] || 0) / 30; - const recent_per_day = c / 7; - const lift = baseline_per_day > 0 ? recent_per_day / baseline_per_day : recent_per_day * 3; - return { entity: k, lift, count: c }; - }); - scored.sort((a, b) => b.lift - a.lift); - return scored.slice(0, 5); -} - -function titleCase(s: string): string { - return s.replace(/\b\w/g, (c) => c.toUpperCase()); -} - -export default async function TrendsSidebar() { - const sb = createClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - { - db: { schema: (process.env.NEXT_PUBLIC_SUPABASE_SCHEMA || "bb") as "public" }, - auth: { persistSession: false }, - } - ); - - const since7d = new Date(Date.now() - 7 * 86400000).toISOString(); - const since30d = new Date(Date.now() - 30 * 86400000).toISOString(); - const [recent, baseline] = await Promise.all([ - sb - .from("wp_imported_posts") - .select("title, excerpt, tags, wp_published_at") - .eq("status", "published") - .gte("wp_published_at", since7d) - .order("wp_published_at", { ascending: false }) - .limit(200), - sb - .from("wp_imported_posts") - .select("title, excerpt, tags, wp_published_at") - .eq("status", "published") - .gte("wp_published_at", since30d) - .lt("wp_published_at", since7d) - .order("wp_published_at", { ascending: false }) - .limit(800), - ]); - - const recentArts: Article[] = (recent.data || []).map((r: any) => ({ - title: r.title, excerpt: r.excerpt, tags: r.tags, published_at: r.wp_published_at, - })); - const baselineArts: Article[] = (baseline.data || []).map((r: any) => ({ - title: r.title, excerpt: r.excerpt, tags: r.tags, published_at: r.wp_published_at, - })); - const trends = detectTrends(recentArts, baselineArts); - - return ( - - ); -}