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 (
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
Berangkat dalam 7 hari ke depan
Pendakian gunung bareng teman baru
Belum ada trip tersedia
Jadilah yang pertama buat open trip pendakian!
+ Buat Trip BaruTrip di bawah Rp 300.000
Buat trip sendiri atau gabung trip yang sudah ada. Seru bareng teman baru!