Sort keywords column: matched entries first, then unmatched, both alphabetical

When filters are active, viable (matched) keywords now appear at the top
of the Mots-clés column so users don't have to scroll past faded entries
to find clickable tags. Both groups maintain alphabetical order internally.
This commit is contained in:
Pontoporeia
2026-06-24 11:28:20 +02:00
parent 654c884fed
commit 982d91345d

View File

@@ -111,6 +111,12 @@ foreach ($filterColumns as $col) {
<div id="repertoire-index" class="repertoire-index">
<?php
// Sort keywords: matched first (alpha), then unmatched (alpha) — keeps viable
// tags at the top so users don't have to scroll past faded entries.
usort($repData['keywords'], fn($a, $b) =>
($b['matched'] <=> $a['matched']) ?: strcasecmp($a['value'], $b['value'])
);
// Render filter columns in the correct left-to-right order.
// Students column (non-filter) is inserted between keywords and AP/or/fi/years.
$renderOrder = ['years', 'ap', 'or', 'fi', 'students', 'kw'];