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.
This commit is contained in:
reecebrowne 2025-01-31 16:22:56 +00:00 committed by GitHub
parent e3adb38a06
commit 4294dc54b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 13 deletions

View File

@ -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';

View File

@ -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 {

View File

@ -55,7 +55,7 @@
</span>
<input type="text" id="searchBar" onkeyup="filterCards()" th:placeholder="#{home.searchBar}" autofocus>
<div style="display: flex;">
<div style="display: flex; column-gap: 3rem; flex-wrap: wrap; margin-left:1rem">
<div
style="height:2.5rem; display: flex; align-items: center; cursor: pointer; justify-content: center;">
<label for="sort-options">Sort by:</label>
@ -66,9 +66,8 @@
<!-- <option value="server">Popularity in organisation</option> -->
</select>
</div>
<div
style="display: flex; margin-left:2rem;align-items: center; flex-wrap: wrap; align-content: flex-start; width: fit-content; max-width: 100%; gap:3rem; justify-content: center;">
<div th:title="#{home.setFavorites}" style="display: flex; align-items: center; cursor: pointer;" onclick="toggleFavoritesMode()">
<div style="display: flex; align-items: center; flex-wrap: wrap; align-content: flex-start; width: fit-content; max-width: 100%; gap:2rem; justify-content: center;">
<div th:title="#{home.setFavorites}" style="display: flex; align-items: center; cursor: pointer;" onclick="toggleFavoritesMode()">
<span class="material-symbols-rounded toggle-favourites"
style="font-size: 2rem; margin-left: 0.2rem;">
star