New features (#592)

* New features

* Lots of bug fixes

* Fix respack creation

* Improve mobile nav with more project types

* Fix resolution sorting and remove icons

* Move cookie consent to top on small devices to get out of the way of navigation

* Move cookie consent + fix hydration

* Fix project editing + update search features

* Centralize hardcoding of loader/category names, fix cookie consent shadow, fix mobile navbar rounding

* Fix plugin platforms formatting

* Kitchen sink!

* Add support for display names

* LiteLoader formatting

* Fixed "show all loaders" toggle not resetting when changing pages

* Allow multiple loaders in version filter controls

* Fix clear filters button

* Revert "Add support for display names"

This reverts commit 370838763d86bcae51bf06c304248f7a1f8fc28f.

* Let's see how this goes. Upstream filters, attempt 1

* github? hello?

* No more "Server mod" on plugins

* Fix formatting of project types in project creation

* Move where project creation sets the resource pack loader

* Allow setting pixelated image-rendering

Allows to apply 'style' attribute to IMG tags with value
'image-rendering' set to 'pixelated', which can be useful for people who
use pixel art in their READMEs (to demonstrate items, for example).

* fix user page + hydration issue fix from Brawaru

* Rename to proxies

* Make categories use title case

* Always show project type on moderation page, improve project type display on project pages

* Remove invalid key

* Missed a check

* Fix browse menu animation

* Fix disabled button condition and minimum width for 2 lines

* Body -> Description in edit pages

* More casing consistency issues

* Fix duplicate version URLs

* Fix version creation

* Edit URLs, fix privacy page buttons

* Fix notifications popup overlaying

* Final merge fixes

Co-authored-by: Prospector <prospectordev@gmail.com>
Co-authored-by: Sasha Sorokin <10401817+Brawaru@users.noreply.github.com>
This commit is contained in:
Geometrically
2022-08-14 12:42:58 -07:00
committed by GitHub
parent b16475b8bd
commit 673f7a82d1
31 changed files with 1152 additions and 348 deletions

View File

@@ -36,38 +36,46 @@
</nuxt-link>
<div
v-if="
project.client_side === 'optional' &&
project.server_side === 'optional'
project.project_type !== 'resourcepack' &&
projectTypeDisplay !== 'plugin'
"
class="side-descriptor"
>
<InfoIcon aria-hidden="true" />
Universal {{ project.project_type }}
</div>
<div
v-else-if="
(project.client_side === 'optional' ||
project.client_side === 'required') &&
(project.server_side === 'optional' ||
project.server_side === 'unsupported')
"
class="side-descriptor"
>
<InfoIcon aria-hidden="true" />
Client {{ project.project_type }}
</div>
<div
v-else-if="
(project.server_side === 'optional' ||
project.server_side === 'required') &&
(project.client_side === 'optional' ||
project.client_side === 'unsupported')
"
class="side-descriptor"
>
<InfoIcon aria-hidden="true" />
Server {{ project.project_type }}
<div
v-if="
project.client_side === 'optional' &&
project.server_side === 'optional'
"
class="side-descriptor"
>
<InfoIcon aria-hidden="true" />
Universal {{ projectTypeDisplay }}
</div>
<div
v-else-if="
(project.client_side === 'optional' ||
project.client_side === 'required') &&
(project.server_side === 'optional' ||
project.server_side === 'unsupported')
"
class="side-descriptor"
>
<InfoIcon aria-hidden="true" />
Client {{ projectTypeDisplay }}
</div>
<div
v-else-if="
(project.server_side === 'optional' ||
project.server_side === 'required') &&
(project.client_side === 'optional' ||
project.client_side === 'unsupported')
"
class="side-descriptor"
>
<InfoIcon aria-hidden="true" />
Server {{ projectTypeDisplay }}
</div>
</div>
<p class="description">
{{ project.description }}
</p>
@@ -389,7 +397,7 @@
<nuxt-link
:to="`/${project.project_type}/${
project.slug ? project.slug : project.id
}/version/${encodeURIComponent(version.version_number)}`"
}/version/${encodeURI(version.displayUrlEnding)}`"
class="top title-link"
>
{{ version.name }}
@@ -398,15 +406,7 @@
v-if="version.game_versions.length > 0"
class="game-version item"
>
{{
version.loaders
.map((x) =>
x.toLowerCase() === 'modloader'
? 'ModLoader'
: x.charAt(0).toUpperCase() + x.slice(1)
)
.join(', ')
}}
{{ version.loaders.map((x) => $formatCategory(x)).join(', ') }}
{{ $formatVersion(version.game_versions) }}
</div>
<VersionBadge
@@ -455,13 +455,25 @@
}}</a>
</div>
</div>
<div class="info">
<div
v-if="
project.project_type !== 'resourcepack' &&
projectTypeDisplay !== 'plugin'
"
class="info"
>
<div class="key">Client side</div>
<div class="value">
{{ project.client_side }}
</div>
</div>
<div class="info">
<div
v-if="
project.project_type !== 'resourcepack' &&
projectTypeDisplay !== 'plugin'
"
class="info"
>
<div class="key">Server side</div>
<div class="value">
{{ project.server_side }}
@@ -647,7 +659,7 @@ export default {
Categories,
},
async asyncData(data) {
const projectTypes = ['mod', 'modpack']
const projectTypes = ['mod', 'modpack', 'resourcepack']
try {
if (
@@ -706,6 +718,16 @@ export default {
project.body = (await data.$axios.get(project.body_url)).data
}
const loaders = []
versions.forEach((version) => {
version.loaders.forEach((loader) => {
if (!loaders.includes(loader)) {
loaders.push(loader)
}
})
})
return {
project,
versions,
@@ -714,6 +736,7 @@ export default {
allMembers: members,
currentMember,
dependencies,
loaders,
}
} catch {
data.error({
@@ -727,6 +750,10 @@ export default {
showKnownErrors: false,
}
},
fetch() {
this.versions = this.$computeVersions(this.versions)
this.featuredVersions = this.$computeVersions(this.featuredVersions)
},
head() {
return {
title: `${this.project.title} - ${
@@ -779,6 +806,14 @@ export default {
],
}
},
computed: {
projectTypeDisplay() {
return this.$getProjectTypeForDisplay(
this.project.project_type,
this.loaders
)
},
},
methods: {
findPrimary(version) {
let file = version.files.find((x) => x.primary)
@@ -1119,7 +1154,10 @@ export default {
.value {
width: 50%;
text-transform: capitalize;
&::first-letter {
text-transform: capitalize;
}
&.lowercase {
text-transform: none;

View File

@@ -14,7 +14,7 @@
<nuxt-link
:to="`/${project.project_type}/${
project.slug ? project.slug : project.id
}/version/${encodeURIComponent(version.version_number)}`"
}/version/${encodeURI(version.displayUrlEnding)}`"
>{{ version.name }}</nuxt-link
>
</h2>
@@ -69,12 +69,6 @@ export default {
DownloadIcon,
VersionFilterControl,
},
data() {
return {
filteredVersions: this.versions,
}
},
auth: false,
props: {
project: {
type: Object,
@@ -95,6 +89,12 @@ export default {
},
},
},
data() {
return {
filteredVersions: this.versions,
}
},
auth: false,
methods: {
updateVersions(updatedVersions) {
this.filteredVersions = updatedVersions

View File

@@ -110,17 +110,13 @@
<Multiselect
id="categories"
v-model="newProject.categories"
:options="
$tag.categories
.filter((x) => x.project_type === project.project_type)
.map((it) => it.name)
"
:options="selectableCategories"
:custom-label="
(value) => value.charAt(0).toUpperCase() + value.slice(1)
"
:loading="$tag.categories.length === 0"
:multiple="true"
:searchable="false"
:searchable="true"
:show-no-results="false"
:close-on-select="false"
:clear-on-select="false"
@@ -132,13 +128,46 @@
:disabled="
(currentMember.permissions & EDIT_DETAILS) !== EDIT_DETAILS
"
@input="setCategories"
/>
</label>
<label>
<span>
<h3>Additional Categories</h3>
<span class="no-padding">
Select up to 3 categories that will help others <br />
find your project.
</span>
</span>
<Multiselect
id="additional_categories"
v-model="newProject.additional_categories"
:options="selectableAdditionalCategories"
:custom-label="
(value) => value.charAt(0).toUpperCase() + value.slice(1)
"
:loading="$tag.categories.length === 0"
:multiple="true"
:searchable="true"
:show-no-results="false"
:close-on-select="false"
:clear-on-select="false"
:show-labels="false"
:max="255"
:limit="6"
:hide-selected="true"
placeholder="Choose additional categories"
:disabled="
(currentMember.permissions & EDIT_DETAILS) !== EDIT_DETAILS
"
@input="setCategories"
/>
</label>
<label class="vertical-input">
<span>
<h3>Vanity URL (slug)<span class="required">*</span></h3>
<span class="slug-description"
>https://modrinth.com/{{ newProject.project_type.toLowerCase() }}/{{
>https://modrinth.com/{{ project.project_type.toLowerCase() }}/{{
newProject.slug ? newProject.slug : 'your-slug'
}}
</span>
@@ -189,7 +218,10 @@
Reset
</button>
</section>
<section class="card game-sides">
<section
v-if="project.project_type !== 'resourcepack'"
class="card game-sides"
>
<div class="columns">
<div>
<h3>Supported environments</h3>
@@ -241,7 +273,7 @@
for="body"
title="You can type an extended description of your project here."
>
Body<span class="required">*</span>
Description<span class="required">*</span>
</label>
</h3>
<span>
@@ -500,6 +532,9 @@ export default {
donationPlatforms: [],
donationLinks: [],
selectableCategories: [],
selectableAdditionalCategories: [],
isProcessing: false,
previewImage: null,
compiledBody: '',
@@ -544,6 +579,8 @@ export default {
this.serverSideType =
this.newProject.server_side.charAt(0) +
this.newProject.server_side.slice(1)
this.setCategories()
},
watch: {
license(newValue, oldValue) {
@@ -584,6 +621,23 @@ export default {
this.DELETE_PROJECT = 1 << 7
},
methods: {
setCategories() {
this.selectableCategories = this.$tag.categories
.filter(
(x) =>
x.project_type === this.project.project_type &&
!this.newProject.additional_categories.includes(x.name)
)
.map((it) => it.name)
this.selectableAdditionalCategories = this.$tag.categories
.filter(
(x) =>
x.project_type === this.project.project_type &&
!this.newProject.categories.includes(x.name)
)
.map((it) => it.name)
},
checkFields() {
const reviewConditions =
this.newProject.body !== '' && this.newProject.versions.length > 0
@@ -626,6 +680,7 @@ export default {
description: this.newProject.description,
body: this.newProject.body,
categories: this.newProject.categories,
additional_categories: this.newProject.additional_categories,
issues_url: this.newProject.issues_url
? this.newProject.issues_url
: null,

View File

@@ -26,7 +26,7 @@
Back to list
</nuxt-link>
</div>
<div>
<div v-if="version">
<div v-if="mode === 'version'" class="version-header">
<h2>{{ version.name }}</h2>
@@ -47,7 +47,7 @@
v-if="$auth.user"
:to="`/${project.project_type}/${
project.slug ? project.slug : project.id
}/version/${encodeURIComponent(version.version_number)}`"
}/version/${encodeURI(version.displayUrlEnding)}`"
class="iconified-button"
>
<CrossIcon aria-hidden="true" />
@@ -113,7 +113,7 @@
class="action iconified-button"
:to="`/${project.project_type}/${
project.slug ? project.slug : project.id
}/version/${encodeURIComponent(version.version_number)}/edit`"
}/version/${encodeURI(version.displayUrlEnding)}/edit`"
@click.prevent="mode = 'edit'"
>
<EditIcon aria-hidden="true" />
@@ -209,8 +209,8 @@
color="red"
/>
</div>
<div class="data">
<p class="title">Mod loaders</p>
<div v-if="project.project_type !== 'resourcepack'" class="data">
<p class="title">Loaders</p>
<multiselect
v-if="mode === 'edit' || mode === 'create'"
v-model="version.loaders"
@@ -223,12 +223,7 @@
)
.map((it) => it.name)
"
:custom-label="
(value) =>
value === 'modloader'
? 'Risugami\'s ModLoader'
: value.charAt(0).toUpperCase() + value.slice(1)
"
:custom-label="(value) => $formatCategory(value)"
:loading="$tag.loaders.length === 0"
:multiple="true"
:searchable="false"
@@ -238,18 +233,10 @@
:show-labels="false"
:limit="6"
:hide-selected="true"
placeholder="Choose mod loaders..."
placeholder="Choose loaders..."
/>
<p v-else class="value">
{{
version.loaders
.map((x) =>
x.toLowerCase() === 'modloader'
? "Risugami's ModLoader"
: x.charAt(0).toUpperCase() + x.slice(1)
)
.join(', ')
}}
{{ version.loaders.map((x) => $formatCategory(x)).join(', ') }}
</p>
</div>
<div v-if="mode === 'version'" class="data">
@@ -365,7 +352,7 @@
dependency.project.slug
? dependency.project.slug
: dependency.project.id
}/version/${encodeURIComponent(
}/version/${encodeURI(
dependency.version.version_number
)}`
: `/${dependency.project.project_type}/${
@@ -754,9 +741,18 @@ export default {
if (!this.version)
this.version = this.versions.find(
(x) => x.version_number === this.$route.params.version
(x) => x.displayUrlEnding === this.$route.params.version
)
if (!this.version) {
this.$nuxt.context.error({
statusCode: 404,
message: 'The page could not be found',
})
return
}
this.version = JSON.parse(JSON.stringify(this.version))
this.primaryFile =
this.version.files.find((file) => file.primary) ?? this.version.files[0]
@@ -891,8 +887,9 @@ export default {
const index = this.versions.findIndex((x) => x.id === this.version.id)
editedVersions.splice(index, 1, version)
this.$emit('update:versions', editedVersions)
const newEditedVersions = this.$computeVersions(editedVersions)
this.$emit('update:versions', newEditedVersions)
this.$emit('update:featuredVersions', featuredVersions)
this.newFiles = []
@@ -901,7 +898,7 @@ export default {
await this.$router.replace(
`/${this.project.project_type}/${
this.project.slug ? this.project.slug : this.project.id
}/version/${encodeURIComponent(this.version.version_number)}`
}/version/${encodeURI(newEditedVersions[index].displayUrlEnding)}`
)
} catch (err) {
this.$notify({
@@ -921,6 +918,10 @@ export default {
const fileParts = this.newFiles.map((f, idx) => `${f.name}-${idx}`)
if (this.project.project_type === 'resourcepack') {
this.version.loaders = ['minecraft']
}
const newVersion = {
project_id: this.version.project_id,
file_parts: fileParts,
@@ -958,15 +959,19 @@ export default {
).data
const newProject = JSON.parse(JSON.stringify(this.project))
newProject.versions = newProject.versions.concat([data])
newProject.versions = newProject.versions.concat([data.id])
const newVersions = this.$computeVersions(this.versions.concat([data]))
await this.$emit('update:project', newProject)
await this.$emit('update:versions', this.versions.concat([data]))
await this.$emit('update:versions', newVersions)
await this.$router.push(
`/${this.project.project_type}/${
this.project.slug ? this.project.slug : this.project.project_id
}/version/${encodeURIComponent(this.version.version_number)}`
}/version/${encodeURI(
newVersions[newVersions.length - 1].displayUrlEnding
)}`
)
} catch (err) {
this.$notify({

View File

@@ -48,7 +48,7 @@
<nuxt-link
:to="`/${project.project_type}/${
project.slug ? project.slug : project.id
}/version/${encodeURIComponent(version.version_number)}`"
}/version/${encodeURI(version.displayUrlEnding)}`"
>
{{ version.name }}
</nuxt-link>
@@ -78,11 +78,7 @@
<p>
{{
version.loaders
.map((x) =>
x.toLowerCase() === 'modloader'
? 'ModLoader'
: x.charAt(0).toUpperCase() + x.slice(1)
)
.map((x) => $formatCategory(x))
.join(', ') +
' ' +
$formatVersion(version.game_versions)
@@ -104,15 +100,7 @@
</td>
<td>
<p>
{{
version.loaders
.map((x) =>
x.toLowerCase() === 'modloader'
? 'ModLoader'
: x.charAt(0).toUpperCase() + x.slice(1)
)
.join(', ')
}}
{{ version.loaders.map((x) => $formatCategory(x)).join(', ') }}
</p>
<p>{{ $formatVersion(version.game_versions) }}</p>
</td>

View File

@@ -54,16 +54,18 @@
<label>
<span>
<h3>Type<span class="required">*</span></h3>
<span class="no-padding">The type of project of your project.</span>
<span class="no-padding">The type of project your project is.</span>
</span>
<Multiselect
v-model="projectType"
placeholder="Select one"
label="display"
:options="projectTypes"
:searchable="false"
:close-on-select="true"
:show-labels="false"
:allow-empty="false"
@input="setCategories(true)"
/>
</label>
<label>
@@ -106,32 +108,59 @@
<multiselect
id="categories"
v-model="categories"
:options="
$tag.categories
.filter((x) => x.project_type === projectType.toLowerCase())
.map((it) => it.name)
"
:options="selectableCategories"
:custom-label="
(value) => value.charAt(0).toUpperCase() + value.slice(1)
"
:loading="$tag.categories.length === 0"
:multiple="true"
:searchable="false"
:searchable="true"
:show-no-results="false"
:close-on-select="false"
:clear-on-select="false"
:clear-on-select="true"
:show-labels="false"
:max="3"
:limit="6"
:hide-selected="true"
placeholder="Choose categories"
@input="setCategories(false)"
/>
</label>
<label>
<span>
<h3>Additional Categories</h3>
<span class="no-padding">
Select more categories that will help others <br />
find your project. These are searchable, but not <br />
displayed in search.
</span>
</span>
<multiselect
id="additional_categories"
v-model="additional_categories"
:show-no-results="false"
:options="selectableAdditionalCategories"
:custom-label="
(value) => value.charAt(0).toUpperCase() + value.slice(1)
"
:loading="$tag.categories.length === 0"
:multiple="true"
:searchable="true"
:close-on-select="false"
:clear-on-select="true"
:show-labels="false"
:max="255"
:limit="6"
:hide-selected="true"
placeholder="Choose additional categories"
@input="setCategories(false)"
/>
</label>
<label>
<span>
<h3>Vanity URL (slug)<span class="required">*</span></h3>
<span class="slug-description"
>https://modrinth.com/{{ projectType.toLowerCase() }}/{{
>https://modrinth.com/{{ projectType.id }}/{{
slug ? slug : 'your-slug'
}}
</span>
@@ -174,7 +203,13 @@
Reset
</button>
</section>
<section class="card game-sides">
<section
v-if="
projectType.realId !== 'resourcepack' &&
projectType.realId !== 'plugin'
"
class="card game-sides"
>
<div class="columns">
<div class="column">
<h3>Supported environments</h3>
@@ -214,7 +249,7 @@
for="body"
title="You can type an extended description of your project here."
>
Body<span class="required">*</span>
Description<span class="required">*</span>
</label>
</h3>
<span>
@@ -318,7 +353,7 @@
Your version must have a unique version number.
</li>
<li v-if="versions[currentVersionIndex].loaders.length < 1">
Your version must have the supported mod loaders selected.
Your version must have the supported loaders selected.
</li>
<li v-if="versions[currentVersionIndex].game_versions.length < 1">
Your version must have the supported Minecraft versions
@@ -387,10 +422,10 @@
:allow-empty="false"
/>
</label>
<label>
<label v-if="projectType.realId !== 'resourcepack'">
<span>
<h3>Mod loaders<span class="required">*</span></h3>
<span> Select all mod loaders this version supports. </span>
<h3>Loaders<span class="required">*</span></h3>
<span> Select all loaders this version supports. </span>
</span>
<multiselect
v-model="versions[currentVersionIndex].loaders"
@@ -401,19 +436,18 @@
}"
:options="
$tag.loaders
.filter((x) =>
x.supported_project_types.includes(
projectType.toLowerCase()
)
)
.filter((x) => {
if (projectType.realId === 'plugin') {
return $tag.loaderData.allPluginLoaders.includes(x.name)
} else if (projectType.realId === 'mod') {
return $tag.loaderData.modLoaders.includes(x.name)
}
return x.supported_project_types.includes(projectType.id)
})
.map((it) => it.name)
"
:custom-label="
(value) =>
value === 'modloader'
? 'Risugami\'s ModLoader'
: value.charAt(0).toUpperCase() + value.slice(1)
"
:custom-label="(value) => $formatCategory(value)"
:loading="$tag.loaders.length === 0"
:multiple="true"
:searchable="false"
@@ -423,7 +457,7 @@
:show-labels="false"
:limit="6"
:hide-selected="true"
placeholder="Choose mod loaders..."
placeholder="Choose loaders..."
/>
</label>
<label>
@@ -547,12 +581,9 @@
<h3>Files<span class="required">*</span></h3>
<span>
You may upload multiple files, but this should only be used for
cases like sources or Javadocs.
cases like sources or Javadocs for mods/plugins.
</span>
<p
v-if="projectType.toLowerCase() === 'modpack'"
aria-label="Warning"
>
<p v-if="projectType.id === 'modpack'" aria-label="Warning">
Modpack support is currently in alpha, and you may encounter
issues. Our documentation includes instructions on
<a
@@ -578,9 +609,9 @@
class="file-input"
multiple
:accept="
projectType.toLowerCase() === 'modpack'
projectType.id === 'modpack'
? '.mrpack,application/x-modrinth-modpack+zip'
: projectType.toLowerCase() === 'mod'
: projectType.id === 'mod'
? '.jar,application/java-archive'
: '*'
"
@@ -661,7 +692,7 @@
>
<th>Name</th>
<th>Version</th>
<th>Mod loaders</th>
<th>Project loaders</th>
<th>Minecraft versions</th>
<th>Release channel</th>
<th>Actions</th>
@@ -1137,6 +1168,7 @@ export default {
body: '',
versions: [],
categories: [],
additional_categories: [],
issues_url: null,
source_url: null,
wiki_url: null,
@@ -1145,8 +1177,41 @@ export default {
license: null,
license_url: null,
projectTypes: ['Mod', 'Modpack'],
projectType: 'Mod',
selectableCategories: [],
selectableAdditionalCategories: [],
projectTypes: [
{
display: 'Mod',
id: 'mod',
realId: 'mod',
},
{
display: 'Plugin',
id: 'mod',
realId: 'plugin',
},
{
display: 'Mod and plugin',
id: 'mod',
realId: 'mod+plugin',
},
{
display: 'Modpack',
id: 'modpack',
realId: 'modpack',
},
{
display: 'Resource pack',
id: 'resourcepack',
realId: 'resourcepack',
},
],
projectType: {
display: 'Mod',
id: 'mod',
realId: 'mod',
},
sideTypes: ['Required', 'Optional', 'Unsupported'],
clientSideType: 'Required',
@@ -1171,6 +1236,9 @@ export default {
savingAsDraft: false,
}
},
fetch() {
this.setCategories()
},
watch: {
license(newValue, oldValue) {
if (newValue == null) {
@@ -1199,6 +1267,28 @@ export default {
})
},
methods: {
setCategories(reset) {
this.selectableCategories = this.$tag.categories
.filter(
(x) =>
x.project_type === this.projectType.id &&
!this.additional_categories.includes(x.name)
)
.map((it) => it.name)
this.selectableAdditionalCategories = this.$tag.categories
.filter(
(x) =>
x.project_type === this.projectType.id &&
!this.categories.includes(x.name)
)
.map((it) => it.name)
if (reset) {
this.categories = []
this.additional_categories = []
}
},
checkFields() {
const reviewConditions = this.body !== '' && this.versions.length > 0
if (
@@ -1221,6 +1311,7 @@ export default {
return false
},
async createDraft() {
this.setValues()
this.savingAsDraft = true
if (this.checkFields()) {
this.draft = true
@@ -1228,11 +1319,21 @@ export default {
}
},
async createProjectForReview() {
this.setValues()
this.savingAsDraft = false
if (this.checkFields()) {
await this.createProject()
}
},
setValues() {
if (this.projectType.realId === 'resourcepack') {
this.clientSideType = 'required'
this.serverSideType = 'optional'
} else if (this.projectType.realId === 'plugin') {
this.clientSideType = 'unsupported'
this.serverSideType = 'required'
}
},
async createProject() {
this.$nuxt.$loading.start()
@@ -1256,7 +1357,7 @@ export default {
'data',
JSON.stringify({
title: this.name,
project_type: this.projectType.toLowerCase(),
project_type: this.projectType.id,
slug: this.slug,
description: this.description,
body: this.body,
@@ -1269,6 +1370,7 @@ export default {
},
],
categories: this.categories,
additional_categories: this.additional_categories,
issues_url: this.issues_url ? this.issues_url : null,
source_url: this.source_url ? this.source_url : null,
wiki_url: this.wiki_url ? this.wiki_url : null,
@@ -1405,6 +1507,9 @@ export default {
saveVersion() {
const version = this.versions[this.currentVersionIndex]
if (this.projectType.realId === 'resourcepack') {
version.loaders = ['minecraft']
}
if (
version.version_number !== '' &&
version.releaseChannels !== null &&

View File

@@ -89,6 +89,7 @@
:client-side="project.client_side"
:server-side="project.server_side"
:type="project.project_type"
:moderation="true"
>
<button
class="iconified-button"

View File

@@ -76,8 +76,8 @@ import UpToDate from '~/assets/images/illustrations/up_to_date.svg?inline'
import ThisOrThat from '~/components/ui/ThisOrThat'
const NOTIFICATION_TYPES = {
'Team Invites': 'team_invite',
'Project Updates': 'project_update',
'Team invites': 'team_invite',
'Project updates': 'project_update',
}
export default {

View File

@@ -34,28 +34,41 @@
Clear filters
</button>
<section aria-label="Category filters">
<h3
v-if="
$tag.categories.filter((x) => x.project_type === projectType)
.length > 0
"
class="sidebar-menu-heading"
>
Categories
</h3>
<SearchFilter
v-for="category in $tag.categories.filter(
(x) => x.project_type === projectType
)"
:key="category.name"
:active-filters="facets"
:display-name="category.name"
:facet-name="`categories:${category.name}`"
:icon="category.icon"
@toggle="toggleFacet"
/>
<div v-for="(categories, header) in categoriesMap" :key="header">
<h3
v-if="
categories.filter((x) => x.project_type === projectType)
.length > 0
"
class="sidebar-menu-heading"
>
{{ $formatCategoryHeader(header) }}
</h3>
<SearchFilter
v-for="category in categories
.filter((x) => x.project_type === projectType)
.sort((a, b) => {
if (header === 'resolutions') {
return (
a.name.replace(/\D/g, '') - b.name.replace(/\D/g, '')
)
}
return 0
})"
:key="category.name"
:active-filters="facets"
:display-name="$formatCategory(category.name)"
:facet-name="`categories:${category.name}`"
:icon="header === 'resolutions' ? null : category.icon"
@toggle="toggleFacet"
/>
</div>
</section>
<section aria-label="Loader filters">
<section
v-if="projectType !== 'resourcepack'"
aria-label="Loader filters"
>
<h3
v-if="
$tag.loaders.filter((x) =>
@@ -69,6 +82,8 @@
<SearchFilter
v-for="loader in $tag.loaders.filter((x) => {
if (
projectType === 'mod' &&
!isPlugins &&
!showAllLoaders &&
x.name !== 'forge' &&
x.name !== 'fabric' &&
@@ -76,18 +91,25 @@
) {
return false
}
return x.supported_project_types.includes(projectType)
if (projectType === 'mod' && showAllLoaders) {
return $tag.loaderData.modLoaders.includes(x.name)
}
return isPlugins
? $tag.loaderData.pluginLoaders.includes(x.name)
: x.supported_project_types.includes(projectType)
})"
:key="loader.name"
ref="loaderFilters"
:active-filters="orFacets"
:display-name="
loader.name === 'modloader' ? 'ModLoader' : loader.name
"
:display-name="$formatCategory(loader.name)"
:facet-name="`categories:${loader.name}`"
:icon="loader.icon"
@toggle="toggleOrFacet"
/>
<Checkbox
v-if="projectType === 'mod' && !isPlugins"
v-model="showAllLoaders"
:label="showAllLoaders ? 'Less' : 'More'"
description="Show all loaders"
@@ -96,7 +118,34 @@
:collapsing-toggle-style="true"
/>
</section>
<section aria-label="Environment filters">
<section v-if="isPlugins" aria-label="Platform loader filters">
<h3
v-if="
$tag.loaders.filter((x) =>
x.supported_project_types.includes(projectType)
).length > 0
"
class="sidebar-menu-heading"
>
Proxies
</h3>
<SearchFilter
v-for="loader in $tag.loaders.filter((x) =>
$tag.loaderData.pluginPlatformLoaders.includes(x.name)
)"
:key="loader.name"
ref="platformFilters"
:active-filters="orFacets"
:display-name="$formatCategory(loader.name)"
:facet-name="`categories:${loader.name}`"
:icon="loader.icon"
@toggle="toggleOrFacet"
/>
</section>
<section
v-if="projectType !== 'resourcepack' && !isPlugins"
aria-label="Environment filters"
>
<h3 class="sidebar-menu-heading">Environments</h3>
<SearchFilter
:active-filters="selectedEnvironments"
@@ -267,7 +316,7 @@
:icon-url="result.icon_url"
:client-side="result.client_side"
:server-side="result.server_side"
:categories="result.categories"
:categories="result.display_categories"
/>
<div v-if="results && results.length === 0" class="no-results">
<p>No results found for your query!</p>
@@ -336,6 +385,7 @@ export default {
currentPage: 1,
projectType: 'mod',
isPlugins: false,
sortTypes: [
{ display: 'Relevance', name: 'relevance' },
@@ -405,8 +455,39 @@ export default {
this.$route.name.length - 1
)
if (this.projectType === 'plugin') {
this.projectType = 'mod'
this.isPlugins = true
}
await this.onSearchChange(this.currentPage)
},
computed: {
categoriesMap() {
const categories = {}
for (const category of this.$tag.categories) {
if (categories[category.header]) {
categories[category.header].push(category)
} else {
categories[category.header] = [category]
}
}
const newVals = Object.keys(categories)
.sort()
.reduce((obj, key) => {
obj[key] = categories[key]
return obj
}, {})
for (const header of Object.keys(categories)) {
newVals[header].sort((a, b) => a.name.localeCompare(b.name))
}
return newVals
},
},
watch: {
'$route.path': {
async handler() {
@@ -415,12 +496,21 @@ export default {
this.$route.name.length - 1
)
if (this.projectType === 'plugin') {
this.projectType = 'mod'
this.isPlugins = true
} else {
this.isPlugins = false
}
this.results = null
this.pages = []
this.currentPage = 1
this.query = ''
this.maxResults = 20
this.sortType = { display: 'Relevance', name: 'relevance' }
this.showAllLoaders = false
this.sidebarMenuOpen = false
await this.clearFilters()
},
@@ -463,6 +553,18 @@ export default {
if (index !== -1) {
this.orFacets.splice(index, 1)
} else {
if (elementName === 'categories:purpur') {
this.orFacets.push('categories:paper')
this.orFacets.push('categories:spigot')
this.orFacets.push('categories:bukkit')
} else if (elementName === 'categories:paper') {
this.orFacets.push('categories:spigot')
this.orFacets.push('categories:bukkit')
} else if (elementName === 'categories:spigot') {
this.orFacets.push('categories:bukkit')
} else if (elementName === 'categories:waterfall') {
this.orFacets.push('categories:bungeecord')
}
this.orFacets.push(elementName)
}
@@ -498,6 +600,7 @@ export default {
if (
this.facets.length > 0 ||
this.orFacets.length > 0 ||
this.selectedVersions.length > 0 ||
this.selectedEnvironments.length > 0 ||
this.projectType
@@ -507,8 +610,19 @@ export default {
formattedFacets.push([facet])
}
// loaders specifier
if (this.orFacets.length > 0) {
formattedFacets.push(this.orFacets)
} else if (this.isPlugins) {
formattedFacets.push(
this.$tag.loaderData.allPluginLoaders.map(
(x) => `categories:${x}`
)
)
} else if (this.projectType === 'mod') {
formattedFacets.push(
this.$tag.loaderData.modLoaders.map((x) => `categories:${x}`)
)
}
if (this.selectedVersions.length > 0) {

View File

@@ -5,9 +5,6 @@
<script>
export default {
name: 'Modpacks',
asyncData(ctx) {
ctx.params.projectType = 'modpack'
},
head: {
title: 'Modpacks - Modrinth',
meta: [

View File

@@ -5,9 +5,6 @@
<script>
export default {
name: 'Mods',
asyncData(ctx) {
ctx.params.projectType = 'mod'
},
head: {
title: 'Mods - Modrinth',
meta: [

31
pages/search/plugins.vue Normal file
View File

@@ -0,0 +1,31 @@
<template>
<div></div>
</template>
<script>
export default {
name: 'Plugins',
head: {
title: 'Plugins - Modrinth',
meta: [
{
hid: 'apple-mobile-web-app-title',
name: 'apple-mobile-web-app-title',
content: 'Plugins - Modrinth',
},
{
hid: 'og:title',
name: 'og:title',
content: 'Plugins - Modrinth',
},
{
hid: 'og:url',
name: 'og:url',
content: `https://modrinth.com/plugins`,
},
],
},
}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,31 @@
<template>
<div></div>
</template>
<script>
export default {
name: 'ResourcePacks',
head: {
title: 'Resource packs - Modrinth',
meta: [
{
hid: 'apple-mobile-web-app-title',
name: 'apple-mobile-web-app-title',
content: 'Resource packs - Modrinth',
},
{
hid: 'og:title',
name: 'og:title',
content: 'Resource packs - Modrinth',
},
{
hid: 'og:url',
name: 'og:url',
content: `https://modrinth.com/resourcepacks`,
},
],
},
}
</script>
<style lang="scss" scoped></style>

View File

@@ -204,6 +204,9 @@ export default {
display: flex;
flex-direction: row;
gap: 0.5rem;
flex-wrap: wrap;
justify-content: flex-end;
}
}
</style>

View File

@@ -90,7 +90,8 @@
<ProjectCard
v-for="project in selectedProjectType !== 'all'
? projects.filter(
(x) => x.project_type === selectedProjectType.slice(0, -1)
(x) =>
x.project_type === convertProjectType(selectedProjectType)
)
: projects"
:id="project.slug || project.id"
@@ -246,13 +247,24 @@ export default {
const obj = { all: true }
for (const project of this.projects) {
obj[project.project_type + 's'] = true
if (project.project_type === 'resourcepack') {
obj['Resource Packs'] = true
} else {
obj[project.project_type + 's'] = true
}
}
return Object.keys(obj)
},
},
methods: {
convertProjectType(name) {
if (name === 'Resource Packs') {
return 'resourcepack'
} else {
return name.slice(0, -1)
}
},
sumDownloads() {
let sum = 0