refactor-upto-phase 6
This commit is contained in:
@@ -6,24 +6,25 @@
|
||||
*/
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
CheckCircleIcon,
|
||||
XCircleIcon,
|
||||
AlertCircleIcon,
|
||||
RefreshCwIcon,
|
||||
ClockIcon,
|
||||
FileTextIcon,
|
||||
TagIcon,
|
||||
PackageIcon,
|
||||
ArrowRightIcon,
|
||||
ChevronDownIcon,
|
||||
ChevronUpIcon,
|
||||
} from 'lucide-react';
|
||||
import PageMeta from '../../components/common/PageMeta';
|
||||
import PageHeader from '../../components/common/PageHeader';
|
||||
import { Card } from '../../components/ui/card';
|
||||
import Button from '../../components/ui/button/Button';
|
||||
import Badge from '../../components/ui/badge/Badge';
|
||||
import { useToast } from '../../components/ui/toast/ToastContainer';
|
||||
import {
|
||||
CheckCircleIcon,
|
||||
ErrorIcon,
|
||||
AlertIcon,
|
||||
BoltIcon,
|
||||
TimeIcon,
|
||||
FileIcon,
|
||||
BoxIcon,
|
||||
ArrowRightIcon,
|
||||
ChevronDownIcon,
|
||||
ChevronUpIcon,
|
||||
PlugInIcon
|
||||
} from '../../icons';
|
||||
import {
|
||||
fetchSyncStatus,
|
||||
runSync,
|
||||
@@ -106,12 +107,12 @@ export default function SyncDashboard() {
|
||||
case 'success':
|
||||
return <CheckCircleIcon className="w-5 h-5 text-green-600 dark:text-green-400" />;
|
||||
case 'warning':
|
||||
return <AlertCircleIcon className="w-5 h-5 text-yellow-600 dark:text-yellow-400" />;
|
||||
return <AlertIcon className="w-5 h-5 text-yellow-600 dark:text-yellow-400" />;
|
||||
case 'error':
|
||||
case 'failed':
|
||||
return <XCircleIcon className="w-5 h-5 text-red-600 dark:text-red-400" />;
|
||||
return <ErrorIcon className="w-5 h-5 text-red-600 dark:text-red-400" />;
|
||||
default:
|
||||
return <ClockIcon className="w-5 h-5 text-gray-400" />;
|
||||
return <TimeIcon className="w-5 h-5 text-gray-400" />;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -132,7 +133,7 @@ export default function SyncDashboard() {
|
||||
<PageMeta title="Sync Dashboard" />
|
||||
<Card className="p-6">
|
||||
<div className="text-center py-8">
|
||||
<AlertCircleIcon className="w-12 h-12 text-gray-400 mx-auto mb-3" />
|
||||
<AlertIcon className="w-12 h-12 text-gray-400 mx-auto mb-3" />
|
||||
<p className="text-gray-600 dark:text-gray-400">No sync data available</p>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -153,30 +154,26 @@ export default function SyncDashboard() {
|
||||
<div className="p-6">
|
||||
<PageMeta title="Sync Dashboard" />
|
||||
|
||||
{/* Header */}
|
||||
<div className="mb-6 flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold text-gray-900 dark:text-white">Sync Dashboard</h1>
|
||||
<p className="text-gray-600 dark:text-gray-400 mt-1">
|
||||
Monitor and manage WordPress sync status
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => navigate(`/sites/${siteId}`)}
|
||||
>
|
||||
Back to Dashboard
|
||||
</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={() => handleSync('both')}
|
||||
disabled={syncing || !hasIntegrations}
|
||||
>
|
||||
<RefreshCwIcon className={`w-4 h-4 mr-2 ${syncing ? 'animate-spin' : ''}`} />
|
||||
{syncing ? 'Syncing...' : 'Sync All'}
|
||||
</Button>
|
||||
</div>
|
||||
<PageHeader
|
||||
title="Sync Dashboard"
|
||||
badge={{ icon: <PlugInIcon />, color: 'blue' }}
|
||||
hideSiteSector
|
||||
/>
|
||||
<div className="mb-6 flex justify-end gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => navigate(`/sites/${siteId}`)}
|
||||
>
|
||||
Back to Dashboard
|
||||
</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={() => handleSync('both')}
|
||||
disabled={syncing || !hasIntegrations}
|
||||
>
|
||||
<BoltIcon className={`w-4 h-4 mr-2 ${syncing ? 'animate-spin' : ''}`} />
|
||||
{syncing ? 'Syncing...' : 'Sync All'}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Overall Status */}
|
||||
@@ -275,7 +272,7 @@ export default function SyncDashboard() {
|
||||
) : (
|
||||
<Card className="p-6 mb-6">
|
||||
<div className="text-center py-8">
|
||||
<AlertCircleIcon className="w-12 h-12 text-gray-400 mx-auto mb-3" />
|
||||
<AlertIcon className="w-12 h-12 text-gray-400 mx-auto mb-3" />
|
||||
<p className="text-gray-600 dark:text-gray-400 mb-2">No active integrations</p>
|
||||
<Button
|
||||
variant="primary"
|
||||
@@ -311,7 +308,7 @@ export default function SyncDashboard() {
|
||||
mismatches.taxonomies.missing_in_igny8.length > 0) && (
|
||||
<div>
|
||||
<h3 className="text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2">
|
||||
<TagIcon className="w-4 h-4" />
|
||||
<BoxIcon className="w-4 h-4" />
|
||||
Taxonomy Mismatches
|
||||
</h3>
|
||||
<div className="space-y-2">
|
||||
@@ -348,7 +345,7 @@ export default function SyncDashboard() {
|
||||
mismatches.products.missing_in_igny8.length > 0) && (
|
||||
<div>
|
||||
<h3 className="text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2">
|
||||
<PackageIcon className="w-4 h-4" />
|
||||
<BoxIcon className="w-4 h-4" />
|
||||
Product Mismatches
|
||||
</h3>
|
||||
<div className="space-y-2">
|
||||
@@ -375,7 +372,7 @@ export default function SyncDashboard() {
|
||||
mismatches.posts.missing_in_igny8.length > 0) && (
|
||||
<div>
|
||||
<h3 className="text-sm font-semibold text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2">
|
||||
<FileTextIcon className="w-4 h-4" />
|
||||
<FileIcon className="w-4 h-4" />
|
||||
Post Mismatches
|
||||
</h3>
|
||||
<div className="space-y-2">
|
||||
@@ -404,7 +401,7 @@ export default function SyncDashboard() {
|
||||
onClick={() => handleSync('both')}
|
||||
disabled={syncing}
|
||||
>
|
||||
<RefreshCwIcon className="w-4 h-4 mr-2" />
|
||||
<BoltIcon className="w-4 h-4 mr-2" />
|
||||
Retry Sync to Resolve
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user