stage 4-1
This commit is contained in:
@@ -86,11 +86,23 @@ export default function AnalysisPreview() {
|
||||
|
||||
{loading || analyzing ? (
|
||||
<div className="text-center py-12">
|
||||
<div className="inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"></div>
|
||||
<p className="mt-2 text-gray-600 dark:text-gray-400">
|
||||
<div className="inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500 mb-3"></div>
|
||||
<p className="text-gray-600 dark:text-gray-400">
|
||||
{loading ? 'Loading content...' : 'Analyzing content...'}
|
||||
</p>
|
||||
</div>
|
||||
) : !content ? (
|
||||
<div className="text-center py-12">
|
||||
<BoltIcon className="w-12 h-12 text-gray-400 dark:text-gray-500 mx-auto mb-3 opacity-50" />
|
||||
<p className="text-gray-600 dark:text-gray-400 mb-2">Content not found</p>
|
||||
<p className="text-sm text-gray-400 dark:text-gray-500">Unable to load content for analysis</p>
|
||||
</div>
|
||||
) : !scores ? (
|
||||
<div className="text-center py-12">
|
||||
<BoltIcon className="w-12 h-12 text-gray-400 dark:text-gray-500 mx-auto mb-3 opacity-50" />
|
||||
<p className="text-gray-600 dark:text-gray-400 mb-2">Analysis unavailable</p>
|
||||
<p className="text-sm text-gray-400 dark:text-gray-500">Unable to analyze this content</p>
|
||||
</div>
|
||||
) : content && scores ? (
|
||||
<div className="space-y-6">
|
||||
{/* Content Info */}
|
||||
|
||||
@@ -87,6 +87,7 @@ export default function PostEditor() {
|
||||
setValidationResult(result);
|
||||
} catch (error: any) {
|
||||
console.error('Failed to load validation:', error);
|
||||
toast.error(`Failed to load validation: ${error.message || 'Unknown error'}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -600,6 +601,7 @@ export default function PostEditor() {
|
||||
variant="primary"
|
||||
onClick={handleValidate}
|
||||
disabled={validating}
|
||||
aria-label="Run content validation"
|
||||
>
|
||||
{validating ? 'Validating...' : 'Run Validation'}
|
||||
</Button>
|
||||
@@ -632,11 +634,11 @@ export default function PostEditor() {
|
||||
</div>
|
||||
|
||||
{/* Metadata Summary */}
|
||||
<div className="bg-gray-50 dark:bg-gray-900 rounded-lg p-4">
|
||||
<h4 className="text-sm font-semibold text-gray-900 dark:text-white mb-3">
|
||||
<div className="bg-gray-50 dark:bg-gray-900 rounded-lg p-4" role="region" aria-labelledby="metadata-summary-title">
|
||||
<h4 id="metadata-summary-title" className="text-sm font-semibold text-gray-900 dark:text-white mb-3">
|
||||
Metadata Summary
|
||||
</h4>
|
||||
<div className="grid grid-cols-2 gap-4 text-sm">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4 text-sm">
|
||||
<div>
|
||||
<span className="text-gray-600 dark:text-gray-400">Entity Type:</span>
|
||||
<span className="ml-2 font-medium text-gray-900 dark:text-white">
|
||||
@@ -668,7 +670,7 @@ export default function PostEditor() {
|
||||
|
||||
{/* Validation Errors */}
|
||||
{validationResult.validation_errors.length > 0 && (
|
||||
<div>
|
||||
<div role="alert" aria-live="polite">
|
||||
<h4 className="text-sm font-semibold text-gray-900 dark:text-white mb-3">
|
||||
Validation Errors
|
||||
</h4>
|
||||
@@ -695,7 +697,7 @@ export default function PostEditor() {
|
||||
|
||||
{/* Publish Errors */}
|
||||
{validationResult.publish_errors && validationResult.publish_errors.length > 0 && (
|
||||
<div>
|
||||
<div role="alert" aria-live="polite">
|
||||
<h4 className="text-sm font-semibold text-gray-900 dark:text-white mb-3">
|
||||
Publish Blockers
|
||||
</h4>
|
||||
@@ -721,8 +723,10 @@ export default function PostEditor() {
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className="text-center py-8 text-gray-500 dark:text-gray-400">
|
||||
<p>Click "Run Validation" to check your content</p>
|
||||
<div className="text-center py-8">
|
||||
<FileTextIcon className="w-12 h-12 text-gray-400 dark:text-gray-500 mx-auto mb-3 opacity-50" />
|
||||
<p className="text-gray-500 dark:text-gray-400 mb-2">No validation results yet</p>
|
||||
<p className="text-sm text-gray-400 dark:text-gray-500">Click "Run Validation" to check your content</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -733,7 +737,7 @@ export default function PostEditor() {
|
||||
|
||||
{/* Stage 3: Sidebar with Metadata Summary */}
|
||||
{content.id && (
|
||||
<div className="w-80 flex-shrink-0">
|
||||
<div className="w-full lg:w-80 flex-shrink-0 mt-6 lg:mt-0">
|
||||
<Card className="p-4 sticky top-6">
|
||||
<h3 className="text-lg font-semibold text-gray-900 dark:text-white mb-4">
|
||||
Content Metadata
|
||||
@@ -741,45 +745,53 @@ export default function PostEditor() {
|
||||
|
||||
<div className="space-y-4">
|
||||
{/* Entity Type */}
|
||||
{content.entity_type && (
|
||||
<div>
|
||||
<div className="text-xs font-medium text-gray-500 dark:text-gray-400 mb-1">
|
||||
Entity Type
|
||||
</div>
|
||||
<div className="text-sm text-gray-900 dark:text-white">
|
||||
{content.entity_type ? content.entity_type.replace('_', ' ').replace(/\b\w/g, l => l.toUpperCase()) : '-'}
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-xs font-medium text-gray-500 dark:text-gray-400 mb-1">
|
||||
Entity Type
|
||||
</div>
|
||||
)}
|
||||
<div className="text-sm text-gray-900 dark:text-white">
|
||||
{content.entity_type ? (
|
||||
content.entity_type.replace('_', ' ').replace(/\b\w/g, l => l.toUpperCase())
|
||||
) : (
|
||||
<span className="text-gray-400 dark:text-gray-500 italic">Not set</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Cluster */}
|
||||
{content.cluster_name && (
|
||||
<div>
|
||||
<div className="text-xs font-medium text-gray-500 dark:text-gray-400 mb-1">
|
||||
Cluster
|
||||
</div>
|
||||
<div className="text-sm text-gray-900 dark:text-white">
|
||||
{content.cluster_name}
|
||||
{content.cluster_role && (
|
||||
<span className="ml-2 text-xs text-gray-500 dark:text-gray-400">
|
||||
({content.cluster_role})
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-xs font-medium text-gray-500 dark:text-gray-400 mb-1">
|
||||
Cluster
|
||||
</div>
|
||||
)}
|
||||
<div className="text-sm text-gray-900 dark:text-white">
|
||||
{content.cluster_name ? (
|
||||
<>
|
||||
{content.cluster_name}
|
||||
{content.cluster_role && (
|
||||
<span className="ml-2 text-xs text-gray-500 dark:text-gray-400">
|
||||
({content.cluster_role})
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<span className="text-gray-400 dark:text-gray-500 italic">Not assigned</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Taxonomy */}
|
||||
{content.taxonomy_name && (
|
||||
<div>
|
||||
<div className="text-xs font-medium text-gray-500 dark:text-gray-400 mb-1">
|
||||
Taxonomy
|
||||
</div>
|
||||
<div className="text-sm text-gray-900 dark:text-white">
|
||||
{content.taxonomy_name}
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-xs font-medium text-gray-500 dark:text-gray-400 mb-1">
|
||||
Taxonomy
|
||||
</div>
|
||||
)}
|
||||
<div className="text-sm text-gray-900 dark:text-white">
|
||||
{content.taxonomy_name ? (
|
||||
content.taxonomy_name
|
||||
) : (
|
||||
<span className="text-gray-400 dark:text-gray-500 italic">Not assigned</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Validation Status */}
|
||||
{validationResult && (
|
||||
@@ -803,21 +815,27 @@ export default function PostEditor() {
|
||||
Quick Actions
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
{content.cluster_id && (
|
||||
{content.cluster_id ? (
|
||||
<button
|
||||
onClick={() => navigate(`/planner/clusters/${content.cluster_id}`)}
|
||||
className="text-xs text-blue-600 dark:text-blue-400 hover:underline w-full text-left"
|
||||
className="text-xs text-blue-600 dark:text-blue-400 hover:underline w-full text-left transition-colors focus:outline-none focus:ring-1 focus:ring-blue-500 rounded px-1"
|
||||
aria-label="View cluster details"
|
||||
>
|
||||
View Cluster →
|
||||
</button>
|
||||
) : (
|
||||
<span className="text-xs text-gray-400 dark:text-gray-500 italic">No cluster assigned</span>
|
||||
)}
|
||||
{content.taxonomy_id && (
|
||||
{content.taxonomy_id ? (
|
||||
<button
|
||||
onClick={() => navigate(`/sites/builder?taxonomy=${content.taxonomy_id}`)}
|
||||
className="text-xs text-blue-600 dark:text-blue-400 hover:underline w-full text-left"
|
||||
className="text-xs text-blue-600 dark:text-blue-400 hover:underline w-full text-left transition-colors focus:outline-none focus:ring-1 focus:ring-blue-500 rounded px-1"
|
||||
aria-label="View taxonomy details"
|
||||
>
|
||||
View Taxonomy →
|
||||
</button>
|
||||
) : (
|
||||
<span className="text-xs text-gray-400 dark:text-gray-500 italic">No taxonomy assigned</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user