โป ๏ธ refactor: restructure MjLogsTable into modular component architecture
Refactor the monolithic MjLogsTable component (971 lines) into a modular, maintainable architecture following the same pattern as LogsTable refactor. ## What Changed ###๐ ๏ธ Architecture - Split large single file into focused, single-responsibility components - Introduced custom hook `useMjLogsData` for centralized state management - Created dedicated column definitions file for better organization - Implemented specialized modal components for Midjourney-specific features ###๐ New Structure ``` web/src/components/table/mj-logs/ โโโ index.jsx # Main page component orchestrator โโโ MjLogsTable.jsx # Pure table rendering component โโโ MjLogsActions.jsx # Actions area (banner + compact mode) โโโ MjLogsFilters.jsx # Search form component โโโ MjLogsColumnDefs.js # Column definitions and renderers โโโ modals/ โโโ ColumnSelectorModal.jsx # Column visibility settings โโโ ContentModal.jsx # Content viewer (text + image preview) web/src/hooks/mj-logs/ โโโ useMjLogsData.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 ###๐จ Midjourney-Specific Features Preserved - All task type rendering with icons (IMAGINE, UPSCALE, VARIATION, etc.) - Status rendering with appropriate colors and icons - Image preview functionality for generated artwork - Progress indicators for task completion - Admin-only columns for channel and submission results - Banner notification system for callback settings ###๐ง Technical Details - Centralized all business logic in `useMjLogsData` 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 ###๐ Fixes - Improved component prop passing patterns - Enhanced type safety through better state management - Optimized rendering performance with proper memoization ## Breaking Changes None - all existing imports and functionality preserved.
Showing
web/src/components/table/mj-logs/MjLogsActions.jsx
0 โ 100644
web/src/components/table/mj-logs/MjLogsColumnDefs.js
0 โ 100644
web/src/components/table/mj-logs/MjLogsFilters.jsx
0 โ 100644
web/src/components/table/mj-logs/MjLogsTable.jsx
0 โ 100644
web/src/components/table/mj-logs/index.jsx
0 โ 100644
web/src/hooks/mj-logs/useMjLogsData.js
0 โ 100644
Please
register
or
sign in
to comment