feat: add social media fields to cms, improve gallery video thumbnails and add navigation buttons

This commit is contained in:
2025-12-10 00:31:32 +03:00
parent b905ec0750
commit dfb9303a67
4 changed files with 64 additions and 10 deletions

View File

@@ -10,9 +10,23 @@ export default async function ContentPage() {
.select('*')
.order('key')
// CMS migration script creates default keys.
// If table is empty, we might want to seed it or just show empty.
// Assuming migration ran, we have data.
// Define default contents that should exist
const DEFAULT_CONTENTS: SiteContent[] = [
{ key: 'social_instagram', value: '', type: 'text', section: 'contact' },
{ key: 'social_facebook', value: '', type: 'text', section: 'contact' },
{ key: 'social_twitter', value: '', type: 'text', section: 'contact' },
{ key: 'contact_map_embed', value: '', type: 'html', section: 'contact' },
]
// Merge default contents with existing contents
const mergedContents = [...(contents as SiteContent[] || [])]
const existingKeys = new Set(mergedContents.map(c => c.key))
DEFAULT_CONTENTS.forEach(item => {
if (!existingKeys.has(item.key)) {
mergedContents.push(item)
}
})
return (
<div className="space-y-6">
@@ -22,7 +36,7 @@ export default async function ContentPage() {
Site başlığı, sloganlar, iletişim bilgileri ve logoları buradan yönetebilirsiniz.
</p>
</div>
<ContentForm initialContent={(contents as SiteContent[]) || []} />
<ContentForm initialContent={mergedContents} />
</div>
)
}

View File

@@ -3,6 +3,7 @@ import { UserNav } from "@/components/user-nav"
import { Building } from "lucide-react"
import { MobileSidebar } from "@/components/mobile-sidebar"
import { createClient } from "@/lib/supabase/server"
import { NavigationButtons } from "@/components/navigation-buttons"
export default async function DashboardLayout({
children,
@@ -28,6 +29,7 @@ export default async function DashboardLayout({
<div className="flex-1 md:ml-72 flex flex-col min-h-screen">
{/* Header */}
<header className="sticky top-0 z-40 h-16 glass border-b px-4 md:px-6 flex items-center justify-between">
<div className="flex items-center gap-4">
<div className="flex items-center gap-2 md:hidden">
<MobileSidebar user={userData} />
<div className="flex items-center font-bold text-lg">
@@ -35,6 +37,8 @@ export default async function DashboardLayout({
WeddingOS
</div>
</div>
<NavigationButtons />
</div>
<div className="ml-auto flex items-center space-x-4">
<UserNav />

View File

@@ -0,0 +1,32 @@
"use client"
import { Button } from "@/components/ui/button"
import { ChevronLeft, ChevronRight } from "lucide-react"
import { useRouter } from "next/navigation"
export function NavigationButtons() {
const router = useRouter()
return (
<div className="flex items-center gap-1 h-8">
<Button
variant="ghost"
size="icon"
className="h-8 w-8 text-muted-foreground hover:text-primary"
onClick={() => router.back()}
title="Geri"
>
<ChevronLeft className="h-5 w-5" />
</Button>
<Button
variant="ghost"
size="icon"
className="h-8 w-8 text-muted-foreground hover:text-primary"
onClick={() => router.forward()}
title="İleri"
>
<ChevronRight className="h-5 w-5" />
</Button>
</div>
)
}

View File

@@ -51,7 +51,7 @@ export function GalleryGrid({ items }: GalleryGridProps) {
}
}}
>
{displayImage && (
{displayImage ? (
<Image
src={displayImage}
alt={item.caption || 'Gallery Image'}
@@ -59,6 +59,10 @@ export function GalleryGrid({ items }: GalleryGridProps) {
className="object-cover transition-transform duration-700 group-hover:scale-110"
sizes="(max-width: 768px) 50vw, 25vw"
/>
) : (
<div className="w-full h-full bg-slate-800 flex items-center justify-center bg-gradient-to-br from-slate-800 to-slate-900 group-hover:from-slate-700 group-hover:to-slate-800 transition-colors">
{/* Fallback for video without generic thumbnail */}
</div>
)}
<div className="absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-col items-center justify-center space-y-2">
{item.video_url && (