From 9ca877602f77b0249649f03bec826a88b9516d42 Mon Sep 17 00:00:00 2001 From: creations Date: Sat, 31 May 2025 10:56:44 -0400 Subject: [PATCH] fix two simple bugs with reviews and timezone showing even if they dont exist --- public/js/index.js | 11 +++++++---- src/views/index.html | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index 3ef1d93..a232fec 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -132,7 +132,7 @@ function resolveActivityImage(img, applicationId) { async function populateReviews(userId) { if (!reviewURL || !userId || isLoadingReviews || !hasMoreReviews) return; - const reviewSection = document.querySelector(".reviews"); + const reviewSection = document.getElementById("reviews-section"); const reviewList = reviewSection?.querySelector(".reviews-list"); if (!reviewList) return; @@ -201,7 +201,9 @@ async function populateReviews(userId) { if (currentReviewOffset === 0) reviewList.innerHTML = reviewsHTML; else reviewList.insertAdjacentHTML("beforeend", reviewsHTML); - reviewSection.classList.remove("hidden"); + if (data.reviews.length > 0 && reviewsHTML) { + reviewSection.classList.remove("hidden"); + } hasMoreReviews = data.hasNextPage; isLoadingReviews = false; @@ -238,7 +240,8 @@ function populateTimezone(userId, format = "24h") { timezoneLoaded = true; const timezoneEl = document.querySelector(".timezone-value"); - if (!timezoneEl) return; + const timezoneWrapper = document.getElementById("timezone-wrapper"); + if (!timezoneEl || !timezoneWrapper) return; const now = new Date(); @@ -261,7 +264,7 @@ function populateTimezone(userId, format = "24h") { timezoneEl.textContent = format === "24h" ? time24 : time12; timezoneEl.title = `${format === "12h" ? time24 : time12} (${currentTimezone})`; - timezoneEl.classList.remove("hidden"); + timezoneWrapper.classList.remove("hidden"); } fetchTimezone(); diff --git a/src/views/index.html b/src/views/index.html index 1c4884f..5f71625 100644 --- a/src/views/index.html +++ b/src/views/index.html @@ -27,7 +27,7 @@ style="opacity: 0.5" loading="lazy" /> -
+ @@ -61,7 +61,7 @@ -