Update application features and add scripts (core changes)

This commit is contained in:
AyrisAI
2026-07-19 11:38:56 +03:00
parent a36b833e00
commit da84cdc231
44 changed files with 2953 additions and 449 deletions
+27
View File
@@ -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 (
<SessionProvider session={session}>
<div className="flex h-screen bg-[#F8FAFC] dark:bg-gray-950 overflow-hidden">
<AdminSidebar />
<div className="flex-1 flex flex-col min-w-0 overflow-hidden relative">
<AdminHeader
userEmail={session?.user?.email}
userName={session?.user?.name}
/>
<main className="flex-1 overflow-y-auto p-4 sm:p-6 lg:p-8 bg-gray-50/50 dark:bg-gray-900/50">
<div className="mx-auto max-w-7xl">
{children}
</div>
</main>
</div>
</div>
</SessionProvider>
)
}
+87
View File
@@ -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 (
<div className="space-y-8">
<motion.div
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4 }}
>
<h2 className="text-3xl font-bold tracking-tight text-gray-900 dark:text-white">Dashboard</h2>
<p className="text-gray-500 dark:text-gray-400 mt-2">
Hoş geldiniz, {session?.user?.name || session?.user?.email || 'Admin'}. İşte projenizin genel görünümü.
</p>
</motion.div>
<motion.div
variants={container}
initial="hidden"
animate="show"
className="grid gap-4 md:grid-cols-2 lg:grid-cols-4"
>
{stats.map((stat, i) => (
<motion.div key={stat.name} variants={item}>
<Card className="border-gray-200 dark:border-gray-800 shadow-sm transition-all hover:shadow-md dark:bg-gray-950/50 backdrop-blur-sm">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium text-gray-500 dark:text-gray-400">
{stat.name}
</CardTitle>
<stat.icon className={`h-4 w-4 ${stat.color}`} />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold text-gray-900 dark:text-white">{stat.stat}</div>
</CardContent>
</Card>
</motion.div>
))}
</motion.div>
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4, delay: 0.4 }}
>
<Card className="border-gray-200 dark:border-gray-800 shadow-sm dark:bg-gray-950/50 backdrop-blur-sm">
<CardHeader>
<CardTitle className="text-lg text-gray-900 dark:text-white">Son Aktiviteler</CardTitle>
</CardHeader>
<CardContent>
<div className="py-4 text-sm text-gray-500 dark:text-gray-400 text-center border-2 border-dashed rounded-lg border-gray-200 dark:border-gray-800">
Henüz aktivite kaydı bulunmuyor.
</div>
</CardContent>
</Card>
</motion.div>
</div>
)
}
@@ -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 (
<div className="space-y-6">
<div className="flex items-center space-x-4">
<Link href="/admin/rooms" className="text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors">
<ArrowLeft className="h-6 w-6" />
</Link>
<div>
<h2 className="text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Odayı Düzenle</h2>
<p className="text-gray-500 dark:text-gray-400 mt-2">
Oda bilgilerini güncellemek için aşağıdaki formu kullanın.
</p>
</div>
</div>
<RoomForm initialData={room} />
</div>
)
}
@@ -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 (
<div className="space-y-6">
<div className="flex items-center space-x-4">
<Link href="/admin/rooms" className="text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors">
<ArrowLeft className="h-6 w-6" />
</Link>
<div>
<h2 className="text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Yeni Oda Ekle</h2>
<p className="text-gray-500 dark:text-gray-400 mt-2">
Sisteme yeni bir oda eklemek için aşağıdaki formu doldurun.
</p>
</div>
</div>
<RoomForm />
</div>
)
}
+155
View File
@@ -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 (
<div className="space-y-6">
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
<div>
<h2 className="text-3xl font-bold tracking-tight text-gray-900 dark:text-white">Odalar</h2>
<p className="text-gray-500 dark:text-gray-400 mt-2">
Sistemdeki tüm odaları buradan yönetebilirsiniz.
</p>
</div>
<Link href="/admin/rooms/create">
<Button className="w-full sm:w-auto">
<Plus className="mr-2 h-4 w-4" /> Yeni Oda Ekle
</Button>
</Link>
</div>
<div className="bg-white dark:bg-gray-950/50 border border-gray-200 dark:border-gray-800 rounded-lg shadow-sm backdrop-blur-sm">
<Table>
<TableHeader>
<TableRow className="hover:bg-transparent">
<TableHead className="w-24">Resimler</TableHead>
<TableHead>Ad (TR)</TableHead>
<TableHead>Tip</TableHead>
<TableHead>Kapasite</TableHead>
<TableHead>Fiyat</TableHead>
<TableHead>Durum</TableHead>
<TableHead className="text-right">İşlemler</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{rooms.length === 0 ? (
<TableRow>
<TableCell colSpan={7} className="h-24 text-center text-gray-500">
Henüz oda bulunmuyor.
</TableCell>
</TableRow>
) : (
rooms.map((room) => (
<TableRow key={room.id} className="group">
<TableCell>
<div className="flex flex-col gap-2">
{room.imageUrl ? (
<img
src={room.imageUrl}
alt={room.nameTr}
className="h-10 w-16 rounded-md object-cover border border-gray-200 dark:border-gray-800"
/>
) : (
<div className="h-10 w-16 rounded-md bg-gray-100 dark:bg-gray-800 flex items-center justify-center border border-gray-200 dark:border-gray-800">
<span className="text-[10px] text-gray-400 dark:text-gray-500">Yok</span>
</div>
)}
{room.images && room.images.length > 0 && (
<div className="flex gap-1">
{room.images.slice(0, 3).map((img, i) => (
<img key={i} src={img} alt="galeri" className="h-6 w-8 rounded object-cover border border-gray-200 dark:border-gray-800" />
))}
{room.images.length > 3 && (
<div className="h-6 w-8 rounded bg-gray-100 dark:bg-gray-800 flex items-center justify-center text-[10px] font-medium border border-gray-200 dark:border-gray-800 text-gray-600 dark:text-gray-300">
+{room.images.length - 3}
</div>
)}
</div>
)}
</div>
</TableCell>
<TableCell className="font-medium text-gray-900 dark:text-white">
{room.nameTr}
</TableCell>
<TableCell className="text-gray-500 dark:text-gray-400">
{room.type === 'STUDIO_1_0' ? 'Stüdyo (1+0)' : 'Süit (1+1)'}
</TableCell>
<TableCell className="text-gray-500 dark:text-gray-400">
{room.capacity} Kişi
</TableCell>
<TableCell className="text-gray-500 dark:text-gray-400">
{room.price ? `${room.price}` : '-'}
</TableCell>
<TableCell>
{room.available ? (
<Badge variant="outline" className="bg-green-50 text-green-700 border-green-200 dark:bg-green-950/30 dark:text-green-400 dark:border-green-900">
Müsait
</Badge>
) : (
<Badge variant="outline" className="bg-red-50 text-red-700 border-red-200 dark:bg-red-950/30 dark:text-red-400 dark:border-red-900">
Kapalı
</Badge>
)}
</TableCell>
<TableCell className="text-right">
<DropdownMenu>
<DropdownMenuTrigger render={<Button variant="ghost" className="h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity focus:opacity-100" />}>
<span className="sr-only">Menüyü </span>
<MoreHorizontal className="h-4 w-4" />
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-[160px]">
<DropdownMenuGroup>
<DropdownMenuLabel>İşlemler</DropdownMenuLabel>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem render={<Link href={`/admin/rooms/${room.id}/edit`} />}>
<Edit className="mr-2 h-4 w-4 text-blue-600 dark:text-blue-400" />
Düzenle
</DropdownMenuItem>
<DropdownMenuItem render={<form action={async () => {
'use server'
const { deleteRoom } = await import('@/lib/actions/room')
await deleteRoom(room.id)
}} />}>
<button type="submit" className="w-full flex items-center cursor-pointer text-red-600 dark:text-red-400 focus:text-red-600">
<Trash2 className="mr-2 h-4 w-4" />
Sil
</button>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</TableCell>
</TableRow>
))
)}
</TableBody>
</Table>
</div>
</div>
)
}
+33
View File
@@ -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 (
<html lang="tr" className={`${nunito_sans.variable} ${literata.variable} h-full antialiased font-sans`}>
<body className="h-full bg-gray-50 text-gray-900" suppressHydrationWarning>
{children}
</body>
</html>
);
}
-97
View File
@@ -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 (
<div className="min-h-screen bg-gray-50 dark:bg-gray-900 flex">
{/* Mobile sidebar backdrop */}
{sidebarOpen && (
<div
className="fixed inset-0 z-40 bg-gray-900/80 lg:hidden"
onClick={() => setSidebarOpen(false)}
/>
)}
{/* Sidebar */}
<div className={`
fixed inset-y-0 left-0 z-50 w-64 bg-white dark:bg-gray-950 border-r border-gray-200 dark:border-gray-800
transform transition-transform duration-200 ease-in-out lg:translate-x-0 lg:static lg:inset-0
${sidebarOpen ? 'translate-x-0' : '-translate-x-full'}
`}>
<div className="h-full flex flex-col">
<div className="h-16 flex items-center px-6 border-b border-gray-200 dark:border-gray-800">
<h1 className="text-lg font-bold text-gray-900 dark:text-white">Admin Paneli</h1>
<button
className="ml-auto lg:hidden text-gray-500"
onClick={() => setSidebarOpen(false)}
>
<X className="h-5 w-5" />
</button>
</div>
<nav className="flex-1 px-4 py-6 space-y-1 overflow-y-auto">
{navigation.map((item) => {
const isActive = pathname.endsWith(item.href)
return (
<Link
key={item.name}
href={item.href}
className={`
flex items-center px-3 py-2.5 text-sm font-medium rounded-md transition-colors
${isActive
? 'bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-white'
: 'text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-white'}
`}
>
<item.icon className={`mr-3 flex-shrink-0 h-5 w-5 ${isActive ? 'text-gray-900 dark:text-white' : 'text-gray-400'}`} />
{item.name}
</Link>
)
})}
</nav>
<div className="p-4 border-t border-gray-200 dark:border-gray-800">
<button
onClick={() => signOut({ callbackUrl: '/' })}
className="flex w-full items-center px-3 py-2.5 text-sm font-medium text-red-600 dark:text-red-400 rounded-md hover:bg-red-50 dark:hover:bg-red-950/30 transition-colors"
>
<LogOut className="mr-3 h-5 w-5" />
Çıkış Yap
</button>
</div>
</div>
</div>
{/* Main content */}
<div className="flex-1 flex flex-col min-w-0 overflow-hidden">
<header className="h-16 flex items-center lg:hidden bg-white dark:bg-gray-950 border-b border-gray-200 dark:border-gray-800 px-4">
<button
onClick={() => setSidebarOpen(true)}
className="text-gray-500 hover:text-gray-900 dark:hover:text-white focus:outline-none"
>
<Menu className="h-6 w-6" />
</button>
<span className="ml-4 text-lg font-bold text-gray-900 dark:text-white">Admin Paneli</span>
</header>
<main className="flex-1 overflow-y-auto p-4 sm:p-6 lg:p-8">
{children}
</main>
</div>
</div>
)
}
-47
View File
@@ -1,47 +0,0 @@
import { auth } from '@/lib/auth'
export default async function AdminDashboardPage() {
const session = await auth()
return (
<div className="space-y-6">
<div>
<h2 className="text-2xl font-bold tracking-tight text-gray-900 dark:text-white">Dashboard</h2>
<p className="text-gray-500 dark:text-gray-400 mt-2">
Hoş geldiniz, {session?.user?.name || session?.user?.email}. İşte projenizin genel görünümü.
</p>
</div>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
{/* 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) => (
<div
key={item.name}
className="overflow-hidden rounded-lg bg-white dark:bg-gray-950 border border-gray-200 dark:border-gray-800 px-4 py-5 shadow-sm sm:p-6"
>
<dt className="truncate text-sm font-medium text-gray-500 dark:text-gray-400">{item.name}</dt>
<dd className="mt-1 text-3xl font-semibold tracking-tight text-gray-900 dark:text-white">
{item.stat}
</dd>
</div>
))}
</div>
<div className="rounded-lg bg-white dark:bg-gray-950 border border-gray-200 dark:border-gray-800 shadow-sm">
<div className="p-6">
<h3 className="text-lg font-medium text-gray-900 dark:text-white">Son Aktiviteler</h3>
<div className="mt-4 border-t border-gray-100 dark:border-gray-800">
<div className="py-4 text-sm text-gray-500">
Henüz aktivite kaydı bulunmuyor.
</div>
</div>
</div>
</div>
</div>
)
}
+94 -92
View File
@@ -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 (
<div className="bg-background min-h-screen text-on-surface">
{/* Hero Section */}
<section className="relative h-[60vh] md:h-[70vh] w-full">
<Image
src={room.image}
alt={room.name}
fill
sizes="100vw"
className="object-cover"
priority
/>
{isExternalImage ? (
<img
src={image}
alt={name}
className="object-cover w-full h-full"
/>
) : (
<Image
src={image}
alt={name}
fill
loader={openinaryLoader}
sizes="100vw"
className="object-cover"
priority
/>
)}
<div className="absolute inset-0 bg-black/40" />
<div className="absolute inset-0 flex items-center justify-center">
<div className="text-center">
<h1 className="font-serif text-[48px] md:text-[64px] text-white font-bold drop-shadow-md">
{room.name}
{name}
</h1>
</div>
</div>
@@ -102,55 +88,71 @@ export default async function RoomDetailPage({ params }: { params: Promise<{ loc
</div>
<div className="flex items-center gap-2 bg-surface-container px-4 py-2 rounded-full text-secondary font-medium">
<Maximize className="w-5 h-5 text-primary" />
<span>{room.size}</span>
<span>{getRoomSize(room.type)}</span>
</div>
<div className="flex items-center gap-2 bg-surface-container px-4 py-2 rounded-full text-secondary font-medium">
<BedDouble className="w-5 h-5 text-primary" />
<span>{room.beds} Yatak</span>
<span>{getBeds(room.type, room.capacity)}</span>
</div>
</div>
{/* Description */}
<div className="prose prose-lg text-on-surface-variant">
<p className="text-[18px] leading-relaxed">
{room.description}
<p className="text-[18px] leading-relaxed whitespace-pre-wrap">
{description}
</p>
</div>
{/* Amenities */}
<div>
<h3 className="font-serif text-[28px] text-secondary font-semibold mb-6">
{tRooms('details.features')}
</h3>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
{room.amenities.map((amenity, index) => (
<div key={index} className="flex items-center gap-3">
<CheckCircle2 className="w-5 h-5 text-accent-green flex-shrink-0" />
<span className="text-on-surface-variant">{amenity}</span>
</div>
))}
{room.amenities.length > 0 && (
<div>
<h3 className="font-serif text-[28px] text-secondary font-semibold mb-6">
{tRooms('details.features')}
</h3>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
{room.amenities.map((amenity, index) => (
<div key={index} className="flex items-center gap-3">
<CheckCircle2 className="w-5 h-5 text-accent-green flex-shrink-0" />
<span className="text-on-surface-variant">{amenity}</span>
</div>
))}
</div>
</div>
</div>
)}
{/* Mini Gallery */}
<div>
<h3 className="font-serif text-[28px] text-secondary font-semibold mb-6">
{tRooms('details.gallery')}
</h3>
<div className="grid grid-cols-1 sm:grid-cols-3 gap-4">
{room.gallery.map((img, i) => (
<div key={i} className="relative aspect-square rounded-2xl overflow-hidden shadow-sm hover:shadow-md transition-shadow">
<Image
src={img}
alt={`${room.name} gallery ${i + 1}`}
fill
sizes="(max-width: 640px) 100vw, 33vw"
className="object-cover hover:scale-105 transition-transform duration-500"
/>
</div>
))}
{gallery.length > 0 && (
<div>
<h3 className="font-serif text-[28px] text-secondary font-semibold mb-6">
{tRooms('details.gallery')}
</h3>
<div className="grid grid-cols-1 sm:grid-cols-3 gap-4">
{gallery.map((img, i) => {
const isGalleryExternal = img.startsWith('http') && !img.includes('media.ayris.tech')
return (
<div key={i} className="relative aspect-square rounded-2xl overflow-hidden shadow-sm hover:shadow-md transition-shadow">
{isGalleryExternal ? (
<img
src={img}
alt={`${name} gallery ${i + 1}`}
className="object-cover w-full h-full hover:scale-105 transition-transform duration-500"
/>
) : (
<Image
src={img}
alt={`${name} gallery ${i + 1}`}
fill
loader={openinaryLoader}
sizes="(max-width: 640px) 100vw, 33vw"
className="object-cover hover:scale-105 transition-transform duration-500"
/>
)}
</div>
)
})}
</div>
</div>
</div>
)}
</div>
+73 -71
View File
@@ -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 (
<div className="flex-1 bg-gray-50 py-12 pt-32">
@@ -51,55 +35,73 @@ export default async function RoomsPage({ params }: { params: Promise<{ locale:
</div>
<div className="space-y-12 max-w-5xl mx-auto">
{MOCK_ROOMS.map((room) => (
<div key={room.slug} className="bg-white rounded-2xl overflow-hidden border shadow-sm flex flex-col md:flex-row group">
<div className="relative w-full md:w-2/5 h-64 md:h-auto bg-gray-100">
<Image
src={room.image}
alt={room.name}
fill
sizes="(max-width: 768px) 100vw, 40vw"
className="object-cover group-hover:scale-105 transition-transform duration-500"
/>
</div>
<div className="p-6 md:p-8 flex-1 flex flex-col">
<div className="flex justify-between items-start mb-4">
<h2 className="text-2xl font-bold text-gray-900">{room.name}</h2>
{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 (
<div key={room.id} className="bg-white rounded-2xl overflow-hidden border shadow-sm flex flex-col md:flex-row group">
<div className="relative w-full md:w-2/5 h-64 md:h-auto bg-gray-100">
{isExternal ? (
<img
src={image}
alt={name}
className="object-cover w-full h-full group-hover:scale-105 transition-transform duration-500"
/>
) : (
<Image
src={image}
alt={name}
fill
loader={openinaryLoader}
sizes="(max-width: 768px) 100vw, 40vw"
className="object-cover group-hover:scale-105 transition-transform duration-500"
/>
)}
</div>
<p className="text-gray-600 mb-6 flex-1">
{room.description}
</p>
<div className="p-6 md:p-8 flex-1 flex flex-col">
<div className="flex justify-between items-start mb-4">
<h2 className="text-2xl font-bold text-gray-900">{name}</h2>
</div>
<p className="text-gray-600 mb-6 flex-1 line-clamp-3">
{description}
</p>
<div className="flex flex-wrap gap-4 mb-8">
<div className="flex items-center gap-1.5 text-sm text-gray-500 font-medium">
<Users className="w-4 h-4 text-[#2FB6C4]" />
<span>{room.capacity} {tRooms('capacity')}</span>
<div className="flex flex-wrap gap-4 mb-8">
<div className="flex items-center gap-1.5 text-sm text-gray-500 font-medium">
<Users className="w-4 h-4 text-[#2FB6C4]" />
<span>{room.capacity} {tRooms('capacity')}</span>
</div>
<div className="flex items-center gap-1.5 text-sm text-gray-500 font-medium">
<Square className="w-4 h-4 text-[#2FB6C4]" />
<span>{getRoomSize(room.type)}</span>
</div>
<div className="flex items-center gap-1.5 text-sm text-gray-500 font-medium">
<Info className="w-4 h-4 text-[#2FB6C4]" />
<span>{room.amenities.length} {tRooms('amenities')}</span>
</div>
</div>
<div className="flex items-center gap-1.5 text-sm text-gray-500 font-medium">
<Square className="w-4 h-4 text-[#2FB6C4]" />
<span>{room.size}</span>
</div>
<div className="flex items-center gap-1.5 text-sm text-gray-500 font-medium">
<Info className="w-4 h-4 text-[#2FB6C4]" />
<span>{room.amenities.length} {tRooms('amenities')}</span>
</div>
</div>
<div className="flex items-center justify-between mt-auto border-t pt-6">
<div className="text-sm text-gray-500">
<span className="font-bold text-gray-900 text-lg">{tRooms('ask_price')}</span> {tRooms('per_night')}
<div className="flex items-center justify-between mt-auto border-t pt-6">
<div className="text-sm text-gray-500">
<span className="font-bold text-gray-900 text-lg">
{room.price ? `${room.price}` : tRooms('ask_price')}
</span> {room.price ? '' : tRooms('per_night')}
</div>
<Link
href={`/dairelerimiz/${room.slug}`}
className="px-6 py-2.5 bg-[#2FB6C4] hover:bg-[#2597a3] text-white rounded-md font-medium transition-colors duration-300 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-[#2FB6C4] focus-visible:ring-offset-2"
>
{tRooms('details_btn')}
</Link>
</div>
<Link
href={`/dairelerimiz/${room.slug}`}
className="px-6 py-2.5 bg-[#2FB6C4] hover:bg-[#2597a3] text-white rounded-md font-medium transition-colors duration-300 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-[#2FB6C4] focus-visible:ring-offset-2"
>
{tRooms('details_btn')}
</Link>
</div>
</div>
</div>
))}
)
})}
</div>
</div>
</div>
+24 -78
View File
@@ -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<string | null>(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 (
<div className="bg-background min-h-screen text-on-surface pt-32 pb-section-gap container mx-auto px-4">
@@ -84,27 +50,10 @@ export default function GalleryPage() {
</p>
</header>
{/* Filter Bar */}
<div className="flex flex-wrap items-center gap-4 mb-12">
{filters.map((filter) => (
<button
key={filter.id}
onClick={() => setActiveFilter(filter.id)}
className={`px-6 py-2 rounded-full font-sans font-bold text-[14px] uppercase tracking-wider transition-all duration-300 border-2 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-primary ${
activeFilter === filter.id
? 'border-primary text-primary bg-primary/10'
: 'border-transparent text-secondary hover:border-primary/30'
}`}
>
{filter.label}
</button>
))}
</div>
{/* Masonry-like Grid */}
<motion.div layout className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<AnimatePresence>
{filteredItems.map((item) => (
{galleryItems.map((item) => (
<motion.div
key={item.id}
layout
@@ -127,14 +76,10 @@ export default function GalleryPage() {
src={item.src}
alt={item.title}
fill
loader={openinaryLoader}
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
className="object-cover transform group-hover:scale-105 transition-transform duration-700"
/>
<div className="absolute inset-0 bg-black/20 opacity-0 group-hover:opacity-100 transition-opacity flex items-end p-6">
<span className="text-white font-serif text-[24px] font-medium drop-shadow-md">
{item.title}
</span>
</div>
</div>
</motion.div>
))}
@@ -169,6 +114,7 @@ export default function GalleryPage() {
src={selectedImage}
alt="Enlarged view"
fill
loader={openinaryLoader}
className="object-contain"
sizes="100vw"
quality={90}
+11 -1
View File
@@ -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() {
<p className="font-sans text-[16px] text-secondary font-medium">iletisim@sitarapart.com</p>
</div>
</div>
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center text-primary shrink-0">
<Clock className="w-5 h-5" />
</div>
<div>
<p className="font-sans font-bold text-[12px] text-on-surface-variant uppercase tracking-wider">{t('connect.check_in')}</p>
<p className="font-sans text-[16px] text-secondary font-medium">{t('connect.check_out')}</p>
</div>
</div>
</div>
{/* Decorative Image */}
+9 -7
View File
@@ -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() {
<header className="relative h-screen w-full flex items-center justify-center overflow-hidden">
<div className="absolute inset-0 z-0">
<Image
src="https://images.unsplash.com/photo-1582719508461-905c673771fd?auto=format&fit=crop&q=80"
src="https://media.ayris.tech/t/starapart/hero/media__1784311319733.jpg"
alt="Sitar Apart Hotel View"
fill
className="object-cover"
@@ -125,22 +126,22 @@ export default function HomePage() {
<div className="grid grid-cols-1 md:grid-cols-3 gap-gutter">
{[
{
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) => (
<motion.div
@@ -156,6 +157,7 @@ export default function HomePage() {
src={room.img}
alt={room.title}
fill
loader={openinaryLoader}
className="object-cover transition-transform duration-700 group-hover:scale-110"
/>
</div>
+122
View File
@@ -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 (
<header className="sticky top-0 z-40 flex h-16 w-full items-center justify-between border-b border-gray-200 dark:border-gray-800 bg-white/80 dark:bg-gray-950/80 px-4 backdrop-blur md:px-6">
{/* Mobile Menu */}
<div className="flex items-center md:hidden">
<Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger render={<Button variant="ghost" size="icon" className="-ml-2 mr-2" />}>
<Menu className="h-5 w-5" />
<span className="sr-only">Menüyü </span>
</SheetTrigger>
<SheetContent side="left" className="w-72">
<SheetHeader className="border-b pb-4 mb-4">
<SheetTitle className="text-left text-xl bg-clip-text text-transparent bg-gradient-to-r from-blue-600 to-indigo-600">
Sitar Admin
</SheetTitle>
</SheetHeader>
<nav className="flex flex-col space-y-1">
{ADMIN_NAVIGATION.map((item) => {
const isActive = pathname === item.href || (item.href !== '/admin' && pathname.startsWith(item.href))
return (
<Link
key={item.name}
href={item.href}
onClick={() => setOpen(false)}
className={`
flex items-center px-3 py-2.5 text-sm font-medium rounded-lg transition-colors
${isActive
? 'bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400'
: 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800'}
`}
>
<item.icon className={`mr-3 h-5 w-5 ${isActive ? 'text-blue-700 dark:text-blue-400' : 'text-gray-400'}`} />
{item.name}
</Link>
)
})}
</nav>
</SheetContent>
</Sheet>
<span className="text-lg font-bold text-gray-900 dark:text-white sm:hidden">Admin</span>
</div>
<div className="flex flex-1 items-center justify-end space-x-4">
{/* User Dropdown */}
<DropdownMenu>
<DropdownMenuTrigger render={<Button variant="ghost" className="relative h-9 w-9 rounded-full" />}>
<Avatar className="h-9 w-9 border border-gray-200 dark:border-gray-800">
<AvatarFallback className="bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-200">
{initials}
</AvatarFallback>
</Avatar>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-56" align="end">
<DropdownMenuGroup>
<DropdownMenuLabel className="font-normal">
<div className="flex flex-col space-y-1">
<p className="text-sm font-medium leading-none text-gray-900 dark:text-white">
{userName || 'Admin'}
</p>
<p className="text-xs leading-none text-gray-500 dark:text-gray-400">
{userEmail}
</p>
</div>
</DropdownMenuLabel>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem render={<Link href="/admin/settings" />}>
<Settings className="mr-2 h-4 w-4" />
<span>Ayarlar</span>
</DropdownMenuItem>
<DropdownMenuItem render={<Link href="/" target="_blank" />}>
<User className="mr-2 h-4 w-4" />
<span>Siteye Git</span>
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
className="text-red-600 dark:text-red-400 cursor-pointer focus:bg-red-50 dark:focus:bg-red-950/30 focus:text-red-600"
onClick={() => signOut({ callbackUrl: '/' })}
>
<LogOut className="mr-2 h-4 w-4" />
<span>Çıkış Yap</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</div>
</header>
)
}
+50
View File
@@ -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 (
<div className="hidden border-r border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-950 md:flex md:flex-col md:w-64 flex-shrink-0">
<div className="flex h-16 items-center border-b border-gray-200 dark:border-gray-800 px-6">
<h1 className="text-xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-blue-600 to-indigo-600 dark:from-blue-400 dark:to-indigo-400">
Sitar Admin
</h1>
</div>
<div className="flex-1 overflow-y-auto px-4 py-6">
<nav className="flex flex-col space-y-1">
{ADMIN_NAVIGATION.map((item) => {
const isActive = pathname === item.href || (item.href !== '/admin' && pathname.startsWith(item.href))
return (
<Link
key={item.name}
href={item.href}
className={`
group flex items-center px-3 py-2.5 text-sm font-medium rounded-lg transition-all duration-200
${isActive
? 'bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-400'
: 'text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-white'}
`}
>
<item.icon
className={`mr-3 h-5 w-5 flex-shrink-0 transition-colors duration-200 ${isActive ? 'text-blue-700 dark:text-blue-400' : 'text-gray-400 group-hover:text-gray-600 dark:group-hover:text-gray-300'}`}
/>
{item.name}
</Link>
)
})}
</nav>
</div>
</div>
)
}
+249
View File
@@ -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<File[]>([])
const [previews, setPreviews] = useState<string[]>([])
const [isUploading, setIsUploading] = useState(false)
const [progress, setProgress] = useState(0) // 0 to total files
const [error, setError] = useState<string | null>(null)
const fileInputRef = useRef<HTMLInputElement>(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<HTMLInputElement>) => {
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 (
<Dialog open={open} onOpenChange={handleOpenChange}>
<DialogTrigger render={
<Button type="button" variant="outline" className="w-full h-24 border-dashed flex flex-col items-center justify-center gap-2">
<ImagePlus className="h-6 w-6 text-gray-500" />
<span className="text-gray-500">{triggerText}</span>
</Button>
} />
<DialogContent className="sm:max-w-[600px]">
<DialogHeader>
<DialogTitle>Resim Yükle</DialogTitle>
<DialogDescription>
{multiple ? "Birden fazla resim seçip yükleyebilirsiniz." : "Odanın ana görselini seçin."}
</DialogDescription>
</DialogHeader>
<div className="py-4 space-y-4">
{!isUploading && (
<div className="flex justify-center">
<input
type="file"
accept="image/*"
multiple={multiple}
className="hidden"
ref={fileInputRef}
onChange={handleFileChange}
/>
<Button type="button" variant="secondary" onClick={() => fileInputRef.current?.click()}>
Bilgisayardan Seç
</Button>
</div>
)}
{error && (
<div className="bg-red-50 text-red-600 p-3 rounded-md text-sm flex items-start gap-2">
<AlertCircle className="h-5 w-5 shrink-0" />
<span>{error}</span>
</div>
)}
{previews.length > 0 && (
<div className="bg-gray-50 dark:bg-gray-900 p-4 rounded-lg border">
<h4 className="text-sm font-medium mb-3">Seçilen Resimler ({selectedFiles.length})</h4>
<div className="grid grid-cols-3 sm:grid-cols-4 gap-4 max-h-[300px] overflow-y-auto p-1">
{previews.map((preview, idx) => (
<div key={idx} className="relative group aspect-square rounded-md border bg-white overflow-hidden">
<img src={preview} alt="preview" className="w-full h-full object-cover" />
{!isUploading && (
<button
type="button"
onClick={() => removeFile(idx)}
className="absolute top-1 right-1 bg-red-500 text-white rounded-full p-1 shadow-sm opacity-0 group-hover:opacity-100 transition-opacity"
>
<X className="h-4 w-4" />
</button>
)}
{isUploading && idx < progress && (
<div className="absolute inset-0 bg-white/70 flex items-center justify-center">
<CheckCircle2 className="h-8 w-8 text-green-500" />
</div>
)}
{isUploading && idx === progress && (
<div className="absolute inset-0 bg-white/50 flex items-center justify-center">
<Loader2 className="h-8 w-8 text-blue-500 animate-spin" />
</div>
)}
</div>
))}
</div>
</div>
)}
{isUploading && (
<div className="space-y-2">
<div className="flex justify-between text-sm font-medium text-gray-500">
<span>Yükleniyor...</span>
<span>{progress} / {selectedFiles.length}</span>
</div>
<div className="h-2 w-full bg-gray-100 rounded-full overflow-hidden">
<div
className="h-full bg-blue-600 transition-all duration-300 ease-in-out"
style={{ width: `${(progress / selectedFiles.length) * 100}%` }}
/>
</div>
</div>
)}
</div>
<DialogFooter>
<Button
type="button"
variant="outline"
onClick={() => handleOpenChange(false)}
disabled={isUploading}
>
İptal
</Button>
<Button
type="button"
onClick={handleUpload}
disabled={isUploading || selectedFiles.length === 0}
className="min-w-[120px]"
>
{isUploading ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Yükleniyor...
</>
) : (
<>
<UploadCloud className="mr-2 h-4 w-4" />
Yüklemeyi Başlat
</>
)}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
)
}
+253
View File
@@ -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<string | null>(null)
const [formData, setFormData] = useState<RoomInput>(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 (
<form onSubmit={handleSubmit} className="space-y-6 max-w-4xl bg-white dark:bg-gray-950 p-6 rounded-lg border border-gray-200 dark:border-gray-800">
{error && (
<div className="bg-red-50 text-red-600 p-3 rounded-md text-sm">
{error}
</div>
)}
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="space-y-2">
<label className="text-sm font-medium">Oda Tipi</label>
<select
value={formData.type}
onChange={(e) => setFormData(prev => ({ ...prev, type: e.target.value as any }))}
className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
>
<option value="STUDIO_1_0">Stüdyo (1+0)</option>
<option value="SUITE_1_1">Süit (1+1)</option>
</select>
</div>
<div className="space-y-2">
<label className="text-sm font-medium">Slug (URL)</label>
<Input
required
value={formData.slug}
onChange={(e) => setFormData(prev => ({ ...prev, slug: e.target.value }))}
placeholder="ornek-oda-1"
/>
</div>
<div className="space-y-2">
<label className="text-sm font-medium">Ad (TR)</label>
<Input required value={formData.nameTr} onChange={(e) => setFormData(prev => ({ ...prev, nameTr: e.target.value }))} />
</div>
<div className="space-y-2">
<label className="text-sm font-medium">Ad (EN)</label>
<Input required value={formData.nameEn} onChange={(e) => setFormData(prev => ({ ...prev, nameEn: e.target.value }))} />
</div>
<div className="space-y-2">
<label className="text-sm font-medium">Ad (DE)</label>
<Input required value={formData.nameDe} onChange={(e) => setFormData(prev => ({ ...prev, nameDe: e.target.value }))} />
</div>
<div className="space-y-2">
<label className="text-sm font-medium">Kapasite</label>
<Input type="number" required value={formData.capacity} onChange={(e) => setFormData(prev => ({ ...prev, capacity: parseInt(e.target.value) || 0 }))} />
</div>
<div className="space-y-2">
<label className="text-sm font-medium">Fiyat (Opsiyonel)</label>
<Input type="number" value={formData.price || ''} onChange={(e) => setFormData(prev => ({ ...prev, price: e.target.value ? parseInt(e.target.value) : null }))} />
</div>
<div className="space-y-2 md:col-span-2">
<label className="text-sm font-medium">Açıklama (TR)</label>
<textarea
required
className="flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
value={formData.descriptionTr}
onChange={(e) => setFormData(prev => ({ ...prev, descriptionTr: e.target.value }))}
/>
</div>
<div className="space-y-2 md:col-span-2">
<label className="text-sm font-medium">Açıklama (EN)</label>
<textarea
required
className="flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
value={formData.descriptionEn}
onChange={(e) => setFormData(prev => ({ ...prev, descriptionEn: e.target.value }))}
/>
</div>
<div className="space-y-2 md:col-span-2">
<label className="text-sm font-medium">Açıklama (DE)</label>
<textarea
required
className="flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
value={formData.descriptionDe}
onChange={(e) => setFormData(prev => ({ ...prev, descriptionDe: e.target.value }))}
/>
</div>
<div className="space-y-2 md:col-span-2">
<label className="text-sm font-medium">Ana Resim</label>
<ImageUploadModal
onUploadComplete={handleMainImageComplete}
multiple={false}
triggerText="Ana Resmi Yükle"
folderName={`starapart/${formData.type}`}
/>
{formData.imageUrl && (
<div className="mt-2">
<img src={formData.imageUrl} alt="Ana Resim" className="h-32 object-cover rounded-md border" />
<Input className="mt-2" value={formData.imageUrl} onChange={(e) => setFormData(prev => ({ ...prev, imageUrl: e.target.value }))} placeholder="Veya doğrudan URL girin..." />
</div>
)}
</div>
<div className="space-y-2 md:col-span-2">
<label className="text-sm font-medium">Galeri (Diğer Resimler)</label>
<ImageUploadModal
onUploadComplete={handleGalleryComplete}
multiple={true}
triggerText="Galeri İçin Çoklu Resim Yükle"
folderName={`starapart/${formData.type}`}
/>
{formData.images.length > 0 && (
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mt-4">
{formData.images.map((url, idx) => (
<div key={idx} className="relative group">
<img src={url} alt={`Gallery ${idx}`} className="h-24 w-full object-cover rounded-md border" />
<button
type="button"
onClick={() => removeGalleryImage(idx)}
className="absolute top-1 right-1 bg-red-500 text-white rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity"
>
×
</button>
</div>
))}
</div>
)}
<Input
className="mt-2"
value={formData.images.join(', ')}
onChange={(e) => handleArrayChange('images', e.target.value)}
placeholder="Veya virgülle ayırarak URL'leri girin..."
/>
</div>
<div className="space-y-2 md:col-span-2">
<label className="text-sm font-medium">Özellikler (Amenities - Virgülle ayırın)</label>
<Input value={formData.amenities.join(', ')} onChange={(e) => handleArrayChange('amenities', e.target.value)} placeholder="Wifi, TV, Klima..." />
</div>
<div className="space-y-2 flex items-center space-x-2">
<input
type="checkbox"
id="available"
checked={formData.available}
onChange={(e) => setFormData(prev => ({ ...prev, available: e.target.checked }))}
className="h-4 w-4 rounded border-gray-300"
/>
<label htmlFor="available" className="text-sm font-medium cursor-pointer">Müsait mi?</label>
</div>
<div className="space-y-2 flex items-center space-x-2">
<input
type="checkbox"
id="featured"
checked={formData.featured}
onChange={(e) => setFormData(prev => ({ ...prev, featured: e.target.checked }))}
className="h-4 w-4 rounded border-gray-300"
/>
<label htmlFor="featured" className="text-sm font-medium cursor-pointer">Öne Çıkan (Anasayfada göster)</label>
</div>
</div>
<div className="flex justify-end space-x-4 pt-4 border-t border-gray-200 dark:border-gray-800">
<Button type="button" variant="outline" onClick={() => router.push('/admin/rooms')} disabled={loading}>İptal</Button>
<Button type="submit" disabled={loading}>
{loading ? 'Kaydediliyor...' : 'Kaydet'}
</Button>
</div>
</form>
)
}
+109
View File
@@ -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 (
<AvatarPrimitive.Root
data-slot="avatar"
data-size={size}
className={cn(
"group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",
className
)}
{...props}
/>
)
}
function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {
return (
<AvatarPrimitive.Image
data-slot="avatar-image"
className={cn(
"aspect-square size-full rounded-full object-cover",
className
)}
{...props}
/>
)
}
function AvatarFallback({
className,
...props
}: AvatarPrimitive.Fallback.Props) {
return (
<AvatarPrimitive.Fallback
data-slot="avatar-fallback"
className={cn(
"flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",
className
)}
{...props}
/>
)
}
function AvatarBadge({ className, ...props }: React.ComponentProps<"span">) {
return (
<span
data-slot="avatar-badge"
className={cn(
"absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none",
"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>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 (
<div
data-slot="avatar-group"
className={cn(
"group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background",
className
)}
{...props}
/>
)
}
function AvatarGroupCount({
className,
...props
}: React.ComponentProps<"div">) {
return (
<div
data-slot="avatar-group-count"
className={cn(
"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>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,
}
+52
View File
@@ -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<typeof badgeVariants>) {
return useRender({
defaultTagName: "span",
props: mergeProps<"span">(
{
className: cn(badgeVariants({ variant }), className),
},
props
),
render,
state: {
slot: "badge",
variant,
},
})
}
export { Badge, badgeVariants }
+160
View File
@@ -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 <DialogPrimitive.Root data-slot="dialog" {...props} />
}
function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
}
function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
}
function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
}
function DialogOverlay({
className,
...props
}: DialogPrimitive.Backdrop.Props) {
return (
<DialogPrimitive.Backdrop
data-slot="dialog-overlay"
className={cn(
"fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
className
)}
{...props}
/>
)
}
function DialogContent({
className,
children,
showCloseButton = true,
...props
}: DialogPrimitive.Popup.Props & {
showCloseButton?: boolean
}) {
return (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Popup
data-slot="dialog-content"
className={cn(
"fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
className
)}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close
data-slot="dialog-close"
render={
<Button
variant="ghost"
className="absolute top-2 right-2"
size="icon-sm"
/>
}
>
<XIcon
/>
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Popup>
</DialogPortal>
)
}
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="dialog-header"
className={cn("flex flex-col gap-2", className)}
{...props}
/>
)
}
function DialogFooter({
className,
showCloseButton = false,
children,
...props
}: React.ComponentProps<"div"> & {
showCloseButton?: boolean
}) {
return (
<div
data-slot="dialog-footer"
className={cn(
"-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",
className
)}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close render={<Button variant="outline" />}>
Close
</DialogPrimitive.Close>
)}
</div>
)
}
function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
return (
<DialogPrimitive.Title
data-slot="dialog-title"
className={cn(
"font-heading text-base leading-none font-medium",
className
)}
{...props}
/>
)
}
function DialogDescription({
className,
...props
}: DialogPrimitive.Description.Props) {
return (
<DialogPrimitive.Description
data-slot="dialog-description"
className={cn(
"text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
className
)}
{...props}
/>
)
}
export {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogOverlay,
DialogPortal,
DialogTitle,
DialogTrigger,
}
+268
View File
@@ -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 <MenuPrimitive.Root data-slot="dropdown-menu" {...props} />
}
function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props) {
return <MenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
}
function DropdownMenuTrigger({ ...props }: MenuPrimitive.Trigger.Props) {
return <MenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />
}
function DropdownMenuContent({
align = "start",
alignOffset = 0,
side = "bottom",
sideOffset = 4,
className,
...props
}: MenuPrimitive.Popup.Props &
Pick<
MenuPrimitive.Positioner.Props,
"align" | "alignOffset" | "side" | "sideOffset"
>) {
return (
<MenuPrimitive.Portal>
<MenuPrimitive.Positioner
className="isolate z-50 outline-none"
align={align}
alignOffset={alignOffset}
side={side}
sideOffset={sideOffset}
>
<MenuPrimitive.Popup
data-slot="dropdown-menu-content"
className={cn("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95", className )}
{...props}
/>
</MenuPrimitive.Positioner>
</MenuPrimitive.Portal>
)
}
function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props) {
return <MenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
}
function DropdownMenuLabel({
className,
inset,
...props
}: MenuPrimitive.GroupLabel.Props & {
inset?: boolean
}) {
return (
<MenuPrimitive.GroupLabel
data-slot="dropdown-menu-label"
data-inset={inset}
className={cn(
"px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",
className
)}
{...props}
/>
)
}
function DropdownMenuItem({
className,
inset,
variant = "default",
...props
}: MenuPrimitive.Item.Props & {
inset?: boolean
variant?: "default" | "destructive"
}) {
return (
<MenuPrimitive.Item
data-slot="dropdown-menu-item"
data-inset={inset}
data-variant={variant}
className={cn(
"group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
className
)}
{...props}
/>
)
}
function DropdownMenuSub({ ...props }: MenuPrimitive.SubmenuRoot.Props) {
return <MenuPrimitive.SubmenuRoot data-slot="dropdown-menu-sub" {...props} />
}
function DropdownMenuSubTrigger({
className,
inset,
children,
...props
}: MenuPrimitive.SubmenuTrigger.Props & {
inset?: boolean
}) {
return (
<MenuPrimitive.SubmenuTrigger
data-slot="dropdown-menu-sub-trigger"
data-inset={inset}
className={cn(
"flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
{...props}
>
{children}
<ChevronRightIcon className="ml-auto" />
</MenuPrimitive.SubmenuTrigger>
)
}
function DropdownMenuSubContent({
align = "start",
alignOffset = -3,
side = "right",
sideOffset = 0,
className,
...props
}: React.ComponentProps<typeof DropdownMenuContent>) {
return (
<DropdownMenuContent
data-slot="dropdown-menu-sub-content"
className={cn("w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className )}
align={align}
alignOffset={alignOffset}
side={side}
sideOffset={sideOffset}
{...props}
/>
)
}
function DropdownMenuCheckboxItem({
className,
children,
checked,
inset,
...props
}: MenuPrimitive.CheckboxItem.Props & {
inset?: boolean
}) {
return (
<MenuPrimitive.CheckboxItem
data-slot="dropdown-menu-checkbox-item"
data-inset={inset}
className={cn(
"relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
checked={checked}
{...props}
>
<span
className="pointer-events-none absolute right-2 flex items-center justify-center"
data-slot="dropdown-menu-checkbox-item-indicator"
>
<MenuPrimitive.CheckboxItemIndicator>
<CheckIcon
/>
</MenuPrimitive.CheckboxItemIndicator>
</span>
{children}
</MenuPrimitive.CheckboxItem>
)
}
function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {
return (
<MenuPrimitive.RadioGroup
data-slot="dropdown-menu-radio-group"
{...props}
/>
)
}
function DropdownMenuRadioItem({
className,
children,
inset,
...props
}: MenuPrimitive.RadioItem.Props & {
inset?: boolean
}) {
return (
<MenuPrimitive.RadioItem
data-slot="dropdown-menu-radio-item"
data-inset={inset}
className={cn(
"relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
{...props}
>
<span
className="pointer-events-none absolute right-2 flex items-center justify-center"
data-slot="dropdown-menu-radio-item-indicator"
>
<MenuPrimitive.RadioItemIndicator>
<CheckIcon
/>
</MenuPrimitive.RadioItemIndicator>
</span>
{children}
</MenuPrimitive.RadioItem>
)
}
function DropdownMenuSeparator({
className,
...props
}: MenuPrimitive.Separator.Props) {
return (
<MenuPrimitive.Separator
data-slot="dropdown-menu-separator"
className={cn("-mx-1 my-1 h-px bg-border", className)}
{...props}
/>
)
}
function DropdownMenuShortcut({
className,
...props
}: React.ComponentProps<"span">) {
return (
<span
data-slot="dropdown-menu-shortcut"
className={cn(
"ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground",
className
)}
{...props}
/>
)
}
export {
DropdownMenu,
DropdownMenuPortal,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuLabel,
DropdownMenuItem,
DropdownMenuCheckboxItem,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuSub,
DropdownMenuSubTrigger,
DropdownMenuSubContent,
}
+138
View File
@@ -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 <SheetPrimitive.Root data-slot="sheet" {...props} />
}
function SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
}
function SheetClose({ ...props }: SheetPrimitive.Close.Props) {
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
}
function SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
}
function SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {
return (
<SheetPrimitive.Backdrop
data-slot="sheet-overlay"
className={cn(
"fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",
className
)}
{...props}
/>
)
}
function SheetContent({
className,
children,
side = "right",
showCloseButton = true,
...props
}: SheetPrimitive.Popup.Props & {
side?: "top" | "right" | "bottom" | "left"
showCloseButton?: boolean
}) {
return (
<SheetPortal>
<SheetOverlay />
<SheetPrimitive.Popup
data-slot="sheet-content"
data-side={side}
className={cn(
"fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",
className
)}
{...props}
>
{children}
{showCloseButton && (
<SheetPrimitive.Close
data-slot="sheet-close"
render={
<Button
variant="ghost"
className="absolute top-3 right-3"
size="icon-sm"
/>
}
>
<XIcon
/>
<span className="sr-only">Close</span>
</SheetPrimitive.Close>
)}
</SheetPrimitive.Popup>
</SheetPortal>
)
}
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="sheet-header"
className={cn("flex flex-col gap-0.5 p-4", className)}
{...props}
/>
)
}
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="sheet-footer"
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
{...props}
/>
)
}
function SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {
return (
<SheetPrimitive.Title
data-slot="sheet-title"
className={cn(
"font-heading text-base font-medium text-foreground",
className
)}
{...props}
/>
)
}
function SheetDescription({
className,
...props
}: SheetPrimitive.Description.Props) {
return (
<SheetPrimitive.Description
data-slot="sheet-description"
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
)
}
export {
Sheet,
SheetTrigger,
SheetClose,
SheetContent,
SheetHeader,
SheetFooter,
SheetTitle,
SheetDescription,
}
+116
View File
@@ -0,0 +1,116 @@
"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
function Table({ className, ...props }: React.ComponentProps<"table">) {
return (
<div
data-slot="table-container"
className="relative w-full overflow-x-auto"
>
<table
data-slot="table"
className={cn("w-full caption-bottom text-sm", className)}
{...props}
/>
</div>
)
}
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
return (
<thead
data-slot="table-header"
className={cn("[&_tr]:border-b", className)}
{...props}
/>
)
}
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
return (
<tbody
data-slot="table-body"
className={cn("[&_tr:last-child]:border-0", className)}
{...props}
/>
)
}
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
return (
<tfoot
data-slot="table-footer"
className={cn(
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
className
)}
{...props}
/>
)
}
function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
return (
<tr
data-slot="table-row"
className={cn(
"border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",
className
)}
{...props}
/>
)
}
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
return (
<th
data-slot="table-head"
className={cn(
"h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
className
)}
{...props}
/>
)
}
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
return (
<td
data-slot="table-cell"
className={cn(
"p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
className
)}
{...props}
/>
)
}
function TableCaption({
className,
...props
}: React.ComponentProps<"caption">) {
return (
<caption
data-slot="table-caption"
className={cn("mt-4 text-sm text-muted-foreground", className)}
{...props}
/>
)
}
export {
Table,
TableHeader,
TableBody,
TableFooter,
TableHead,
TableRow,
TableCell,
TableCaption,
}
+48
View File
@@ -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)
+75
View File
@@ -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.' }
}
}
+23
View File
@@ -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 }
}
}
+7 -1
View File
@@ -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
+8 -1
View File
@@ -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}`
}
+11
View File
@@ -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
+18 -16
View File
@@ -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": {
+17 -15
View File
@@ -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"
}
},
+17 -15
View File
@@ -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"
}
},
+7
View File
@@ -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)
+255 -4
View File
@@ -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",
+4
View File
@@ -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",
+133
View File
@@ -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<string | null>(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 (
<div className="bg-background min-h-screen text-on-surface pt-32 pb-section-gap container mx-auto px-4">
{/* Header Section */}
<header className="relative mb-16 max-w-2xl">
<div className="absolute -top-6 -left-4 opacity-80 -rotate-6 pointer-events-none text-accent-pink">
<BougainvilleaMotif className="w-16 h-16" />
</div>
<h1 className="font-serif text-[40px] md:text-[48px] font-semibold text-secondary mb-4 relative z-10">
{t('title')}
</h1>
<p className="font-sans text-[18px] text-on-surface-variant max-w-xl">
{t('description')}
</p>
</header>
{/* Masonry-like Grid */}
<motion.div layout className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<AnimatePresence>
{galleryItems.map((item) => (
<motion.div
key={item.id}
layout
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.9 }}
transition={{ duration: 0.4 }}
className={\`group cursor-pointer focus:outline-none focus-visible:ring-4 focus-visible:ring-primary rounded-[24px] \${item.colSpan}\`}
onClick={() => setSelectedImage(item.src)}
tabIndex={0}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
setSelectedImage(item.src);
}
}}
>
<div className="relative overflow-hidden rounded-[24px] bg-surface-container shadow-sm hover:shadow-xl transition-all duration-500 aspect-[4/3] md:aspect-auto md:h-80">
<Image
src={item.src}
alt={item.title}
fill
loader={openinaryLoader}
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
className="object-cover transform group-hover:scale-105 transition-transform duration-700"
/>
</div>
</motion.div>
))}
</AnimatePresence>
</motion.div>
{/* Lightbox Overlay */}
<AnimatePresence>
{selectedImage && (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4 md:p-8 backdrop-blur-sm"
onClick={() => setSelectedImage(null)}
>
<button
aria-label="Close lightbox"
className="absolute top-6 right-6 text-white/70 hover:text-white transition-colors duration-300 z-50 p-2 bg-black/20 rounded-full cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-white"
onClick={() => setSelectedImage(null)}
>
<X className="w-8 h-8" />
</button>
<motion.div
initial={{ scale: 0.9, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
exit={{ scale: 0.9, opacity: 0 }}
className="relative w-full max-w-5xl h-[80vh] bg-transparent rounded-lg overflow-hidden"
onClick={(e) => e.stopPropagation()}
>
<Image
src={selectedImage}
alt="Enlarged view"
fill
loader={openinaryLoader}
className="object-contain"
sizes="100vw"
quality={90}
/>
</motion.div>
</motion.div>
)}
</AnimatePresence>
</div>
)
}
`
fs.writeFileSync('app/[locale]/galeri/page.tsx', content)
+4
View File
@@ -1,4 +1,8 @@
import 'dotenv/config'
import { defineConfig } from '@prisma/config'
export default defineConfig({
datasource: {
url: process.env.DATABASE_URL
}
})
+11 -4
View File
@@ -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|.*\\..*).*)']
+9
View File
@@ -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();
+8
View File
@@ -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();
+100
View File
@@ -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)
+66
View File
@@ -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)
+45
View File
@@ -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)