"use client" import { useEffect, useState } from "react" import { getApiUrl } from "@/lib/api-config" import { Card, CardContent } from "@/components/ui/card" import { Calendar, MessageSquare, Star, Users } from "lucide-react" import Link from "next/link" import { WikiText } from "@/components/ui/wiki-text" interface FeedItem { type: string timestamp: string data: any user: { id: number username: string avatar?: string } } export function ActivityFeed() { const [feed, setFeed] = useState([]) const [loading, setLoading] = useState(true) useEffect(() => { fetch(`${getApiUrl()}/feed/`) .then(res => res.json()) .then(setFeed) .catch(console.error) .finally(() => setLoading(false)) }, []) if (loading) return
Loading activity...
return (
{feed.map((item, idx) => (
{item.type === "review" && } {item.type === "attendance" && } {item.type === "post" && }

{item.user.username || "Anonymous"} {item.type === "review" && " reviewed a show"} {item.type === "attendance" && " attended a show"} {item.type === "post" && " posted in a group"}

{item.type === "review" && (
""
)} {item.type === "post" && (

{item.data.content}

)}

{new Date(item.timestamp).toLocaleDateString()}

))} {feed.length === 0 && (

No recent activity.

)}
) }