diff --git a/app/(admin-routes)/admin/layout.tsx b/app/(admin-routes)/admin/layout.tsx
new file mode 100644
index 0000000..8080665
--- /dev/null
+++ b/app/(admin-routes)/admin/layout.tsx
@@ -0,0 +1,27 @@
+import { auth } from '@/lib/auth'
+import { AdminSidebar } from '@/components/admin/AdminSidebar'
+import { AdminHeader } from '@/components/admin/AdminHeader'
+import { SessionProvider } from 'next-auth/react'
+
+export default async function AdminLayout({ children }: { children: React.ReactNode }) {
+ const session = await auth()
+
+ return (
+
+
+
+ )
+}
diff --git a/app/(admin-routes)/admin/page.tsx b/app/(admin-routes)/admin/page.tsx
new file mode 100644
index 0000000..b258f35
--- /dev/null
+++ b/app/(admin-routes)/admin/page.tsx
@@ -0,0 +1,87 @@
+'use client'
+
+import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
+import { Users, Activity, UserPlus, Zap } from 'lucide-react'
+import { motion } from 'framer-motion'
+import { useSession } from 'next-auth/react'
+
+export default function AdminDashboardPage() {
+ const { data: session } = useSession()
+
+ const stats = [
+ { name: 'Toplam Kullanıcı', stat: '1,245', icon: Users, color: 'text-blue-600 dark:text-blue-400' },
+ { name: 'Aktif Oturumlar', stat: '42', icon: Activity, color: 'text-green-600 dark:text-green-400' },
+ { name: 'Yeni Kayıtlar', stat: '8', icon: UserPlus, color: 'text-orange-600 dark:text-orange-400' },
+ { name: 'Sistem Durumu', stat: 'Online', icon: Zap, color: 'text-indigo-600 dark:text-indigo-400' },
+ ]
+
+ const container = {
+ hidden: { opacity: 0 },
+ show: {
+ opacity: 1,
+ transition: {
+ staggerChildren: 0.1
+ }
+ }
+ }
+
+ const item = {
+ hidden: { opacity: 0, y: 20 },
+ show: { opacity: 1, y: 0 }
+ }
+
+ return (
+
+
+ Dashboard
+
+ Hoş geldiniz, {session?.user?.name || session?.user?.email || 'Admin'}. İşte projenizin genel görünümü.
+
+
+
+
+ {stats.map((stat, i) => (
+
+
+
+
+ {stat.name}
+
+
+
+
+ {stat.stat}
+
+
+
+ ))}
+
+
+
+
+
+ Son Aktiviteler
+
+
+
+ Henüz aktivite kaydı bulunmuyor.
+
+
+
+
+
+ )
+}
diff --git a/app/(admin-routes)/admin/rooms/[id]/edit/page.tsx b/app/(admin-routes)/admin/rooms/[id]/edit/page.tsx
new file mode 100644
index 0000000..3427d2f
--- /dev/null
+++ b/app/(admin-routes)/admin/rooms/[id]/edit/page.tsx
@@ -0,0 +1,34 @@
+import { RoomForm } from '@/components/admin/RoomForm'
+import { ArrowLeft } from 'lucide-react'
+import Link from 'next/link'
+import { db } from '@/lib/db'
+import { notFound } from 'next/navigation'
+
+export default async function EditRoomPage({ params }: { params: Promise<{ id: string }> }) {
+ const { id } = await params
+ const room = await db.room.findUnique({
+ where: { id }
+ })
+
+ if (!room) {
+ notFound()
+ }
+
+ return (
+
+
+
+
+
+
+
Odayı Düzenle
+
+ Oda bilgilerini güncellemek için aşağıdaki formu kullanın.
+
+
+
+
+
+
+ )
+}
diff --git a/app/(admin-routes)/admin/rooms/create/page.tsx b/app/(admin-routes)/admin/rooms/create/page.tsx
new file mode 100644
index 0000000..1f9fc84
--- /dev/null
+++ b/app/(admin-routes)/admin/rooms/create/page.tsx
@@ -0,0 +1,23 @@
+import { RoomForm } from '@/components/admin/RoomForm'
+import { ArrowLeft } from 'lucide-react'
+import Link from 'next/link'
+
+export default function CreateRoomPage() {
+ return (
+
+
+
+
+
+
+
Yeni Oda Ekle
+
+ Sisteme yeni bir oda eklemek için aşağıdaki formu doldurun.
+
+
+
+
+
+
+ )
+}
diff --git a/app/(admin-routes)/admin/rooms/page.tsx b/app/(admin-routes)/admin/rooms/page.tsx
new file mode 100644
index 0000000..cde1844
--- /dev/null
+++ b/app/(admin-routes)/admin/rooms/page.tsx
@@ -0,0 +1,155 @@
+import { db } from '@/lib/db'
+import Link from 'next/link'
+import { Plus, Edit, Trash2, MoreHorizontal } from 'lucide-react'
+import { Button } from '@/components/ui/button'
+import { Badge } from '@/components/ui/badge'
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from '@/components/ui/table'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+ DropdownMenuGroup,
+} from '@/components/ui/dropdown-menu'
+
+export default async function AdminRoomsPage() {
+ const rooms = await db.room.findMany({
+ orderBy: { createdAt: 'desc' }
+ })
+
+ return (
+
+
+
+
Odalar
+
+ Sistemdeki tüm odaları buradan yönetebilirsiniz.
+
+
+
+
+
+
+
+
+
+
+
+ Resimler
+ Ad (TR)
+ Tip
+ Kapasite
+ Fiyat
+ Durum
+ İşlemler
+
+
+
+ {rooms.length === 0 ? (
+
+
+ Henüz oda bulunmuyor.
+
+
+ ) : (
+ rooms.map((room) => (
+
+
+
+ {room.imageUrl ? (
+

+ ) : (
+
+ Yok
+
+ )}
+
+ {room.images && room.images.length > 0 && (
+
+ {room.images.slice(0, 3).map((img, i) => (
+

+ ))}
+ {room.images.length > 3 && (
+
+ +{room.images.length - 3}
+
+ )}
+
+ )}
+
+
+
+ {room.nameTr}
+
+
+ {room.type === 'STUDIO_1_0' ? 'Stüdyo (1+0)' : 'Süit (1+1)'}
+
+
+ {room.capacity} Kişi
+
+
+ {room.price ? `₺${room.price}` : '-'}
+
+
+ {room.available ? (
+
+ Müsait
+
+ ) : (
+
+ Kapalı
+
+ )}
+
+
+
+ }>
+ Menüyü aç
+
+
+
+
+ İşlemler
+
+
+ }>
+
+ Düzenle
+
+ {
+ 'use server'
+ const { deleteRoom } = await import('@/lib/actions/room')
+ await deleteRoom(room.id)
+ }} />}>
+
+
+
+
+
+
+ ))
+ )}
+
+
+
+
+ )
+}
diff --git a/app/(admin-routes)/layout.tsx b/app/(admin-routes)/layout.tsx
new file mode 100644
index 0000000..a1aa560
--- /dev/null
+++ b/app/(admin-routes)/layout.tsx
@@ -0,0 +1,33 @@
+import type { Metadata } from "next";
+import { Literata, Nunito_Sans } from "next/font/google";
+import "@/app/globals.css";
+
+const nunito_sans = Nunito_Sans({
+ variable: "--font-nunito-sans",
+ subsets: ["latin"],
+ weight: ["400", "600", "700"],
+});
+
+const literata = Literata({
+ variable: "--font-literata",
+ subsets: ["latin"],
+ weight: ["400", "500", "600", "700"],
+});
+
+export const metadata: Metadata = {
+ title: "Admin Paneli - Sitar Apart",
+};
+
+export default function AdminRootLayout({
+ children,
+}: Readonly<{
+ children: React.ReactNode;
+}>) {
+ return (
+
+
+ {children}
+
+
+ );
+}
diff --git a/app/[locale]/login/page.tsx b/app/(admin-routes)/login/page.tsx
similarity index 100%
rename from app/[locale]/login/page.tsx
rename to app/(admin-routes)/login/page.tsx
diff --git a/app/[locale]/admin/layout.tsx b/app/[locale]/admin/layout.tsx
deleted file mode 100644
index d16615e..0000000
--- a/app/[locale]/admin/layout.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-'use client'
-
-import { signOut } from 'next-auth/react'
-import Link from 'next/link'
-import { usePathname } from 'next/navigation'
-import { LayoutDashboard, Users, Settings, LogOut, Menu, X } from 'lucide-react'
-import { useState } from 'react'
-
-export default function AdminLayout({ children }: { children: React.ReactNode }) {
- const pathname = usePathname()
- const [sidebarOpen, setSidebarOpen] = useState(false)
-
- const navigation = [
- { name: 'Dashboard', href: '/admin', icon: LayoutDashboard },
- { name: 'Kullanıcılar', href: '/admin/users', icon: Users },
- { name: 'Ayarlar', href: '/admin/settings', icon: Settings },
- ]
-
- return (
-
- {/* Mobile sidebar backdrop */}
- {sidebarOpen && (
-
setSidebarOpen(false)}
- />
- )}
-
- {/* Sidebar */}
-
-
-
-
Admin Paneli
-
-
-
-
-
-
-
-
-
-
-
- {/* Main content */}
-
-
-
- Admin Paneli
-
-
-
- {children}
-
-
-
- )
-}
diff --git a/app/[locale]/admin/page.tsx b/app/[locale]/admin/page.tsx
deleted file mode 100644
index 4b16051..0000000
--- a/app/[locale]/admin/page.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import { auth } from '@/lib/auth'
-
-export default async function AdminDashboardPage() {
- const session = await auth()
-
- return (
-
-
-
Dashboard
-
- Hoş geldiniz, {session?.user?.name || session?.user?.email}. İşte projenizin genel görünümü.
-
-
-
-
- {/* Placeholder Stat Cards */}
- {[
- { name: 'Toplam Kullanıcı', stat: '1,245' },
- { name: 'Aktif Oturumlar', stat: '42' },
- { name: 'Yeni Kayıtlar', stat: '8' },
- { name: 'Sistem Durumu', stat: 'Online' },
- ].map((item) => (
-
-
{item.name}
-
- {item.stat}
-
-
- ))}
-
-
-
-
-
Son Aktiviteler
-
-
- Henüz aktivite kaydı bulunmuyor.
-
-
-
-
-
- )
-}
diff --git a/app/[locale]/dairelerimiz/[slug]/page.tsx b/app/[locale]/dairelerimiz/[slug]/page.tsx
index b71fd0c..729f4fc 100644
--- a/app/[locale]/dairelerimiz/[slug]/page.tsx
+++ b/app/[locale]/dairelerimiz/[slug]/page.tsx
@@ -3,6 +3,8 @@ import { Link } from '@/i18n/routing'
import Image from 'next/image'
import { notFound } from 'next/navigation'
import { CheckCircle2, Maximize, Users, BedDouble, ArrowRight } from 'lucide-react'
+import { db } from '@/lib/db'
+import openinaryLoader from '@/lib/openinary-loader'
// Bu sayfa parametre olarak dinamik slug alacak
export default async function RoomDetailPage({ params }: { params: Promise<{ locale: string, slug: string }> }) {
@@ -11,77 +13,61 @@ export default async function RoomDetailPage({ params }: { params: Promise<{ loc
const tRooms = await getTranslations('rooms')
- const MOCK_ROOMS = [
- {
- slug: '1-0-daire',
- name: tRooms('room_list.1_0_daire.name'),
- description: tRooms('room_list.1_0_daire.desc'),
- capacity: 2,
- size: '25m²',
- beds: '1',
- image: 'https://images.unsplash.com/photo-1631049307264-da0ec9d70304?auto=format&fit=crop&q=80',
- gallery: [
- 'https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?auto=format&fit=crop&q=80',
- 'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?auto=format&fit=crop&q=80',
- 'https://images.unsplash.com/photo-1582719508461-905c673771fd?auto=format&fit=crop&q=80'
- ],
- amenities: ['Mini Mutfak', 'Klima', 'Balkon', 'WiFi', 'TV', 'Saç Kurutma Makinesi']
- },
- {
- slug: '1-1-daire-a',
- name: tRooms('room_list.1_1_daire_a.name'),
- description: tRooms('room_list.1_1_daire_a.desc'),
- capacity: 2,
- size: '40m²',
- beds: '1 + Sofa',
- image: 'https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?auto=format&fit=crop&q=80',
- gallery: [
- 'https://images.unsplash.com/photo-1631049307264-da0ec9d70304?auto=format&fit=crop&q=80',
- 'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?auto=format&fit=crop&q=80',
- 'https://images.unsplash.com/photo-1582719508461-905c673771fd?auto=format&fit=crop&q=80'
- ],
- amenities: ['Ayrı Mutfak', 'Klima', 'Balkon', 'WiFi', 'Oturma Alanı', 'Çamaşır Makinesi']
- },
- {
- slug: '1-1-daire-b',
- name: tRooms('room_list.1_1_daire_b.name'),
- description: tRooms('room_list.1_1_daire_b.desc'),
- capacity: 4,
- size: '50m²',
- beds: '2',
- image: 'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?auto=format&fit=crop&q=80',
- gallery: [
- 'https://images.unsplash.com/photo-1631049307264-da0ec9d70304?auto=format&fit=crop&q=80',
- 'https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?auto=format&fit=crop&q=80',
- 'https://images.unsplash.com/photo-1582719508461-905c673771fd?auto=format&fit=crop&q=80'
- ],
- amenities: ['2 Oda', 'Ayrı Mutfak', 'Klima', 'Balkon', 'WiFi', 'Geniş Oturma Alanı']
- }
- ];
+ const room = await db.room.findUnique({
+ where: { slug }
+ })
- const room = MOCK_ROOMS.find(r => r.slug === slug);
-
- if (!room) {
+ if (!room || !room.available) {
notFound();
}
+ const name = locale === 'tr' ? room.nameTr : locale === 'de' ? room.nameDe : room.nameEn
+ const description = locale === 'tr' ? room.descriptionTr : locale === 'de' ? room.descriptionDe : room.descriptionEn
+ const image = room.imageUrl || 'https://images.unsplash.com/photo-1631049307264-da0ec9d70304?auto=format&fit=crop&q=80'
+ const isExternalImage = image.startsWith('http') && !image.includes('media.ayris.tech')
+ const gallery = room.images && room.images.length > 0 ? room.images : [image]
+
+ // Size helper mapping based on room type
+ const getRoomSize = (type: string) => {
+ if (type === 'STUDIO_1_0') return '25m²'
+ if (type === 'SUITE_1_1') return '45m²'
+ return '20m²'
+ }
+
+ // Bed helper based on capacity/type roughly
+ const getBeds = (type: string, capacity: number) => {
+ if (type === 'STUDIO_1_0') return '1'
+ if (type === 'SUITE_1_1') return '2'
+ if (capacity === 3) return '1 + Ek Yatak'
+ return '1'
+ }
+
return (
{/* Hero Section */}
-
+ {isExternalImage ? (
+
+ ) : (
+
+ )}
@@ -102,55 +88,71 @@ export default async function RoomDetailPage({ params }: { params: Promise<{ loc
- {room.size}
+ {getRoomSize(room.type)}
- {room.beds} Yatak
+ {getBeds(room.type, room.capacity)}
{/* Description */}
-
- {room.description}
+
+ {description}
{/* Amenities */}
-
-
- {tRooms('details.features')}
-
-
- {room.amenities.map((amenity, index) => (
-
-
- {amenity}
-
- ))}
+ {room.amenities.length > 0 && (
+
+
+ {tRooms('details.features')}
+
+
+ {room.amenities.map((amenity, index) => (
+
+
+ {amenity}
+
+ ))}
+
-
+ )}
{/* Mini Gallery */}
-
-
- {tRooms('details.gallery')}
-
-
- {room.gallery.map((img, i) => (
-
-
-
- ))}
+ {gallery.length > 0 && (
+
+
+ {tRooms('details.gallery')}
+
+
+ {gallery.map((img, i) => {
+ const isGalleryExternal = img.startsWith('http') && !img.includes('media.ayris.tech')
+ return (
+
+ {isGalleryExternal ? (
+

+ ) : (
+
+ )}
+
+ )
+ })}
+
-
+ )}
diff --git a/app/[locale]/dairelerimiz/page.tsx b/app/[locale]/dairelerimiz/page.tsx
index 4956b64..3872c78 100644
--- a/app/[locale]/dairelerimiz/page.tsx
+++ b/app/[locale]/dairelerimiz/page.tsx
@@ -2,6 +2,8 @@ import { getTranslations, setRequestLocale } from 'next-intl/server'
import { Link } from '@/i18n/routing'
import Image from 'next/image'
import { Users, Square, Info } from 'lucide-react'
+import { db } from '@/lib/db'
+import openinaryLoader from '@/lib/openinary-loader'
export default async function RoomsPage({ params }: { params: Promise<{ locale: string }> }) {
const { locale } = await params
@@ -10,35 +12,17 @@ export default async function RoomsPage({ params }: { params: Promise<{ locale:
const tNav = await getTranslations('nav')
const tRooms = await getTranslations('rooms')
- const MOCK_ROOMS = [
- {
- slug: '1-0-daire',
- name: tRooms('room_list.1_0_daire.name'),
- description: tRooms('room_list.1_0_daire.desc'),
- capacity: 2,
- size: '25m²',
- image: 'https://images.unsplash.com/photo-1631049307264-da0ec9d70304?auto=format&fit=crop&q=80',
- amenities: ['Mini Mutfak', 'Klima', 'Balkon', 'WiFi']
- },
- {
- slug: '1-1-daire-a',
- name: tRooms('room_list.1_1_daire_a.name'),
- description: tRooms('room_list.1_1_daire_a.desc'),
- capacity: 2,
- size: '40m²',
- image: 'https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?auto=format&fit=crop&q=80',
- amenities: ['Ayrı Mutfak', 'Klima', 'Balkon', 'WiFi', 'Oturma Alanı']
- },
- {
- slug: '1-1-daire-b',
- name: tRooms('room_list.1_1_daire_b.name'),
- description: tRooms('room_list.1_1_daire_b.desc'),
- capacity: 4,
- size: '50m²',
- image: 'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?auto=format&fit=crop&q=80',
- amenities: ['2 Oda', 'Ayrı Mutfak', 'Klima', 'Balkon', 'WiFi']
- }
- ];
+ const dbRooms = await db.room.findMany({
+ where: { available: true },
+ orderBy: { createdAt: 'asc' }
+ })
+
+ // Size helper mapping based on room type
+ const getRoomSize = (type: string) => {
+ if (type === 'STUDIO_1_0') return '25m²'
+ if (type === 'SUITE_1_1') return '45m²'
+ return '20m²'
+ }
return (
@@ -51,55 +35,73 @@ export default async function RoomsPage({ params }: { params: Promise<{ locale:
- {MOCK_ROOMS.map((room) => (
-
-
-
-
-
-
-
{room.name}
+ {dbRooms.map((room) => {
+ const name = locale === 'tr' ? room.nameTr : locale === 'de' ? room.nameDe : room.nameEn
+ const description = locale === 'tr' ? room.descriptionTr : locale === 'de' ? room.descriptionDe : room.descriptionEn
+ const image = room.imageUrl || 'https://images.unsplash.com/photo-1631049307264-da0ec9d70304?auto=format&fit=crop&q=80'
+ const isExternal = image.startsWith('http') && !image.includes('media.ayris.tech')
+
+ return (
+
+
+ {isExternal ? (
+

+ ) : (
+
+ )}
-
-
- {room.description}
-
+
+
+
{name}
+
+
+
+ {description}
+
-
-
-
-
{room.capacity} {tRooms('capacity')}
+
+
+
+ {room.capacity} {tRooms('capacity')}
+
+
+
+ {getRoomSize(room.type)}
+
+
+
+ {room.amenities.length} {tRooms('amenities')}
+
-
-
- {room.size}
-
-
-
- {room.amenities.length} {tRooms('amenities')}
-
-
-
-
-
{tRooms('ask_price')} {tRooms('per_night')}
+
+
+
+ {room.price ? `${room.price}₺` : tRooms('ask_price')}
+ {room.price ? '' : tRooms('per_night')}
+
+
+ {tRooms('details_btn')}
+
-
- {tRooms('details_btn')}
-
-
- ))}
+ )
+ })}
diff --git a/app/[locale]/galeri/page.tsx b/app/[locale]/galeri/page.tsx
index 64486c8..8e411f0 100644
--- a/app/[locale]/galeri/page.tsx
+++ b/app/[locale]/galeri/page.tsx
@@ -6,68 +6,34 @@ import Image from 'next/image'
import BougainvilleaMotif from '@/components/BougainvilleaMotif'
import { useTranslations } from 'next-intl'
import { X } from 'lucide-react'
+import openinaryLoader from '@/lib/openinary-loader'
export default function GalleryPage() {
const t = useTranslations('gallery')
- const [activeFilter, setActiveFilter] = useState('all')
const [selectedImage, setSelectedImage] = useState
(null)
- const filters = [
- { id: 'all', label: t('filters.all') },
- { id: 'rooms', label: t('filters.rooms') },
- { id: 'exterior', label: t('filters.exterior') },
- { id: 'view', label: t('filters.view') },
- { id: 'balcony', label: t('filters.balcony') },
+ const galleryImages = [
+ 'DSC01477.jpg',
+ 'DSC01478.jpg',
+ 'DSC01479.jpg',
+ 'DSC01480.jpg',
+ 'DSC01481.jpg',
+ 'DSC01482.jpg',
+ 'DSC01483.jpg',
+ 'DSC01487.jpg',
+ 'DSC01535.jpg',
+ 'DSC01544.jpg',
+ 'DSC01554.jpg',
+ 'DSC01560.jpg',
+ 'DSC01563.jpg'
]
- const galleryItems = [
- {
- id: 1,
- category: 'rooms',
- title: t('items.1'),
- src: 'https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?auto=format&fit=crop&q=80',
- colSpan: 'col-span-1',
- },
- {
- id: 2,
- category: 'exterior',
- title: t('items.2'),
- src: 'https://images.unsplash.com/photo-1596394516093-501ba68a0ba6?auto=format&fit=crop&q=80',
- colSpan: 'col-span-1 md:col-span-2 lg:col-span-1',
- },
- {
- id: 3,
- category: 'view',
- title: t('items.3'),
- src: 'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?auto=format&fit=crop&q=80',
- colSpan: 'col-span-1',
- },
- {
- id: 4,
- category: 'balcony',
- title: t('items.4'),
- src: 'https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?auto=format&fit=crop&q=80',
- colSpan: 'col-span-1 md:col-span-2',
- },
- {
- id: 5,
- category: 'rooms',
- title: t('items.5'),
- src: 'https://images.unsplash.com/photo-1631049307264-da0ec9d70304?auto=format&fit=crop&q=80',
- colSpan: 'col-span-1',
- },
- {
- id: 6,
- category: 'view',
- title: t('items.6'),
- src: 'https://images.unsplash.com/photo-1582719508461-905c673771fd?auto=format&fit=crop&q=80',
- colSpan: 'col-span-1 md:col-span-2 lg:col-span-1',
- },
- ]
-
- const filteredItems = galleryItems.filter(item =>
- activeFilter === 'all' || item.category === activeFilter
- )
+ const galleryItems = galleryImages.map((file, idx) => ({
+ id: idx + 1,
+ title: t('items.' + ((idx % 6) + 1)), // Use existing translations just to not break them
+ src: `https://media.ayris.tech/t/starapart/gallery/${file}`,
+ colSpan: idx % 4 === 1 ? 'col-span-1 md:col-span-2 lg:col-span-1' : 'col-span-1'
+ }))
return (
@@ -84,27 +50,10 @@ export default function GalleryPage() {
- {/* Filter Bar */}
-
- {filters.map((filter) => (
-
- ))}
-
-
{/* Masonry-like Grid */}
- {filteredItems.map((item) => (
+ {galleryItems.map((item) => (
-
-
- {item.title}
-
-
))}
@@ -169,6 +114,7 @@ export default function GalleryPage() {
src={selectedImage}
alt="Enlarged view"
fill
+ loader={openinaryLoader}
className="object-contain"
sizes="100vw"
quality={90}
diff --git a/app/[locale]/iletisim/page.tsx b/app/[locale]/iletisim/page.tsx
index 33eceee..70f4c07 100644
--- a/app/[locale]/iletisim/page.tsx
+++ b/app/[locale]/iletisim/page.tsx
@@ -3,7 +3,7 @@
import { motion } from 'framer-motion'
import Image from 'next/image'
import BougainvilleaMotif from '@/components/BougainvilleaMotif'
-import { MapPin, Waves, ShoppingBasket, Coffee, PersonStanding, Phone, Mail } from 'lucide-react'
+import { MapPin, Waves, ShoppingBasket, Coffee, PersonStanding, Phone, Mail, Clock } from 'lucide-react'
import { useTranslations } from 'next-intl'
const EASE: [number, number, number, number] = [0.22, 1, 0.36, 1]
@@ -175,6 +175,16 @@ export default function ContactPage() {
iletisim@sitarapart.com
+
+
+
+
+
+
+
{t('connect.check_in')}
+
{t('connect.check_out')}
+
+
{/* Decorative Image */}
diff --git a/app/[locale]/page.tsx b/app/[locale]/page.tsx
index ba40208..b7950dd 100644
--- a/app/[locale]/page.tsx
+++ b/app/[locale]/page.tsx
@@ -6,6 +6,7 @@ import { motion, useReducedMotion } from 'framer-motion'
import { MapPin, Wifi, UtensilsCrossed, Waves, Car } from 'lucide-react'
import Image from 'next/image'
import BougainvilleaMotif from '@/components/BougainvilleaMotif'
+import openinaryLoader from '@/lib/openinary-loader'
const EASE: [number, number, number, number] = [0.22, 1, 0.36, 1]
@@ -36,7 +37,7 @@ export default function HomePage() {
{[
{
- id: '1-0-daire',
+ id: 'standart-oda',
title: tRooms('room_1.title'),
desc: tRooms('room_1.desc'),
- img: 'https://images.unsplash.com/photo-1631049307264-da0ec9d70304?auto=format&fit=crop&q=80'
+ img: 'https://media.ayris.tech/t/starapart/SUITE_1_1/DSC01491 (1).JPG'
},
{
- id: '1-1-daire-a',
+ id: 'kucuk-oda',
title: tRooms('room_2.title'),
desc: tRooms('room_2.desc'),
- img: 'https://images.unsplash.com/photo-1522708323590-d24dbb6b0267?auto=format&fit=crop&q=80'
+ img: 'https://media.ayris.tech/t/starapart/STUDIO_1_0/DSC01465 (1).JPG'
},
{
- id: '1-1-daire-b',
+ id: '1-1-daire',
title: tRooms('room_3.title'),
desc: tRooms('room_3.desc'),
- img: 'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?auto=format&fit=crop&q=80'
+ img: 'https://media.ayris.tech/t/starapart/SUITE_1_1/DSC01491 (1).JPG'
}
].map((room, idx) => (
diff --git a/components/admin/AdminHeader.tsx b/components/admin/AdminHeader.tsx
new file mode 100644
index 0000000..b55e2d7
--- /dev/null
+++ b/components/admin/AdminHeader.tsx
@@ -0,0 +1,122 @@
+'use client'
+
+import { useState } from 'react'
+import { signOut } from 'next-auth/react'
+import { Menu, LogOut, Settings, User } from 'lucide-react'
+import { usePathname } from 'next/navigation'
+import Link from 'next/link'
+import { ADMIN_NAVIGATION } from './AdminSidebar'
+import { Button } from '@/components/ui/button'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+ DropdownMenuGroup,
+} from '@/components/ui/dropdown-menu'
+import { Avatar, AvatarFallback } from '@/components/ui/avatar'
+import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from '@/components/ui/sheet'
+
+interface AdminHeaderProps {
+ userEmail?: string | null
+ userName?: string | null
+}
+
+export function AdminHeader({ userEmail, userName }: AdminHeaderProps) {
+ const pathname = usePathname()
+ const [open, setOpen] = useState(false)
+
+ const initials = userName
+ ? userName.slice(0, 2).toUpperCase()
+ : userEmail?.slice(0, 2).toUpperCase() || 'AD'
+
+ return (
+
+
+ {/* Mobile Menu */}
+
+
+ }>
+
+ Menüyü aç
+
+
+
+
+ Sitar Admin
+
+
+
+
+
+ Admin
+
+
+
+ {/* User Dropdown */}
+
+ }>
+
+
+ {initials}
+
+
+
+
+
+
+
+
+ {userName || 'Admin'}
+
+
+ {userEmail}
+
+
+
+
+
+ }>
+
+ Ayarlar
+
+ }>
+
+ Siteye Git
+
+
+ signOut({ callbackUrl: '/' })}
+ >
+
+ Çıkış Yap
+
+
+
+
+
+ )
+}
diff --git a/components/admin/AdminSidebar.tsx b/components/admin/AdminSidebar.tsx
new file mode 100644
index 0000000..e48bef8
--- /dev/null
+++ b/components/admin/AdminSidebar.tsx
@@ -0,0 +1,50 @@
+'use client'
+
+import Link from 'next/link'
+import { usePathname } from 'next/navigation'
+import { LayoutDashboard, Users, Settings, BedDouble } from 'lucide-react'
+
+export const ADMIN_NAVIGATION = [
+ { name: 'Dashboard', href: '/admin', icon: LayoutDashboard },
+ { name: 'Odalar', href: '/admin/rooms', icon: BedDouble },
+ { name: 'Kullanıcılar', href: '/admin/users', icon: Users },
+ { name: 'Ayarlar', href: '/admin/settings', icon: Settings },
+]
+
+export function AdminSidebar() {
+ const pathname = usePathname()
+
+ return (
+
+
+
+ Sitar Admin
+
+
+
+
+
+
+ )
+}
diff --git a/components/admin/ImageUploadModal.tsx b/components/admin/ImageUploadModal.tsx
new file mode 100644
index 0000000..df81cf7
--- /dev/null
+++ b/components/admin/ImageUploadModal.tsx
@@ -0,0 +1,249 @@
+'use client'
+
+import { useState, useRef } from 'react'
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+ DialogDescription,
+ DialogFooter,
+ DialogTrigger,
+} from '@/components/ui/dialog'
+import { Button } from '@/components/ui/button'
+import { uploadImageAction } from '@/lib/actions/upload'
+import { ImagePlus, X, UploadCloud, Loader2, CheckCircle2, AlertCircle } from 'lucide-react'
+
+interface ImageUploadModalProps {
+ onUploadComplete: (urls: string[]) => void
+ multiple?: boolean
+ triggerText?: string
+ folderName?: string
+}
+
+export function ImageUploadModal({
+ onUploadComplete,
+ multiple = false,
+ triggerText = "Resim Yükle",
+ folderName = "starapart"
+}: ImageUploadModalProps) {
+ const [open, setOpen] = useState(false)
+ const [selectedFiles, setSelectedFiles] = useState([])
+ const [previews, setPreviews] = useState([])
+ const [isUploading, setIsUploading] = useState(false)
+ const [progress, setProgress] = useState(0) // 0 to total files
+ const [error, setError] = useState(null)
+
+ const fileInputRef = useRef(null)
+
+ const resetState = () => {
+ setSelectedFiles([])
+ previews.forEach(p => URL.revokeObjectURL(p))
+ setPreviews([])
+ setIsUploading(false)
+ setProgress(0)
+ setError(null)
+ }
+
+ const handleOpenChange = (newOpen: boolean) => {
+ if (isUploading) return // Prevent closing while uploading
+ setOpen(newOpen)
+ if (!newOpen) {
+ resetState()
+ }
+ }
+
+ const handleFileChange = (e: React.ChangeEvent) => {
+ if (!e.target.files?.length) return
+
+ const files = Array.from(e.target.files)
+ const newFiles = multiple ? [...selectedFiles, ...files] : [files[0]]
+
+ setSelectedFiles(newFiles)
+
+ // Create preview URLs
+ const newPreviews = newFiles.map(file => URL.createObjectURL(file))
+ if (!multiple) {
+ previews.forEach(p => URL.revokeObjectURL(p)) // cleanup old previews
+ setPreviews(newPreviews)
+ } else {
+ setPreviews([...previews, ...newPreviews])
+ }
+
+ setError(null)
+
+ // Reset file input so same file can be selected again if removed
+ if (fileInputRef.current) {
+ fileInputRef.current.value = ''
+ }
+ }
+
+ const removeFile = (index: number) => {
+ const newFiles = [...selectedFiles]
+ newFiles.splice(index, 1)
+
+ const newPreviews = [...previews]
+ URL.revokeObjectURL(newPreviews[index])
+ newPreviews.splice(index, 1)
+
+ setSelectedFiles(newFiles)
+ setPreviews(newPreviews)
+ }
+
+ const handleUpload = async () => {
+ if (!selectedFiles.length) return
+
+ setIsUploading(true)
+ setError(null)
+ setProgress(0)
+
+ const uploadedUrls: string[] = []
+
+ try {
+ // Upload one by one to prevent timeout and body size limits
+ for (let i = 0; i < selectedFiles.length; i++) {
+ const file = selectedFiles[i]
+ const fd = new FormData()
+ fd.append('file', file)
+ fd.append('folder', folderName)
+
+ const res = await uploadImageAction(fd)
+ if (res.success && res.url) {
+ uploadedUrls.push(res.url)
+ } else {
+ throw new Error(res.error || `${file.name} yüklenemedi.`)
+ }
+
+ setProgress(i + 1)
+ }
+
+ onUploadComplete(uploadedUrls)
+ setOpen(false)
+ resetState()
+ } catch (err: any) {
+ setError(err.message || "Yükleme sırasında bir hata oluştu.")
+ setIsUploading(false)
+ }
+ }
+
+ return (
+
+ )
+}
diff --git a/components/admin/RoomForm.tsx b/components/admin/RoomForm.tsx
new file mode 100644
index 0000000..da90362
--- /dev/null
+++ b/components/admin/RoomForm.tsx
@@ -0,0 +1,253 @@
+'use client'
+
+import { useState } from 'react'
+import { useRouter } from 'next/navigation'
+import { Button } from '@/components/ui/button'
+import { Input } from '@/components/ui/input'
+import { createRoom, updateRoom, RoomInput } from '@/lib/actions/room'
+import { uploadImageAction } from '@/lib/actions/upload'
+import { Loader2 } from 'lucide-react'
+import { ImageUploadModal } from '@/components/admin/ImageUploadModal'
+
+interface RoomFormProps {
+ initialData?: RoomInput & { id: string }
+}
+
+export function RoomForm({ initialData }: RoomFormProps) {
+ const router = useRouter()
+ const [loading, setLoading] = useState(false)
+ const [error, setError] = useState(null)
+
+ const [formData, setFormData] = useState(initialData || {
+ slug: '',
+ type: 'STUDIO_1_0',
+ nameTr: '',
+ nameEn: '',
+ nameDe: '',
+ descriptionTr: '',
+ descriptionEn: '',
+ descriptionDe: '',
+ capacity: 2,
+ price: null,
+ imageUrl: '',
+ images: [],
+ amenities: [],
+ available: true,
+ featured: false,
+ })
+
+ // Helper for comma-separated arrays
+ const handleArrayChange = (field: 'images' | 'amenities', value: string) => {
+ const arrayValue = value.split(',').map(s => s.trim()).filter(Boolean)
+ setFormData(prev => ({ ...prev, [field]: arrayValue }))
+ }
+
+ const handleMainImageComplete = (urls: string[]) => {
+ if (urls.length > 0) {
+ setFormData(prev => ({ ...prev, imageUrl: urls[0] }))
+ }
+ }
+
+ const handleGalleryComplete = (urls: string[]) => {
+ if (urls.length > 0) {
+ setFormData(prev => ({ ...prev, images: [...prev.images, ...urls] }))
+ }
+ }
+
+ const removeGalleryImage = (index: number) => {
+ setFormData(prev => ({
+ ...prev,
+ images: prev.images.filter((_, i) => i !== index)
+ }))
+ }
+
+ const handleSubmit = async (e: React.FormEvent) => {
+ e.preventDefault()
+ setLoading(true)
+ setError(null)
+
+ try {
+ let result
+ if (initialData?.id) {
+ result = await updateRoom(initialData.id, formData)
+ } else {
+ result = await createRoom(formData)
+ }
+
+ if (result?.success) {
+ router.push('/admin/rooms')
+ router.refresh()
+ } else {
+ setError(result?.error || 'Bir hata oluştu.')
+ }
+ } catch (err) {
+ setError('Bir hata oluştu.')
+ } finally {
+ setLoading(false)
+ }
+ }
+
+ return (
+
+ )
+}
diff --git a/components/ui/avatar.tsx b/components/ui/avatar.tsx
new file mode 100644
index 0000000..e4fed86
--- /dev/null
+++ b/components/ui/avatar.tsx
@@ -0,0 +1,109 @@
+"use client"
+
+import * as React from "react"
+import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar"
+
+import { cn } from "@/lib/utils"
+
+function Avatar({
+ className,
+ size = "default",
+ ...props
+}: AvatarPrimitive.Root.Props & {
+ size?: "default" | "sm" | "lg"
+}) {
+ return (
+
+ )
+}
+
+function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {
+ return (
+
+ )
+}
+
+function AvatarFallback({
+ className,
+ ...props
+}: AvatarPrimitive.Fallback.Props) {
+ return (
+
+ )
+}
+
+function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {
+ return (
+ svg]:hidden",
+ "group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2",
+ "group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+function AvatarGroup({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+
+ )
+}
+
+function AvatarGroupCount({
+ className,
+ ...props
+}: React.ComponentProps<"div">) {
+ return (
+ svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+export {
+ Avatar,
+ AvatarImage,
+ AvatarFallback,
+ AvatarGroup,
+ AvatarGroupCount,
+ AvatarBadge,
+}
diff --git a/components/ui/badge.tsx b/components/ui/badge.tsx
new file mode 100644
index 0000000..b20959d
--- /dev/null
+++ b/components/ui/badge.tsx
@@ -0,0 +1,52 @@
+import { mergeProps } from "@base-ui/react/merge-props"
+import { useRender } from "@base-ui/react/use-render"
+import { cva, type VariantProps } from "class-variance-authority"
+
+import { cn } from "@/lib/utils"
+
+const badgeVariants = cva(
+ "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
+ {
+ variants: {
+ variant: {
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
+ secondary:
+ "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
+ destructive:
+ "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
+ outline:
+ "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
+ ghost:
+ "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
+ link: "text-primary underline-offset-4 hover:underline",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+ }
+)
+
+function Badge({
+ className,
+ variant = "default",
+ render,
+ ...props
+}: useRender.ComponentProps<"span"> & VariantProps
) {
+ return useRender({
+ defaultTagName: "span",
+ props: mergeProps<"span">(
+ {
+ className: cn(badgeVariants({ variant }), className),
+ },
+ props
+ ),
+ render,
+ state: {
+ slot: "badge",
+ variant,
+ },
+ })
+}
+
+export { Badge, badgeVariants }
diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsx
new file mode 100644
index 0000000..014f5aa
--- /dev/null
+++ b/components/ui/dialog.tsx
@@ -0,0 +1,160 @@
+"use client"
+
+import * as React from "react"
+import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
+
+import { cn } from "@/lib/utils"
+import { Button } from "@/components/ui/button"
+import { XIcon } from "lucide-react"
+
+function Dialog({ ...props }: DialogPrimitive.Root.Props) {
+ return
+}
+
+function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
+ return
+}
+
+function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
+ return
+}
+
+function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
+ return
+}
+
+function DialogOverlay({
+ className,
+ ...props
+}: DialogPrimitive.Backdrop.Props) {
+ return (
+
+ )
+}
+
+function DialogContent({
+ className,
+ children,
+ showCloseButton = true,
+ ...props
+}: DialogPrimitive.Popup.Props & {
+ showCloseButton?: boolean
+}) {
+ return (
+
+
+
+ {children}
+ {showCloseButton && (
+
+ }
+ >
+
+ Close
+
+ )}
+
+
+ )
+}
+
+function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+
+ )
+}
+
+function DialogFooter({
+ className,
+ showCloseButton = false,
+ children,
+ ...props
+}: React.ComponentProps<"div"> & {
+ showCloseButton?: boolean
+}) {
+ return (
+
+ {children}
+ {showCloseButton && (
+ }>
+ Close
+
+ )}
+
+ )
+}
+
+function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
+ return (
+
+ )
+}
+
+function DialogDescription({
+ className,
+ ...props
+}: DialogPrimitive.Description.Props) {
+ return (
+
+ )
+}
+
+export {
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogOverlay,
+ DialogPortal,
+ DialogTitle,
+ DialogTrigger,
+}
diff --git a/components/ui/dropdown-menu.tsx b/components/ui/dropdown-menu.tsx
new file mode 100644
index 0000000..9d5ebbd
--- /dev/null
+++ b/components/ui/dropdown-menu.tsx
@@ -0,0 +1,268 @@
+"use client"
+
+import * as React from "react"
+import { Menu as MenuPrimitive } from "@base-ui/react/menu"
+
+import { cn } from "@/lib/utils"
+import { ChevronRightIcon, CheckIcon } from "lucide-react"
+
+function DropdownMenu({ ...props }: MenuPrimitive.Root.Props) {
+ return
+}
+
+function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props) {
+ return
+}
+
+function DropdownMenuTrigger({ ...props }: MenuPrimitive.Trigger.Props) {
+ return
+}
+
+function DropdownMenuContent({
+ align = "start",
+ alignOffset = 0,
+ side = "bottom",
+ sideOffset = 4,
+ className,
+ ...props
+}: MenuPrimitive.Popup.Props &
+ Pick<
+ MenuPrimitive.Positioner.Props,
+ "align" | "alignOffset" | "side" | "sideOffset"
+ >) {
+ return (
+
+
+
+
+
+ )
+}
+
+function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props) {
+ return
+}
+
+function DropdownMenuLabel({
+ className,
+ inset,
+ ...props
+}: MenuPrimitive.GroupLabel.Props & {
+ inset?: boolean
+}) {
+ return (
+
+ )
+}
+
+function DropdownMenuItem({
+ className,
+ inset,
+ variant = "default",
+ ...props
+}: MenuPrimitive.Item.Props & {
+ inset?: boolean
+ variant?: "default" | "destructive"
+}) {
+ return (
+
+ )
+}
+
+function DropdownMenuSub({ ...props }: MenuPrimitive.SubmenuRoot.Props) {
+ return
+}
+
+function DropdownMenuSubTrigger({
+ className,
+ inset,
+ children,
+ ...props
+}: MenuPrimitive.SubmenuTrigger.Props & {
+ inset?: boolean
+}) {
+ return (
+
+ {children}
+
+
+ )
+}
+
+function DropdownMenuSubContent({
+ align = "start",
+ alignOffset = -3,
+ side = "right",
+ sideOffset = 0,
+ className,
+ ...props
+}: React.ComponentProps) {
+ return (
+
+ )
+}
+
+function DropdownMenuCheckboxItem({
+ className,
+ children,
+ checked,
+ inset,
+ ...props
+}: MenuPrimitive.CheckboxItem.Props & {
+ inset?: boolean
+}) {
+ return (
+
+
+
+
+
+
+ {children}
+
+ )
+}
+
+function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {
+ return (
+
+ )
+}
+
+function DropdownMenuRadioItem({
+ className,
+ children,
+ inset,
+ ...props
+}: MenuPrimitive.RadioItem.Props & {
+ inset?: boolean
+}) {
+ return (
+
+
+
+
+
+
+ {children}
+
+ )
+}
+
+function DropdownMenuSeparator({
+ className,
+ ...props
+}: MenuPrimitive.Separator.Props) {
+ return (
+
+ )
+}
+
+function DropdownMenuShortcut({
+ className,
+ ...props
+}: React.ComponentProps<"span">) {
+ return (
+
+ )
+}
+
+export {
+ DropdownMenu,
+ DropdownMenuPortal,
+ DropdownMenuTrigger,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuLabel,
+ DropdownMenuItem,
+ DropdownMenuCheckboxItem,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
+ DropdownMenuSeparator,
+ DropdownMenuShortcut,
+ DropdownMenuSub,
+ DropdownMenuSubTrigger,
+ DropdownMenuSubContent,
+}
diff --git a/components/ui/sheet.tsx b/components/ui/sheet.tsx
new file mode 100644
index 0000000..78c0a76
--- /dev/null
+++ b/components/ui/sheet.tsx
@@ -0,0 +1,138 @@
+"use client"
+
+import * as React from "react"
+import { Dialog as SheetPrimitive } from "@base-ui/react/dialog"
+
+import { cn } from "@/lib/utils"
+import { Button } from "@/components/ui/button"
+import { XIcon } from "lucide-react"
+
+function Sheet({ ...props }: SheetPrimitive.Root.Props) {
+ return
+}
+
+function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {
+ return
+}
+
+function SheetClose({ ...props }: SheetPrimitive.Close.Props) {
+ return
+}
+
+function SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {
+ return
+}
+
+function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
+ return (
+
+ )
+}
+
+function SheetContent({
+ className,
+ children,
+ side = "right",
+ showCloseButton = true,
+ ...props
+}: SheetPrimitive.Popup.Props & {
+ side?: "top" | "right" | "bottom" | "left"
+ showCloseButton?: boolean
+}) {
+ return (
+
+
+
+ {children}
+ {showCloseButton && (
+
+ }
+ >
+
+ Close
+
+ )}
+
+
+ )
+}
+
+function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+
+ )
+}
+
+function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+
+ )
+}
+
+function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
+ return (
+
+ )
+}
+
+function SheetDescription({
+ className,
+ ...props
+}: SheetPrimitive.Description.Props) {
+ return (
+
+ )
+}
+
+export {
+ Sheet,
+ SheetTrigger,
+ SheetClose,
+ SheetContent,
+ SheetHeader,
+ SheetFooter,
+ SheetTitle,
+ SheetDescription,
+}
diff --git a/components/ui/table.tsx b/components/ui/table.tsx
new file mode 100644
index 0000000..abeaced
--- /dev/null
+++ b/components/ui/table.tsx
@@ -0,0 +1,116 @@
+"use client"
+
+import * as React from "react"
+
+import { cn } from "@/lib/utils"
+
+function Table({ className, ...props }: React.ComponentProps<"table">) {
+ return (
+
+ )
+}
+
+function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
+ return (
+
+ )
+}
+
+function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
+ return (
+
+ )
+}
+
+function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
+ return (
+ tr]:last:border-b-0",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
+ return (
+
+ )
+}
+
+function TableHead({ className, ...props }: React.ComponentProps<"th">) {
+ return (
+ |
+ )
+}
+
+function TableCell({ className, ...props }: React.ComponentProps<"td">) {
+ return (
+ |
+ )
+}
+
+function TableCaption({
+ className,
+ ...props
+}: React.ComponentProps<"caption">) {
+ return (
+
+ )
+}
+
+export {
+ Table,
+ TableHeader,
+ TableBody,
+ TableFooter,
+ TableHead,
+ TableRow,
+ TableCell,
+ TableCaption,
+}
diff --git a/copy-images.ts b/copy-images.ts
new file mode 100644
index 0000000..fa53548
--- /dev/null
+++ b/copy-images.ts
@@ -0,0 +1,48 @@
+import { config } from 'dotenv'
+config()
+
+import fs from 'fs'
+import path from 'path'
+
+async function getPrisma() {
+ const { db } = await import('./lib/db')
+ return db
+}
+
+async function main() {
+ const prisma = await getPrisma()
+
+ console.log('Süit Daire 1 aranıyor...')
+ const suiteRoom = await prisma.room.findFirst({
+ where: { nameTr: { contains: 'Süit Daire 1' } }
+ })
+
+ if (!suiteRoom) {
+ console.error('Süit Daire 1 bulunamadı!')
+ return
+ }
+
+ console.log('Standart Oda 1 (25m²) aranıyor...')
+ const standardRoom = await prisma.room.findFirst({
+ where: { nameTr: { contains: 'Standart Oda 1' } }
+ })
+
+ if (!standardRoom) {
+ console.error('Standart Oda 1 bulunamadı!')
+ return
+ }
+
+ console.log('Resimler kopyalanıyor...')
+ await prisma.room.update({
+ where: { id: standardRoom.id },
+ data: {
+ imageUrl: suiteRoom.imageUrl,
+ images: suiteRoom.images
+ }
+ })
+
+ console.log('Standart Oda 1 resimleri başarıyla güncellendi!')
+ await prisma.$disconnect()
+}
+
+main().catch(console.error)
diff --git a/lib/actions/room.ts b/lib/actions/room.ts
new file mode 100644
index 0000000..eb76660
--- /dev/null
+++ b/lib/actions/room.ts
@@ -0,0 +1,75 @@
+'use server'
+
+import { db } from '@/lib/db'
+import { revalidatePath } from 'next/cache'
+import { RoomType } from '@prisma/client'
+
+export type RoomInput = {
+ slug: string
+ type: RoomType
+ nameTr: string
+ nameEn: string
+ nameDe: string
+ descriptionTr: string
+ descriptionEn: string
+ descriptionDe: string
+ capacity: number
+ price: number | null
+ imageUrl: string | null
+ images: string[]
+ amenities: string[]
+ available: boolean
+ featured: boolean
+}
+
+export async function createRoom(data: RoomInput) {
+ try {
+ const room = await db.room.create({
+ data,
+ })
+
+ revalidatePath('/[locale]/admin/rooms', 'page')
+ revalidatePath('/[locale]/dairelerimiz', 'page')
+ revalidatePath('/[locale]', 'page')
+
+ return { success: true, room }
+ } catch (error) {
+ console.error('Failed to create room:', error)
+ return { success: false, error: 'Oda oluşturulurken bir hata oluştu.' }
+ }
+}
+
+export async function updateRoom(id: string, data: RoomInput) {
+ try {
+ const room = await db.room.update({
+ where: { id },
+ data,
+ })
+
+ revalidatePath('/[locale]/admin/rooms', 'page')
+ revalidatePath('/[locale]/dairelerimiz', 'page')
+ revalidatePath('/[locale]', 'page')
+
+ return { success: true, room }
+ } catch (error) {
+ console.error('Failed to update room:', error)
+ return { success: false, error: 'Oda güncellenirken bir hata oluştu.' }
+ }
+}
+
+export async function deleteRoom(id: string) {
+ try {
+ await db.room.delete({
+ where: { id },
+ })
+
+ revalidatePath('/[locale]/admin/rooms', 'page')
+ revalidatePath('/[locale]/dairelerimiz', 'page')
+ revalidatePath('/[locale]', 'page')
+
+ return { success: true }
+ } catch (error) {
+ console.error('Failed to delete room:', error)
+ return { success: false, error: 'Oda silinirken bir hata oluştu.' }
+ }
+}
diff --git a/lib/actions/upload.ts b/lib/actions/upload.ts
new file mode 100644
index 0000000..2bb405a
--- /dev/null
+++ b/lib/actions/upload.ts
@@ -0,0 +1,23 @@
+'use server'
+
+import { uploadToOpeninary } from '@/lib/openinary'
+
+export async function uploadImageAction(formData: FormData) {
+ try {
+ const file = formData.get('file') as File
+ if (!file) throw new Error('No file provided')
+
+ const folder = (formData.get('folder') as string) || 'starapart'
+
+ const result = await uploadToOpeninary(file, folder)
+ let finalUrl = result.url
+ if (finalUrl && finalUrl.startsWith('/')) {
+ finalUrl = `${process.env.NEXT_PUBLIC_OPENINARY_URL || 'https://media.ayris.tech'}${finalUrl}`
+ }
+
+ return { success: true, url: finalUrl }
+ } catch (error: any) {
+ console.error('Upload error:', error)
+ return { success: false, error: error.message }
+ }
+}
diff --git a/lib/db.ts b/lib/db.ts
index b207402..4f384cf 100644
--- a/lib/db.ts
+++ b/lib/db.ts
@@ -1,9 +1,15 @@
import { PrismaClient } from '@prisma/client'
+import { Pool } from 'pg'
+import { PrismaPg } from '@prisma/adapter-pg'
+
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined
}
-export const db = globalForPrisma.prisma ?? new PrismaClient()
+const pool = new Pool({ connectionString: process.env.DATABASE_URL })
+const adapter = new PrismaPg(pool)
+
+export const db = globalForPrisma.prisma ?? new PrismaClient({ adapter })
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = db
diff --git a/lib/openinary-loader.ts b/lib/openinary-loader.ts
index ad51f52..9c2bb36 100644
--- a/lib/openinary-loader.ts
+++ b/lib/openinary-loader.ts
@@ -35,5 +35,12 @@ export default function openinaryLoader({ src, width, quality }: { src: string,
path = path.substring(1);
}
- return `https://media.ayris.tech/t/w_${width},f_webp,q_${quality || 75}/${path}`
+ // Ensure 'starapart/' prefix for Openinary transform URLs
+ // Since the API sometimes returns URLs without the root folder, we inject it back.
+ if (!path.startsWith('starapart/') && !path.startsWith('http')) {
+ path = `starapart/${path}`;
+ }
+
+ // Adding a_auto to automatically rotate images based on EXIF data (fixes sideways phone photos)
+ return `https://media.ayris.tech/t/w_${width},f_webp,q_${quality || 75},a_auto/${path}`
}
diff --git a/lib/redis.ts b/lib/redis.ts
new file mode 100644
index 0000000..cd9a00b
--- /dev/null
+++ b/lib/redis.ts
@@ -0,0 +1,11 @@
+import Redis from 'ioredis'
+
+const globalForRedis = globalThis as unknown as {
+ redis: Redis | undefined
+}
+
+export const redis =
+ globalForRedis.redis ??
+ new Redis(process.env.REDIS_URL || 'redis://localhost:6379')
+
+if (process.env.NODE_ENV !== 'production') globalForRedis.redis = redis
diff --git a/messages/de.json b/messages/de.json
index aaa37f8..bd42135 100644
--- a/messages/de.json
+++ b/messages/de.json
@@ -23,16 +23,16 @@
"title": "Unsere Unterkünfte",
"subtitle": "Geräumige Apartments, die modernen Komfort mit traditionellen Akzenten verbinden.",
"room_1": {
- "title": "Studio-Apartment",
- "desc": "Komfortables Studio für 1-2 Personen mit Einzelbett, Miniküche und Bad."
+ "title": "Standard Hotelzimmer",
+ "desc": "25 qm Standardzimmer mit Wald- oder Meerblick, für Ihren Komfort konzipiert (2 Gäste)."
},
"room_2": {
- "title": "1-Zimmer-Apartment",
- "desc": "Geräumiges Apartment für 2 Personen mit Schlafzimmer, Wohnzimmer mit Küchenzeile und Balkon."
+ "title": "Kleines Zimmer",
+ "desc": "Kompakte Zimmer mit eigenem WC, Wald- oder Meerblick, für bis zu 3 Personen."
},
"room_3": {
- "title": "2-Zimmer-Apartment",
- "desc": "Apartment mit 2 separaten Zimmern und Balkon. Bietet Platz für 3-4 Personen."
+ "title": "1-Zimmer-Wohnung",
+ "desc": "Geräumige 1+1 Apartments mit größerem Wohnbereich, mit Wald- oder Meerblick."
}
},
"rooms": {
@@ -44,17 +44,17 @@
"per_night": "/ Nacht",
"details_btn": "Details ansehen",
"room_list": {
- "1_0_daire": {
- "name": "Studio-Apartment",
- "desc": "Komfortables Studio für 1-2 Personen mit Einzelbett, Miniküche und Bad."
+ "standart_oda": {
+ "name": "Standard Hotelzimmer",
+ "desc": "25 qm Standardzimmer mit Wald- oder Meerblick, für Ihren Komfort konzipiert."
},
- "1_1_daire_a": {
- "name": "1-Zimmer-Apartment",
- "desc": "Geräumiges Apartment für 2 Personen mit Schlafzimmer, Wohnzimmer mit Küchenzeile und Balkon."
+ "kucuk_oda": {
+ "name": "Kleines Zimmer",
+ "desc": "Kompakte Zimmer mit eigenem WC, Wald- oder Meerblick, für bis zu 3 Personen."
},
- "1_1_daire_b": {
- "name": "2-Zimmer-Apartment",
- "desc": "Apartment mit 2 separaten Zimmern und Balkon. Bietet Platz für 3-4 Personen."
+ "1_1_daire": {
+ "name": "1-Zimmer-Wohnung",
+ "desc": "Geräumige 1+1 Apartments mit größerem Wohnbereich, mit Wald- oder Meerblick."
}
},
"details": {
@@ -124,7 +124,9 @@
"email": "E-Mail",
"address_title": "Unsere Adresse",
"address_value": "Karanfil Sokak No: 12, Akyaka",
- "map_placeholder": "Interaktive Karte"
+ "check_in": "Check-in: 12:30 - 14:00",
+ "check_out": "Check-out: 10:00 - 11:00",
+ "map_placeholder": "Interaktiver Karten-Platzhalter"
}
},
"footer": {
diff --git a/messages/en.json b/messages/en.json
index 5686c4c..ac8652c 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -23,16 +23,16 @@
"title": "Accommodation Options",
"subtitle": "Spacious apartments combining modern comfort with traditional touches, suitable for every need.",
"room_1": {
- "title": "Studio Apartment",
- "desc": "Comfortable studio for 1-2 people with a single bed, mini kitchen, and bathroom."
+ "title": "Standard Hotel Room",
+ "desc": "25 sqm standard rooms with forest or sea views, designed for your comfort (2 guests)."
},
"room_2": {
- "title": "1 Bedroom Apartment",
- "desc": "Spacious apartment for 2 with a bedroom, living room with kitchenette, and balcony."
+ "title": "Small Room",
+ "desc": "Compact rooms with private WC, forest or sea views, accommodating up to 3 guests."
},
"room_3": {
- "title": "2 Bedroom Apartment",
- "desc": "Apartment with 2 separate rooms (one double, one single) and balcony. Accommodates 3-4 people."
+ "title": "1 Bedroom Apartment",
+ "desc": "Spacious 1+1 apartments offering a larger area with forest or sea views."
}
},
"rooms": {
@@ -44,17 +44,17 @@
"per_night": "/ night",
"details_btn": "View Details",
"room_list": {
- "1_0_daire": {
- "name": "Studio Apartment",
- "desc": "Comfortable studio for 1-2 people with a single bed, mini kitchen, and bathroom."
+ "standart_oda": {
+ "name": "Standard Hotel Room",
+ "desc": "25 sqm standard rooms with forest or sea views, designed for your comfort."
},
- "1_1_daire_a": {
+ "kucuk_oda": {
+ "name": "Small Room",
+ "desc": "Compact rooms with private WC, forest or sea views, accommodating up to 3 guests."
+ },
+ "1_1_daire": {
"name": "1 Bedroom Apartment",
- "desc": "Spacious apartment for 2 with a bedroom, living room with kitchenette, and balcony."
- },
- "1_1_daire_b": {
- "name": "2 Bedroom Apartment",
- "desc": "Apartment with 2 separate rooms (one double, one single) and balcony. Accommodates 3-4 people."
+ "desc": "Spacious 1+1 apartments offering a larger area with forest or sea views."
}
},
"details": {
@@ -124,6 +124,8 @@
"email": "Email",
"address_title": "Our Address",
"address_value": "Karanfil Sokak No: 12, Akyaka",
+ "check_in": "Check-in: 12:30 - 14:00",
+ "check_out": "Check-out: 10:00 - 11:00",
"map_placeholder": "Interactive Map Placeholder"
}
},
diff --git a/messages/tr.json b/messages/tr.json
index 2f3dc46..24afd39 100644
--- a/messages/tr.json
+++ b/messages/tr.json
@@ -23,16 +23,16 @@
"title": "Konaklama Seçeneklerimiz",
"subtitle": "Modern konforun geleneksel dokunuşlarla buluştuğu, her ihtiyaca uygun geniş apart dairelerimiz.",
"room_1": {
- "title": "1+0 Dairemiz",
- "desc": "Stüdyo tip, tek yataklı, mini mutfak ve banyo içeren konforlu 1-2 kişilik dairelerimiz."
+ "title": "Standart Otel Odası",
+ "desc": "25 m² genişliğinde, 2 kişi kapasiteli, orman veya deniz manzaralı standart odalarımız."
},
"room_2": {
- "title": "1+1 Dairemiz",
- "desc": "Yatak odası ve ayrı mutfak köşeli salon, balkonlu, 2 kişilik ferah dairelerimiz."
+ "title": "Küçük Oda",
+ "desc": "Kendi WC'si bulunan, 3 kişi kapasiteli, orman veya deniz manzaralı kompakt odalarımız."
},
"room_3": {
- "title": "1+1 Dairemiz (2 Oda)",
- "desc": "2 kişilik ve 1 kişilik olmak üzere 2 ayrı oda içeren balkonlu dairelerimiz. 3-4 kişi konaklayabilir."
+ "title": "1+1 Daire",
+ "desc": "Daha geniş bir alan sunan, 1+1 ferah, orman veya deniz manzaralı dairelerimiz."
}
},
"rooms": {
@@ -44,17 +44,17 @@
"per_night": "/ gece",
"details_btn": "Detaylı İncele",
"room_list": {
- "1_0_daire": {
- "name": "1+0 Dairemiz",
- "desc": "Stüdyo tip, tek yataklı, mini mutfak ve banyo içeren 1-2 kişilik dairelerimiz."
+ "standart_oda": {
+ "name": "Standart Otel Odası",
+ "desc": "25 m² genişliğinde, orman veya deniz manzaralı standart odalarımız."
},
- "1_1_daire_a": {
- "name": "1+1 Dairemiz",
- "desc": "Yatak odası ve ayrı mutfak köşeli salon, balkonlu, 2 kişilik ferah dairelerimiz."
+ "kucuk_oda": {
+ "name": "Küçük Oda",
+ "desc": "Kendi WC'si bulunan, 3 kişi kapasiteli, orman veya deniz manzaralı kompakt odalar."
},
- "1_1_daire_b": {
- "name": "1+1 Dairemiz (2 Oda)",
- "desc": "2 kişilik ve 1 kişilik olmak üzere 2 ayrı oda içeren balkonlu dairelerimiz. 3-4 kişi konaklayabilir."
+ "1_1_daire": {
+ "name": "1+1 Daire",
+ "desc": "Daha geniş bir alan sunan, orman veya deniz manzaralı ferah dairelerimiz."
}
},
"details": {
@@ -124,6 +124,8 @@
"email": "E-posta",
"address_title": "Adresimiz",
"address_value": "Karanfil Sokak No: 12, Akyaka",
+ "check_in": "Giriş: 12:30 - 14:00",
+ "check_out": "Çıkış: 10:00 - 11:00",
"map_placeholder": "İnteraktif Harita"
}
},
diff --git a/next.config.ts b/next.config.ts
index 8dff980..a85f883 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -9,8 +9,15 @@ const nextConfig: NextConfig = {
remotePatterns: [
{ protocol: 'https', hostname: 'res.cloudinary.com' },
{ protocol: 'https', hostname: 'images.unsplash.com' },
+ { protocol: 'https', hostname: 'media.ayris.tech' },
],
},
+ experimental: {
+ serverActions: {
+ bodySizeLimit: '20mb',
+ },
+ proxyClientMaxBodySize: '20mb',
+ },
}
export default withNextIntl(nextConfig)
diff --git a/package-lock.json b/package-lock.json
index 8ebed4d..d91e4b8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,17 +9,21 @@
"version": "0.1.0",
"dependencies": {
"@base-ui/react": "^1.5.0",
+ "@prisma/adapter-pg": "^7.8.0",
"@prisma/client": "^7.8.0",
+ "@types/pg": "^8.20.0",
"class-variance-authority": "^0.7.1",
"cloudinary": "^2.10.0",
"clsx": "^2.1.1",
"developer-icons": "^7.0.1",
"embla-carousel-react": "^8.6.0",
"framer-motion": "^12.42.2",
+ "ioredis": "^5.11.1",
"lucide-react": "^1.18.0",
"next": "16.2.9",
"next-auth": "^5.0.0-beta.31",
"next-intl": "^4.13.0",
+ "pg": "^8.22.0",
"react": "19.2.4",
"react-dom": "19.2.4",
"shadcn": "^4.11.0",
@@ -1573,6 +1577,12 @@
"url": "https://opencollective.com/libvips"
}
},
+ "node_modules/@ioredis/commands": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.10.0.tgz",
+ "integrity": "sha512-UmeW7z4LfctwoQ5wkhVzgq8tXkreED2xZGpX+Bg+zA+WJFZCT6c062AfCK/Dfk81xZnnwdhJCUMkitihRaoC2Q==",
+ "license": "MIT"
+ },
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.13",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
@@ -2250,6 +2260,18 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
+ "node_modules/@prisma/adapter-pg": {
+ "version": "7.8.0",
+ "resolved": "https://registry.npmjs.org/@prisma/adapter-pg/-/adapter-pg-7.8.0.tgz",
+ "integrity": "sha512-ygb3UkerK3v8MDpXVgCISdRNDozpxh6+JVJgiIGbSr5KBgz10LLf5ejUskPGoXlsIjxsOu6nuy1JVQr2EKGSlg==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@prisma/driver-adapter-utils": "7.8.0",
+ "@types/pg": "^8.16.0",
+ "pg": "^8.16.3",
+ "postgres-array": "3.0.4"
+ }
+ },
"node_modules/@prisma/client": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-7.8.0.tgz",
@@ -2297,7 +2319,6 @@
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-7.8.0.tgz",
"integrity": "sha512-p+QZReysDUqXC+mk17q9a+Y/qzh4c2KYliDK30buYUyfrGeTGSyfmc0AIrJRhZJrLHhRiJa9Au/J72h3C+szvA==",
- "devOptional": true,
"license": "Apache-2.0"
},
"node_modules/@prisma/dev": {
@@ -2326,6 +2347,15 @@
"zeptomatch": "2.1.0"
}
},
+ "node_modules/@prisma/driver-adapter-utils": {
+ "version": "7.8.0",
+ "resolved": "https://registry.npmjs.org/@prisma/driver-adapter-utils/-/driver-adapter-utils-7.8.0.tgz",
+ "integrity": "sha512-/Q13o0ZT0rjc1Xk0Q9KhZYwuq2EW/vSbWUBKfgEKkaCuB/Sg6bqnjmTZqC5cD4d6y1vfFAEwBRzfzoSMIVJ55A==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@prisma/debug": "7.8.0"
+ }
+ },
"node_modules/@prisma/engines": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-7.8.0.tgz",
@@ -3247,12 +3277,22 @@
"version": "20.19.43",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz",
"integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==",
- "dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
}
},
+ "node_modules/@types/pg": {
+ "version": "8.20.0",
+ "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.20.0.tgz",
+ "integrity": "sha512-bEPFOaMAHTEP1EzpvHTbmwR8UsFyHSKsRisLIHVMXnpNefSbGA1bD6CVy+qKjGSqmZqNqBDV2azOBo8TgkcVow==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*",
+ "pg-protocol": "*",
+ "pg-types": "^2.2.0"
+ }
+ },
"node_modules/@types/react": {
"version": "19.2.17",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.17.tgz",
@@ -4632,6 +4672,15 @@
"node": ">=6"
}
},
+ "node_modules/cluster-key-slot": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.1.tgz",
+ "integrity": "sha512-rwHwUfXL40Chm1r08yrhU3qpUvdVlgkKNeyeGPOxnW8/SyVDvgRaed/Uz54AqWNaTCAThlj6QAs3TZcKI0xDEw==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/code-block-writer": {
"version": "13.0.3",
"resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-13.0.3.tgz",
@@ -5026,7 +5075,6 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz",
"integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==",
- "devOptional": true,
"license": "Apache-2.0",
"engines": {
"node": ">=0.10"
@@ -6869,6 +6917,28 @@
"@formatjs/icu-messageformat-parser": "3.5.11"
}
},
+ "node_modules/ioredis": {
+ "version": "5.11.1",
+ "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.11.1.tgz",
+ "integrity": "sha512-ehuGcf94bQXhfagULNXrJdfnWO38v070jxSx/qE87Kjzmu2fU7ro5EFAb+OPituLqgfyuQaym5DlrNydW2sJ9A==",
+ "license": "MIT",
+ "dependencies": {
+ "@ioredis/commands": "1.10.0",
+ "cluster-key-slot": "1.1.1",
+ "debug": "4.4.3",
+ "denque": "2.1.0",
+ "redis-errors": "1.2.0",
+ "redis-parser": "3.0.0",
+ "standard-as-callback": "2.1.0"
+ },
+ "engines": {
+ "node": ">=12.22.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/ioredis"
+ }
+ },
"node_modules/ip-address": {
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.2.0.tgz",
@@ -9048,6 +9118,104 @@
"devOptional": true,
"license": "MIT"
},
+ "node_modules/pg": {
+ "version": "8.22.0",
+ "resolved": "https://registry.npmjs.org/pg/-/pg-8.22.0.tgz",
+ "integrity": "sha512-8wih1vVIBMxoUM2oB4soJsD9tDnDpLv4OXBJ+EJzFsvycD+lfyIreC2gGHq78f8jbLLt+bvlPTFdFZfJkOuzAA==",
+ "license": "MIT",
+ "dependencies": {
+ "pg-connection-string": "^2.14.0",
+ "pg-pool": "^3.14.0",
+ "pg-protocol": "^1.15.0",
+ "pg-types": "2.2.0",
+ "pgpass": "1.0.5"
+ },
+ "engines": {
+ "node": ">= 16.0.0"
+ },
+ "optionalDependencies": {
+ "pg-cloudflare": "^1.4.0"
+ },
+ "peerDependencies": {
+ "pg-native": ">=3.0.1"
+ },
+ "peerDependenciesMeta": {
+ "pg-native": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/pg-cloudflare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.4.0.tgz",
+ "integrity": "sha512-Vo7z/6rrQYxpNRylp4Tlob2elzbh+N/MOQbxFVWCxS7oEx6jF53GTJFxK2WWpKuBRkmiin4Mt+xofFDjx09R0A==",
+ "license": "MIT",
+ "optional": true
+ },
+ "node_modules/pg-connection-string": {
+ "version": "2.14.0",
+ "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.14.0.tgz",
+ "integrity": "sha512-XwWDGcLRGCXAR8F/AM5bG7Q+A3Wm2s6QeEjlOKZLlH3UYcguiqCWKyWXVag5TLTIjR7oOJUY8kcADaZgWPyLeg==",
+ "license": "MIT"
+ },
+ "node_modules/pg-int8": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
+ "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/pg-pool": {
+ "version": "3.14.0",
+ "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.14.0.tgz",
+ "integrity": "sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw==",
+ "license": "MIT",
+ "peerDependencies": {
+ "pg": ">=8.0"
+ }
+ },
+ "node_modules/pg-protocol": {
+ "version": "1.15.0",
+ "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.15.0.tgz",
+ "integrity": "sha512-cq9sECI5s0+uPUXjbz8ioyPJni6RzsRib0US67i5IoTZKw8fNeYlVE7u8F4dG7vEJJtc5wdD1K189lCCUwqWTQ==",
+ "license": "MIT"
+ },
+ "node_modules/pg-types": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
+ "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
+ "license": "MIT",
+ "dependencies": {
+ "pg-int8": "1.0.1",
+ "postgres-array": "~2.0.0",
+ "postgres-bytea": "~1.0.0",
+ "postgres-date": "~1.0.4",
+ "postgres-interval": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/pg-types/node_modules/postgres-array": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
+ "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/pgpass": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
+ "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
+ "license": "MIT",
+ "dependencies": {
+ "split2": "^4.1.0"
+ }
+ },
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
@@ -9158,6 +9326,45 @@
"url": "https://github.com/sponsors/porsager"
}
},
+ "node_modules/postgres-array": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-3.0.4.tgz",
+ "integrity": "sha512-nAUSGfSDGOaOAEGwqsRY27GPOea7CNipJPOA7lPbdEpx5Kg3qzdP0AaWC5MlhTWV9s4hFX39nomVZ+C4tnGOJQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/postgres-bytea": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz",
+ "integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/postgres-date": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
+ "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/postgres-interval": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
+ "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
+ "license": "MIT",
+ "dependencies": {
+ "xtend": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/powershell-utils": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/powershell-utils/-/powershell-utils-0.1.0.tgz",
@@ -9469,6 +9676,27 @@
"node": ">= 4"
}
},
+ "node_modules/redis-errors": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz",
+ "integrity": "sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/redis-parser": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz",
+ "integrity": "sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==",
+ "license": "MIT",
+ "dependencies": {
+ "redis-errors": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/reflect.getprototypeof": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz",
@@ -10132,6 +10360,15 @@
"node": ">=0.10.0"
}
},
+ "node_modules/split2": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
+ "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">= 10.x"
+ }
+ },
"node_modules/sqlstring": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz",
@@ -10149,6 +10386,12 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/standard-as-callback": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.1.0.tgz",
+ "integrity": "sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==",
+ "license": "MIT"
+ },
"node_modules/statuses": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
@@ -10820,7 +11063,6 @@
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
- "dev": true,
"license": "MIT"
},
"node_modules/unicorn-magic": {
@@ -11145,6 +11387,15 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/xtend": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
+ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.4"
+ }
+ },
"node_modules/yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
diff --git a/package.json b/package.json
index 27b2547..f2e942b 100644
--- a/package.json
+++ b/package.json
@@ -10,17 +10,21 @@
},
"dependencies": {
"@base-ui/react": "^1.5.0",
+ "@prisma/adapter-pg": "^7.8.0",
"@prisma/client": "^7.8.0",
+ "@types/pg": "^8.20.0",
"class-variance-authority": "^0.7.1",
"cloudinary": "^2.10.0",
"clsx": "^2.1.1",
"developer-icons": "^7.0.1",
"embla-carousel-react": "^8.6.0",
"framer-motion": "^12.42.2",
+ "ioredis": "^5.11.1",
"lucide-react": "^1.18.0",
"next": "16.2.9",
"next-auth": "^5.0.0-beta.31",
"next-intl": "^4.13.0",
+ "pg": "^8.22.0",
"react": "19.2.4",
"react-dom": "19.2.4",
"shadcn": "^4.11.0",
diff --git a/patch-galeri.ts b/patch-galeri.ts
new file mode 100644
index 0000000..c9360b8
--- /dev/null
+++ b/patch-galeri.ts
@@ -0,0 +1,133 @@
+import fs from 'fs'
+
+const content = `'use client'
+
+import { useState } from 'react'
+import { motion, AnimatePresence } from 'framer-motion'
+import Image from 'next/image'
+import BougainvilleaMotif from '@/components/BougainvilleaMotif'
+import { useTranslations } from 'next-intl'
+import { X } from 'lucide-react'
+import openinaryLoader from '@/lib/openinary-loader'
+
+export default function GalleryPage() {
+ const t = useTranslations('gallery')
+ const [selectedImage, setSelectedImage] = useState(null)
+
+ const galleryImages = [
+ 'DSC01477.jpg',
+ 'DSC01478.jpg',
+ 'DSC01479.jpg',
+ 'DSC01480.jpg',
+ 'DSC01481.jpg',
+ 'DSC01482.jpg',
+ 'DSC01483.jpg',
+ 'DSC01487.jpg',
+ 'DSC01535.jpg',
+ 'DSC01544.jpg',
+ 'DSC01554.jpg',
+ 'DSC01560.jpg',
+ 'DSC01563.jpg'
+ ]
+
+ const galleryItems = galleryImages.map((file, idx) => ({
+ id: idx + 1,
+ title: t('items.' + ((idx % 6) + 1)), // Use existing translations just to not break them
+ src: \`https://media.ayris.tech/t/starapart/gallery/\${file}\`,
+ colSpan: idx % 4 === 1 ? 'col-span-1 md:col-span-2 lg:col-span-1' : 'col-span-1'
+ }))
+
+ return (
+
+ {/* Header Section */}
+
+
+
+
+
+ {t('title')}
+
+
+ {t('description')}
+
+
+
+ {/* Masonry-like Grid */}
+
+
+ {galleryItems.map((item) => (
+ setSelectedImage(item.src)}
+ tabIndex={0}
+ onKeyDown={(e) => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ e.preventDefault();
+ setSelectedImage(item.src);
+ }
+ }}
+ >
+
+
+
+
+ ))}
+
+
+
+ {/* Lightbox Overlay */}
+
+ {selectedImage && (
+ setSelectedImage(null)}
+ >
+
+ e.stopPropagation()}
+ >
+
+
+
+ )}
+
+
+ )
+}
+`
+
+fs.writeFileSync('app/[locale]/galeri/page.tsx', content)
diff --git a/prisma.config.ts b/prisma.config.ts
index 5f884cb..e0e9fbd 100644
--- a/prisma.config.ts
+++ b/prisma.config.ts
@@ -1,4 +1,8 @@
+import 'dotenv/config'
import { defineConfig } from '@prisma/config'
export default defineConfig({
+ datasource: {
+ url: process.env.DATABASE_URL
+ }
})
diff --git a/proxy.ts b/proxy.ts
index 30cd1fa..1108c87 100644
--- a/proxy.ts
+++ b/proxy.ts
@@ -5,15 +5,22 @@ import { routing } from '@/i18n/routing'
const intlMiddleware = createMiddleware(routing)
-export async function proxy(request: NextRequest) {
- if (request.nextUrl.pathname.includes('/admin')) {
- const session = await auth()
+export const proxy = auth((request) => {
+ const isAuthOrAdmin = request.nextUrl.pathname.startsWith('/admin') || request.nextUrl.pathname.startsWith('/login')
+
+ if (request.nextUrl.pathname.startsWith('/admin')) {
+ const session = request.auth
if (!session || (session.user as any)?.role !== 'ADMIN') {
return NextResponse.redirect(new URL('/login', request.url))
}
}
+
+ if (isAuthOrAdmin) {
+ return NextResponse.next()
+ }
+
return intlMiddleware(request)
-}
+})
export const config = {
matcher: ['/((?!api|_next|_vercel|.*\\..*).*)']
diff --git a/test-db-images.ts b/test-db-images.ts
new file mode 100644
index 0000000..cb5577c
--- /dev/null
+++ b/test-db-images.ts
@@ -0,0 +1,9 @@
+import 'dotenv/config';
+import { db } from './lib/db';
+async function run() {
+ const rooms = await db.room.findMany({ orderBy: { createdAt: 'asc' } });
+ for (const r of rooms) {
+ console.log(r.nameTr, r.images[0]);
+ }
+}
+run();
diff --git a/test-db.ts b/test-db.ts
new file mode 100644
index 0000000..b10e09c
--- /dev/null
+++ b/test-db.ts
@@ -0,0 +1,8 @@
+import { db } from './lib/db';
+async function run() {
+ const rooms = await db.room.findMany();
+ for (const r of rooms) {
+ if (r.images.length > 0) console.log(r.nameTr, r.images[0]);
+ }
+}
+run();
diff --git a/upload-1plus1.ts b/upload-1plus1.ts
new file mode 100644
index 0000000..9e07ca1
--- /dev/null
+++ b/upload-1plus1.ts
@@ -0,0 +1,100 @@
+import { config } from 'dotenv'
+config()
+
+import fs from 'fs'
+import path from 'path'
+
+async function getPrisma() {
+ const { db } = await import('./lib/db')
+ return db
+}
+
+async function uploadToOpeninary(filePath: string, folder: string) {
+ const fileBuffer = fs.readFileSync(filePath)
+ const ext = path.extname(filePath).toLowerCase()
+ let type = 'image/jpeg'
+ if (ext === '.png') type = 'image/png'
+ if (ext === '.webp') type = 'image/webp'
+
+ const blob = new Blob([fileBuffer], { type })
+ const formData = new FormData()
+
+ formData.append('files', blob, path.basename(filePath))
+ formData.append('folder', folder)
+
+ const res = await fetch(`${process.env.OPENINARY_API_URL}/api/upload`, {
+ method: 'POST',
+ headers: { Authorization: `Bearer ${process.env.OPENINARY_API_KEY}` },
+ body: formData,
+ })
+
+ if (!res.ok) {
+ const errorText = await res.text()
+ throw new Error('Upload başarısız: ' + errorText)
+ }
+
+ const data = await res.json()
+ return data.files[0]
+}
+
+async function processFolder(prisma: any, roomName: string, folderPath: string, openinaryFolder: string) {
+ console.log(`\n--- İşleniyor: ${roomName} ---`)
+ const room = await prisma.room.findFirst({
+ where: { nameTr: { contains: roomName } }
+ })
+
+ if (!room) {
+ console.error(`Oda bulunamadı: ${roomName}`)
+ return
+ }
+
+ console.log(`Oda bulundu: ${room.nameTr} (ID: ${room.id})`)
+
+ const imagesDir = path.join(__dirname, 'public', folderPath)
+ if (!fs.existsSync(imagesDir)) {
+ console.error(`Klasör bulunamadı: ${imagesDir}`)
+ return
+ }
+
+ const files = fs.readdirSync(imagesDir).filter(f => !f.startsWith('.'))
+ const uploadedUrls: string[] = []
+
+ console.log(`${files.length} resim bulundu. Yükleniyor...`)
+
+ for (let i = 0; i < files.length; i++) {
+ const file = files[i]
+ console.log(`Yükleniyor: ${file} (${i+1}/${files.length})...`)
+ try {
+ const result = await uploadToOpeninary(path.join(imagesDir, file), openinaryFolder)
+ let finalUrl = result.url
+ if (finalUrl && finalUrl.startsWith('/')) {
+ finalUrl = `${process.env.NEXT_PUBLIC_OPENINARY_URL || 'https://media.ayris.tech'}${finalUrl}`
+ }
+ uploadedUrls.push(finalUrl)
+ console.log(` -> Başarılı: ${finalUrl}`)
+ } catch (err) {
+ console.error(` -> Hata:`, err)
+ }
+ }
+
+ if (uploadedUrls.length > 0) {
+ console.log('Veritabanı güncelleniyor...')
+ await prisma.room.update({
+ where: { id: room.id },
+ data: {
+ imageUrl: uploadedUrls[0],
+ images: uploadedUrls
+ }
+ })
+ console.log(`${roomName} veritabanı güncellendi!`)
+ }
+}
+
+async function main() {
+ const prisma = await getPrisma()
+ await processFolder(prisma, 'Süit Daire 1', '1+1', 'starapart/SUITE_1_1')
+ await processFolder(prisma, 'Küçük Oda 1 (3 Kişilik)', '1+0', 'starapart/STUDIO_1_0')
+ await prisma.$disconnect()
+}
+
+main().catch(console.error)
diff --git a/upload-galery.ts b/upload-galery.ts
new file mode 100644
index 0000000..80e8a4b
--- /dev/null
+++ b/upload-galery.ts
@@ -0,0 +1,66 @@
+import { config } from 'dotenv'
+config()
+
+import fs from 'fs'
+import path from 'path'
+
+async function uploadToOpeninary(filePath: string, folder: string) {
+ const fileBuffer = fs.readFileSync(filePath)
+ const ext = path.extname(filePath).toLowerCase()
+ let type = 'image/jpeg'
+ if (ext === '.png') type = 'image/png'
+ if (ext === '.webp') type = 'image/webp'
+
+ const blob = new Blob([fileBuffer], { type })
+ const formData = new FormData()
+
+ formData.append('files', blob, path.basename(filePath))
+ formData.append('folder', folder)
+
+ const res = await fetch(`${process.env.OPENINARY_API_URL}/api/upload`, {
+ method: 'POST',
+ headers: { Authorization: `Bearer ${process.env.OPENINARY_API_KEY}` },
+ body: formData,
+ })
+
+ if (!res.ok) {
+ const errorText = await res.text()
+ throw new Error('Upload başarısız: ' + errorText)
+ }
+
+ const data = await res.json()
+ return data.files[0]
+}
+
+async function main() {
+ const imagesDir = path.join(process.cwd(), 'public/galery')
+ if (!fs.existsSync(imagesDir)) {
+ console.error('Directory not found:', imagesDir)
+ return
+ }
+
+ const files = fs.readdirSync(imagesDir)
+ .filter(file => /\.(jpg|jpeg|png|webp)$/i.test(file))
+ .sort()
+
+ const uploadedUrls: string[] = []
+
+ for (const file of files) {
+ console.log(`Uploading ${file}...`)
+ try {
+ const result = await uploadToOpeninary(path.join(imagesDir, file), 'starapart/gallery')
+ let finalUrl = result.url
+ if (finalUrl && finalUrl.startsWith('/')) {
+ finalUrl = `${process.env.NEXT_PUBLIC_OPENINARY_URL || 'https://media.ayris.tech'}${finalUrl}`
+ }
+ uploadedUrls.push(finalUrl)
+ console.log(`Uploaded ${file}: ${finalUrl}`)
+ } catch (e) {
+ console.error(`Failed to upload ${file}:`, e)
+ }
+ }
+
+ console.log('All uploaded URLs:', JSON.stringify(uploadedUrls, null, 2))
+}
+
+main().catch(console.error)
diff --git a/upload-hero.ts b/upload-hero.ts
new file mode 100644
index 0000000..6b1bb7a
--- /dev/null
+++ b/upload-hero.ts
@@ -0,0 +1,45 @@
+import { config } from 'dotenv'
+config()
+
+import fs from 'fs'
+import path from 'path'
+
+async function uploadToOpeninary(filePath: string, folder: string) {
+ const fileBuffer = fs.readFileSync(filePath)
+ const ext = path.extname(filePath).toLowerCase()
+ let type = 'image/jpeg'
+ if (ext === '.png') type = 'image/png'
+ if (ext === '.webp') type = 'image/webp'
+
+ const blob = new Blob([fileBuffer], { type })
+ const formData = new FormData()
+
+ formData.append('files', blob, path.basename(filePath))
+ formData.append('folder', folder)
+
+ const res = await fetch(`${process.env.OPENINARY_API_URL}/api/upload`, {
+ method: 'POST',
+ headers: { Authorization: `Bearer ${process.env.OPENINARY_API_KEY}` },
+ body: formData,
+ })
+
+ if (!res.ok) {
+ const errorText = await res.text()
+ throw new Error('Upload başarısız: ' + errorText)
+ }
+
+ const data = await res.json()
+ return data.files[0]
+}
+
+async function main() {
+ const file = '/Users/ayrisdev/.gemini/antigravity-ide/brain/4d6ff40f-af54-4d09-b92f-d0078b260d91/media__1784311319733.jpg'
+ const result = await uploadToOpeninary(file, 'starapart/hero')
+ let finalUrl = result.url
+ if (finalUrl && finalUrl.startsWith('/')) {
+ finalUrl = `${process.env.NEXT_PUBLIC_OPENINARY_URL || 'https://media.ayris.tech'}${finalUrl}`
+ }
+ console.log('UPLOAD_URL=' + finalUrl)
+}
+
+main().catch(console.error)