<?php
 
 
 
 

$albumTabs = [
    'newest'      => __('sort_newest'),
    'popular'     => __('sort_most_viewed'),
    'most_images' => __('sort_most_images'),
];
$albumTabs = HookSystem::applyFilter('front.album_sort_tabs', $albumTabs);
?>

<div class="section-title-row">
    <h1 class="section-title" style="text-transform:uppercase;"><?php echo htmlspecialchars($category['name']); ?><?php if ($pagination->total > 0): ?> <span style="font-weight:400;font-size:14px;color:var(--text-muted);margin-left:6px;"><?php echo Format::number($pagination->total); ?></span><?php endif; ?></h1>
    <?php if (!empty($albums)): ?>
        <?php echo simplySortDropdown($sort ?? 'newest', '', $albumTabs); ?>
    <?php endif; ?>
</div>

<?php if (!empty($category['description'])): ?>
<p style="color:var(--text-muted);font-size:14px;line-height:1.7;max-width:700px;margin:0 0 24px;"><?php echo htmlspecialchars($category['description']); ?></p>
<?php endif; ?>

<?php Ads::zone('album_listing_top'); ?>

<?php echo simplyAlbumBrowseBar(Album::activeType()); ?>

<div class="album-body">
    <?php echo simplyAlbumSidebar(Album::activeType()); ?>
    <main class="album-main">
        <?php if (!empty($albums)): ?>
        <div class="album-grid<?php echo simplyAlbumGridClass(); ?>">
            <?php foreach ($albums as $album): ?>
                <?php echo simplyAlbumCard($album); ?>
                <?php Ads::betweenGrid('album_listing_between', 10); ?>
            <?php endforeach; ?>
        </div>
        <?php else: ?>
        <div class="empty-state">
            <div class="empty-state__icon"><i class="fa-light fa-images"></i></div>
            <p class="empty-state__text"><?php echo __('no_albums'); ?></p>
        </div>
        <?php endif; ?>
        <?php Ads::zone('album_listing_bottom'); ?>
        <?php echo simplyPagination($pagination); ?>
    </main>
</div>
