import { createClient } from "@/lib/supabase-server" import { SettingsTabs } from "@/components/dashboard/settings-tabs" import { getSmsSettings } from "@/lib/sms/actions" import { SiteContent } from "@/types/cms" export default async function SettingsPage() { const supabase = createClient() // Fetch SMS settings const smsResponse = await getSmsSettings() const smsSettings = smsResponse.data || null // Fetch Users (Profiles) const { data: profiles } = await supabase .from("profiles") .select("*") .order("created_at", { ascending: false }) // Fetch Site Contents (CMS) const { data: contents } = await supabase .from('site_contents') .select('*') .order('key') // Define default contents for CMS 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' }, { key: 'favicon_url', value: '', type: 'image_url', section: 'general' }, // Home { key: 'home_hero_title', value: 'GÜVENLİK SINIR
TANIMAZ', type: 'html', section: 'home' }, { key: 'home_hero_description', value: 'En değerli varlıklarınız için tasarlanmış yüksek güvenlikli çelik kasalar. Modern teknoloji ve zanaatkarlığın mükemmel uyumu.', type: 'long_text', section: 'home' }, { key: 'home_hero_button_text', value: 'Koleksiyonu İncele', type: 'text', section: 'home' }, { key: 'home_hero_bg_image', value: '/images/hero-safe.png', type: 'image_url', section: 'home' }, { key: 'home_categories_title', value: 'Ürün Kategorileri', type: 'text', section: 'home' }, { key: 'home_categories_description', value: 'İhtiyacınıza uygun güvenlik çözümünü seçin.', type: 'text', section: 'home' }, // 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' }, // SEO { key: 'meta_keywords', value: '', type: 'text', section: 'seo' }, { key: 'meta_author', value: '', type: 'text', section: 'seo' }, // Scripts & Analytics { key: 'google_analytics_id', value: '', type: 'text', section: 'scripts' }, { key: 'facebook_pixel_id', value: '', type: 'text', section: 'scripts' }, ] // 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 (

Ayarlar

) }