diff --git a/index.php b/index.php index f09b236..d42aa78 100644 --- a/index.php +++ b/index.php @@ -42,6 +42,7 @@ $scan_reference_rows = []; $scan_reference_max_occurrence = 0; $scan_reference_error = null; $ship_preset_rows = []; +$ship_preset_manufacturers = []; $ship_preset_error = null; try { @@ -112,15 +113,26 @@ try { ); foreach ($stmt_ship_presets->fetchAll() as $row) { + $ship_name = trim((string) ($row['cl_scpreset_name'] ?? '')) ?: 'Vaisseau inconnu'; + $manufacturer = trim((string) ($row['cl_scpreset_manufacturer'] ?? '')) ?: 'Manufacture inconnue'; + $manufacturer_key = function_exists('mb_strtolower') + ? mb_strtolower($manufacturer, 'UTF-8') + : strtolower($manufacturer); + + $ship_preset_manufacturers[$manufacturer_key] = $manufacturer; + $ship_preset_rows[] = [ 'id' => (string) ($row['cl_scpreset_id'] ?? ''), - 'name' => trim((string) ($row['cl_scpreset_name'] ?? '')), - 'manufacturer' => trim((string) ($row['cl_scpreset_manufacturer'] ?? '')), + 'name' => $ship_name, + 'manufacturer' => $manufacturer, 'creator' => trim((string) ($row['cl_scpreset_creator'] ?? '')) ?: 'Inconnu', 'description' => trim((string) ($row['cl_scpreset_description'] ?? '')) ?: 'Aucune description disponible pour ce preset.', 'link' => trim((string) ($row['cl_scpreset_link'] ?? '')), ]; } + + natcasesort($ship_preset_manufacturers); + $ship_preset_manufacturers = array_values($ship_preset_manufacturers); } catch (Throwable $e) { $ship_preset_error = 'Impossible de charger les presets de vaisseaux pour le moment.'; } @@ -374,7 +386,6 @@ try { padding: 22px 26px 26px; } - .ship-presets-intro, .ship-presets-empty, .ship-presets-error { margin: 0 0 18px; @@ -384,10 +395,6 @@ try { text-align: left !important; } - .ship-presets-intro { - background: rgba(162, 155, 120, 0.12); - border: 1px solid rgba(162, 155, 120, 0.18); - } .ship-presets-empty { background: rgba(255, 255, 255, 0.06); @@ -400,6 +407,64 @@ try { color: #ffbdbd; } + .ship-presets-filter-bar { + display: flex; + align-items: flex-end; + gap: 16px; + margin: 0 0 18px; + padding: 14px 16px; + border-radius: 14px; + background: rgba(255, 255, 255, 0.04); + border: 1px solid rgba(162, 155, 120, 0.18); + flex-wrap: wrap; + } + + .ship-presets-filter-group { + display: flex; + flex-direction: column; + gap: 8px; + min-width: 240px; + flex: 1 1 240px; + } + + .ship-presets-filter-label { + margin: 0; + font-size: 0.8em; + font-weight: 700; + letter-spacing: 0.08em; + text-transform: uppercase; + color: rgba(255, 255, 255, 0.88); + } + + .ship-presets-filter-select { + width: 100%; + padding: 10px 14px; + border-radius: 10px; + border: 1px solid rgba(162, 155, 120, 0.3); + background: rgba(10, 14, 21, 0.95); + color: #ffffff; + font-size: 0.92em; + } + + .ship-presets-filter-select:disabled { + opacity: 0.55; + cursor: not-allowed; + } + + .ship-presets-filter-select:focus-visible { + outline: 2px solid rgba(162, 155, 120, 0.45); + outline-offset: 2px; + } + + .ship-presets-filter-status { + margin: 0 0 0 auto; + font-size: 0.85em; + color: rgba(255, 255, 255, 0.7); + flex: 1 1 220px; + text-align: right; + align-self: center; + } + .ship-presets-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); @@ -482,6 +547,10 @@ try { outline: none; } + .ship-preset-card.is-hidden-by-ship-filter { + display: none; + } + @media (max-width: 1100px) { .modal-scan-reference, .modal-ship-presets { @@ -503,6 +572,15 @@ try { text-align: left; } + .ship-presets-filter-bar { + align-items: stretch; + } + + .ship-presets-filter-status { + margin-left: 0; + text-align: left; + } + .ship-presets-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } @@ -601,10 +679,27 @@ try {
Aucun preset de vaisseau n'est enregistré pour le moment.
- -