* Migrate to Nuxt 3 * Update vercel config * remove tsconfig comment * Changelog experiment + working proj pages * Fix package json * Prevent vercel complaining * fix deploy (hopefully) * Tag generator * Switch to yarn * Vercel pls 🙏 * Fix tag generation bug * Make (most) non-logged in pages work * fix base build * Linting + state * Eradicate axios, make most user pages work * Fix checkbox state being set incorrectly * Make most things work * Final stretch * Finish (most) things * Move to update model value * Fix modal text getting blurred from transforms (#964) * Adjust nav-link border radius when focused (#961) * Transition between animation states on TextLogo (#955) * Transition between animation states on TextLogo * Remove unused refs * Fixes from review * Disable tabbing to pagination arrows when disabled (#972) * Make position of the "no results" text on grid/gallery views consistent (fixes #963) (#965) * Fix position of the "no results" text on grid view * fix padding * Remove extra margin on main page, fixes #957 (#959) * Fix layout shift and placeholder line height (#973) * Fix a lot of issues * Fix more nuxt 3 issues * fix not all versions showing up (temp) * inline inter css file * More nuxt 3 fixes * [skip ci] broken- backup changes * Change modpack warnings to blue instead of red (#991) * Fix some hydration issues * Update nuxt * Fix some images not showing * Add pagination to versions page + fix lag * Make changelog page consistent with versions page * sync before merge * Delete old file * Fix actions failing * update branch * Fixes navbar transition animation. (#1012) * Fixes navbar transition animation. * Fixes Y-axis animation. Fixes mobile menu. Removes highlightjs prop. * Changes xss call to renderString. * Fixes renderString call. * Removes unnecessary styling. * Reverts mobile nav change. * Nuxt 3 Lazy Loading Search (#1022) * Uses lazyFetch for results. onSearchChange refreshes. Adds loading circle. * Removes console.log * Preserves old page when paging. * Diagnosing filtering bugs. * Fix single facet filtering * Implements useAuth in settings/account. * tiny ssr fix * Updating nuxt.config checklist. * Implements useAuth in revenue, moneitzation, and dashboard index pages. * Fixes setups. * Eliminates results when path changes. Adds animated logo. * Ensures loading animation renders on search page. --------- Co-authored-by: Jai A <jaiagr+gpg@pm.me> * Fix navigation issues * Square button fix (#1023) * Removes checklist from nuxt.config. * Modifies Nuxt CI to build after linting. * Fixes prettierignore file. * bug fixes * Update whitelist domains * Page improvements, fix CLS * Fix a lot of things * Fix project type redirect * Fix 404 errors * Fix user settings + hydration error * Final fixes * fix(creator-section): border radius on icons not aligning with bg (#1027) Co-authored-by: MagnusHJensen <magnus.holm.jensen@lego.dk> * Improvements to the mobile navbar (#984) * Transition between animation states on TextLogo * Remove unused refs * Fixes from review * Improvements to the mobile nav menu * fix avatar alt text * Nevermind, got confused for a moment * Tab bar, menu layout improvements * Highlight search icon when menu is open * Update layouts/default.vue Co-authored-by: Magnus Jensen <magnushjensen.mail@gmail.com> * Fix some issues * Use caret instead * Run prettier * Add create a project --------- Co-authored-by: Magnus Jensen <magnushjensen.mail@gmail.com> Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com> Co-authored-by: Jai A <jaiagr+gpg@pm.me> * Fix mobile menu issues * More issues * Fix lint --------- Co-authored-by: Kaeden Murphy <kmurphy@kaedenmurphy.dev> Co-authored-by: triphora <emmaffle@modrinth.com> Co-authored-by: Zach Baird <30800863+ZachBaird@users.noreply.github.com> Co-authored-by: stairman06 <36215135+stairman06@users.noreply.github.com> Co-authored-by: Zachary Baird <zdb1994@yahoo.com> Co-authored-by: Magnus Jensen <magnushjensen.mail@gmail.com> Co-authored-by: MagnusHJensen <magnus.holm.jensen@lego.dk>
179 lines
5.0 KiB
Vue
179 lines
5.0 KiB
Vue
<template>
|
|
<div
|
|
v-if="
|
|
loaderFilters.length > 1 || gameVersionFilters.length > 1 || versionTypeFilters.length > 1
|
|
"
|
|
class="card search-controls"
|
|
>
|
|
<Multiselect
|
|
v-if="loaderFilters.length > 1"
|
|
v-model="selectedLoaders"
|
|
:options="loaderFilters"
|
|
:custom-label="(value) => value.charAt(0).toUpperCase() + value.slice(1)"
|
|
:multiple="true"
|
|
:searchable="false"
|
|
:show-no-results="false"
|
|
:close-on-select="true"
|
|
:clear-search-on-select="false"
|
|
:show-labels="false"
|
|
:allow-empty="true"
|
|
placeholder="Filter loader..."
|
|
@update:model-value="updateVersionFilters()"
|
|
/>
|
|
<Multiselect
|
|
v-if="gameVersionFilters.length > 1"
|
|
v-model="selectedGameVersions"
|
|
:options="
|
|
includeSnapshots
|
|
? gameVersionFilters.map((x) => x.version)
|
|
: gameVersionFilters.filter((it) => it.version_type === 'release').map((x) => x.version)
|
|
"
|
|
:multiple="true"
|
|
:searchable="true"
|
|
:show-no-results="false"
|
|
:close-on-select="false"
|
|
:show-labels="false"
|
|
:hide-selected="true"
|
|
:selectable="() => selectedGameVersions.length <= 6"
|
|
placeholder="Filter versions..."
|
|
@update:model-value="updateVersionFilters()"
|
|
/>
|
|
<Multiselect
|
|
v-if="versionTypeFilters.length > 1"
|
|
v-model="selectedVersionTypes"
|
|
:options="versionTypeFilters"
|
|
:custom-label="(x) => $capitalizeString(x)"
|
|
:multiple="true"
|
|
:searchable="false"
|
|
:show-no-results="false"
|
|
:close-on-select="true"
|
|
:clear-search-on-select="false"
|
|
:show-labels="false"
|
|
:allow-empty="true"
|
|
placeholder="Filter channels..."
|
|
@update:model-value="updateVersionFilters()"
|
|
/>
|
|
<Checkbox
|
|
v-if="
|
|
gameVersionFilters.length > 1 &&
|
|
gameVersionFilters.some((v) => v.version_type !== 'release')
|
|
"
|
|
v-model="includeSnapshots"
|
|
label="Include snapshots"
|
|
description="Include snapshots"
|
|
:border="false"
|
|
@update:model-value="updateQuery"
|
|
/>
|
|
<button
|
|
title="Clear filters"
|
|
:disabled="selectedLoaders.length === 0 && selectedGameVersions.length === 0"
|
|
class="iconified-button"
|
|
@click="
|
|
() => {
|
|
selectedLoaders = []
|
|
selectedGameVersions = []
|
|
selectedVersionTypes = []
|
|
updateVersionFilters()
|
|
}
|
|
"
|
|
>
|
|
<ClearIcon />
|
|
Clear filters
|
|
</button>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import Multiselect from 'vue-multiselect'
|
|
import Checkbox from '~/components/ui/Checkbox'
|
|
import ClearIcon from '~/assets/images/utils/clear.svg'
|
|
|
|
const emit = defineEmits(['updateVersions'])
|
|
const props = defineProps({
|
|
versions: {
|
|
type: Array,
|
|
default() {
|
|
return []
|
|
},
|
|
},
|
|
})
|
|
|
|
const data = useNuxtApp()
|
|
const route = useRoute()
|
|
|
|
const tempLoaders = new Set()
|
|
let tempVersions = new Set()
|
|
const tempReleaseChannels = new Set()
|
|
|
|
for (const version of props.versions) {
|
|
for (const loader of version.loaders) {
|
|
tempLoaders.add(loader)
|
|
}
|
|
for (const gameVersion of version.game_versions) {
|
|
tempVersions.add(gameVersion)
|
|
}
|
|
tempReleaseChannels.add(version.version_type)
|
|
}
|
|
|
|
tempVersions = Array.from(tempVersions)
|
|
|
|
const loaderFilters = shallowRef(Array.from(tempLoaders))
|
|
const gameVersionFilters = shallowRef(
|
|
data.$tag.gameVersions.filter((gameVer) => tempVersions.includes(gameVer.version))
|
|
)
|
|
const versionTypeFilters = shallowRef(Array.from(tempReleaseChannels))
|
|
const includeSnapshots = ref(route.query.s === 'true')
|
|
|
|
const selectedGameVersions = shallowRef(route.query.g ?? [])
|
|
const selectedLoaders = shallowRef(route.query.l ?? [])
|
|
const selectedVersionTypes = shallowRef(route.query.c ?? [])
|
|
|
|
async function updateVersionFilters() {
|
|
const temp = props.versions.filter(
|
|
(projectVersion) =>
|
|
(selectedGameVersions.value.length === 0 ||
|
|
selectedGameVersions.value.some((gameVersion) =>
|
|
projectVersion.game_versions.includes(gameVersion)
|
|
)) &&
|
|
(selectedLoaders.value.length === 0 ||
|
|
selectedLoaders.value.some((loader) => projectVersion.loaders.includes(loader))) &&
|
|
(selectedVersionTypes.value.length === 0 ||
|
|
selectedVersionTypes.value.includes(projectVersion.version_type))
|
|
)
|
|
|
|
await updateQuery()
|
|
emit('updateVersions', temp)
|
|
}
|
|
|
|
async function updateQuery() {
|
|
const router = useRouter()
|
|
const route = useRoute()
|
|
|
|
await router.replace({
|
|
query: {
|
|
...route.query,
|
|
l: selectedLoaders.value.length === 0 ? undefined : selectedLoaders.value,
|
|
g: selectedGameVersions.value.length === 0 ? undefined : selectedGameVersions.value,
|
|
c: selectedVersionTypes.value.length === 0 ? undefined : selectedVersionTypes.value,
|
|
s: includeSnapshots.value ? true : undefined,
|
|
},
|
|
})
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.search-controls {
|
|
display: flex;
|
|
flex-direction: row;
|
|
gap: var(--spacing-card-md);
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
.multiselect {
|
|
flex: 1;
|
|
}
|
|
.checkbox-outer {
|
|
min-width: fit-content;
|
|
}
|
|
}
|
|
</style>
|