Fix Next.js 15 compatibility and TypeScript errors

- Update API route handlers to use async params for Next.js 15 compatibility
- Fix MUI DataGrid deprecated props (pageSize -> initialState.pagination)
- Replace Material-UI Grid components with Box for better compatibility
- Fix admin authentication system with proper request parameters
- Update permission constants to match available AdminPermission enum values
- Add missing properties to Page interface for type safety
- Update .gitignore to exclude venv/, import logs, and large data directories
- Optimize Next.js config to reduce memory usage during builds

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-24 09:54:13 +00:00
parent b0dd6c1a4b
commit 4303e48fac
25 changed files with 269 additions and 91 deletions

View File

@@ -231,16 +231,16 @@ export function ImageUpload({ open, onClose, onImageSelect }: ImageUploadProps)
{loadingMedia ? (
<Typography>Loading media files...</Typography>
) : (
<Grid container spacing={2}>
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 2 }}>
{mediaFiles.length === 0 ? (
<Grid item xs={12}>
<Typography color="text.secondary" textAlign="center">
<Box sx={{ width: '100%', textAlign: 'center' }}>
<Typography color="text.secondary">
No images found. Upload some images first.
</Typography>
</Grid>
</Box>
) : (
mediaFiles.map((file) => (
<Grid item xs={12} sm={6} md={4} key={file.id}>
<Box key={file.id} sx={{ width: { xs: '100%', sm: '48%', md: '31%' } }}>
<Card>
<CardMedia
component="img"
@@ -267,10 +267,10 @@ export function ImageUpload({ open, onClose, onImageSelect }: ImageUploadProps)
</Button>
</CardActions>
</Card>
</Grid>
</Box>
))
)}
</Grid>
</Box>
)}
</Box>
)}

View File

@@ -293,8 +293,8 @@ export function PageEditor({ open, onClose, page, onSave }: PageEditorProps) {
{/* Content Tab */}
{contentTab === 0 && (
<Box>
<Grid container spacing={2}>
<Grid item xs={12} sm={8}>
<Box sx={{ display: 'flex', gap: 2, flexDirection: { xs: 'column', sm: 'row' } }}>
<Box sx={{ flex: { xs: '1', sm: '2' } }}>
<TextField
label="Page Title"
fullWidth
@@ -302,8 +302,8 @@ export function PageEditor({ open, onClose, page, onSave }: PageEditorProps) {
value={formData.title}
onChange={(e) => handleTitleChange(e.target.value)}
/>
</Grid>
<Grid item xs={12} sm={4}>
</Box>
<Box sx={{ flex: '1' }}>
<FormControl fullWidth>
<InputLabel>Content Type</InputLabel>
<Select
@@ -316,8 +316,8 @@ export function PageEditor({ open, onClose, page, onSave }: PageEditorProps) {
<MenuItem value="MARKDOWN">Markdown</MenuItem>
</Select>
</FormControl>
</Grid>
</Grid>
</Box>
</Box>
<TextField
label="URL Slug"
@@ -347,8 +347,8 @@ export function PageEditor({ open, onClose, page, onSave }: PageEditorProps) {
{/* Settings Tab */}
{contentTab === 1 && (
<Box>
<Grid container spacing={3}>
<Grid item xs={12} sm={6}>
<Box sx={{ display: 'flex', gap: 3, flexDirection: { xs: 'column', sm: 'row' } }}>
<Box sx={{ flex: '1' }}>
<Paper sx={{ p: 2 }}>
<Typography variant="h6" gutterBottom>Publication</Typography>
<FormControl fullWidth sx={{ mb: 2 }}>
@@ -371,9 +371,9 @@ export function PageEditor({ open, onClose, page, onSave }: PageEditorProps) {
onChange={(e) => setFormData(prev => ({ ...prev, featuredImage: e.target.value }))}
/>
</Paper>
</Grid>
</Box>
<Grid item xs={12} sm={6}>
<Box sx={{ flex: '1' }}>
<Paper sx={{ p: 2 }}>
<Typography variant="h6" gutterBottom>Display Options</Typography>
@@ -421,8 +421,8 @@ export function PageEditor({ open, onClose, page, onSave }: PageEditorProps) {
/>
)}
</Paper>
</Grid>
</Grid>
</Box>
</Box>
</Box>
)}