import { createClient } from "@/lib/supabase-server" import { ContentForm } from "@/components/dashboard/content-form" import { SiteContent } from "@/types/cms" export default async function ContentPage() { const supabase = await createClient() const { data: contents } = await supabase .from('site_contents') .select('*') .order('key') // Define default contents that should exist const DEFAULT_CONTENTS: SiteContent[] = [ // General { key: 'site_title', value: 'ParaKasa', type: 'text', section: 'general' }, { key: 'site_description', value: '', type: 'long_text', section: 'general' }, { key: 'site_logo', value: '', type: 'image_url', section: 'general' }, // Contact { key: 'contact_phone', value: '', type: 'text', section: 'contact' }, { key: 'contact_email', value: '', type: 'text', section: 'contact' }, { key: 'contact_address', value: '', type: 'long_text', section: 'contact' }, { key: 'social_instagram', value: '', type: 'text', section: 'contact' }, { key: 'social_youtube', value: '', type: 'text', section: 'contact' }, { key: 'social_tiktok', 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 (
Site başlığı, sloganlar, iletişim bilgileri ve logoları buradan yönetebilirsiniz.