
// src/render.js
import { state } from './state.js';

export function renderApps() {
  const folderEl = document.getElementById('folder');
  folderEl.innerHTML = '';
  state.appsOrder.forEach(id => {
    const app = state.appsData.find(a => a.id === id);
    if (!app) return;
    const div = document.createElement('div');
    div.className = 'app-icon';
    div.dataset.id = app.id;
    div.innerHTML = `
      <img src="${app.icon}" alt="${app.name}">
      <span>${app.name}</span>
    `;
    div.addEventListener('click', () => {
      if (!state.editMode) window.open(app.url, '_blank', 'noopener');
    });
    folderEl.appendChild(div);
  });
}
