import Link from "next/link"; import Image from "next/image"; import { tripService } from "@/server/services/trip.service"; import { TripCard } from "@/features/trip/components/trip-card"; export default async function HomePage() { const trips = await tripService.getOpenTrips(); const now = new Date(); const nextWeek = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000); const upcomingTrips = trips .filter((t) => new Date(t.date) <= nextWeek) .slice(0, 3); const upcomingIds = new Set(upcomingTrips.map((t) => t.id)); const latestTrips = trips .filter((t) => !upcomingIds.has(t.id)) .slice(0, 6); const shownIds = new Set([...upcomingIds, ...latestTrips.map((t) => t.id)]); const budgetTrips = trips .filter((t) => !shownIds.has(t.id) && t.price <= 300000) .slice(0, 3); return (
{/* ========== HERO ========== */}
{/* Logo background full */}
{/* Brand badge */}
🏔️ Open Trip Pendakian Gunung

SeTrip

Masa cowok sejati, cewek seimut nggak{" "} SeTrip bareng?

Yuk mulai dari sini. Cari open trip pendakian, gabung bareng, nikmati petualangan ke gunung-gunung Jawa Barat.

Cari Trip Sekarang {/* Stats */}

{trips.length}

Trip Tersedia

8

Gunung Jabar

100%

Seru

{/* ========== CONTENT ========== */}
{/* Trip Terdekat */} {upcomingTrips.length > 0 && (
🔥

Trip Terdekat

Berangkat dalam 7 hari ke depan

{upcomingTrips.slice(0, 3).map((trip, i) => ( ))}
)} {/* Open Trip */}
🏔️

Open Trip

Pendakian gunung bareng teman baru

Lihat semua
{latestTrips.length === 0 ? (
🏕️

Belum ada trip tersedia

Jadilah yang pertama buat open trip pendakian!

+ Buat Trip Baru
) : (
{latestTrips.map((trip) => ( ))}
)}
{/* Budget Friendly */} {budgetTrips.length > 0 && (
💸

Budget Friendly

Trip di bawah Rp 300.000

{budgetTrips.map((trip) => ( ))}
)} {/* CTA Bottom */}

Siap naik gunung?

Buat trip sendiri atau gabung trip yang sudah ada. Seru bareng teman baru!

Buat Trip Cari Trip
{/* ========== FAB ========== */} +
); }