()
| 356 | return text.includes(state.query.toLowerCase()); |
| 357 | } |
| 358 | function renderNavigation() { |
| 359 | const host = $('files'); host.replaceChildren(); |
| 360 | if (state.pass === 'conformance') { |
| 361 | $('navigation-title').textContent = viewConformance?.scope ? 'View intents' : 'Intents and criteria'; |
| 362 | const query=state.query.toLowerCase(); |
| 363 | const groups=Array.from(intentCatalog.values()).map(intent=>{ |
| 364 | const ownMatch=!query || [intent.id,intent.human_key,intent.title,intent.status,intent.view].join(' ').toLowerCase().includes(query); |
| 365 | const criteria=intent.criteria.filter(item=>ownMatch || (item.text+' '+item.id+' '+item.navigation_findings.map(number=>'F'+number).join(' ')).toLowerCase().includes(query)); |
| 366 | return {...intent,criteria,visible:ownMatch || criteria.length>0}; |
| 367 | }).filter(intent=>intent.visible).sort((a,b)=>Number(b.scoped)-Number(a.scoped) || a.human_key.localeCompare(b.human_key,undefined,{numeric:true})); |
| 368 | const selected=groups.find(intent=>intent.id===state.intent) || groups.find(intent=>intent.criteria.some(item=>item.id===state.criterion)) || groups[0]; |
| 369 | state.intent=selected?.id || null; |
| 370 | if(!selected?.criteria.some(item=>item.id===state.criterion))state.criterion=selected?.criteria[0]?.id || null; |
| 371 | let contextHeading=false; |
| 372 | for (const intent of groups) { |
| 373 | if(viewConformance?.scope && !intent.scoped && !contextHeading) {host.append(el('h3','file-title','Change-linked context (not view assignment)'));contextHeading=true;} |
| 374 | const group=el('section','intent-group');group.dataset.intentGroup=intent.id; |
| 375 | const own=button('',()=>{state.intent=intent.id;state.criterion=intent.criteria[0]?.id || null;state.criterionRegion=null;closeMobileFiles();render();},'region-button intent-button'); |
| 376 | own.dataset.intent=intent.id;own.dataset.active=String(intent.id===state.intent); |
| 377 | own.setAttribute('aria-current',String(intent.id===state.intent && !state.criterion)); |
| 378 | own.append(el('strong','',intent.human_key),el('span','intent-name',intent.title),el('small','',`${intent.status || 'recorded context'} · ${intent.criteria.length} criteria${intent.scoped?' · view '+intent.view:' · change-linked only'}`)); |
| 379 | group.append(own); |
| 380 | const children=el('div','intent-criteria'); |
| 381 | for (const item of intent.criteria) { |
| 382 | const control = button('', () => { state.intent=intent.id;state.criterion = item.id; state.criterionRegion = null; closeMobileFiles(); render(); }, 'region-button criterion-button'); |
| 383 | control.dataset.criterion=item.id; |
| 384 | control.setAttribute('aria-current', String(item.id === state.criterion)); |
| 385 | control.append(el('strong', '', item.text), el('small', '', `Review: ${item.review_assessment} · ${item.navigation_findings.length} related findings`)); |
| 386 | children.append(control); |
| 387 | } |
| 388 | group.append(children);host.append(group); |
| 389 | } |
| 390 | if (!groups.length) host.append(el('p', 'empty', intentCatalog.size ? 'No intents or criteria match this search.' : viewConformance?.scope ? 'No intents scoped to view '+viewConformance.scope.view+'.' : 'No governing intents resolved.')); |
| 391 | const criteria=groups.reduce((count,intent)=>count+intent.criteria.length,0); |
| 392 | $('result-count').textContent = `${groups.length} intents · ${criteria} criteria`; |
| 393 | return; |
| 394 | } |
| 395 | $('navigation-title').textContent = 'Files & regions'; |
| 396 | const visible = regions.filter(region => eligible(region) && matches(region)); |
| 397 | if (!visible.some(region => region.id === state.region)) state.region = visible.find(region => region.findings.length)?.id || visible[0]?.id || null; |
| 398 | const files = new Map(); |
| 399 | for (const region of visible) { |
| 400 | const key = region.path + '\0' + region.change; |
| 401 | if (!files.has(key)) files.set(key, []); |
| 402 | files.get(key).push(region); |
| 403 | } |
| 404 | for (const items of files.values()) { |
| 405 | const group = el('div', 'file-group'); |
| 406 | const compared=comparedFiles.get(items[0].change); |
| 407 | group.append(el('h3', 'file-title', compared ? `${compared.before_path || '(absent)'} → ${compared.after_path || '(absent)'} · ${title(compared.status)}` : items[0].path + (report.selected_roots.length > 1 ? ' · ' + items[0].change.slice(0, 8) : ''))); |
| 408 | for (const region of items) { |
| 409 | const control = button('', () => { state.region = region.id; closeMobileFiles(); render(); }, 'region-button'); |
| 410 | control.dataset.region = region.id; |
| 411 | control.setAttribute('aria-current', String(region.id === state.region)); |
| 412 | control.append(el('strong', '', regionName(region)), el('small', '', location(region) + (region.findings.length ? ' · ' + numberText(region) : ''))); |
| 413 | group.append(control); |
| 414 | } |
| 415 | host.append(group); |
no test coverage detected