Files
desktop/src/App/App.php
Lars Gebhardt-Kusche 853dab5cef
Some checks failed
Deploy / deploy-staging (push) Failing after 6m30s
Deploy / deploy-production (push) Has been skipped
Skin upload
2026-06-08 01:53:05 +02:00

67 lines
2.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App;
use Desktop\AppRegistry;
use Desktop\AppIconResolver;
use Desktop\DesktopState;
use Desktop\SkinResolver;
use Desktop\WidgetRegistry;
use Desktop\WindowManager;
final class App
{
public function __construct(
private readonly string $projectRoot,
) {
}
/**
* @return array<string, mixed>
*/
public function desktopPayload(): array
{
$registry = new AppRegistry($this->projectRoot . '/config/apps.php');
$widgetRegistry = new WidgetRegistry($this->projectRoot . '/config/widgets.php');
$skins = SkinResolver::all();
$activeSkin = SkinResolver::resolve($_GET['skin'] ?? null);
$apps = AppIconResolver::decorate($registry->all(), $activeSkin);
$windows = (new WindowManager($registry))->defaultWindows();
$activeWidgetIds = DesktopState::defaultWidgetIds();
return [
'meta' => [
'title' => 'Kusche.Berlin Desktop UI',
'active_skin' => $activeSkin,
'available_skins' => $skins,
'base_skin_profile' => SkinResolver::profile('base'),
'skin_profile' => SkinResolver::profile($activeSkin),
],
'desktop' => [
'greeting' => 'Neue Desktop-Shell fuer Kusche.Berlin',
'wallpaper' => SkinResolver::wallpaper($activeSkin),
'storage_scope' => 'guest',
'workspace' => DesktopState::defaultWorkspace(),
'login' => [
'authenticated' => false,
'mode' => 'public-home',
'keycloak_theme_handoff' => '/docs/keycloak-theme-handoff.md',
],
],
'apps' => $apps,
'windows' => $windows,
'widgets' => [
'active' => $widgetRegistry->active($activeWidgetIds),
'registry' => $widgetRegistry->all(),
'active_ids' => $activeWidgetIds,
],
'tray' => DesktopState::trayItems(),
'menu' => [
'quick_actions' => DesktopState::quickActions(),
],
];
}
}