general category trip
This commit is contained in:
+25
-7
@@ -5,21 +5,34 @@ import { tripService } from "@/server/services/trip.service";
|
||||
import { TripCard } from "@/features/trip/components/trip-card";
|
||||
import { TripFilter } from "@/features/trip/components/trip-filter";
|
||||
import { siteConfig } from "@/lib/site";
|
||||
import { categoryLabel, isActivityCategory } from "@/lib/activity-category";
|
||||
|
||||
interface TripsPageProps {
|
||||
searchParams: Promise<{ q?: string; from?: string; to?: string }>;
|
||||
searchParams: Promise<{
|
||||
q?: string;
|
||||
from?: string;
|
||||
to?: string;
|
||||
category?: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
searchParams,
|
||||
}: TripsPageProps): Promise<Metadata> {
|
||||
const { q } = await searchParams;
|
||||
const { q, category: categoryParam } = await searchParams;
|
||||
const category = isActivityCategory(categoryParam) ? categoryParam : undefined;
|
||||
const categoryName = category ? categoryLabel(category) : null;
|
||||
|
||||
const title = q
|
||||
? `Cari Teman Trip "${q}" — Gabung Bareng`
|
||||
: "Cari Teman Trip & Aktivitas — Daftar Open Trip Aktif";
|
||||
: categoryName
|
||||
? `Cari Teman ${categoryName} — Daftar Open Trip Aktif`
|
||||
: "Cari Teman Trip & Aktivitas — Daftar Open Trip Aktif";
|
||||
const description = q
|
||||
? `Hasil pencarian "${q}" di ${siteConfig.name}. Temukan teman seperjalanan, lihat trip & organizer terverifikasi, langsung gabung.`
|
||||
: `Daftar open trip aktif di ${siteConfig.name} — hiking, camping, snorkeling, city trip, dan aktivitas bareng lainnya. Pilih trip, kenal calon teman seperjalanan, dan gabung bareng — grup kecil & organizer terverifikasi.`;
|
||||
: categoryName
|
||||
? `Daftar open trip ${categoryName.toLowerCase()} di ${siteConfig.name}. Pilih trip, kenal calon teman seperjalanan, dan gabung bareng — grup kecil & organizer terverifikasi.`
|
||||
: `Daftar open trip aktif di ${siteConfig.name} — hiking, camping, snorkeling, city trip, dan aktivitas bareng lainnya. Pilih trip, kenal calon teman seperjalanan, dan gabung bareng — grup kecil & organizer terverifikasi.`;
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
@@ -30,11 +43,13 @@ export async function generateMetadata({
|
||||
|
||||
export default async function TripsPage({ searchParams }: TripsPageProps) {
|
||||
const params = await searchParams;
|
||||
const hasFilters = params.q || params.from || params.to;
|
||||
const category = isActivityCategory(params.category) ? params.category : undefined;
|
||||
const hasFilters = Boolean(params.q || params.from || params.to || category);
|
||||
const filters = {
|
||||
q: params.q,
|
||||
from: params.from,
|
||||
to: params.to,
|
||||
category,
|
||||
};
|
||||
|
||||
const [trips, allTrips] = await Promise.all([
|
||||
@@ -48,7 +63,9 @@ export default async function TripsPage({ searchParams }: TripsPageProps) {
|
||||
<div className="mb-6 flex flex-col gap-3 sm:mb-8 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-neutral-800 sm:text-2xl">
|
||||
Cari Teman Trip & Aktivitas
|
||||
{category
|
||||
? `Cari Teman ${categoryLabel(category)}`
|
||||
: "Cari Teman Trip & Aktivitas"}
|
||||
</h1>
|
||||
<p className="mt-0.5 text-sm text-neutral-500">
|
||||
{hasFilters
|
||||
@@ -102,7 +119,8 @@ export default async function TripsPage({ searchParams }: TripsPageProps) {
|
||||
key={trip.id}
|
||||
id={trip.id}
|
||||
title={trip.title}
|
||||
mountain={trip.mountain}
|
||||
category={trip.category}
|
||||
destination={trip.destination}
|
||||
location={trip.location}
|
||||
date={trip.date}
|
||||
endDate={trip.endDate}
|
||||
|
||||
Reference in New Issue
Block a user