Files
marmarislocal/app/[locale]/[category]/[slug]/StickyActionBar.tsx
T
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

95 lines
2.9 KiB
TypeScript

'use client'
import { Phone, MessageSquare, MapPin } from 'lucide-react'
interface StickyActionBarProps {
phone?: string | null
whatsapp?: string | null
latitude?: number | null
longitude?: number | null
address?: string
labels: {
call: string
whatsapp: string
directions: string
}
}
export default function StickyActionBar({
phone,
whatsapp,
latitude,
longitude,
address,
labels,
}: StickyActionBarProps) {
if (!phone && !whatsapp && !latitude && !longitude) {
return null
}
const getWhatsAppLink = (number: string) => {
const cleanNum = number.replace(/\D/g, '')
return `https://wa.me/${cleanNum}`
}
const getDirectionsLink = () => {
if (latitude && longitude) {
return `https://www.google.com/maps/dir/?api=1&destination=${latitude},${longitude}`
}
if (address) {
return `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(address + ', Marmaris')}`
}
return 'https://maps.google.com'
}
return (
<div className="lg:hidden fixed bottom-0 left-0 right-0 z-40 bg-pine/95 backdrop-blur-md border-t border-white/10 p-3 shadow-2xl">
<div className="max-w-md mx-auto grid grid-cols-3 gap-2.5">
{/* WhatsApp Action */}
{whatsapp ? (
<a
href={getWhatsAppLink(whatsapp)}
target="_blank"
rel="noopener noreferrer"
className="flex flex-col items-center justify-center gap-1 bg-turquoise hover:bg-turquoise/90 text-paper font-bold text-[11px] py-2 px-2 rounded-xl transition shadow-sm min-h-[48px] active:scale-95"
aria-label={labels.whatsapp}
>
<MessageSquare className="w-4 h-4" />
<span>{labels.whatsapp}</span>
</a>
) : (
<div className="hidden" />
)}
{/* Call Action */}
{phone ? (
<a
href={`tel:${phone}`}
className="flex flex-col items-center justify-center gap-1 bg-paper/10 hover:bg-paper/20 text-stone font-bold text-[11px] py-2 px-2 rounded-xl border border-white/10 transition shadow-sm min-h-[48px] active:scale-95"
aria-label={labels.call}
>
<Phone className="w-4 h-4 text-turquoise" />
<span>{labels.call}</span>
</a>
) : (
<div className="hidden" />
)}
{/* Directions Action */}
{(latitude || longitude || address) && (
<a
href={getDirectionsLink()}
target="_blank"
rel="noopener noreferrer"
className="flex flex-col items-center justify-center gap-1 bg-paper/10 hover:bg-paper/20 text-stone font-bold text-[11px] py-2 px-2 rounded-xl border border-white/10 transition shadow-sm min-h-[48px] active:scale-95"
aria-label={labels.directions}
>
<MapPin className="w-4 h-4 text-gold" />
<span>{labels.directions}</span>
</a>
)}
</div>
</div>
)
}