This commit is contained in:
@@ -3,6 +3,7 @@ $app = app();
|
||||
$flash = $app->flash()->get();
|
||||
|
||||
$eventsForJs = [];
|
||||
$threadsForJs = [];
|
||||
try {
|
||||
$pdo = $app->pdo();
|
||||
if ($pdo) {
|
||||
@@ -29,9 +30,24 @@ try {
|
||||
'lng' => $r['lng'] !== null ? (float)$r['lng'] : null,
|
||||
];
|
||||
}
|
||||
|
||||
$communityCfg = require __DIR__ . '/../../../config/community.php';
|
||||
$community = new \App\Community($pdo, $communityCfg);
|
||||
$threads = $community->listThreads(8);
|
||||
foreach ($threads as $thread) {
|
||||
$threadsForJs[] = [
|
||||
'id' => (int)$thread['id'],
|
||||
'title' => (string)$thread['title'],
|
||||
'body' => (string)$thread['body'],
|
||||
'displayName' => (string)($thread['display_name'] ?: 'Mitglied'),
|
||||
'createdAt' => (string)$thread['created_at'],
|
||||
'answers' => (int)$thread['answers'],
|
||||
];
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
$eventsForJs = [];
|
||||
$threadsForJs = [];
|
||||
}
|
||||
?>
|
||||
<main>
|
||||
@@ -110,6 +126,21 @@ try {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section alt" id="community-preview">
|
||||
<div class="container">
|
||||
<div class="section__intro">
|
||||
<h2>Tausch dich in der Community aus</h2>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<button class="btn ghost slider__nav" type="button" data-thread-slider-prev aria-label="Zurück">‹</button>
|
||||
<div class="slider__viewport">
|
||||
<div class="slider__track" id="threadSlider"></div>
|
||||
</div>
|
||||
<button class="btn ghost slider__nav" type="button" data-thread-slider-next aria-label="Weiter">›</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section alt" id="mitgliederbereich">
|
||||
<div class="container">
|
||||
<div class="section__intro">
|
||||
@@ -146,6 +177,7 @@ try {
|
||||
</main>
|
||||
<script>
|
||||
window.__events = <?= json_encode($eventsForJs, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
|
||||
window.__threads = <?= json_encode($threadsForJs, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
|
||||
</script>
|
||||
<div class="modal" id="eventModal">
|
||||
<div class="panel">
|
||||
|
||||
Reference in New Issue
Block a user