From 783dd51e5a7d141ce3d40e5c74c54bc741935a31 Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Sat, 21 Feb 2026 13:26:02 +0300 Subject: [PATCH] Public: fix mobile topic drawer and simplify bottom nav Ensure topic items remain visible in the mobile sidebar by building and rendering a filtered visible topic tree with non-zero counts. Remove the redundant 'back to section/topic' action from the photo bottom nav and tighten its layout while keeping menu toggle access. --- index.php | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/index.php b/index.php index 231bbdb..b854f1a 100644 --- a/index.php +++ b/index.php @@ -65,6 +65,7 @@ $topics = []; $topicCounts = []; $topicTree = []; $hasVisibleTopics = false; +$visibleTopicTree = []; try { $topics = topicsAllForSelect(); if ($activeTopicId > 0) { @@ -75,12 +76,27 @@ try { } $topicCounts = topicPhotoCounts(null); $topicTree = buildTopicTreePublic($topics); - foreach ($topics as $topicItem) { - if ((int)($topicCounts[(int)$topicItem['id']] ?? 0) > 0) { - $hasVisibleTopics = true; - break; + foreach ($topicTree as $root) { + $rootCount = (int)($topicCounts[(int)$root['id']] ?? 0); + $visibleChildren = []; + foreach (($root['children'] ?? []) as $child) { + $childCount = (int)($topicCounts[(int)$child['id']] ?? 0); + if ($childCount < 1) { + continue; + } + $child['visible_count'] = $childCount; + $visibleChildren[] = $child; } + + if ($rootCount < 1 && $visibleChildren === []) { + continue; + } + + $root['visible_count'] = $rootCount; + $root['children'] = $visibleChildren; + $visibleTopicTree[] = $root; } + $hasVisibleTopics = $visibleTopicTree !== []; } catch (Throwable) { $topics = []; $topicCounts = []; @@ -88,6 +104,7 @@ try { $activeTopicId = 0; $filterMode = $activeSectionId > 0 ? 'section' : 'none'; $hasVisibleTopics = false; + $visibleTopicTree = []; } $photos = ($activeSectionId > 0 || $activeTopicId > 0) @@ -383,7 +400,7 @@ function outputWatermarked(string $path, string $mime): never .has-mobile-nav .app{padding-bottom:84px} .mobile-photo-nav,.mobile-catalog-nav{position:fixed;left:0;right:0;bottom:0;z-index:50;display:grid;align-items:center;gap:8px;padding:10px 12px calc(10px + env(safe-area-inset-bottom));background:rgba(255,255,255,.97);backdrop-filter:blur(6px);border-top:1px solid #e5e7eb} - .mobile-photo-nav{grid-template-columns:auto auto 1fr auto auto} + .mobile-photo-nav{grid-template-columns:auto 1fr auto auto} .mobile-catalog-nav{grid-template-columns:auto 1fr} .mobile-nav-link{padding:8px 10px;font-size:13px} @@ -430,25 +447,18 @@ function outputWatermarked(string $path, string $mime): never - +