From 3b2e899c14e17912b20ba230dc5377227761a03c Mon Sep 17 00:00:00 2001 From: daniyal Date: Mon, 30 Sep 2024 14:52:19 +0500 Subject: [PATCH 1/3] fix: update form state on getting existing mod data --- src/components/ModForm.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/ModForm.tsx b/src/components/ModForm.tsx index 982fc75..8be5ba8 100644 --- a/src/components/ModForm.tsx +++ b/src/components/ModForm.tsx @@ -60,7 +60,7 @@ export const ModForm = ({ existingModData }: ModFormProps) => { const [isPublishing, setIsPublishing] = useState(false) const [gameOptions, setGameOptions] = useState([]) const [formState, setFormState] = useState( - initializeFormState(existingModData) + initializeFormState() ) const [formErrors, setFormErrors] = useState({}) @@ -70,6 +70,12 @@ export const ModForm = ({ existingModData }: ModFormProps) => { } }, [location.pathname]) // Only trigger when the pathname changes to submit-mod + useEffect(() => { + if (existingModData) { + setFormState(initializeFormState(existingModData)) + } + }, [existingModData]) + useEffect(() => { const options = games.map((game) => ({ label: game['Game Name'], -- 2.34.1 From 3ff4437d4486b51c72d85a3fca36fc0066b0e8ea Mon Sep 17 00:00:00 2001 From: daniyal Date: Mon, 30 Sep 2024 15:13:57 +0500 Subject: [PATCH 2/3] fix: hide mods from latest mods section in homepage that admin/user adds to mute list --- src/pages/home.tsx | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/pages/home.tsx b/src/pages/home.tsx index f432d51..9b204dc 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -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 } from '../hooks' +import { useDidMount, useGames, useMuteLists } from '../hooks' import { appRoutes, getModPageRoute } from '../routes' import { ModDetails } from '../types' import { @@ -258,12 +258,12 @@ const DisplayLatestMods = () => { const [isFetchingLatestMods, setIsFetchingLatestMods] = useState(true) const [latestMods, setLatestMods] = useState([]) + const muteLists = useMuteLists() + useDidMount(() => { fetchMods({ source: window.location.host }) .then((res) => { - const mods = res - .sort((a, b) => b.published_at - a.published_at) - .slice(0, 4) + const mods = res.sort((a, b) => b.published_at - a.published_at) setLatestMods(mods) }) .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 (
@@ -280,7 +295,7 @@ const DisplayLatestMods = () => { {isFetchingLatestMods ? ( ) : ( - latestMods.map((mod) => { + filteredMods.map((mod) => { return }) )} -- 2.34.1 From 3ed7eada8356bea3fccced223448a0ea7d2b0cb7 Mon Sep 17 00:00:00 2001 From: daniyal Date: Mon, 30 Sep 2024 15:17:32 +0500 Subject: [PATCH 3/3] fix: display download url in authentication details --- src/pages/mod/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pages/mod/index.tsx b/src/pages/mod/index.tsx index ac1636f..1c3cee6 100644 --- a/src/pages/mod/index.tsx +++ b/src/pages/mod/index.tsx @@ -1344,6 +1344,14 @@ const Download = ({

{showAuthDetails && (
+
+
+

Download URL

+
+
+

{url}

+
+

SHA-256 hash

-- 2.34.1