forked from didirus/AstralRinth
Mod search fixes (#249)
* Remove all uses of `process.env.domain` * Revert "Remove all uses of `process.env.domain`" This reverts commit 5af9b83091f395d3a0f954cf6776494c1cfe7a04. * Increase minimum amount of pages for pagination Fixes modrinth/knossos#231 * Detect mod search query removal Fixes modrinth/knossos#240 * Increase margin on project card categories mobile Fixes modrinth/knossos#230
This commit is contained in:
@@ -288,7 +288,7 @@ export default {
|
||||
@media screen and (max-width: 560px) {
|
||||
.left-categories {
|
||||
display: flex;
|
||||
margin: 0 0 0.75rem 0.75rem;
|
||||
margin: 0 0.75rem 0.75rem 0.75rem;
|
||||
width: 7rem;
|
||||
}
|
||||
.right-categories {
|
||||
|
||||
@@ -453,6 +453,25 @@ export default {
|
||||
maxResults: 20,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
async '$route.query'(to, from) {
|
||||
// Detects when the query is removed from the URL
|
||||
if (Object.keys(to).length === 0 && Object.keys(from).length !== 0) {
|
||||
this.query = ''
|
||||
this.displayLicense = ''
|
||||
this.selectedLicense = ''
|
||||
this.showSnapshots = false
|
||||
this.selectedVersions = []
|
||||
this.selectedEnvironments = []
|
||||
this.facets = []
|
||||
this.currentPage = 1
|
||||
this.sortType = { display: 'Relevance', name: 'relevance' }
|
||||
this.maxResults = 20
|
||||
|
||||
await this.onSearchChange(1)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
async fillVersions() {
|
||||
try {
|
||||
@@ -613,7 +632,7 @@ export default {
|
||||
const pageAmount = Math.ceil(res.data.total_hits / res.data.limit)
|
||||
|
||||
this.currentPage = newPageNumber
|
||||
if (pageAmount > 4) {
|
||||
if (pageAmount > 7) {
|
||||
if (this.currentPage + 3 >= pageAmount) {
|
||||
this.pages = [
|
||||
1,
|
||||
@@ -657,7 +676,12 @@ export default {
|
||||
if (this.maxResults > 20)
|
||||
url += `&m=${encodeURIComponent(this.maxResults)}`
|
||||
|
||||
window.history.replaceState(new Date(), 'Mods', url)
|
||||
// Check if URL needs to be changed, ignoring browser `,` to `%2C` changes
|
||||
if (
|
||||
url.replace(/%2C|,/g, '') !==
|
||||
this.$route.fullPath.substring(1).replace(/%2C|,/g, '')
|
||||
)
|
||||
this.$router.replace(url)
|
||||
}
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
|
||||
Reference in New Issue
Block a user