fix(mod-card): add nsfw tag if mod is in nsfwList, while filtering

This commit is contained in:
enes 2024-10-28 14:00:44 +01:00
parent 0b1d43eac4
commit 4f4e3a7c85

View File

@ -22,6 +22,15 @@ export const useFilteredMods = (
) => { ) => {
return useMemo(() => { return useMemo(() => {
const nsfwFilter = (mods: ModDetails[]) => { const nsfwFilter = (mods: ModDetails[]) => {
// Add nsfw tag to mods included in nsfwList
if (filterOptions.nsfw !== NSFWFilter.Hide_NSFW) {
mods = mods.map((mod) => {
return !mod.nsfw && nsfwList.includes(mod.aTag)
? { ...mod, nsfw: true }
: mod
})
}
// Determine the filtering logic based on the NSFW filter option // Determine the filtering logic based on the NSFW filter option
switch (filterOptions.nsfw) { switch (filterOptions.nsfw) {
case NSFWFilter.Hide_NSFW: case NSFWFilter.Hide_NSFW: