Compare commits
4 Commits
e46c022d3d
...
5d791413ff
Author | SHA1 | Date | |
---|---|---|---|
|
5d791413ff | ||
|
3ed7eada83 | ||
|
3ff4437d44 | ||
|
3b2e899c14 |
@ -60,7 +60,7 @@ export const ModForm = ({ existingModData }: ModFormProps) => {
|
|||||||
const [isPublishing, setIsPublishing] = useState(false)
|
const [isPublishing, setIsPublishing] = useState(false)
|
||||||
const [gameOptions, setGameOptions] = useState<GameOption[]>([])
|
const [gameOptions, setGameOptions] = useState<GameOption[]>([])
|
||||||
const [formState, setFormState] = useState<ModFormState>(
|
const [formState, setFormState] = useState<ModFormState>(
|
||||||
initializeFormState(existingModData)
|
initializeFormState()
|
||||||
)
|
)
|
||||||
const [formErrors, setFormErrors] = useState<FormErrors>({})
|
const [formErrors, setFormErrors] = useState<FormErrors>({})
|
||||||
|
|
||||||
@ -70,6 +70,12 @@ export const ModForm = ({ existingModData }: ModFormProps) => {
|
|||||||
}
|
}
|
||||||
}, [location.pathname]) // Only trigger when the pathname changes to submit-mod
|
}, [location.pathname]) // Only trigger when the pathname changes to submit-mod
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (existingModData) {
|
||||||
|
setFormState(initializeFormState(existingModData))
|
||||||
|
}
|
||||||
|
}, [existingModData])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const options = games.map((game) => ({
|
const options = games.map((game) => ({
|
||||||
label: game['Game Name'],
|
label: game['Game Name'],
|
||||||
|
@ -8,7 +8,7 @@ import { GameCard } from '../components/GameCard'
|
|||||||
import { ModCard } from '../components/ModCard'
|
import { ModCard } from '../components/ModCard'
|
||||||
import { LANDING_PAGE_DATA } from '../constants'
|
import { LANDING_PAGE_DATA } from '../constants'
|
||||||
import { RelayController } from '../controllers'
|
import { RelayController } from '../controllers'
|
||||||
import { useDidMount, useGames } from '../hooks'
|
import { useDidMount, useGames, useMuteLists } from '../hooks'
|
||||||
import { appRoutes, getModPageRoute } from '../routes'
|
import { appRoutes, getModPageRoute } from '../routes'
|
||||||
import { ModDetails } from '../types'
|
import { ModDetails } from '../types'
|
||||||
import {
|
import {
|
||||||
@ -258,12 +258,12 @@ const DisplayLatestMods = () => {
|
|||||||
const [isFetchingLatestMods, setIsFetchingLatestMods] = useState(true)
|
const [isFetchingLatestMods, setIsFetchingLatestMods] = useState(true)
|
||||||
const [latestMods, setLatestMods] = useState<ModDetails[]>([])
|
const [latestMods, setLatestMods] = useState<ModDetails[]>([])
|
||||||
|
|
||||||
|
const muteLists = useMuteLists()
|
||||||
|
|
||||||
useDidMount(() => {
|
useDidMount(() => {
|
||||||
fetchMods({ source: window.location.host })
|
fetchMods({ source: window.location.host })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const mods = res
|
const mods = res.sort((a, b) => b.published_at - a.published_at)
|
||||||
.sort((a, b) => b.published_at - a.published_at)
|
|
||||||
.slice(0, 4)
|
|
||||||
setLatestMods(mods)
|
setLatestMods(mods)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
@ -271,6 +271,21 @@ const DisplayLatestMods = () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const filteredMods = useMemo(() => {
|
||||||
|
const mutedAuthors = [...muteLists.admin.authors, ...muteLists.user.authors]
|
||||||
|
const mutedEvents = [
|
||||||
|
...muteLists.admin.replaceableEvents,
|
||||||
|
...muteLists.user.replaceableEvents
|
||||||
|
]
|
||||||
|
|
||||||
|
const filtered = latestMods.filter(
|
||||||
|
(mod) =>
|
||||||
|
!mutedAuthors.includes(mod.author) && !mutedEvents.includes(mod.aTag)
|
||||||
|
)
|
||||||
|
|
||||||
|
return filtered.slice(0, 4)
|
||||||
|
}, [muteLists, latestMods])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='IBMSecMain IBMSMListWrapper'>
|
<div className='IBMSecMain IBMSMListWrapper'>
|
||||||
<div className='IBMSMTitleMain'>
|
<div className='IBMSMTitleMain'>
|
||||||
@ -280,7 +295,7 @@ const DisplayLatestMods = () => {
|
|||||||
{isFetchingLatestMods ? (
|
{isFetchingLatestMods ? (
|
||||||
<Spinner />
|
<Spinner />
|
||||||
) : (
|
) : (
|
||||||
latestMods.map((mod) => {
|
filteredMods.map((mod) => {
|
||||||
return <ModCard key={mod.id} {...mod} />
|
return <ModCard key={mod.id} {...mod} />
|
||||||
})
|
})
|
||||||
)}
|
)}
|
||||||
|
@ -1344,6 +1344,14 @@ const Download = ({
|
|||||||
</p>
|
</p>
|
||||||
{showAuthDetails && (
|
{showAuthDetails && (
|
||||||
<div className='IBMSMSMBSSDownloadsElementInsideAltTable'>
|
<div className='IBMSMSMBSSDownloadsElementInsideAltTable'>
|
||||||
|
<div className='IBMSMSMBSSDownloadsElementInsideAltTableRow'>
|
||||||
|
<div className='IBMSMSMBSSDownloadsElementInsideAltTableRowCol IBMSMSMBSSDownloadsElementInsideAltTableRowColFirst'>
|
||||||
|
<p>Download URL</p>
|
||||||
|
</div>
|
||||||
|
<div className='IBMSMSMBSSDownloadsElementInsideAltTableRowCol'>
|
||||||
|
<p>{url}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div className='IBMSMSMBSSDownloadsElementInsideAltTableRow'>
|
<div className='IBMSMSMBSSDownloadsElementInsideAltTableRow'>
|
||||||
<div className='IBMSMSMBSSDownloadsElementInsideAltTableRowCol IBMSMSMBSSDownloadsElementInsideAltTableRowColFirst'>
|
<div className='IBMSMSMBSSDownloadsElementInsideAltTableRowCol IBMSMSMBSSDownloadsElementInsideAltTableRowColFirst'>
|
||||||
<p>SHA-256 hash</p>
|
<p>SHA-256 hash</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user