app = new Application(); $this->window = new Window('Server Manager', 800, 600); $this->settings = new Settings('ServerManager'); } public function run(): void { // Main container $mainContainer = new Container('flex flex-col bg-gray-100'); // Status label (referenced by tabs) $statusLabel = new Label( text: 'Fenster: ' . $this->window->getViewport()->windowWidth . 'x' . $this->window->getViewport()->windowHeight, style: 'basis-4/8 text-black' ); // Settings variables (simple variables work better with async than object properties) $currentApiKey = $this->settings->get('api_key', ''); $currentPrivateKeyPath = $this->settings->get('private_key_path', ''); $currentRemoteStartDir = $this->settings->get('remote_start_dir', '/'); // Create menu bar first $menuBar = new \PHPNative\Ui\Widget\MenuBar(); $mainContainer->addComponent($menuBar); // Create settings modal with the real menu bar $settingsModal = new SettingsModal($this->settings, $menuBar, $currentApiKey, $currentPrivateKeyPath, $currentRemoteStartDir); $mainContainer->addComponent($settingsModal->getModal()); // Build menu bar menus after modal is created MenuBarBuilder::buildMenus($this->app, $menuBar, $settingsModal); // Tab container $tabContainer = new TabContainer('flex-1'); // Create tabs $kanbanTab = new KanbanTab($this->settings); $serverListTab = new ServerListTab( $currentApiKey, $currentPrivateKeyPath, $tabContainer, $statusLabel, $this->settings, $kanbanTab, ); $sftpManagerTab = new SftpManagerTab( $currentApiKey, $currentPrivateKeyPath, $currentRemoteStartDir, $serverListTab, $tabContainer, $statusLabel, ); // Add tabs $tabContainer->addTab('Server', $serverListTab->getContainer()); $tabContainer->addTab('Kanban', $kanbanTab->getContainer()); $tabContainer->addTab('SFTP Manager', $sftpManagerTab->getContainer()); $mainContainer->addComponent($tabContainer); // Add modals to main container (must be at top level for overlay to work) $mainContainer->addComponent($sftpManagerTab->getEditModal()); $mainContainer->addComponent($sftpManagerTab->getFilenameModal()); $mainContainer->addComponent($sftpManagerTab->getRenameModal()); $mainContainer->addComponent($sftpManagerTab->getDeleteConfirmModal()); // Status bar $statusBar = new StatusBar(); $statusBar->addSegment($statusLabel); $statusBar->addSegment(new Label('v1.0', 'basis-1/8 text-center text-black border-l border-gray-300')); $statusBar->addSegment(new Label( 'PHPNative Framework', 'basis-3/8 text-right text-black pr-2 border-l border-gray-300' )); $mainContainer->addComponent($statusBar); // Set window content and run $this->window->setRoot($mainContainer); $this->app->addWindow($this->window); $this->app->run(); } }