diff --git a/assets/scripts/competency-status-board.js b/assets/scripts/competency-status-board.js index d994c82..317924e 100755 --- a/assets/scripts/competency-status-board.js +++ b/assets/scripts/competency-status-board.js @@ -6,10 +6,68 @@ const STATES = [ { key: "comments", label: "Comments" }, ]; +const LEVELS = [ + { key: "graduate", label: "Graduate" }, + { key: "engineer", label: "Engineer" }, +]; + +let currentLevel = LEVELS[0].key; + function isMobile() { return window.matchMedia("(max-width: 600px)").matches; } +function renderLevelTabs() { + const board = document.getElementById("kanban-board"); + if (!board || document.getElementById("level-tabs")) return; + + const nav = document.createElement("div"); + nav.id = "level-tabs"; + + LEVELS.forEach(({ key, label }) => { + const btn = document.createElement("button"); + btn.textContent = label; + btn.dataset.level = key; + btn.className = "level-tab" + (key === currentLevel ? " active" : ""); + btn.addEventListener("click", () => { + currentLevel = key; + document.querySelectorAll(".level-tab").forEach(b => + b.classList.toggle("active", b.dataset.level === key) + ); + loadBoard(); + }); + nav.appendChild(btn); + }); + + board.insertAdjacentElement("beforebegin", nav); + + if (!document.getElementById("level-tab-styles")) { + const style = document.createElement("style"); + style.id = "level-tab-styles"; + style.textContent = ` + #level-tabs { + display: flex; + gap: 0.5em; + margin-bottom: 1em; + } + .level-tab { + padding: 0.4em 1.2em; + border: 1px solid #ccc; + background: none; + cursor: pointer; + border-radius: 4px; + font-size: 0.95em; + } + .level-tab.active { + background: #333; + color: #fff; + border-color: #333; + } + `; + document.head.appendChild(style); + } +} + function populateMobileControls(items) { if (!isMobile()) return; @@ -35,7 +93,6 @@ function populateMobileControls(items) { toSelect.appendChild(new Option(s.label, s.key)); }); - // Auto-fill "from" when item selected itemSelect.onchange = () => { const selected = itemSelect.selectedOptions[0]; if (selected?.dataset.state) { @@ -84,12 +141,8 @@ function countByState(items) { async function updateProgress(items) { const total = items.length; const completed = items.filter(i => i.state === "completed").length; - - const percent = total === 0 ? 0 : Math.round((completed / total) * 100); - console.log(`Progress: ${percent}% (${completed}/${total})`); - const fill = document.getElementById("progress-fill"); const label = document.getElementById("progress-label"); @@ -143,7 +196,7 @@ function createColumn(state, items, counts) { }); if (res.ok) { - loadBoard(); // simple & safe re-render + loadBoard(); } else { alert("Failed to update state"); } @@ -172,11 +225,13 @@ function renderBoard(items) { } async function loadBoard() { - const res = await fetch("/api/competencies/items"); + const res = await fetch(`/api/competencies/items?group=${currentLevel}`); const items = await res.json(); updateProgress(items); renderBoard(items); populateMobileControls(items); } + +renderLevelTabs(); loadBoard(); diff --git a/assets/styles/kanban.css b/assets/styles/kanban.css index 19d3c4b..5942e82 100755 --- a/assets/styles/kanban.css +++ b/assets/styles/kanban.css @@ -206,3 +206,48 @@ background: #22c55e; transition: width 0.3s ease; } +#level-tabs { + display: inline-flex; + align-items: center; + gap: 0; + margin-bottom: 1rem; + + //border: 1px solid var(--border-color, #ccc); + border-radius: 999px; + padding: 3px; + + background: var(--bg, #fff); + width: fit-content; +} + +.level-tab { + border: none; + background: transparent; + + padding: 0.35rem 1rem; + font-size: 0.85rem; + + border-radius: 999px; + cursor: pointer; + + color: var(--fg, #333); + + transition: + background 0.2s ease, + color 0.2s ease, + transform 0.1s ease; +} + +.level-tab:hover { + background: rgba(0,0,0,0.05); +} + +.level-tab.active { + background: #333; + color: white; + font-weight: 500; +} + +.level-tab:active { + transform: scale(0.97); +} diff --git a/blogs/blogs-list.org b/blogs/blogs-list.org index ea9bfd4..8160b4f 100755 --- a/blogs/blogs-list.org +++ b/blogs/blogs-list.org @@ -4,8 +4,8 @@ See the categories: @@html:Categories@@ * Blogs: -- [[file:2026/2026-list.org][2026 List]] @@html:08-03-2026 12:51@@ -- [[file:2025/2025-list.org][2025 List]] @@html:08-03-2026 12:51@@ +- [[file:2026/2026-list.org][2026 List]] @@html:08-03-2026 17:33@@ +- [[file:2025/2025-list.org][2025 List]] @@html:08-03-2026 17:33@@ - [[file:2026/03-march/01-03-week-review.org][[01-03-2026] - Weekly Review]] @@html:01-03-2026 12:00@@ @@html: review @@ - [[file:2026/02-february/27-02-26.org][Journeys rambles again...]] @@html:27-02-2026 17:12@@ @@html: life @@ - [[file:2026/02-february/26-02-26.org][Starting the Journeys Upgrade]] @@html:26-02-2026 17:32@@ @@html: life @@ diff --git a/home/status.org b/home/status.org index 2cac6b9..80938e3 100755 --- a/home/status.org +++ b/home/status.org @@ -4,8 +4,7 @@ #+COMMENTS: t #+SLUG: competency-board - -This page shows the status of the competencies I am working on (*grad*) +This page shows the status of the competencies I am working on. #+BEGIN_EXPORT html