Release 2.3.1 (#828)

* chore: bump version to v2.3.1-preview

* Fix flashing of game covers

* Change sort order of games on the start page (most recently added first)

* Add "Date added" column to table in Collection Management
This commit is contained in:
Simon
2025-12-14 22:05:56 +01:00
committed by GitHub
parent cd0149bb64
commit bb6f0ac931
6 changed files with 93 additions and 36 deletions
+28 -2
View File
@@ -39,6 +39,32 @@ export default function HomeView() {
}, [librariesState.sorted, collectionsState.sorted, gamesByLibrary, gamesByCollection]);
// Sort games by date added (newest first) for libraries
const getSortedLibraryGames = (libraryId: number) => {
const games = gamesByLibrary[libraryId] || [];
return [...games].sort((a, b) => {
const dateA = new Date(a.createdAt).getTime();
const dateB = new Date(b.createdAt).getTime();
return dateB - dateA; // Descending order (newest first)
});
};
// Sort games by date added (newest first) for collections
const getSortedCollectionGames = (collection: CollectionDto) => {
const games = gamesByCollection[collection.id] || [];
const gamesAddedAt = collection.metadata?.gamesAddedAt || {};
return [...games].sort((a, b) => {
const dateA = gamesAddedAt[a.id.toString()]
? new Date(gamesAddedAt[a.id.toString()]).getTime()
: 0;
const dateB = gamesAddedAt[b.id.toString()]
? new Date(gamesAddedAt[b.id.toString()]).getTime()
: 0;
return dateB - dateA; // Descending order (newest first)
});
};
return (
<div className="w-full">
<div className="flex flex-col gap-4">
@@ -65,13 +91,13 @@ export default function HomeView() {
}
{filteredAndSortedLibraries.map((library) => (
<CoverRow key={library.id} title={library.name}
games={gamesByLibrary[library.id] || []}
games={getSortedLibraryGames(library.id)}
link={"/library/" + library.id}
/>
))}
{filteredAndSortedCollections.map((collection) => (
<CoverRow key={collection.id} title={collection.name}
games={gamesByCollection[collection.id] || []}
games={getSortedCollectionGames(collection)}
link={"/collection/" + collection.id}
/>
))}