diff --git a/app/[lang]/page.tsx b/app/[lang]/page.tsx index 4dcac39..063cafb 100644 --- a/app/[lang]/page.tsx +++ b/app/[lang]/page.tsx @@ -65,6 +65,33 @@ const testimonials = [ import { getDictionary, Locale } from "./dictionaries"; import prisma from "@/lib/prisma"; +async function getInstagramData() { + const url = 'https://instagram120.p.rapidapi.com/api/instagram/posts'; + const options = { + method: 'POST', + headers: { + 'x-rapidapi-key': process.env.RAPIDAPI_KEY || '', + 'x-rapidapi-host': 'instagram120.p.rapidapi.com', + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + username: 'kitebeachakyaka', + maxId: '' + }), + next: { revalidate: 86400 } + }; + + try { + const res = await fetch(url, options); + if (!res.ok) throw new Error('Instagram fetch failed'); + const data = await res.json(); + return data.result?.edges?.slice(0, 4).map((edge: any) => edge.node) || []; + } catch (err) { + console.error("Instagram fetch error:", err); + return []; + } +} + export default async function Home({ params }: { params: Promise<{ lang: string }> }) { const { lang } = await params; const dict = await getDictionary(lang as Locale); @@ -83,14 +110,14 @@ export default async function Home({ params }: { params: Promise<{ lang: string const activities = await prisma.activity.findMany({ where: { lang }, orderBy: { order: "asc" } }); const events = await prisma.event.findMany({ where: { lang }, orderBy: { date: "asc" } }); const dbFeatures = await prisma.feature.findMany({ where: { lang }, orderBy: { order: "asc" } }); - + const aboutDb = await prisma.aboutSection.findUnique({ where: { lang } }); const aboutData = aboutDb || { badge: lang === "en" ? "Our Story" : "Hikayemiz", titleLine1: lang === "en" ? "In the" : "Doğanın", titleLine2: lang === "en" ? "Heart of Nature" : "Kalbinde", titleHighlight: lang === "en" ? "A Special Escape" : "Özel Bir Kaçış", - description1: lang === "en" + description1: lang === "en" ? "Located right on the banks of the Azmak River flowing into the crystal waters of the Gulf of Gokova, we are in a unique location where the wind never ceases." : "Gökova Körfezi'nin kristal sularına dökülen Azmak Nehri'nin hemen kıyısında, rüzgarın hiç eksik olmadığı eşsiz bir konumda yer alıyoruz.", description2: lang === "en" @@ -106,6 +133,7 @@ export default async function Home({ params }: { params: Promise<{ lang: string }; const displayFeatures = dbFeatures.length > 0 ? dbFeatures : defaultFeatures; + const instagramPosts = await getInstagramData(); return (
@@ -353,8 +381,8 @@ export default async function Home({ params }: { params: Promise<{ lang: string
{activities.length > 0 ? ( activities.map((act, i) => ( - @@ -468,6 +496,59 @@ export default async function Home({ params }: { params: Promise<{ lang: string
+ {/* ────────────────────────────────────────── + INSTAGRAM FEED + ────────────────────────────────────────── */} + {instagramPosts.length > 0 && ( +
+
+ + + @kitebeachakyaka + +

Instagram

+
+ + + {instagramPosts.map((post: any) => ( + + {/* eslint-disable-next-line @next/next/no-img-element */} + {post.caption?.text?.substring(0, +
+ +

+ {post.caption?.text} +

+
+
+ ))} +
+ +
+ + Bizi Takip Edin + + +
+
+
+ )} + {/* ────────────────────────────────────────── TESTIMONIALS ────────────────────────────────────────── */}