feat: Complete Stage 2 frontend refactor
- Removed deprecated fields from Content and Task models, including entity_type, sync_status, and cluster_role. - Updated Content model to include new fields: content_type, content_structure, taxonomy_terms, source, external_id, and cluster_id. - Refactored Writer module components (Content, ContentView, Dashboard, Tasks) to align with new schema. - Enhanced Dashboard metrics and removed unused filters. - Implemented ClusterDetail page to display cluster information and associated content. - Updated API service interfaces to reflect changes in data structure. - Adjusted sorting and filtering logic across various components to accommodate new field names and types. - Improved user experience by providing loading states and error handling in data fetching.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { SourceBadge, ContentSource } from './SourceBadge';
|
||||
import { SyncStatusBadge, SyncStatus } from './SyncStatusBadge';
|
||||
|
||||
interface ContentFilterProps {
|
||||
onFilterChange: (filters: FilterState) => void;
|
||||
@@ -9,14 +8,12 @@ interface ContentFilterProps {
|
||||
|
||||
export interface FilterState {
|
||||
source: ContentSource | 'all';
|
||||
syncStatus: SyncStatus | 'all';
|
||||
search: string;
|
||||
}
|
||||
|
||||
export const ContentFilter: React.FC<ContentFilterProps> = ({ onFilterChange, className = '' }) => {
|
||||
const [filters, setFilters] = useState<FilterState>({
|
||||
source: 'all',
|
||||
syncStatus: 'all',
|
||||
search: '',
|
||||
});
|
||||
|
||||
@@ -26,12 +23,6 @@ export const ContentFilter: React.FC<ContentFilterProps> = ({ onFilterChange, cl
|
||||
onFilterChange(newFilters);
|
||||
};
|
||||
|
||||
const handleSyncStatusChange = (syncStatus: SyncStatus | 'all') => {
|
||||
const newFilters = { ...filters, syncStatus };
|
||||
setFilters(newFilters);
|
||||
onFilterChange(newFilters);
|
||||
};
|
||||
|
||||
const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const search = e.target.value;
|
||||
const newFilters = { ...filters, search };
|
||||
@@ -81,37 +72,6 @@ export const ContentFilter: React.FC<ContentFilterProps> = ({ onFilterChange, cl
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Sync Status Filter */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Sync Status</label>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<button
|
||||
onClick={() => handleSyncStatusChange('all')}
|
||||
className={`px-3 py-1 rounded-full text-sm font-medium transition-colors ${
|
||||
filters.syncStatus === 'all'
|
||||
? 'bg-blue-500 text-white'
|
||||
: 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600'
|
||||
}`}
|
||||
>
|
||||
All
|
||||
</button>
|
||||
{(['native', 'imported', 'synced'] as SyncStatus[]).map((status) => (
|
||||
<button
|
||||
key={status}
|
||||
onClick={() => handleSyncStatusChange(status)}
|
||||
className={`px-3 py-1 rounded-full text-sm font-medium transition-colors ${
|
||||
filters.syncStatus === status
|
||||
? 'bg-blue-500 text-white'
|
||||
: 'bg-gray-100 text-gray-700 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600'
|
||||
}`}
|
||||
>
|
||||
<SyncStatusBadge status={status} />
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user