Add comprehensive page management system to admin dashboard

Features added:
- Database schema for pages and media files with content types (Rich Text, HTML, Markdown)
- Admin API routes for full page CRUD operations
- Image upload functionality with file management
- Rich text editor using TinyMCE with image insertion
- Admin interface for creating/editing pages with SEO options
- Dynamic navigation and footer integration
- Public page display routes with proper SEO metadata
- Support for featured images and content excerpts

Admin features:
- Create/edit/delete pages with rich content editor
- Upload and manage images through media library
- Configure pages to appear in navigation or footer
- Set page status (Draft, Published, Archived)
- SEO title and description management
- Real-time preview of content changes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-24 07:26:25 +00:00
parent f81886a851
commit 95070e5369
53 changed files with 3628 additions and 206 deletions

View File

@@ -1,5 +1,5 @@
'use client'
import React, { useState } from 'react'
import React, { useState, useEffect } from 'react'
import {
AppBar,
Box,
@@ -38,10 +38,19 @@ import { useTranslations, useLocale } from 'next-intl'
import { LanguageSwitcher } from './language-switcher'
import { useAuth } from '@/hooks/use-auth'
interface DynamicPage {
id: string
title: string
slug: string
showInNavigation: boolean
navigationOrder?: number
}
export function Navigation() {
const [anchorElNav, setAnchorElNav] = useState<null | HTMLElement>(null)
const [anchorElUser, setAnchorElUser] = useState<null | HTMLElement>(null)
const [drawerOpen, setDrawerOpen] = useState(false)
const [dynamicPages, setDynamicPages] = useState<DynamicPage[]>([])
const router = useRouter()
const theme = useTheme()
const isMobile = useMediaQuery(theme.breakpoints.down('md'))
@@ -49,13 +58,37 @@ export function Navigation() {
const locale = useLocale()
const { user, isAuthenticated, logout } = useAuth()
const pages = [
useEffect(() => {
fetchDynamicPages()
}, [])
const fetchDynamicPages = async () => {
try {
const response = await fetch('/api/pages?location=navigation')
if (response.ok) {
const data = await response.json()
setDynamicPages(data.data || [])
}
} catch (error) {
console.error('Failed to fetch dynamic pages:', error)
}
}
const basePages = [
{ name: t('home'), path: '/', icon: <Home /> },
{ name: t('bible'), path: '/bible', icon: <MenuBook /> },
{ name: t('prayers'), path: '/prayers', icon: <Prayer /> },
{ name: t('search'), path: '/search', icon: <Search /> },
]
const dynamicNavPages = dynamicPages.map(page => ({
name: page.title,
path: `/pages/${page.slug}`,
icon: null
}))
const pages = [...basePages, ...dynamicNavPages]
const authenticatedPages = [
...pages,
{ name: t('bookmarks'), path: '/bookmarks', icon: <Bookmark /> },