This commit is contained in:
Tomas Dvorak
2025-05-30 13:02:19 +02:00
parent 67ea06ff38
commit be893d0c3c
+1 -53
View File
@@ -2190,60 +2190,8 @@ function openAddAppModal() {
// Update title
document.getElementById('appModalTitle').textContent = 'Přidat aplikaci';
// Select an icon
function selectIcon(iconClass) {
const iconInput = document.getElementById('appIcon');
const iconPreview = document.getElementById('iconPreview');
const iconClassInput = document.getElementById('appIconClass');
const iconPickerModal = document.getElementById('iconPickerModal');
// Hide any custom icon preview
const customIconPreview = document.getElementById('customIconPreview');
if (customIconPreview) {
customIconPreview.classList.add('hidden');
customIconPreview.src = '';
}
// Show the Font Awesome icon
const selectedIcon = document.getElementById('selectedIcon');
if (selectedIcon) {
selectedIcon.className = `fas ${iconClass} text-2xl text-blue-600`;
selectedIcon.classList.remove('hidden');
}
if (iconInput && selectedIcon && iconClassInput) {
// Update the hidden input with the icon class
iconClassInput.value = iconClass;
// Update the visible input with a friendly name
const iconName = iconClass.replace('fa-', '').replace(/-/g, ' ');
iconInput.value = iconName.split(' ')
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');
// Highlight the selected icon
const selectedOption = document.querySelector(`.icon-option[data-icon="${iconClass}"]`);
if (selectedOption) {
// Remove active class from all icons
document.querySelectorAll('.icon-option').forEach(option => {
option.classList.remove('active');
});
// Add active class to selected icon
selectedOption.classList.add('active');
}
// Close the modal
isModalOpen = false;
document.body.style.overflow = '';
iconPickerModal.style.display = 'none';
// Update the preview
if (iconPreview) {
iconPreview.className = 'w-12 h-12 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center mr-3';
}
}
}
// Reset icon selection
const appIcon = document.getElementById('appIcon');
const customIconInput = document.getElementById('customIconInput');