From 04974dc3ea36498e3a43ff45b0cfc954b2ede605 Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Fri, 30 May 2025 13:10:30 +0200 Subject: [PATCH] test --- admin-dashboard.html | 98 +++++++++++--------------------------------- 1 file changed, 23 insertions(+), 75 deletions(-) diff --git a/admin-dashboard.html b/admin-dashboard.html index f5281fa..7641a10 100644 --- a/admin-dashboard.html +++ b/admin-dashboard.html @@ -1073,24 +1073,12 @@
-
- -
-
- - -
-
- - @@ -1896,41 +1884,29 @@ async function loadDynamicApps() { return; } - // Generate a random color if not specified - const colors = ['blue', 'green', 'red', 'yellow', 'indigo', 'purple', 'pink', 'gray']; - const randomColor = colors[Math.floor(Math.random() * colors.length)]; - - dynamicAppsList.innerHTML = customApps.map(app => { - // Use the app's color or generate a random one - const appColor = app.color || randomColor; - const iconClass = app.icon ? 'fa-apple-alt' : (app.iconClass || 'fa-globe'); - - return ` -
-
- ${app.icon ? - `${app.name}` : - `
- -
` - } -
-

${app.name || 'Neznámá aplikace'}

-

${app.url || ''}

- ${app.description ? `

${app.description}

` : ''} -
+ console.log("Rendering", customApps.length, "dynamic apps"); + dynamicAppsList.innerHTML = customApps.map(app => ` +
+
+
+
-
- - +
+

${app.name || 'Neznámá aplikace'}

+

${app.url || ''}

+ ${app.description ? `

${app.description}

` : ''}
- `; - }).join(''); +
+ + +
+
+ `).join(''); } catch (error) { console.error('Error loading dynamic apps:', error); @@ -2000,7 +1976,7 @@ async function saveApp(event) { const name = document.getElementById('appName')?.value.trim() || ''; const url = document.getElementById('appLink')?.value.trim() || ''; const description = document.getElementById('appDescription')?.value.trim() || ''; - const icon = document.getElementById('appIconClass')?.value || 'fas fa-cube'; + const icon = document.getElementById('appIcon')?.value || 'fa-globe'; const color = document.getElementById('appColor')?.value || '#4a6cf7'; console.log('Saving app with data:', { name, url, description, icon, color }); @@ -2021,19 +1997,7 @@ async function saveApp(event) { formData.append('description', description); formData.append('icon', icon); formData.append('color', color); - - // Handle custom icon file upload if selected - const customIconInput = document.getElementById('customIconInput'); - if (customIconInput && customIconInput.files.length > 0) { - formData.append('iconFile', customIconInput.files[0]); - } else { - // Make sure we have a valid icon class - if (!icon) { - showNotification('Vyberte prosím ikonu pro aplikaci', 'error'); - return; - } - } - + try { const isEdit = !!appId; const url = isEdit ? `/api/apps/${appId}` : '/api/apps'; @@ -2293,22 +2257,6 @@ function setupFileInput() { selectedIcon.classList.remove('hidden'); appIcon.value = ''; } -} - -document.addEventListener('DOMContentLoaded', function() { - // Initialize file input for custom icon upload - // setupFileInput(); // Removed custom icon upload functionality - - // Add click handler for custom icon button - const customIconBtn = document.getElementById('customIconBtn'); - const customIconInput = document.getElementById('customIconInput'); - - if (customIconBtn && customIconInput) { - customIconBtn.addEventListener('click', function(e) { - e.preventDefault(); - customIconInput.click(); - }); - } // Color picker setup const appColor = document.getElementById('appColor'); @@ -2331,7 +2279,7 @@ document.addEventListener('DOMContentLoaded', function() { } }); } -}); +}; // Reset form when modal is closed // Initialize icon picker when the modal is shown