<?php header('Content-Type: text/html; charset=UTF-8'); ?>

<?php
// views/home.php - Vista della pagina principale
$stations = loadRadioStations();
?>

<h1 class="titlePage">Radio</h1>
<p class="subtitlePage">Seleziona la tua radio che vuoi ascoltare</p>

<hr>

<div class="stationList">
    <div class="row g-2">
        <?php foreach ($stations as $station): ?>
        <div class="col-6">
            <div class="stationCard <?php if((string)$station->thematic === 'true'){echo "isthematic";} ?>" data-id="<?php echo $station->id; ?>">
                <a href="<?php echo $base_path; ?>/play/<?php echo $station->id; ?>" data-page="play/<?php echo $station->id; ?>" class="nav-link stationLink">
                    <img src="<?php echo $station->logo; ?>" alt="<?php echo $station->name; ?>" class="stationLogo">
                </a>
            </div>
        </div>
        <?php endforeach; ?>
    </div>
</div>

<a href="<?php echo $base_path; ?>/home" data-page="home" class="linkBox mt-3">
    <div class="clickBox mt-5 mb-4">
        <svg class="w-6 h-6 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12l4-4m-4 4 4 4"/></svg>
        Torna alla Home
    </div>
</a>