Skip to content

Commit

Permalink
Filter out non-std maps in search results
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Schürz committed Jan 6, 2025
1 parent da60ad6 commit 09efc05
Showing 1 changed file with 26 additions and 22 deletions.
48 changes: 26 additions & 22 deletions packages/beatmap-viewer/src/screens/home/HomeScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ export class HomeScreen extends OsucadScreen {
#hero!: SearchHero;

updateResults(results: BeatmapSetResponse[]) {
this.beatmaps.value = results.map(mapset => this.createMapsetInfo(mapset));
this.beatmaps.value = results
.map(mapset => this.createMapsetInfo(mapset))
.filter(it => it.beatmaps.length > 0);

this.#hero.minimize();
}
Expand Down Expand Up @@ -97,27 +99,29 @@ export class HomeScreen extends OsucadScreen {
},
};

carouselMapsetInfo.beatmaps = mapset.beatmaps.map<CarouselBeatmapInfo>((beatmap) => {
const { id, version, difficulty_rating } = beatmap;

return {
id: id.toString(),
artist,
title,
audioUrl: '',
authorName: creator,
difficultyName: version,
backgroundPath: async () => null,
lastEdited: null,
loadThumbnailLarge: async () => carouselMapsetInfo.loadThumbnailLarge(),
loadThumbnailSmall: async () => carouselMapsetInfo.loadThumbnailSmall(),
mapset: carouselMapsetInfo,
previewPoint: null,
setId: mapset.id.toString(),
starRating: difficulty_rating,
select: async () => this.openEditor(mapset, beatmap),
};
});
carouselMapsetInfo.beatmaps = mapset.beatmaps
.filter(it => it.mode_int === 0)
.map<CarouselBeatmapInfo>((beatmap) => {
const { id, version, difficulty_rating } = beatmap;

return {
id: id.toString(),
artist,
title,
audioUrl: '',
authorName: creator,
difficultyName: version,
backgroundPath: async () => null,
lastEdited: null,
loadThumbnailLarge: async () => carouselMapsetInfo.loadThumbnailLarge(),
loadThumbnailSmall: async () => carouselMapsetInfo.loadThumbnailSmall(),
mapset: carouselMapsetInfo,
previewPoint: null,
setId: mapset.id.toString(),
starRating: difficulty_rating,
select: async () => this.openEditor(mapset, beatmap),
};
});

return carouselMapsetInfo;
}
Expand Down

0 comments on commit 09efc05

Please sign in to comment.