diff --git a/frontend/src/components/Settings/ServerStats/PlatformsStats.vue b/frontend/src/components/Settings/ServerStats/PlatformsStats.vue
index 58c845b66..a3134fbfa 100644
--- a/frontend/src/components/Settings/ServerStats/PlatformsStats.vue
+++ b/frontend/src/components/Settings/ServerStats/PlatformsStats.vue
@@ -3,6 +3,7 @@ import { formatBytes } from "@/utils";
import PlatformListItem from "@/components/common/Platform/ListItem.vue";
import storePlatforms from "@/stores/platforms";
import { storeToRefs } from "pinia";
+import { ref, computed } from "vue";
// Props
const props = defineProps<{
@@ -11,62 +12,89 @@ const props = defineProps<{
const platformsStore = storePlatforms();
const { filteredPlatforms } = storeToRefs(platformsStore);
+const orderBy = ref("name");
// Functions
-function getPercentage(filesize: number | string, total: number): number {
+const sortedPlatforms = computed(() => {
+ const platforms = [...filteredPlatforms.value];
+ if (orderBy.value === "size") {
+ return platforms.sort(
+ (a, b) => Number(b.fs_size_bytes) - Number(a.fs_size_bytes),
+ );
+ }
+ // Default to name
+ return platforms.sort((a, b) =>
+ a.name.localeCompare(b.name, undefined, { sensitivity: "base" }),
+ );
+});
+
+function getPlatformPercentage(
+ filesize: number | string,
+ total: number,
+): number {
const size = typeof filesize === "string" ? parseInt(filesize, 10) : filesize;
if (!total || isNaN(size)) return 0;
return (size / total) * 100;
}
-
-function idToHexColor(id: number): string {
- const knuthHash = 2654435761;
- const hex = ((id * knuthHash) >>> 0).toString(16).padStart(6, "0");
- return `#${hex.slice(0, 6)}`;
-}
-
-
-
-
-
-
-
-
-
- {{ formatBytes(Number(platform.fs_size_bytes)) }}
- ({{
- getPercentage(
- platform.fs_size_bytes,
- props.total_filesize,
- ).toFixed(1)
- }}%)
-
-
- {{ platform.rom_count }} roms
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ formatBytes(Number(platform.fs_size_bytes)) }}
+ ({{
+ getPlatformPercentage(
+ platform.fs_size_bytes,
+ props.total_filesize,
+ ).toFixed(1)
+ }}%)
+
+
+ {{ platform.rom_count }} roms
+
+
+
+
+
+
+
diff --git a/frontend/src/components/Settings/ServerStats/SummaryStats.vue b/frontend/src/components/Settings/ServerStats/SummaryStats.vue
index ee787a121..d0fb62552 100644
--- a/frontend/src/components/Settings/ServerStats/SummaryStats.vue
+++ b/frontend/src/components/Settings/ServerStats/SummaryStats.vue
@@ -17,11 +17,6 @@ const { t } = useI18n();
-
- mdi-server
- {{ t("rom.summary") }}
-
-