Refactor frontend components to use new icon imports and improve default values

- Updated `EnhancedMetricCard` to set a default accent color to blue.
- Replaced `lucide-react` icons with custom icons in `LinkResults`, `OptimizationScores`, and various pages in the Automation and Optimizer sections.
- Enhanced button layouts in `AutomationRules`, `Tasks`, and `ContentSelector` for better alignment and user experience.
- Improved loading indicators across components for a more consistent UI experience.
This commit is contained in:
IGNY8 VPS (Salman)
2025-11-17 21:38:08 +00:00
parent 0818dfe385
commit ee56f9bbac
11 changed files with 153 additions and 125 deletions

Binary file not shown.

View File

@@ -62,7 +62,7 @@ export default function EnhancedMetricCard({
subtitle, subtitle,
trend, trend,
icon, icon,
accentColor, accentColor = "blue", // Default to blue if not provided
href, href,
onClick, onClick,
tooltip, tooltip,
@@ -70,7 +70,7 @@ export default function EnhancedMetricCard({
className = "", className = "",
}: MetricCardProps) { }: MetricCardProps) {
const [isHovered, setIsHovered] = useState(false); const [isHovered, setIsHovered] = useState(false);
const colors = accentColors[accentColor]; const colors = accentColors[accentColor] || accentColors.blue; // Fallback to blue if invalid
const formatValue = (val: string | number): string => { const formatValue = (val: string | number): string => {
if (typeof val === "number") { if (typeof val === "number") {

View File

@@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Link2, CheckCircle, XCircle } from 'lucide-react'; import { PlugInIcon, CheckCircleIcon, XCircleIcon } from '../../icons';
interface Link { interface Link {
anchor_text: string; anchor_text: string;
@@ -25,7 +25,7 @@ export const LinkResults: React.FC<LinkResultsProps> = ({
<div className="flex items-center justify-between mb-4"> <div className="flex items-center justify-between mb-4">
<h3 className="text-lg font-semibold text-gray-900 dark:text-white">Linking Results</h3> <h3 className="text-lg font-semibold text-gray-900 dark:text-white">Linking Results</h3>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Link2 className="w-5 h-5 text-blue-500" /> <PlugInIcon className="w-5 h-5 text-blue-500" />
<span className="text-sm text-gray-600 dark:text-gray-400">Version {linkerVersion}</span> <span className="text-sm text-gray-600 dark:text-gray-400">Version {linkerVersion}</span>
</div> </div>
</div> </div>
@@ -33,7 +33,7 @@ export const LinkResults: React.FC<LinkResultsProps> = ({
{linksAdded > 0 ? ( {linksAdded > 0 ? (
<div className="space-y-4"> <div className="space-y-4">
<div className="flex items-center gap-2 text-green-600 dark:text-green-400"> <div className="flex items-center gap-2 text-green-600 dark:text-green-400">
<CheckCircle className="w-5 h-5" /> <CheckCircleIcon className="w-5 h-5" />
<span className="font-medium">{linksAdded} link{linksAdded !== 1 ? 's' : ''} added</span> <span className="font-medium">{linksAdded} link{linksAdded !== 1 ? 's' : ''} added</span>
</div> </div>
@@ -54,7 +54,7 @@ export const LinkResults: React.FC<LinkResultsProps> = ({
</div> </div>
) : ( ) : (
<div className="flex items-center gap-2 text-gray-500 dark:text-gray-400"> <div className="flex items-center gap-2 text-gray-500 dark:text-gray-400">
<XCircle className="w-5 h-5" /> <XCircleIcon className="w-5 h-5" />
<span>No links were added to this content.</span> <span>No links were added to this content.</span>
</div> </div>
)} )}

View File

@@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { TrendingUp, TrendingDown, Minus } from 'lucide-react'; import { ArrowUpIcon, ArrowDownIcon } from '../../icons';
interface ScoreData { interface ScoreData {
seo_score: number; seo_score: number;
@@ -39,9 +39,9 @@ export const OptimizationScores: React.FC<OptimizationScoresProps> = ({
const getChangeIcon = (current: number, previous?: number) => { const getChangeIcon = (current: number, previous?: number) => {
if (!previous) return null; if (!previous) return null;
const diff = current - previous; const diff = current - previous;
if (diff > 0) return <TrendingUp className="w-4 h-4 text-green-600" />; if (diff > 0) return <ArrowUpIcon className="w-4 h-4 text-green-600" />;
if (diff < 0) return <TrendingDown className="w-4 h-4 text-red-600" />; if (diff < 0) return <ArrowDownIcon className="w-4 h-4 text-red-600" />;
return <Minus className="w-4 h-4 text-gray-400" />; return <span className="w-4 h-4 text-gray-400"></span>;
}; };
const getChangeText = (current: number, previous?: number) => { const getChangeText = (current: number, previous?: number) => {

View File

@@ -5,7 +5,7 @@ import PageHeader from '../../components/common/PageHeader';
import ComponentCard from '../../components/common/ComponentCard'; import ComponentCard from '../../components/common/ComponentCard';
import { automationApi, AutomationRule } from '../../api/automation.api'; import { automationApi, AutomationRule } from '../../api/automation.api';
import { useToast } from '../../components/ui/toast/ToastContainer'; import { useToast } from '../../components/ui/toast/ToastContainer';
import { BoltIcon, PlusIcon, PlayIcon, PauseIcon, TrashIcon, EditIcon } from '../../icons'; import { BoltIcon, PlusIcon, TrashBinIcon, PencilIcon, PaperPlaneIcon, CloseIcon } from '../../icons';
import { useSiteStore } from '../../store/siteStore'; import { useSiteStore } from '../../store/siteStore';
import { useSectorStore } from '../../store/sectorStore'; import { useSectorStore } from '../../store/sectorStore';
@@ -191,33 +191,33 @@ export default function AutomationRules() {
<div className="flex items-center gap-2 pt-2 border-t border-gray-200 dark:border-gray-700"> <div className="flex items-center gap-2 pt-2 border-t border-gray-200 dark:border-gray-700">
<button <button
onClick={() => handleToggleActive(rule)} onClick={() => handleToggleActive(rule)}
className="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" className="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center"
title={rule.is_active ? 'Deactivate' : 'Activate'} title={rule.is_active ? 'Deactivate' : 'Activate'}
> >
{rule.is_active ? <PauseIcon /> : <PlayIcon />} {rule.is_active ? <CloseIcon className="w-4 h-4" /> : <PaperPlaneIcon className="w-4 h-4" />}
</button> </button>
{rule.trigger === 'manual' && ( {rule.trigger === 'manual' && (
<button <button
onClick={() => handleExecute(rule.id)} onClick={() => handleExecute(rule.id)}
className="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" className="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center"
title="Execute Now" title="Execute Now"
> >
<PlayIcon /> <PaperPlaneIcon className="w-4 h-4" />
</button> </button>
)} )}
<button <button
onClick={() => handleEdit(rule)} onClick={() => handleEdit(rule)}
className="px-3 py-1.5 text-sm rounded-lg border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" className="px-3 py-1.5 text-sm rounded-lg border border-gray-300 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center"
title="Edit" title="Edit"
> >
<EditIcon /> <PencilIcon className="w-4 h-4" />
</button> </button>
<button <button
onClick={() => handleDelete(rule.id)} onClick={() => handleDelete(rule.id)}
className="px-3 py-1.5 text-sm rounded-lg border border-red-300 dark:border-red-600 text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors" className="px-3 py-1.5 text-sm rounded-lg border border-red-300 dark:border-red-600 text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors flex items-center justify-center"
title="Delete" title="Delete"
> >
<TrashIcon /> <TrashBinIcon className="w-4 h-4" />
</button> </button>
</div> </div>
</div> </div>

View File

@@ -4,7 +4,7 @@ import PageHeader from '../../components/common/PageHeader';
import ComponentCard from '../../components/common/ComponentCard'; import ComponentCard from '../../components/common/ComponentCard';
import { automationApi, ScheduledTask } from '../../api/automation.api'; import { automationApi, ScheduledTask } from '../../api/automation.api';
import { useToast } from '../../components/ui/toast/ToastContainer'; import { useToast } from '../../components/ui/toast/ToastContainer';
import { ClockIcon, CheckCircleIcon, XCircleIcon, RefreshCwIcon } from '../../icons'; import { ClockIcon, CheckCircleIcon, XCircleIcon, ArrowRightIcon } from '../../icons';
import { useSiteStore } from '../../store/siteStore'; import { useSiteStore } from '../../store/siteStore';
import { useSectorStore } from '../../store/sectorStore'; import { useSectorStore } from '../../store/sectorStore';
@@ -233,7 +233,7 @@ export default function AutomationTasks() {
onClick={() => handleRetry(task.id)} onClick={() => handleRetry(task.id)}
className="flex items-center gap-2 px-4 py-2 text-sm bg-brand-500 text-white rounded-lg hover:bg-brand-600 transition-colors" className="flex items-center gap-2 px-4 py-2 text-sm bg-brand-500 text-white rounded-lg hover:bg-brand-600 transition-colors"
> >
<RefreshCwIcon /> <ArrowRightIcon className="w-4 h-4" />
Retry Task Retry Task
</button> </button>
</div> </div>

View File

@@ -7,7 +7,7 @@ import { fetchContent, Content as ContentType } from '../../services/api';
import { useToast } from '../../components/ui/toast/ToastContainer'; import { useToast } from '../../components/ui/toast/ToastContainer';
import { SourceBadge, ContentSource } from '../../components/content/SourceBadge'; import { SourceBadge, ContentSource } from '../../components/content/SourceBadge';
import { LinkResults } from '../../components/linker/LinkResults'; import { LinkResults } from '../../components/linker/LinkResults';
import { Link2, Loader2 } from 'lucide-react'; import { PlugInIcon } from '../../icons';
import { useSectorStore } from '../../store/sectorStore'; import { useSectorStore } from '../../store/sectorStore';
import { usePageSizeStore } from '../../store/pageSizeStore'; import { usePageSizeStore } from '../../store/pageSizeStore';
@@ -161,12 +161,12 @@ export default function LinkerContentList() {
> >
{isProcessing ? ( {isProcessing ? (
<> <>
<Loader2 className="w-4 h-4 animate-spin" /> <div className="w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin" />
Processing... Processing...
</> </>
) : ( ) : (
<> <>
<Link2 className="w-4 h-4" /> <PlugInIcon className="w-4 h-4" />
Add Links Add Links
</> </>
)} )}

View File

@@ -4,7 +4,7 @@ import PageMeta from '../../components/common/PageMeta';
import ComponentCard from '../../components/common/ComponentCard'; import ComponentCard from '../../components/common/ComponentCard';
import EnhancedMetricCard from '../../components/dashboard/EnhancedMetricCard'; import EnhancedMetricCard from '../../components/dashboard/EnhancedMetricCard';
import PageHeader from '../../components/common/PageHeader'; import PageHeader from '../../components/common/PageHeader';
import { Link2, FileText, TrendingUp, ArrowRight } from 'lucide-react'; import { FileTextIcon, ArrowRightIcon, PlugInIcon, ArrowUpIcon } from '../../icons';
import { fetchContent } from '../../services/api'; import { fetchContent } from '../../services/api';
import { useSiteStore } from '../../store/siteStore'; import { useSiteStore } from '../../store/siteStore';
import { useSectorStore } from '../../store/sectorStore'; import { useSectorStore } from '../../store/sectorStore';
@@ -67,19 +67,26 @@ export default function LinkerDashboard() {
<PageMeta title="Linker Dashboard" description="Internal linking overview and statistics" /> <PageMeta title="Linker Dashboard" description="Internal linking overview and statistics" />
<div className="space-y-6"> <div className="space-y-6">
<PageHeader <div className="flex items-center justify-between mb-6">
title="Linker Dashboard" <PageHeader
description="Manage internal linking for your content" title="Linker Dashboard"
actions={ lastUpdated={new Date()}
<Link badge={{
to="/linker/content" icon: <PlugInIcon />,
className="inline-flex items-center gap-2 px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors" color: 'blue',
> }}
<Link2 className="w-4 h-4" /> />
View Content <Link
</Link> to="/linker/content"
} className="inline-flex items-center gap-2 px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors"
/> >
<PlugInIcon />
View Content
</Link>
</div>
<p className="text-gray-600 dark:text-gray-400 mb-6">
Manage internal linking for your content
</p>
{loading ? ( {loading ? (
<div className="text-center py-12"> <div className="text-center py-12">
@@ -94,8 +101,8 @@ export default function LinkerDashboard() {
title="Total Linked" title="Total Linked"
value={stats.totalLinked.toString()} value={stats.totalLinked.toString()}
subtitle={`${stats.contentWithoutLinks} without links`} subtitle={`${stats.contentWithoutLinks} without links`}
icon={<FileText className="w-6 h-6" />} icon={<FileTextIcon className="w-6 h-6" />}
trend={null} accentColor="blue"
onClick={() => navigate('/linker/content')} onClick={() => navigate('/linker/content')}
/> />
@@ -103,8 +110,8 @@ export default function LinkerDashboard() {
title="Total Links" title="Total Links"
value={stats.totalLinks.toString()} value={stats.totalLinks.toString()}
subtitle="Internal links created" subtitle="Internal links created"
icon={<Link2 className="w-6 h-6" />} icon={<PlugInIcon className="w-6 h-6" />}
trend={null} accentColor="purple"
onClick={() => navigate('/linker/content')} onClick={() => navigate('/linker/content')}
/> />
@@ -112,8 +119,8 @@ export default function LinkerDashboard() {
title="Avg Links/Content" title="Avg Links/Content"
value={stats.averageLinksPerContent.toString()} value={stats.averageLinksPerContent.toString()}
subtitle="Average per linked content" subtitle="Average per linked content"
icon={<TrendingUp className="w-6 h-6" />} icon={<ArrowUpIcon className="w-6 h-6" />}
trend={null} accentColor="green"
onClick={() => navigate('/linker/content')} onClick={() => navigate('/linker/content')}
/> />
</div> </div>
@@ -126,13 +133,13 @@ export default function LinkerDashboard() {
className="flex items-center justify-between p-4 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" className="flex items-center justify-between p-4 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"
> >
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<Link2 className="w-5 h-5 text-blue-500" /> <PlugInIcon className="w-5 h-5 text-blue-500" />
<div> <div>
<h3 className="font-medium text-gray-900 dark:text-white">Link Content</h3> <h3 className="font-medium text-gray-900 dark:text-white">Link Content</h3>
<p className="text-sm text-gray-500 dark:text-gray-400">Process content for internal linking</p> <p className="text-sm text-gray-500 dark:text-gray-400">Process content for internal linking</p>
</div> </div>
</div> </div>
<ArrowRight className="w-5 h-5 text-gray-400" /> <ArrowRightIcon className="w-5 h-5 text-gray-400" />
</Link> </Link>
<Link <Link
@@ -140,13 +147,13 @@ export default function LinkerDashboard() {
className="flex items-center justify-between p-4 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" className="flex items-center justify-between p-4 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"
> >
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<FileText className="w-5 h-5 text-purple-500" /> <FileTextIcon className="w-5 h-5 text-purple-500" />
<div> <div>
<h3 className="font-medium text-gray-900 dark:text-white">View Content</h3> <h3 className="font-medium text-gray-900 dark:text-white">View Content</h3>
<p className="text-sm text-gray-500 dark:text-gray-400">Browse all content items</p> <p className="text-sm text-gray-500 dark:text-gray-400">Browse all content items</p>
</div> </div>
</div> </div>
<ArrowRight className="w-5 h-5 text-gray-400" /> <ArrowRightIcon className="w-5 h-5 text-gray-400" />
</Link> </Link>
</div> </div>
</ComponentCard> </ComponentCard>

View File

@@ -6,7 +6,7 @@ import { optimizerApi } from '../../api/optimizer.api';
import { fetchContent, Content as ContentType } from '../../services/api'; import { fetchContent, Content as ContentType } from '../../services/api';
import { useToast } from '../../components/ui/toast/ToastContainer'; import { useToast } from '../../components/ui/toast/ToastContainer';
import { OptimizationScores } from '../../components/optimizer/OptimizationScores'; import { OptimizationScores } from '../../components/optimizer/OptimizationScores';
import { Loader2, ArrowLeft } from 'lucide-react'; import { ArrowLeftIcon, BoltIcon } from '../../icons';
export default function AnalysisPreview() { export default function AnalysisPreview() {
const { id } = useParams<{ id: string }>(); const { id } = useParams<{ id: string }>();
@@ -63,19 +63,26 @@ export default function AnalysisPreview() {
<PageMeta title="Content Analysis" description="Preview content optimization scores" /> <PageMeta title="Content Analysis" description="Preview content optimization scores" />
<div className="space-y-6"> <div className="space-y-6">
<PageHeader <div className="flex items-center justify-between mb-6">
title="Content Analysis" <PageHeader
description="Preview optimization scores without optimizing" title="Content Analysis"
actions={ lastUpdated={new Date()}
<button badge={{
onClick={() => navigate(-1)} icon: <BoltIcon />,
className="inline-flex items-center gap-2 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" color: 'orange',
> }}
<ArrowLeft className="w-4 h-4" /> />
Back <button
</button> onClick={() => navigate(-1)}
} className="inline-flex items-center gap-2 px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"
/> >
<ArrowLeftIcon className="w-4 h-4" />
Back
</button>
</div>
<p className="text-gray-600 dark:text-gray-400 mb-6">
Preview optimization scores without optimizing
</p>
{loading || analyzing ? ( {loading || analyzing ? (
<div className="text-center py-12"> <div className="text-center py-12">

View File

@@ -9,7 +9,7 @@ import { SourceBadge, ContentSource } from '../../components/content/SourceBadge
import { SyncStatusBadge, SyncStatus } from '../../components/content/SyncStatusBadge'; import { SyncStatusBadge, SyncStatus } from '../../components/content/SyncStatusBadge';
import { ContentFilter, FilterState } from '../../components/content/ContentFilter'; import { ContentFilter, FilterState } from '../../components/content/ContentFilter';
import { OptimizationScores } from '../../components/optimizer/OptimizationScores'; import { OptimizationScores } from '../../components/optimizer/OptimizationScores';
import { Zap, Loader2, CheckCircle2 } from 'lucide-react'; import { BoltIcon, CheckCircleIcon } from '../../icons';
import { useSectorStore } from '../../store/sectorStore'; import { useSectorStore } from '../../store/sectorStore';
import { usePageSizeStore } from '../../store/pageSizeStore'; import { usePageSizeStore } from '../../store/pageSizeStore';
@@ -146,42 +146,49 @@ export default function OptimizerContentSelector() {
<PageMeta title="Optimize Content" description="Select and optimize content for SEO and engagement" /> <PageMeta title="Optimize Content" description="Select and optimize content for SEO and engagement" />
<div className="space-y-6"> <div className="space-y-6">
<PageHeader <div className="flex items-center justify-between mb-6">
title="Optimize Content" <PageHeader
description="Select content to optimize for SEO, readability, and engagement" title="Optimize Content"
actions={ lastUpdated={new Date()}
<div className="flex items-center gap-4"> badge={{
<select icon: <BoltIcon />,
value={entryPoint} color: 'orange',
onChange={(e) => setEntryPoint(e.target.value as EntryPoint)} }}
className="px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white" />
> <div className="flex items-center gap-4">
<option value="auto">Auto-detect</option> <select
<option value="writer">From Writer</option> value={entryPoint}
<option value="wordpress">From WordPress</option> onChange={(e) => setEntryPoint(e.target.value as EntryPoint)}
<option value="external">From External</option> className="px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-white"
<option value="manual">Manual</option> >
</select> <option value="auto">Auto-detect</option>
<button <option value="writer">From Writer</option>
onClick={handleBatchOptimize} <option value="wordpress">From WordPress</option>
disabled={selectedIds.length === 0 || processing.length > 0} <option value="external">From External</option>
className="inline-flex items-center gap-2 px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors" <option value="manual">Manual</option>
> </select>
{processing.length > 0 ? ( <button
<> onClick={handleBatchOptimize}
<Loader2 className="w-4 h-4 animate-spin" /> disabled={selectedIds.length === 0 || processing.length > 0}
Optimizing... className="inline-flex items-center gap-2 px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors"
</> >
) : ( {processing.length > 0 ? (
<> <>
<Zap className="w-4 h-4" /> <div className="w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin" />
Optimize Selected ({selectedIds.length}) Optimizing...
</> </>
)} ) : (
</button> <>
</div> <BoltIcon className="w-4 h-4" />
} Optimize Selected ({selectedIds.length})
/> </>
)}
</button>
</div>
</div>
<p className="text-gray-600 dark:text-gray-400 mb-6">
Select content to optimize for SEO, readability, and engagement
</p>
{/* Filters */} {/* Filters */}
<ContentFilter onFilterChange={setFilters} /> <ContentFilter onFilterChange={setFilters} />
@@ -275,12 +282,12 @@ export default function OptimizerContentSelector() {
> >
{isProcessing ? ( {isProcessing ? (
<> <>
<Loader2 className="w-4 h-4 animate-spin" /> <div className="w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin" />
Optimizing... Optimizing...
</> </>
) : ( ) : (
<> <>
<Zap className="w-4 h-4" /> <BoltIcon className="w-4 h-4" />
Optimize Optimize
</> </>
)} )}

View File

@@ -4,7 +4,7 @@ import PageMeta from '../../components/common/PageMeta';
import ComponentCard from '../../components/common/ComponentCard'; import ComponentCard from '../../components/common/ComponentCard';
import EnhancedMetricCard from '../../components/dashboard/EnhancedMetricCard'; import EnhancedMetricCard from '../../components/dashboard/EnhancedMetricCard';
import PageHeader from '../../components/common/PageHeader'; import PageHeader from '../../components/common/PageHeader';
import { Zap, FileText, TrendingUp, ArrowRight } from 'lucide-react'; import { BoltIcon, FileTextIcon, ArrowUpIcon, ArrowRightIcon } from '../../icons';
import { fetchContent } from '../../services/api'; import { fetchContent } from '../../services/api';
import { useSiteStore } from '../../store/siteStore'; import { useSiteStore } from '../../store/siteStore';
import { useSectorStore } from '../../store/sectorStore'; import { useSectorStore } from '../../store/sectorStore';
@@ -69,19 +69,26 @@ export default function OptimizerDashboard() {
<PageMeta title="Optimizer Dashboard" description="Content optimization overview and statistics" /> <PageMeta title="Optimizer Dashboard" description="Content optimization overview and statistics" />
<div className="space-y-6"> <div className="space-y-6">
<PageHeader <div className="flex items-center justify-between mb-6">
title="Optimizer Dashboard" <PageHeader
description="Optimize your content for SEO, readability, and engagement" title="Optimizer Dashboard"
actions={ lastUpdated={new Date()}
<Link badge={{
to="/optimizer/content" icon: <BoltIcon />,
className="inline-flex items-center gap-2 px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors" color: 'orange',
> }}
<Zap className="w-4 h-4" /> />
Optimize Content <Link
</Link> to="/optimizer/content"
} className="inline-flex items-center gap-2 px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition-colors"
/> >
<BoltIcon />
Optimize Content
</Link>
</div>
<p className="text-gray-600 dark:text-gray-400 mb-6">
Optimize your content for SEO, readability, and engagement
</p>
{loading ? ( {loading ? (
<div className="text-center py-12"> <div className="text-center py-12">
@@ -96,8 +103,8 @@ export default function OptimizerDashboard() {
title="Total Optimized" title="Total Optimized"
value={stats.totalOptimized.toString()} value={stats.totalOptimized.toString()}
subtitle={`${stats.contentWithoutScores} not optimized`} subtitle={`${stats.contentWithoutScores} not optimized`}
icon={<FileText className="w-6 h-6" />} icon={<FileTextIcon className="w-6 h-6" />}
trend={null} accentColor="blue"
onClick={() => navigate('/optimizer/content')} onClick={() => navigate('/optimizer/content')}
/> />
@@ -105,8 +112,8 @@ export default function OptimizerDashboard() {
title="Avg Score Improvement" title="Avg Score Improvement"
value={`+${stats.averageScoreImprovement}%`} value={`+${stats.averageScoreImprovement}%`}
subtitle="Average improvement per optimization" subtitle="Average improvement per optimization"
icon={<TrendingUp className="w-6 h-6" />} icon={<ArrowUpIcon className="w-6 h-6" />}
trend={null} accentColor="green"
onClick={() => navigate('/optimizer/content')} onClick={() => navigate('/optimizer/content')}
/> />
@@ -114,8 +121,8 @@ export default function OptimizerDashboard() {
title="Credits Used" title="Credits Used"
value={stats.totalCreditsUsed.toString()} value={stats.totalCreditsUsed.toString()}
subtitle="Total credits for optimization" subtitle="Total credits for optimization"
icon={<Zap className="w-6 h-6" />} icon={<BoltIcon className="w-6 h-6" />}
trend={null} accentColor="orange"
onClick={() => navigate('/optimizer/content')} onClick={() => navigate('/optimizer/content')}
/> />
</div> </div>
@@ -128,13 +135,13 @@ export default function OptimizerDashboard() {
className="flex items-center justify-between p-4 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" className="flex items-center justify-between p-4 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"
> >
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<Zap className="w-5 h-5 text-yellow-500" /> <BoltIcon className="w-5 h-5 text-yellow-500" />
<div> <div>
<h3 className="font-medium text-gray-900 dark:text-white">Optimize Content</h3> <h3 className="font-medium text-gray-900 dark:text-white">Optimize Content</h3>
<p className="text-sm text-gray-500 dark:text-gray-400">Select and optimize content items</p> <p className="text-sm text-gray-500 dark:text-gray-400">Select and optimize content items</p>
</div> </div>
</div> </div>
<ArrowRight className="w-5 h-5 text-gray-400" /> <ArrowRightIcon className="w-5 h-5 text-gray-400" />
</Link> </Link>
<Link <Link
@@ -142,13 +149,13 @@ export default function OptimizerDashboard() {
className="flex items-center justify-between p-4 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors" className="flex items-center justify-between p-4 border border-gray-200 dark:border-gray-700 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"
> >
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<FileText className="w-5 h-5 text-purple-500" /> <FileTextIcon className="w-5 h-5 text-purple-500" />
<div> <div>
<h3 className="font-medium text-gray-900 dark:text-white">View Content</h3> <h3 className="font-medium text-gray-900 dark:text-white">View Content</h3>
<p className="text-sm text-gray-500 dark:text-gray-400">Browse all content items</p> <p className="text-sm text-gray-500 dark:text-gray-400">Browse all content items</p>
</div> </div>
</div> </div>
<ArrowRight className="w-5 h-5 text-gray-400" /> <ArrowRightIcon className="w-5 h-5 text-gray-400" />
</Link> </Link>
</div> </div>
</ComponentCard> </ComponentCard>