mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-03 20:12:59 +00:00
f
This commit is contained in:
+31
-10
@@ -2540,6 +2540,11 @@ function renderIcons(searchTerm) {
|
|||||||
const iconList = document.getElementById('iconList');
|
const iconList = document.getElementById('iconList');
|
||||||
if (!iconList) return;
|
if (!iconList) return;
|
||||||
|
|
||||||
|
// Clear existing event listeners
|
||||||
|
iconList.querySelectorAll('.icon-option').forEach(option => {
|
||||||
|
option.removeEventListener('click', handleIconClick);
|
||||||
|
});
|
||||||
|
|
||||||
let iconsHtml = '';
|
let iconsHtml = '';
|
||||||
let hasVisibleIcons = false;
|
let hasVisibleIcons = false;
|
||||||
|
|
||||||
@@ -2562,8 +2567,8 @@ function renderIcons(searchTerm) {
|
|||||||
<div class="icon-option"
|
<div class="icon-option"
|
||||||
data-icon="${iconClass}"
|
data-icon="${iconClass}"
|
||||||
title="${displayName}">
|
title="${displayName}">
|
||||||
<i class="fas ${iconClass}"></i>
|
<i class="fas ${iconClass} text-xl hover:text-blue-500 transition-colors duration-200"></i>
|
||||||
<span class="icon-name">${displayName}</span>
|
<span class="icon-name text-sm text-gray-600">${displayName}</span>
|
||||||
</div>`;
|
</div>`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2579,15 +2584,24 @@ function renderIcons(searchTerm) {
|
|||||||
|
|
||||||
iconList.innerHTML = iconsHtml;
|
iconList.innerHTML = iconsHtml;
|
||||||
|
|
||||||
// Add click handlers to icon options
|
// Add click handlers to new icon options
|
||||||
document.querySelectorAll('.icon-option').forEach(option => {
|
iconList.querySelectorAll('.icon-option').forEach(option => {
|
||||||
option.addEventListener('click', function() {
|
option.addEventListener('click', handleIconClick);
|
||||||
const iconClass = this.getAttribute('data-icon');
|
|
||||||
selectIcon(iconClass);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle icon click
|
||||||
|
function handleIconClick(e) {
|
||||||
|
const iconClass = this.getAttribute('data-icon');
|
||||||
|
if (iconClass) {
|
||||||
|
selectIcon(iconClass);
|
||||||
|
const modal = document.getElementById('iconPickerModal');
|
||||||
|
if (modal) {
|
||||||
|
modal.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Filter icons based on search input (now handled in renderIcons)
|
// Filter icons based on search input (now handled in renderIcons)
|
||||||
|
|
||||||
// Select an icon
|
// Select an icon
|
||||||
@@ -2608,17 +2622,24 @@ function selectIcon(iconClass) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the app icon value to the selected icon class
|
// Set the app icon value to the selected icon class
|
||||||
if (appIcon) appIcon.value = iconClass;
|
if (appIcon) {
|
||||||
|
appIcon.value = iconClass;
|
||||||
|
appIcon.dispatchEvent(new Event('change'));
|
||||||
|
}
|
||||||
|
|
||||||
// Reset file input
|
// Reset file input
|
||||||
const customIconInput = document.getElementById('customIconInput');
|
const customIconInput = document.getElementById('customIconInput');
|
||||||
if (customIconInput) customIconInput.value = '';
|
if (customIconInput) {
|
||||||
|
customIconInput.value = '';
|
||||||
|
customIconInput.dispatchEvent(new Event('change'));
|
||||||
|
}
|
||||||
|
|
||||||
// Update preview with random color
|
// Update preview with random color
|
||||||
const colors = ['blue', 'green', 'red', 'yellow', 'indigo', 'purple', 'pink', 'gray'];
|
const colors = ['blue', 'green', 'red', 'yellow', 'indigo', 'purple', 'pink', 'gray'];
|
||||||
const randomColor = colors[Math.floor(Math.random() * colors.length)];
|
const randomColor = colors[Math.floor(Math.random() * colors.length)];
|
||||||
if (iconPreview) {
|
if (iconPreview) {
|
||||||
iconPreview.className = `mt-2 flex items-center justify-center w-16 h-16 bg-${randomColor}-100 rounded-md overflow-hidden`;
|
iconPreview.className = `mt-2 flex items-center justify-center w-16 h-16 bg-${randomColor}-100 rounded-md overflow-hidden`;
|
||||||
|
iconPreview.innerHTML = `<i class="fas ${iconClass} text-2xl text-gray-400"></i>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user