// core/torrent-handler/routes.js import React from 'react'; import { TorrentDashboard, AddTorrentForm, TorrentSettings } from './components'; export default function registerRoutes(framework, core) { // Register routes based on navigation items in manifest framework.registerRoute('/torrents', () => ); framework.registerRoute('/torrents/add', ({navigate}) => ); framework.registerRoute('/torrents/settings', ({navigate}) => ); } // core/torrent-handler/register.js import TorrentHandlerCore from './index'; import registerRoutes from './routes'; import manifest from './manifest'; // Register the core system with the framework export default function register(framework) { // Create instance of the core system const core = new TorrentHandlerCore(framework); // Register core with the framework framework.registerCore(core.id, core); // Register navigation items manifest.navigation.forEach(item => { framework.registerNavigationItem(item.id, { name: item.name, icon: item.icon, route: item.route, coreId: core.id }); }); // Register routes registerRoutes(framework, core); // Register CSS/Styles framework.registerStyles(` /* Torrent Dashboard Styles */ .torrent-dashboard .progress-bar { width: 100%; background-color: #f1f1f1; border-radius: 4px; position: relative; height: 20px; } .torrent-dashboard .progress-fill { background-color: #4CAF50; height: 100%; border-radius: 4px; transition: width 0.3s ease; } .torrent-dashboard .progress-bar span { position: absolute; text-align: center; line-height: 20px; width: 100%; color: #000; font-size: 12px; } .torrent-dashboard .torrents-table { width: 100%; border-collapse: collapse; margin-top: 20px; } .torrent-dashboard .torrents-table th, .torrent-dashboard .torrents-table td { padding: 8px; text-align: left; border-bottom: 1px solid #ddd; } .torrent-dashboard .torrents-table th { background-color: #f2f2f2; font-weight: bold; } .torrent-dashboard .torrents-table .actions { display: flex; gap: 5px; } .error-message, .success-message { padding: 10px; margin: 10px 0; border-radius: 4px; display: flex; justify-content: space-between; align-items: center; } .error-message { background-color: #f8d7da; color: #721c24; } .success-message { background-color: #d4edda; color: #155724; } /* Form Styles */ .form-group { margin-bottom: 15px; } .form-group label { display: block; margin-bottom: 5px; font-weight: bold; } .form-group input[type="text"], .form-group input[type="password"], .form-group input[type="number"] { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; } .form-group .help-text { font-size: 12px; color: #666; margin-top: 3px; } .form-actions { display: flex; gap: 10px; margin-top: 20px; } button { padding: 8px 16px; background-color: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; } button:hover { background-color: #45a049; } button:disabled { background-color: #cccccc; cursor: not-allowed; } button[type="button"] { background-color: #f1f1f1; color: #333; } button[type="button"]:hover { background-color: #e0e0e0; } fieldset { margin-bottom: 20px; border: 1px solid #ddd; padding: 15px; border-radius: 4px; } legend { font-weight: bold; padding: 0 10px; } `); // Return success return { success: true, message: `${manifest.name} core system registered successfully` }; }