feat: integrate RapidAPI Instagram feed, apply Bodoni Moda font globally, disable prisma query logs, and fix UI minor issues
This commit is contained in:
+6
-11
@@ -1,17 +1,12 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Playfair_Display, Lato } from "next/font/google";
|
||||
import { Bodoni_Moda } from "next/font/google";
|
||||
import "../globals.css";
|
||||
import { prisma } from "@/lib/db";
|
||||
|
||||
const playfair = Playfair_Display({
|
||||
variable: "--font-playfair",
|
||||
const bodoni = Bodoni_Moda({
|
||||
variable: "--font-bodoni",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
const lato = Lato({
|
||||
variable: "--font-lato",
|
||||
subsets: ["latin"],
|
||||
weight: ["300", "400", "700", "900"],
|
||||
display: "swap",
|
||||
});
|
||||
|
||||
export async function generateStaticParams() {
|
||||
@@ -147,14 +142,14 @@ export default async function RootLayout({
|
||||
};
|
||||
|
||||
return (
|
||||
<html lang={lang} className="scroll-smooth">
|
||||
<html lang={lang} className={`scroll-smooth ${bodoni.variable}`}>
|
||||
<head>
|
||||
<script
|
||||
type="application/ld+json"
|
||||
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
|
||||
/>
|
||||
</head>
|
||||
<body className={`${lato.variable} ${playfair.variable} antialiased`}>
|
||||
<body className="antialiased font-sans">
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+42
-3
@@ -9,15 +9,54 @@ import Footer from "@/components/Footer";
|
||||
import { getDictionary } from "../dictionaries";
|
||||
import { prisma } from "@/lib/db";
|
||||
|
||||
async function getInstagramData() {
|
||||
try {
|
||||
const res = await fetch('https://instagram120.p.rapidapi.com/api/instagram/posts', {
|
||||
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: 'moy_akyaka',
|
||||
maxId: ''
|
||||
}),
|
||||
next: { revalidate: 86400 } // 24 hours
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
console.error('Instagram verisi çekilemedi:', await res.text());
|
||||
return [];
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
const edges = data?.result?.edges || [];
|
||||
|
||||
// Get the first 4 posts and map them
|
||||
return edges.slice(0, 4).map((edge: any) => ({
|
||||
id: edge.node.id || edge.node.code,
|
||||
url: `https://www.instagram.com/p/${edge.node.code}/`,
|
||||
imageUrl: edge.node.image_versions2?.candidates?.[0]?.url || edge.node.display_uri || '',
|
||||
caption: edge.node.caption?.text || '',
|
||||
isVideo: edge.node.media_type === 2
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('Instagram API hatası:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export default async function Home({ params }: { params: Promise<{ lang: string }> }) {
|
||||
const { lang } = await params;
|
||||
const dict = await getDictionary(lang);
|
||||
|
||||
const [dbPhotos, dbServices, heroMediaList, dbSettings] = await Promise.all([
|
||||
const [dbPhotos, dbServices, heroMediaList, dbSettings, instagramPosts] = await Promise.all([
|
||||
prisma.gallery.findMany({ orderBy: { createdAt: 'desc' } }),
|
||||
prisma.service.findMany({ orderBy: { createdAt: 'asc' } }),
|
||||
prisma.heroMedia.findMany(),
|
||||
prisma.siteSettings.findFirst()
|
||||
prisma.siteSettings.findFirst(),
|
||||
getInstagramData()
|
||||
]);
|
||||
|
||||
const dbHeroMedia = heroMediaList.length > 0 ? heroMediaList[0] : null;
|
||||
@@ -29,7 +68,7 @@ export default async function Home({ params }: { params: Promise<{ lang: string
|
||||
<About dict={dict} />
|
||||
<Services dict={dict} dbServices={dbServices} />
|
||||
<Gallery dict={dict} dbPhotos={dbPhotos} />
|
||||
<InstagramFeed dict={dict} />
|
||||
<InstagramFeed dict={dict} posts={instagramPosts} />
|
||||
<Contact dict={dict} dbSettings={dbSettings} />
|
||||
<Footer dict={dict} dbSettings={dbSettings} />
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user