repertoire: remove matched-first sorting and faded/disabled system for filter entries

Remove the system that sorted valid (matched) filter entries to the top and
faded/disabled unmatched ones when any filter was active. Entries now stay in
their natural alphabetical/numeric order regardless of selection state.

- Drop usort calls that reordered entries by matched status
- Simplify repFilterEntry: remove anyActive and colHasMatch params
- Remove colHasMatches computation
- Remove rep-entry--faded CSS rule
- All filter buttons remain clickable at all times
This commit is contained in:
Pontoporeia
2026-07-10 12:35:45 +02:00
parent b9c7d6c663
commit f86deaf02f
2 changed files with 3 additions and 37 deletions
-7
View File
@@ -359,13 +359,6 @@
color: var(--accent-primary); color: var(--accent-primary);
} }
/* Faded/disabled: muted, not interactive */
.rep-entry--faded {
opacity: 0.3;
cursor: not-allowed;
pointer-events: none;
}
/* Years column — big numbers, semi-bold (BBBDMSans Medium weight) */ /* Years column — big numbers, semi-bold (BBBDMSans Medium weight) */
.repertoire-col[data-col="years"] .rep-entry { .repertoire-col[data-col="years"] .rep-entry {
font-size: var(--step-3); font-size: var(--step-3);
+3 -30
View File
@@ -62,22 +62,18 @@ function repFilterEntry(
array $item, array $item,
string $dim, string $dim,
array $activeSets, array $activeSets,
bool $anyActive,
bool $colHasMatch,
string $hx, string $hx,
): void { ): void {
$val = (string)$item['value']; $val = (string)$item['value'];
$isActive = in_array($val, $activeSets[$dim], true); $isActive = in_array($val, $activeSets[$dim], true);
$isFaded = $anyActive && $colHasMatch && !$item['matched'] && !$isActive;
$cls = 'rep-entry' $cls = 'rep-entry'
. ($isActive ? ' rep-entry--selected' : '') . ($isActive ? ' rep-entry--selected' : '');
. ($isFaded ? ' rep-entry--faded' : '');
$url = repToggleUrl($activeSets, $dim, $val); $url = repToggleUrl($activeSets, $dim, $val);
?> ?>
<li> <li>
<button type="button" class="<?= $cls ?>" <button type="button" class="<?= $cls ?>"
aria-pressed="<?= $isActive ? 'true' : 'false' ?>" aria-pressed="<?= $isActive ? 'true' : 'false' ?>"
<?= $isFaded ? 'disabled' : "hx-get=\"" . htmlspecialchars($url) . "\" $hx" ?>> hx-get="<?= htmlspecialchars($url) ?>" <?= $hx ?>>
<?= htmlspecialchars($dim === 'ap' ? formatApDisplay($val) : $val) ?> <?= htmlspecialchars($dim === 'ap' ? formatApDisplay($val) : $val) ?>
</button> </button>
</li> </li>
@@ -87,10 +83,6 @@ function repFilterEntry(
// ── Column definitions ────────────────────────────────────────────────────── // ── Column definitions ──────────────────────────────────────────────────────
$hx = 'hx-target="#repertoire-index" hx-swap="outerHTML" hx-push-url="true" hx-indicator="#rep-indicator"'; $hx = 'hx-target="#repertoire-index" hx-swap="outerHTML" hx-push-url="true" hx-indicator="#rep-indicator"';
$anyActive = !empty($activeSets['years']) || !empty($activeSets['ap'])
|| !empty($activeSets['or']) || !empty($activeSets['fi'])
|| !empty($activeSets['kw']);
$filterColumns = [ $filterColumns = [
['dataKey' => 'years', 'dim' => 'years', 'heading' => 'Années'], ['dataKey' => 'years', 'dim' => 'years', 'heading' => 'Années'],
['dataKey' => 'ap_programs', 'dim' => 'ap', 'heading' => 'Ateliers Pluridisciplinaires'], ['dataKey' => 'ap_programs', 'dim' => 'ap', 'heading' => 'Ateliers Pluridisciplinaires'],
@@ -99,29 +91,10 @@ $filterColumns = [
['dataKey' => 'keywords', 'dim' => 'kw', 'heading' => 'Mots-clés'], ['dataKey' => 'keywords', 'dim' => 'kw', 'heading' => 'Mots-clés'],
]; ];
$colHasMatches = [];
foreach ($filterColumns as $col) {
$colHasMatches[$col['dim']] = !empty(array_filter(
$repData[$col['dataKey']],
fn($i) => $i['matched']
));
}
?> ?>
<div id="repertoire-index" class="repertoire-index"> <div id="repertoire-index" class="repertoire-index">
<?php <?php
// Sort filter columns: matched first (alpha), then unmatched (alpha) — keeps
// viable entries at the top so users don't have to scroll past faded ones.
$sortMatchedFirst = fn($a, $b) =>
($b['matched'] <=> $a['matched']) ?: strcasecmp($a['value'], $b['value']);
usort($repData['years'], fn($a, $b) =>
($b['matched'] <=> $a['matched']) ?: ($b['value'] <=> $a['value']));
usort($repData['ap_programs'], $sortMatchedFirst);
usort($repData['orientations'], $sortMatchedFirst);
usort($repData['finality_types'], $sortMatchedFirst);
usort($repData['keywords'], $sortMatchedFirst);
// Render filter columns in the correct left-to-right order. // Render filter columns in the correct left-to-right order.
// Students column (non-filter) is inserted between keywords and AP/or/fi/years. // Students column (non-filter) is inserted between keywords and AP/or/fi/years.
$renderOrder = ['years', 'ap', 'or', 'fi', 'students', 'kw']; $renderOrder = ['years', 'ap', 'or', 'fi', 'students', 'kw'];
@@ -184,7 +157,7 @@ foreach ($renderOrder as $colKey):
<div class="rep-accordion__panel"> <div class="rep-accordion__panel">
<ul> <ul>
<?php foreach ($repData[$col['dataKey']] as $item): <?php foreach ($repData[$col['dataKey']] as $item):
repFilterEntry($item, $col['dim'], $activeSets, $anyActive, $colHasMatches[$col['dim']], $hx); repFilterEntry($item, $col['dim'], $activeSets, $hx);
endforeach; ?> endforeach; ?>
</ul> </ul>
</div> </div>