Compare commits
No commits in common. "7840c32d2b83413b3f1e2e47b3b166a69282bd63" and "c1d226b4d433897946f634f85a6fe287b7bf8a1a" have entirely different histories.
7840c32d2b
...
c1d226b4d4
@ -2,5 +2,4 @@ export * from './redux'
|
||||
export * from './useDidMount'
|
||||
export * from './useGames'
|
||||
export * from './useMuteLists'
|
||||
export * from './useNSFWList'
|
||||
export * from './useReactions'
|
||||
|
@ -1,17 +0,0 @@
|
||||
import { MetadataController } from 'controllers'
|
||||
import { useState } from 'react'
|
||||
import { useDidMount } from './useDidMount'
|
||||
|
||||
export const useNSFWList = () => {
|
||||
const [nsfwList, setNSFWList] = useState<string[]>([])
|
||||
|
||||
useDidMount(async () => {
|
||||
const metadataController = await MetadataController.getInstance()
|
||||
|
||||
metadataController.getNSFWList().then((list) => {
|
||||
setNSFWList(list)
|
||||
})
|
||||
})
|
||||
|
||||
return nsfwList
|
||||
}
|
@ -8,7 +8,7 @@ import { GameCard } from '../components/GameCard'
|
||||
import { ModCard } from '../components/ModCard'
|
||||
import { LANDING_PAGE_DATA } from '../constants'
|
||||
import { RelayController } from '../controllers'
|
||||
import { useDidMount, useGames, useMuteLists, useNSFWList } from '../hooks'
|
||||
import { useDidMount, useGames, useMuteLists } from '../hooks'
|
||||
import { appRoutes, getModPageRoute } from '../routes'
|
||||
import { ModDetails } from '../types'
|
||||
import {
|
||||
@ -259,7 +259,6 @@ const DisplayLatestMods = () => {
|
||||
const [latestMods, setLatestMods] = useState<ModDetails[]>([])
|
||||
|
||||
const muteLists = useMuteLists()
|
||||
const nsfwList = useNSFWList()
|
||||
|
||||
useDidMount(() => {
|
||||
fetchMods({ source: window.location.host })
|
||||
@ -281,14 +280,11 @@ const DisplayLatestMods = () => {
|
||||
|
||||
const filtered = latestMods.filter(
|
||||
(mod) =>
|
||||
!mutedAuthors.includes(mod.author) &&
|
||||
!mutedEvents.includes(mod.aTag) &&
|
||||
!nsfwList.includes(mod.aTag) &&
|
||||
!mod.nsfw
|
||||
!mutedAuthors.includes(mod.author) && !mutedEvents.includes(mod.aTag)
|
||||
)
|
||||
|
||||
return filtered.slice(0, 4)
|
||||
}, [muteLists, nsfwList, latestMods])
|
||||
}, [muteLists, latestMods])
|
||||
|
||||
return (
|
||||
<div className='IBMSecMain IBMSMListWrapper'>
|
||||
|
@ -12,7 +12,8 @@ import { createSearchParams, useNavigate } from 'react-router-dom'
|
||||
import { LoadingSpinner } from '../components/LoadingSpinner'
|
||||
import { ModCard } from '../components/ModCard'
|
||||
import { MOD_FILTER_LIMIT } from '../constants'
|
||||
import { useAppSelector, useMuteLists, useNSFWList } from '../hooks'
|
||||
import { MetadataController } from '../controllers'
|
||||
import { useAppSelector, useDidMount, useMuteLists } from '../hooks'
|
||||
import { appRoutes } from '../routes'
|
||||
import '../styles/filters.css'
|
||||
import '../styles/pagination.css'
|
||||
@ -57,12 +58,21 @@ export const ModsPage = () => {
|
||||
moderated: ModeratedFilter.Moderated
|
||||
})
|
||||
const muteLists = useMuteLists()
|
||||
const nsfwList = useNSFWList()
|
||||
|
||||
const [nsfwList, setNSFWList] = useState<string[]>([])
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
|
||||
const userState = useAppSelector((state) => state.user)
|
||||
|
||||
useDidMount(async () => {
|
||||
const metadataController = await MetadataController.getInstance()
|
||||
|
||||
metadataController.getNSFWList().then((list) => {
|
||||
setNSFWList(list)
|
||||
})
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
setIsFetching(true)
|
||||
fetchMods({ source: filterOptions.source })
|
||||
|
Loading…
Reference in New Issue
Block a user