From 4294dc54b16010c11fbd16705d38891ec5c7024a Mon Sep 17 00:00:00 2001 From: reecebrowne <74901996+reecebrowne@users.noreply.github.com> Date: Fri, 31 Jan 2025 16:22:56 +0000 Subject: [PATCH] Homepage ui hotfixes (#2837) # Description of Changes Fixed layout of homepage buttons when resizing pages Fixed bug showing/hiding favourites column toggle button --- ## Checklist ### General - [x ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ x] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [x ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md) (if applicable) - [ x] I have performed a self-review of my own code - [ x] My changes generate no new warnings ### Documentation - [ x] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ x] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ x] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ x] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing) for more details. --- src/main/resources/static/js/homecard.js | 7 +++---- src/main/resources/static/js/pages/home.js | 5 ----- src/main/resources/templates/home.html | 7 +++---- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/main/resources/static/js/homecard.js b/src/main/resources/static/js/homecard.js index 6534104c..09d5a8cb 100644 --- a/src/main/resources/static/js/homecard.js +++ b/src/main/resources/static/js/homecard.js @@ -95,24 +95,23 @@ function reorderCards(container) { function initializeCards() { updateFavoritesSection(); + updateFavoritesView(); updateFavoritesDropdown(); filterCards(); } function updateFavoritesView() { const isFavoritesView = JSON.parse(localStorage.getItem('favoritesView') || 'false'); - const textElement = document.getElementById('toggle-favourites-text'); const iconElement = document.getElementById('toggle-favourites-icon'); const favoritesGroup = document.querySelector('#groupFavorites'); const favoritesList = JSON.parse(localStorage.getItem('favoritesList')) || []; - document.getElementById('favouritesVisibility').style.display = 'flex'; if (isFavoritesView && favoritesList.length > 0) { - iconElement.textContent = 'visibility_off'; + document.getElementById('favouritesVisibility').style.display = 'flex'; favoritesGroup.style.display = 'flex'; } else { if (favoritesList.length > 0) { - iconElement.textContent = 'visibility'; + document.getElementById('favouritesVisibility').style.display = 'flex'; favoritesGroup.style.display = 'none'; } else { document.getElementById('favouritesVisibility').style.display = 'none'; diff --git a/src/main/resources/static/js/pages/home.js b/src/main/resources/static/js/pages/home.js index 1be5e796..9633c9a4 100644 --- a/src/main/resources/static/js/pages/home.js +++ b/src/main/resources/static/js/pages/home.js @@ -127,14 +127,9 @@ function adjustVisibleElements() { } function adjustContainerAlignment() { - console.log('Adjusting container alignment'); - document.querySelectorAll('.features-container').forEach((parent) => { parent.querySelectorAll('.feature-rows').forEach((container) => { - const childElements = Array.from(container.children); - const containerWidth = parent.offsetWidth; - console.log(containerWidth < 32 * parseFloat(getComputedStyle(document.documentElement).fontSize)); if (containerWidth < 32 * parseFloat(getComputedStyle(document.documentElement).fontSize)) { container.classList.add('single-column'); } else { diff --git a/src/main/resources/templates/home.html b/src/main/resources/templates/home.html index 5e39c768..f53558c6 100644 --- a/src/main/resources/templates/home.html +++ b/src/main/resources/templates/home.html @@ -55,7 +55,7 @@ -