feat: integrate Cloudinary image upload, Instagram Feed, and fix Next.js warnings

This commit is contained in:
2026-06-09 21:28:45 +03:00
parent 2b3392dcb1
commit a4ad9344a0
52 changed files with 4300 additions and 263 deletions
+63
View File
@@ -0,0 +1,63 @@
"use server";
import { prisma } from "@/lib/prisma";
import { revalidatePath } from "next/cache";
export async function getBeachSettings() {
try {
let settings = await prisma.beachSettings.findUnique({
where: { id: "default" }
});
if (!settings) {
settings = await prisma.beachSettings.create({
data: {
id: "default",
title: "Ayrıcalıklı Bir Gevşeme Alanı",
description: "Tertemiz sularla buluşan özel plajımız, kendinizi tamamen yenileyebilmeniz için rahatlığın merkezinde. Altın kumların ve berrak denizin tadını çıkarırken, dünya standartlarındaki hizmetimizle her anınızın özel hissettirmesini sağlıyoruz.",
reservationInfo: "VIP cabana ve ön sıra şezlonglar yoğun talep görmektedir. Yeriniz garantilemek için en az bir gün önceden bizimle iletişime geçmenizi öneririz.",
image1: "https://images.unsplash.com/photo-1544148103-0773bf10d330?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80",
image2: "https://images.unsplash.com/photo-1519046904884-53103b34b206?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80",
image3: "https://images.unsplash.com/photo-1499793983690-e29da59ef1c2?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80",
image4: "https://images.unsplash.com/photo-1520250497591-112f2f40a3f4?ixlib=rb-4.0.3&auto=format&fit=crop&w=800&q=80",
}
});
}
return { success: true, data: settings };
} catch (error) {
console.error("Error fetching beach settings:", error);
return { success: false, error: "Plaj ayarları alınırken bir hata oluştu." };
}
}
export async function updateBeachSettings(formData: FormData) {
try {
const title = formData.get("title") as string;
const description = formData.get("description") as string;
const reservationInfo = formData.get("reservationInfo") as string;
const image1 = formData.get("image1") as string;
const image2 = formData.get("image2") as string;
const image3 = formData.get("image3") as string;
const image4 = formData.get("image4") as string;
if (!title || !description || !reservationInfo || !image1 || !image2 || !image3 || !image4) {
return { success: false, error: "Tüm alanların doldurulması zorunludur." };
}
await prisma.beachSettings.upsert({
where: { id: "default" },
update: { title, description, reservationInfo, image1, image2, image3, image4 },
create: { id: "default", title, description, reservationInfo, image1, image2, image3, image4 }
});
revalidatePath("/admin/beach");
revalidatePath("/");
revalidatePath("/tr");
revalidatePath("/en");
return { success: true };
} catch (error) {
console.error("Error updating beach settings:", error);
return { success: false, error: "Plaj ayarları güncellenirken bir hata oluştu." };
}
}