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>