Files
AyrisAIandClaude Sonnet 5 1b8cfeda95 feat: harden admin security, add AI trip planner, map view, and SEO/notification improvements
Security:
- requireAdmin() session check added to every admin-only server action
  (previously relied only on middleware path matching, which Next.js
  Server Actions don't reliably respect)
- Real Prisma + bcrypt admin auth, replacing hardcoded credentials; split
  into an Edge-safe auth.config.ts (used by proxy.ts) and the full
  Prisma-backed auth.ts (route handler, server actions, server components)
- Removed hardcoded fallback secret on the Instagram sync cron endpoint
- Honeypot field + per-IP rate limiting on contact/business-submission
  forms and the analytics events endpoint

Features:
- AI trip planner (/plan-olustur, /plan/[id]) backed by DeepSeek, grounded
  to only recommend isLocalApproved listings, with a deterministic
  link-injection fallback for anything the model doesn't format as markdown
- Interactive Leaflet/OpenStreetMap view on category listing pages
- Telegram notifications for new contact messages and business submissions

SEO:
- Brand-consistent favicon/apple-icon/PWA icons and default Open Graph/
  Twitter share images, generated via next/og (replacing default Next.js
  placeholders)
- BreadcrumbList structured data on category and listing detail pages
- Fixed two remaining raw <img> tags to use next/image

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-24 00:01:06 +03:00

96 lines
3.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { setRequestLocale } from 'next-intl/server'
import { mockDb } from '@/lib/mockDb'
import ListingCard from '@/components/ListingCard'
import { notFound } from 'next/navigation'
import { MapPin } from 'lucide-react'
import type { Metadata } from 'next'
import { basicMetadata } from '@/lib/seo'
interface NeighborhoodPageProps {
params: Promise<{ locale: string; slug: string }>
}
export async function generateMetadata({ params }: NeighborhoodPageProps): Promise<Metadata> {
const { locale, slug } = await params
const neighborhood = await mockDb.getNeighborhoodBySlug(slug)
if (!neighborhood) return {}
const name = locale === 'ru' ? neighborhood.nameRu : locale === 'en' ? neighborhood.nameEn : neighborhood.nameTr
const title =
locale === 'en'
? `${name}, Marmaris — Local Guide — Marmaris Local`
: locale === 'ru'
? `${name}, Мармарис — Местный гид — Marmaris Local`
: `${name}, Marmaris — Mahalle Rehberi — Marmaris Local`
const description =
locale === 'en'
? `Discover the best restaurants, apart hotels and local businesses in ${name}, Marmaris.`
: locale === 'ru'
? `Лучшие рестораны, апарт-отели и заведения в районе ${name}, Мармарис.`
: `${name}, Marmaris'teki en iyi restoranlar, apart oteller ve yerel işletmeler.`
return basicMetadata(title, description, locale, `/neighborhood/${slug}`)
}
export default async function NeighborhoodPage({ params }: NeighborhoodPageProps) {
const { locale, slug } = await params
setRequestLocale(locale)
const neighborhood = await mockDb.getNeighborhoodBySlug(slug)
if (!neighborhood) {
notFound()
}
const listings = await mockDb.getListings({
neighborhoodId: neighborhood.id
})
const name =
locale === 'ru'
? neighborhood.nameRu
: locale === 'en'
? neighborhood.nameEn
: neighborhood.nameTr
return (
<div className="flex-1 flex flex-col min-h-screen bg-stone text-ink">
<main className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 flex-1">
{/* Header */}
<div className="flex items-center gap-3 mb-10 pb-6 border-b border-pine/8">
<div className="p-3 bg-paper rounded-xl border border-pine/8 text-turquoise shadow-sm">
<MapPin className="w-6 h-6" />
</div>
<div>
<h1 className="text-3xl font-heading font-extrabold text-pine lowercase">
{name}
</h1>
<p className="text-xs text-shutter font-mono uppercase tracking-wider mt-1">
{locale === 'tr' ? 'mahalle rehberi' : locale === 'en' ? 'neighborhood directory' : 'гид по району'} {listings.length} {locale === 'tr' ? 'mekan' : locale === 'en' ? 'places' : 'заведений'}
</p>
</div>
</div>
{/* Results */}
{listings.length === 0 ? (
<div className="bg-paper/50 rounded-2xl border border-dashed border-pine/12 p-16 text-center text-shutter">
<p className="text-sm font-medium">
{locale === 'tr' ? 'Bu mahallede henüz kayıtlı mekan bulunmamaktadır.' : locale === 'en' ? 'No registered places in this neighborhood yet.' : 'В этом районе пока нет зарегистрированных мест.'}
</p>
</div>
) : (
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8">
{listings.map((listing) => (
<ListingCard key={listing.id} listing={listing} />
))}
</div>
)}
</main>
</div>
)
}