โป ๏ธ refactor: restructure TaskLogsTable into modular component architecture
Refactor the monolithic TaskLogsTable component (802 lines) into a modular, maintainable architecture following the established pattern from LogsTable and MjLogsTable refactors. ## What Changed ###๐ ๏ธ Architecture - Split large single file into focused, single-responsibility components - Introduced custom hook `useTaskLogsData` for centralized state management - Created dedicated column definitions file for better organization - Implemented modal components for user interactions ###๐ New Structure ``` web/src/components/table/task-logs/ โโโ index.jsx # Main page component orchestrator โโโ TaskLogsTable.jsx # Pure table rendering component โโโ TaskLogsActions.jsx # Actions area (task records + compact mode) โโโ TaskLogsFilters.jsx # Search form component โโโ TaskLogsColumnDefs.js # Column definitions and renderers โโโ modals/ โโโ ColumnSelectorModal.jsx # Column visibility settings โโโ ContentModal.jsx # Content viewer for JSON data web/src/hooks/task-logs/ โโโ useTaskLogsData.js # Custom hook for state & logic ``` ###๐ฏ Key Improvements - **Maintainability**: Clear separation of concerns, easier to understand - **Reusability**: Modular components can be reused independently - **Performance**: Optimized with `useMemo` for column rendering - **Testing**: Single-responsibility components easier to test - **Developer Experience**: Better code organization and readability ###๐จ Task-Specific Features Preserved - All task type rendering with icons (MUSIC, LYRICS, video generation) - Platform-specific rendering (Suno, Kling, Jimeng) with distinct colors - Progress indicators for task completion status - Video preview links for successful video generation tasks - Admin-only columns for channel information - Status rendering with appropriate colors and icons ###๐ง Technical Details - Centralized all business logic in `useTaskLogsData` custom hook - Extracted comprehensive column definitions with Lucide React icons - Split complex UI into focused components (table, actions, filters, modals) - Maintained responsive design patterns for mobile compatibility - Preserved admin permission handling for restricted features - Optimized spacing and layout (reduced gap from 4 to 2 for better density) ###๐ฎ Platform Support - **Suno**: Music and lyrics generation with music icons - **Kling**: Video generation with video icons - **Jimeng**: Video generation with distinct purple styling ###๐ Fixes - Improved component prop passing patterns - Enhanced type safety through better state management - Optimized rendering performance with proper memoization - Streamlined export pattern using `export { default }` ## Breaking Changes None - all existing imports and functionality preserved.
Showing
This diff is collapsed.
Click to expand it.
web/src/components/table/task-logs/TaskLogsTable.jsx
0 โ 100644
web/src/components/table/task-logs/index.jsx
0 โ 100644
web/src/hooks/task-logs/useTaskLogsData.js
0 โ 100644
Please
register
or
sign in
to comment