dashboard - whole redesign and rewrite

This commit is contained in:
2026-09-04 13:15:08 +02:00
parent 87fc43db87
commit 01b4be301f
9 changed files with 273 additions and 99 deletions
@@ -8,8 +8,8 @@ require_once __DIR__ . '/../../../general_files/ini/runtime_env.php';
const DASHBOARD_TIMEZONE = 'Europe/Berlin';
const DASHBOARD_HA_ENTITY_ID = 'sensor.temp_temperatur';
const DASHBOARD_OPENWEATHER_LATITUDE = '52.571291';
const DASHBOARD_OPENWEATHER_LONGITUDE = '13.310422';
const DASHBOARD_OPENWEATHER_LATITUDE = '52.571524';
const DASHBOARD_OPENWEATHER_LONGITUDE = '13.312494';
const DASHBOARD_NEWS_URL = '/intranet_repo/projects/contentpanel/insertion/news/png/';
function dashboard_now(): DateTimeImmutable
@@ -91,15 +91,12 @@ function dashboard_prepare_announcement(array $announcement, DateTimeImmutable $
$place = trim((string) ($announcement['ansage_ort'] ?? ''));
return [
'start' => $start,
'end' => $end,
'date_label' => $label,
'end_label' => $endLabel,
'time' => $time,
'place' => $place,
'title' => trim((string) ($announcement['ansage_titel'] ?? '')),
'subtitle' => trim((string) ($announcement['ansage_untertitel'] ?? '')),
'meta' => implode(' · ', array_filter([$label, $endLabel, $time !== '' ? $time . ' Uhr' : '', $place])),
];
}
@@ -146,8 +143,8 @@ function dashboard_list_posters(DateTimeImmutable $now, string $directory = CONT
$title = str_replace('_', ' ', substr($match[1], 11));
$posters[] = $image + [
'document' => $match[1],
'kind' => 'poster', 'expires' => $expiry, 'page' => (int) $match[2],
'title' => $title, 'alt' => $title . ' · Seite ' . (int) $match[2],
'expires' => $expiry, 'page' => (int) $match[2],
'alt' => $title . ' · Seite ' . (int) $match[2],
];
}
}
@@ -162,10 +159,7 @@ function dashboard_month_images(?string $directory = null): array
$filename = 'terminuebersicht-' . $page . '.png';
$image = dashboard_image($directory . '/' . $filename, 'month/' . $filename);
if ($image) {
$images[] = $image + [
'kind' => 'month', 'page' => $page, 'title' => 'Monatsplan',
'alt' => 'Monatsplan · Seite ' . $page,
];
$images[] = $image + ['alt' => 'Monatsplan · Seite ' . $page];
}
}
return $images;
@@ -183,7 +177,7 @@ function dashboard_fetch_indoor_temperature(): array
}
return [
'value' => round((float) $data['state'], 1),
'value' => (int) ceil((float) $data['state'] - 0.4),
'unit' => (string) ($data['attributes']['unit_of_measurement'] ?? '°C'),
];
}