Files
michaelschiemer/src/Application/Admin/Content/ImageManagerController.php
Michael Schiemer 8f3c15ddbb fix(console): comprehensive TUI rendering fixes
- Fix Enter key detection: handle multiple Enter key formats (\n, \r, \r\n)
- Reduce flickering: lower render frequency from 60 FPS to 30 FPS
- Fix menu bar visibility: re-render menu bar after content to prevent overwriting
- Fix content positioning: explicit line positioning for categories and commands
- Fix line shifting: clear lines before writing, control newlines manually
- Limit visible items: prevent overflow with maxVisibleCategories/Commands
- Improve CPU usage: increase sleep interval when no events processed

This fixes:
- Enter key not working for selection
- Strong flickering of the application
- Menu bar not visible or being overwritten
- Top half of selection list not displayed
- Lines being shifted/misaligned
2025-11-10 11:06:07 +01:00

48 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Application\Admin\Content;
use App\Domain\Media\ImageRepository;
use App\Domain\Media\ImageSlotRepository;
use App\Framework\Admin\Attributes\AdminPage;
use App\Framework\Admin\Attributes\AdminSection;
use App\Framework\Attributes\Route;
use App\Framework\DateTime\Clock;
use App\Framework\Http\Method;
use App\Framework\Meta\MetaData;
use App\Framework\Router\Result\ViewResult;
#[AdminSection(name: 'Content', icon: 'photo', order: 3, description: 'Content management')]
final readonly class ImageManagerController
{
public function __construct(
private ImageSlotRepository $slotRepository,
private ImageRepository $imageRepository,
private Clock $clock,
) {
}
#[AdminPage(title: 'Images', icon: 'images', section: 'Content', order: 10)]
#[Route(path: '/admin/content/images', method: Method::GET, name: 'admin.content.images')]
public function show(): ViewResult
{
$slots = $this->slotRepository->findAllWithImages();
$images = $this->imageRepository->findAll(100, 0);
$data = [
'title' => 'Image Manager',
'slots' => $slots,
'images' => $images,
'current_year' => $this->clock->now()->format('Y'),
];
return new ViewResult(
'image-manager',
new MetaData('Image Manager'),
$data
);
}
}