"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { useI18n } from "@/lib/i18n"; import { clearRecentDestinations, loadRecentDestinations, type RecentDestination, } from "@/lib/recentDestinations"; import { meetupCityHref } from "@/lib/meetupLinks"; interface Props { compact?: boolean; } export default function RecentlyViewed({ compact = false }: Props) { const { t } = useI18n(); const [items, setItems] = useState([]); useEffect(() => { setItems(loadRecentDestinations()); }, []); if (items.length === 0) return null; return (
{t.recent.tag}

{t.recent.title}

{!compact &&

{t.recent.subtitle}

}
{!compact && ( {t.nav.compare} )}
{items.map((d) => ( {d.emoji}
{d.name} , {d.country}

¥{d.cost.toLocaleString()}/mo · ⭐ {d.rating}

))}
{items.length >= 2 && (
d.slug) .join(",")}`} className="btn btn-primary btn-sm" > {t.recent.compareRecent} {t.common.cityMeetups} {t.strip.openPlan}
)}
); }