From 58c4dc08f3e5f40116b1ed4cb410d817786a3ca1 Mon Sep 17 00:00:00 2001 From: Ian Keane Date: Thu, 11 Jun 2026 12:54:08 -0400 Subject: [PATCH] Collapse to learn, review, callible into one column --- app.js | 46 ++++++++++++++++++++-------------------------- index.html | 15 +++++++++------ style.css | 24 ++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 34 deletions(-) diff --git a/app.js b/app.js index 4366fe6..d3359a5 100644 --- a/app.js +++ b/app.js @@ -241,9 +241,7 @@ const filters = { modal: null, instrument: null, tuning: null, - callable: null, - review: null, - to_learn: null, + status: null, difficulty: null, }; @@ -251,8 +249,8 @@ const popover = $('filter-popover'); const popoverInner = $('filter-popover-inner'); let activeFilterKey = null; -const BOOL_FILTERS = new Set(['modal', 'callable', 'review', 'to_learn']); -const DROPDOWN_FILTERS = new Set(['source', 'instrument', 'tuning', 'difficulty']); +const BOOL_FILTERS = new Set(['modal']); +const DROPDOWN_FILTERS = new Set(['source', 'instrument', 'tuning', 'difficulty', 'status']); function openFilterPopover(key, thEl) { if (activeFilterKey === key) { closeFilterPopover(); return; } @@ -267,7 +265,7 @@ function openFilterPopover(key, thEl) { if (filters[key] === true) { cb.checked = true; cb.indeterminate = false; } else if (filters[key] === false) { cb.checked = false; cb.indeterminate = true; } else { cb.checked = false; cb.indeterminate = false; } - const names = { modal: 'Modal', callable: 'Callable', review: 'Needs review', to_learn: 'To learn' }; + const names = { modal: 'Modal' }; label.appendChild(cb); label.appendChild(document.createTextNode(names[key] ?? key)); popoverInner.appendChild(label); @@ -328,6 +326,7 @@ function buildDropdownOptions(key) { if (key === 'instrument') return [...none, ...allInstruments.map(i => [String(i.id), i.name])]; if (key === 'tuning') return [...none, ...allTunings.map(t => [String(t.id), t.name])]; if (key === 'difficulty') return [...none, ['easy', 'Easy'], ['hard', 'Hard']]; + if (key === 'status') return [...none, ['callable', 'Callable'], ['review', 'Needs Review'], ['to_learn', 'To Learn']]; return none; } @@ -367,9 +366,7 @@ function rowMatchesFilters(tune, entry) { if (filters.instrument && (!entry || String(entry.instrument_id) !== filters.instrument)) return false; if (entry) { if (filters.tuning && String(entry.tuning_id) !== filters.tuning) return false; - if (filters.callable !== null && entry.callable !== filters.callable) return false; - if (filters.review !== null && entry.review !== filters.review) return false; - if (filters.to_learn !== null && entry.to_learn !== filters.to_learn) return false; + if (filters.status && entry.status !== filters.status) return false; if (filters.difficulty && entry.difficulty?.toLowerCase() !== filters.difficulty) return false; } return true; @@ -420,11 +417,7 @@ function renderTable() { ? (tune.modal ? `${tune.key} modal` : tune.key) : (tune.modal ? 'modal' : ''); const metaRaw = [instStr, keyStr].filter(Boolean).join(' ยท '); - const mobPills = entry ? [ - `Call`, - `Rev`, - `Lrn`, - ].join('') : ''; + const mobPills = entry ? pillStatus(entry.status, 'mob-pill') : ''; const mobActions = [ hasNotes ? `` : '', tune.references?.length > 0 ? `` : '', @@ -439,9 +432,7 @@ function renderTable() { ${tune.modal ? 'Yes' : 'โ€”'} ${esc(entry?.instrument_name ?? '')} ${esc(entry?.tuning ?? '')} - ${pillBool(entry?.callable)} - ${pillBool(entry?.review, true)} - ${pillBool(entry?.to_learn, false, true)} + ${pillStatus(entry?.status)} ${hasNotes ? `` : ''} @@ -486,6 +477,14 @@ function pillBool(val, warnIfTrue = false, neutralIfTrue = false) { return 'No'; } +function pillStatus(status, extraClass = '') { + const c = extraClass ? ' ' + extraClass : ''; + if (status === 'callable') return `Callable`; + if (status === 'review') return `Needs Review`; + if (status === 'to_learn') return `To Learn`; + return `โ€”`; +} + // โ”€โ”€ Add / Edit modal โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ btnAddTune.addEventListener('click', openAdd); @@ -524,9 +523,7 @@ function openEdit(tuneId, entryId) { tuneForm.elements.inst_tuning.value = entry.tuning ?? ''; tuneForm.elements.inst_learned_from.value = entry.learned_from ?? ''; tuneForm.elements.inst_date_learned.value = entry.date_learned ?? ''; - tuneForm.elements.inst_callable.checked = !!entry.callable; - tuneForm.elements.inst_review.checked = !!entry.review; - tuneForm.elements.inst_to_learn.checked = !!entry.to_learn; + tuneForm.elements.inst_status.value = entry.status ?? ''; tuneForm.elements.inst_difficulty.value = entry.difficulty ?? ''; } @@ -657,9 +654,7 @@ async function saveTune() { tuning_id: resolveTuningId(f.inst_tuning.value), learned_from_id: resolveMusicianId(f.inst_learned_from.value), date_learned: f.inst_date_learned.value || null, - callable: f.inst_callable.checked, - review: f.inst_review.checked, - to_learn: f.inst_to_learn.checked, + status: f.inst_status.value || null, difficulty: f.inst_difficulty.value || null, } : null; @@ -891,7 +886,7 @@ function callGetEntries() { const result = []; for (const tune of allTunes) for (const entry of tune.instruments) - if (entry[callMode]) result.push({ tune, entry }); + if (entry.status === callMode) result.push({ tune, entry }); return result; } @@ -986,8 +981,7 @@ function callSelect(value, modal) { callStep = 2; renderCallStep(); } else { - filters.callable = callMode === 'callable' ? true : null; - filters.to_learn = callMode === 'to_learn' ? true : null; + filters.status = callMode; filters.instrument = callInstrumentId !== null ? String(callInstrumentId) : null; filters.tuning = callTuningId !== null ? String(callTuningId) : null; filters.key = value; diff --git a/index.html b/index.html index e5d23cb..1e8e98d 100644 --- a/index.html +++ b/index.html @@ -33,9 +33,7 @@ ModalMod. Instrument Tuning - CallableCall. - ReviewRev. - To learnLearn + Status Notes Refs @@ -129,9 +127,14 @@ - - - +