changed docs view
This commit is contained in:
parent
955c9202e4
commit
498824ee98
1 changed files with 20 additions and 24 deletions
|
|
@ -54,15 +54,9 @@ function getDocCategories($docsDir) {
|
||||||
$metadata = [];
|
$metadata = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if documentation is complete (default to false if not specified)
|
// Get display name (no TODO prefix - just display all docs)
|
||||||
$isComplete = isset($metadata['complete']) ? (bool)$metadata['complete'] : false;
|
|
||||||
$displayName = $metadata['name'] ?? ucfirst($folder);
|
$displayName = $metadata['name'] ?? ucfirst($folder);
|
||||||
|
|
||||||
// Add TODO prefix for incomplete documentation
|
|
||||||
if (!$isComplete) {
|
|
||||||
$displayName = 'TODO: ' . $displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find icon file
|
// Find icon file
|
||||||
$icon = '';
|
$icon = '';
|
||||||
if (file_exists($folderPath . '/icon.png')) {
|
if (file_exists($folderPath . '/icon.png')) {
|
||||||
|
|
@ -77,21 +71,18 @@ function getDocCategories($docsDir) {
|
||||||
'description' => $metadata['description'] ?? '',
|
'description' => $metadata['description'] ?? '',
|
||||||
'category' => $metadata['category'] ?? 'other',
|
'category' => $metadata['category'] ?? 'other',
|
||||||
'order' => $metadata['order'] ?? 999,
|
'order' => $metadata['order'] ?? 999,
|
||||||
'icon' => $icon,
|
'icon' => $icon
|
||||||
'complete' => $isComplete
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort by category, then order, then name
|
// Sort alphabetically by name within categories
|
||||||
usort($categories, function($a, $b) {
|
usort($categories, function($a, $b) {
|
||||||
if ($a['category'] !== $b['category']) {
|
if ($a['category'] !== $b['category']) {
|
||||||
|
// Keep category grouping (game, mods, other)
|
||||||
return strcmp($a['category'], $b['category']);
|
return strcmp($a['category'], $b['category']);
|
||||||
}
|
}
|
||||||
if ($a['order'] !== $b['order']) {
|
// Sort alphabetically by name (case-insensitive)
|
||||||
return $a['order'] - $b['order'];
|
return strcasecmp($a['name'], $b['name']);
|
||||||
}
|
|
||||||
// Sort alphabetically by name
|
|
||||||
return strcmp(strtolower($a['name']), strtolower($b['name']));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $categories;
|
return $categories;
|
||||||
|
|
@ -113,20 +104,25 @@ foreach ($categories as $cat) {
|
||||||
// Category labels - can be extended via JSON
|
// Category labels - can be extended via JSON
|
||||||
$categoryLabels = [
|
$categoryLabels = [
|
||||||
'game' => 'Game Servers',
|
'game' => 'Game Servers',
|
||||||
|
'mods' => 'Mods & Plugins',
|
||||||
'panel' => 'Panel Documentation',
|
'panel' => 'Panel Documentation',
|
||||||
'mods' => 'Mods & Addons',
|
|
||||||
'troubleshooting' => 'Troubleshooting',
|
'troubleshooting' => 'Troubleshooting',
|
||||||
'other' => 'Other'
|
'other' => 'Other'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Sort categories by number of items (fewest to most)
|
// Define category display order
|
||||||
uksort($grouped, function($a, $b) use ($grouped) {
|
$categoryOrder = ['panel', 'game', 'mods', 'troubleshooting', 'other'];
|
||||||
$countA = count($grouped[$a]);
|
|
||||||
$countB = count($grouped[$b]);
|
// Sort categories by defined order
|
||||||
if ($countA !== $countB) {
|
uksort($grouped, function($a, $b) use ($categoryOrder) {
|
||||||
return $countA - $countB; // ascending order (fewest first)
|
$posA = array_search($a, $categoryOrder);
|
||||||
}
|
$posB = array_search($b, $categoryOrder);
|
||||||
return strcmp($a, $b);
|
|
||||||
|
// If not in order array, put at end
|
||||||
|
if ($posA === false) $posA = 999;
|
||||||
|
if ($posB === false) $posB = 999;
|
||||||
|
|
||||||
|
return $posA - $posB;
|
||||||
});
|
});
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue