add end date and create logo and fix filter
This commit is contained in:
+34
-6
@@ -1,7 +1,7 @@
|
||||
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";
|
||||
import { SearchBar } from "@/features/trip/components/search-bar";
|
||||
|
||||
export default async function HomePage() {
|
||||
const trips = await tripService.getOpenTrips();
|
||||
@@ -9,15 +9,35 @@ export default async function HomePage() {
|
||||
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);
|
||||
const budgetTrips = trips.filter((t) => t.price <= 300000).slice(0, 3);
|
||||
const latestTrips = trips.slice(0, 6);
|
||||
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 (
|
||||
<div className="relative min-h-screen bg-neutral-50">
|
||||
{/* ========== HERO ========== */}
|
||||
<section className="relative overflow-hidden bg-neutral-900">
|
||||
<div className="absolute inset-0 bg-linear-to-br from-primary-900/90 via-neutral-900/80 to-secondary-900/70" />
|
||||
{/* Logo background full */}
|
||||
<Image
|
||||
src="/images/SeTrip.png"
|
||||
alt=""
|
||||
fill
|
||||
className="object-cover opacity-10 brightness-150"
|
||||
priority
|
||||
/>
|
||||
<div className="absolute inset-0 bg-linear-to-br from-primary-900/85 via-neutral-900/75 to-secondary-900/80" />
|
||||
|
||||
<div className="relative mx-auto max-w-4xl px-4 pb-10 pt-8 text-center sm:pb-14 sm:pt-12 lg:pb-16 lg:pt-14">
|
||||
{/* Brand badge */}
|
||||
@@ -41,7 +61,12 @@ export default async function HomePage() {
|
||||
petualangan ke gunung-gunung Jawa Barat.
|
||||
</p>
|
||||
|
||||
<SearchBar />
|
||||
<Link
|
||||
href="/trips"
|
||||
className="inline-block rounded-xl bg-primary-600 px-6 py-2.5 text-sm font-semibold text-white shadow-lg shadow-primary-600/25 transition-all hover:bg-primary-500 hover:scale-105 active:scale-95 sm:px-8 sm:py-3 sm:text-base"
|
||||
>
|
||||
Cari Trip Sekarang
|
||||
</Link>
|
||||
|
||||
{/* Stats */}
|
||||
<div className="mt-8 flex justify-center gap-6 sm:mt-10 sm:gap-10 lg:gap-12">
|
||||
@@ -92,6 +117,7 @@ export default async function HomePage() {
|
||||
mountain={trip.mountain}
|
||||
location={trip.location}
|
||||
date={trip.date}
|
||||
endDate={trip.endDate}
|
||||
price={trip.price}
|
||||
maxParticipants={trip.maxParticipants}
|
||||
participantCount={trip._count.participants}
|
||||
@@ -157,6 +183,7 @@ export default async function HomePage() {
|
||||
mountain={trip.mountain}
|
||||
location={trip.location}
|
||||
date={trip.date}
|
||||
endDate={trip.endDate}
|
||||
price={trip.price}
|
||||
maxParticipants={trip.maxParticipants}
|
||||
participantCount={trip._count.participants}
|
||||
@@ -194,6 +221,7 @@ export default async function HomePage() {
|
||||
mountain={trip.mountain}
|
||||
location={trip.location}
|
||||
date={trip.date}
|
||||
endDate={trip.endDate}
|
||||
price={trip.price}
|
||||
maxParticipants={trip.maxParticipants}
|
||||
participantCount={trip._count.participants}
|
||||
|
||||
Reference in New Issue
Block a user