fix two simple bugs with reviews and timezone showing even if they dont exist
All checks were successful
Code quality checks / biome (push) Successful in 9s
All checks were successful
Code quality checks / biome (push) Successful in 9s
This commit is contained in:
parent
152d1c475f
commit
9ca877602f
2 changed files with 9 additions and 6 deletions
|
@ -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);
|
||||
|
||||
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();
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
style="opacity: 0.5" loading="lazy" />
|
||||
</a>
|
||||
|
||||
<div class="timezone-wrapper" id="timezone-wrapper" aria-label="Timezone Information">
|
||||
<div class="timezone-wrapper hidden" id="timezone-wrapper" aria-label="Timezone Information">
|
||||
<span class="timezone-label">Users Time:</span>
|
||||
<span class="timezone-value"></span>
|
||||
</div>
|
||||
|
@ -61,7 +61,7 @@
|
|||
</section>
|
||||
</main>
|
||||
|
||||
<section class="reviews hidden" aria-label="User Reviews">
|
||||
<section class="reviews hidden" aria-label="User Reviews" id="reviews-section">
|
||||
<h2>User Reviews</h2>
|
||||
<ul class="reviews-list">
|
||||
</ul>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue