/* Project dashboard UI: board (kanban), gallery and list views, a side panel to edit a project, see its git/storage/tool info and start actions. Icons come from the Lucide sprite served at /icons.svg. */ const STATUS = [ { key: 'idea', label: 'Idee', icon: 'lightbulb', color: '#94a3b8' }, { key: 'active', label: 'Aktiv', icon: 'rocket', color: '#22c55e' }, { key: 'paused', label: 'Pausiert', icon: 'circle-pause', color: '#f59e0b' }, { key: 'done', label: 'Fertig', icon: 'circle-check', color: '#3b82f6' }, { key: 'archived', label: 'Archiviert', icon: 'archive', color: '#8b5cf6' }, ] const STATUS_BY = Object.fromEntries(STATUS.map((s) => [s.key, s])) const PRIO_ORDER = { high: 0, medium: 1, low: 2 } const PRIO_LABEL = { high: 'Hoch', medium: 'Mittel', low: 'Niedrig' } const TECH_ICON = { Unity: 'box', Node: 'hexagon', Electron: 'atom', Expo: 'smartphone', Capacitor: 'smartphone', Vite: 'zap', React: 'atom', '.NET': 'code-xml', Flutter: 'feather', Android: 'smartphone', 'C++/CMake': 'cpu', Python: 'square-terminal', Web: 'globe', Arduino: 'circuit-board', } const GIT_ICON = { green: 'git-branch', yellow: 'git-commit-horizontal', red: 'git-branch-minus' } // label/hint/short come from the dictionary (tier..*); here only style + icon const TIER = { Cache: { cls: 'ok', icon: 'recycle' }, Release: { cls: 'warn', icon: 'package' }, Output: { cls: 'warn', icon: 'images' }, } // use window.I18N.t (not the global t) – these run inside .map((t)=>…) where t is shadowed const tierLabel = (k) => window.I18N.t('tier.' + k + '.label') const tierHint = (k) => window.I18N.t('tier.' + k + '.hint') const tierShort = (k) => window.I18N.t('tier.' + k + '.short') const ACTION_ICON = { 'Einrichten': 'download', 'Starten': 'play', 'Bauen': 'hammer', 'Werkzeuge': 'wand-sparkles', 'Öffnen': 'folder-open', } let projects = [] let totals = null let scanState = null let cleanupAvailable = false let editing = null let editingTasks = [] let searchTerm = '' let quickFilter = 'all' let activeView = 'board' let scanTimer = null /* ── helpers ──────────────────────────────────────────────────────────── */ const ic = (name, cls = '') => `` // ?r= keeps the browser cache apart when two projects folders have a project of the same name const thumbUrl = (name) => `/api/projects/${encodeURIComponent(name)}/thumb?r=${encodeURIComponent(activeRoots.join(','))}` const api = (name, what) => `/api/projects/${encodeURIComponent(name)}/${what}` function escapeHtml(s) { return String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])) } // Small, dependency-free Markdown -> HTML for a project's README. Everything is escaped first, so no // raw HTML from the file can run; then a safe subset is formatted. Links only for http(s), open extern. function renderMarkdown(src) { const esc = escapeHtml(String(src ?? '').replace(/\r\n?/g, '\n')) const inline = (s) => s .replace(/`([^`]+)`/g, (_, c) => `${c}`) .replace(/\[([^\]]+)\]\((https?:[^)\s]+)\)/g, (_, txt, url) => `${txt}`) .replace(/(^|[^*])\*\*([^*\n]+)\*\*/g, '$1$2') .replace(/(^|[^*_])[*_]([^*_\n]+)[*_]/g, '$1$2') const lines = esc.split('\n') let html = '', i = 0 const closeList = (stack) => { while (stack.length) html += stack.pop() } const listStack = [] while (i < lines.length) { const line = lines[i] // fenced code block if (/^\s*```/.test(line)) { closeList(listStack); i++; const buf = []; while (i < lines.length && !/^\s*```/.test(lines[i])) buf.push(lines[i++]); i++; html += `
${buf.join('\n')}
`; continue } if (/^\s*(---|\*\*\*|___)\s*$/.test(line)) { closeList(listStack); html += '
'; i++; continue } const h = line.match(/^(#{1,6})\s+(.*)$/) if (h) { closeList(listStack); html += `${inline(h[2].trim())}`; i++; continue } const q = line.match(/^\s*>\s?(.*)$/) // '>' was escaped to > if (q) { closeList(listStack); const buf = []; let m = q; while (i < lines.length && (m = lines[i].match(/^\s*>\s?(.*)$/))) { buf.push(m[1]); i++ } html += `
${inline(buf.join(' '))}
`; continue } const li = line.match(/^(\s*)([-*+]|\d+\.)\s+(.*)$/) if (li) { const ordered = /\d/.test(li[2]); const want = ordered ? '' : ''; if (listStack[listStack.length - 1] !== want) { closeList(listStack); html += ordered ? '
    ' : '