Fix admin layout integration for Payload CMS custom views

Layout Corrections:
- Removed unavailable DefaultTemplate import (not available in @payloadcms/ui)
- Created proper custom view layout that integrates with Payload's admin structure
- Added flexible props interface for future extensibility
- Optimized container structure for admin panel embedding
- Removed breadcrumbs (handled by Payload's navigation system)

Technical Improvements:
- Component now works as a proper Payload custom view
- Height and overflow handling for admin panel integration
- Maintained theme integration and responsive design
- Added proper TypeScript interfaces for props
- Ensured compatibility with Payload's rendering system

The view now properly integrates with Payload's admin panel as a custom view
while preserving all spreadsheet functionality and theme support.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-03 16:07:36 +02:00
parent fd848dcfe8
commit 4091141722

View File

@@ -23,7 +23,12 @@ interface FeatureFlag {
updatedAt: string updatedAt: string
} }
const FeatureFlagsViewComponent = () => { interface FeatureFlagsViewProps {
// Props that would typically be passed from the parent view
[key: string]: any
}
const FeatureFlagsViewComponent = (props: FeatureFlagsViewProps = {}) => {
const { config } = useConfig() const { config } = useConfig()
const { theme } = useTheme() const { theme } = useTheme()
const [flags, setFlags] = useState<FeatureFlag[]>([]) const [flags, setFlags] = useState<FeatureFlag[]>([])
@@ -195,49 +200,31 @@ const FeatureFlagsViewComponent = () => {
if (loading) { if (loading) {
return ( return (
<div style={{ <div style={{
minHeight: '100vh', padding: '2rem',
backgroundColor: styles.background, textAlign: 'center',
color: styles.text minHeight: '400px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}}> }}>
<div style={{ <div style={{ fontSize: '1.125rem', color: styles.textMuted }}>Loading feature flags...</div>
maxWidth: '1200px',
margin: '0 auto',
padding: '2rem',
textAlign: 'center'
}}>
<div style={{ fontSize: '1.125rem', color: styles.textMuted }}>Loading feature flags...</div>
</div>
</div> </div>
) )
} }
return ( return (
<div style={{ <div style={{
minHeight: '100vh', padding: '0',
backgroundColor: styles.background, height: '100%',
color: styles.text overflow: 'auto'
}}> }}>
{/* Content Container */}
<div style={{ <div style={{
maxWidth: '1200px', padding: '2rem',
margin: '0 auto', maxWidth: '100%'
padding: '2rem'
}}> }}>
{/* Header */} {/* Header */}
<div style={{ marginBottom: '2rem' }}> <div style={{ marginBottom: '2rem' }}>
{/* Breadcrumb */}
<div style={{
fontSize: '0.875rem',
color: styles.textMuted,
marginBottom: '1rem',
display: 'flex',
alignItems: 'center',
gap: '0.5rem'
}}>
<a href="/admin" style={{ color: styles.info, textDecoration: 'none' }}>Dashboard</a>
<span></span>
<span>Feature Flags</span>
</div>
<h1 style={{ <h1 style={{
fontSize: '2rem', fontSize: '2rem',
fontWeight: '700', fontWeight: '700',
@@ -637,4 +624,5 @@ const FeatureFlagsViewComponent = () => {
) )
} }
export const FeatureFlagsView = memo(FeatureFlagsViewComponent) export const FeatureFlagsView = memo(FeatureFlagsViewComponent)
export default FeatureFlagsView