From 316fe72ea521adc0b516fe8464287411bae0cb4b Mon Sep 17 00:00:00 2001 From: Awakened Redstone <40528665+Awakened-Redstone@users.noreply.github.com> Date: Thu, 9 Jan 2025 21:45:23 -0300 Subject: [PATCH] feat(frontend): Automatically open download modal when filter queries are present (on the main mod page) (#3133) * feat: Automatically open download modal when filter queries are present * chore: Use a hash to open the modal, and make the filter queries independent of the modal --- apps/frontend/src/pages/[type]/[id].vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps/frontend/src/pages/[type]/[id].vue b/apps/frontend/src/pages/[type]/[id].vue index 198fa03f3..5a3afd6e8 100644 --- a/apps/frontend/src/pages/[type]/[id].vue +++ b/apps/frontend/src/pages/[type]/[id].vue @@ -1247,6 +1247,23 @@ if (!route.name.startsWith("type-id-settings")) { const onUserCollectProject = useClientTry(userCollectProject); +const {version, loader} = route.query; +if (version !== undefined && project.value.game_versions.includes(version)) { + userSelectedGameVersion.value = version; +} +if (loader !== undefined && project.value.loaders.includes(loader)) { + userSelectedPlatform.value = loader; +} + +watch(downloadModal, (modal) => { + if (!modal) return; + + // route.hash returns everything in the hash string, including the # itself + if (route.hash === "#download") { + modal.show(); + } +}) + async function setProcessing() { startLoading();