Revert "Additional categories + fix project creation" (#591)

This reverts commit 62e86f95076929907c4326a8b8ced482313e9854.
This commit is contained in:
Geometrically 2022-08-02 20:28:43 -07:00 committed by GitHub
parent 62e86f9507
commit 848e26eec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 131 deletions

View File

@ -155,11 +155,6 @@ export default {
component: resolve(__dirname, 'pages/search/modpacks.vue'), component: resolve(__dirname, 'pages/search/modpacks.vue'),
name: 'modpacks', name: 'modpacks',
}, },
{
path: '/resourcepacks',
component: resolve(__dirname, 'pages/search/resourcepacks.vue'),
name: 'resourcepacks',
},
], ],
}) })
@ -314,7 +309,7 @@ export default {
}, },
hooks: { hooks: {
render: { render: {
routeDone(url, result, context) { routeDone(url) {
setTimeout(() => { setTimeout(() => {
axios axios
.post( .post(
@ -328,12 +323,6 @@ export default {
{ {
headers: { headers: {
'Modrinth-Admin': process.env.ARIADNE_ADMIN_KEY || 'feedbeef', 'Modrinth-Admin': process.env.ARIADNE_ADMIN_KEY || 'feedbeef',
'User-Agent':
context.req.rawHeaders[
context.req.rawHeaders.findIndex(
(x) => x === 'User-Agent'
) + 1
],
}, },
} }
) )

View File

@ -54,18 +54,16 @@
<label> <label>
<span> <span>
<h3>Type<span class="required">*</span></h3> <h3>Type<span class="required">*</span></h3>
<span class="no-padding">The type of project your project is.</span> <span class="no-padding">The type of project of your project.</span>
</span> </span>
<Multiselect <Multiselect
v-model="projectType" v-model="projectType"
placeholder="Select one" placeholder="Select one"
label="display"
:options="projectTypes" :options="projectTypes"
:searchable="false" :searchable="false"
:close-on-select="true" :close-on-select="true"
:show-labels="false" :show-labels="false"
:allow-empty="false" :allow-empty="false"
@input="setCategories"
/> />
</label> </label>
<label> <label>
@ -108,7 +106,11 @@
<multiselect <multiselect
id="categories" id="categories"
v-model="categories" v-model="categories"
:options="selectableCategories" :options="
$tag.categories
.filter((x) => x.project_type === projectType.toLowerCase())
.map((it) => it.name)
"
:custom-label=" :custom-label="
(value) => value.charAt(0).toUpperCase() + value.slice(1) (value) => value.charAt(0).toUpperCase() + value.slice(1)
" "
@ -123,44 +125,13 @@
:limit="6" :limit="6"
:hide-selected="true" :hide-selected="true"
placeholder="Choose categories" placeholder="Choose categories"
@input="setCategories"
/>
</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="false"
:close-on-select="false"
:clear-on-select="false"
:show-labels="false"
:max="255"
:limit="6"
:hide-selected="true"
placeholder="Choose additional categories"
@input="setCategories"
/> />
</label> </label>
<label> <label>
<span> <span>
<h3>Vanity URL (slug)<span class="required">*</span></h3> <h3>Vanity URL (slug)<span class="required">*</span></h3>
<span class="slug-description" <span class="slug-description"
>https://modrinth.com/{{ projectType.id }}/{{ >https://modrinth.com/{{ projectType.toLowerCase() }}/{{
slug ? slug : 'your-slug' slug ? slug : 'your-slug'
}} }}
</span> </span>
@ -431,7 +402,9 @@
:options=" :options="
$tag.loaders $tag.loaders
.filter((x) => .filter((x) =>
x.supported_project_types.includes(projectType.id) x.supported_project_types.includes(
projectType.toLowerCase()
)
) )
.map((it) => it.name) .map((it) => it.name)
" "
@ -576,7 +549,10 @@
You may upload multiple files, but this should only be used for You may upload multiple files, but this should only be used for
cases like sources or Javadocs. cases like sources or Javadocs.
</span> </span>
<p v-if="projectType.id === 'modpack'" aria-label="Warning"> <p
v-if="projectType.toLowerCase() === 'modpack'"
aria-label="Warning"
>
Modpack support is currently in alpha, and you may encounter Modpack support is currently in alpha, and you may encounter
issues. Our documentation includes instructions on issues. Our documentation includes instructions on
<a <a
@ -602,9 +578,9 @@
class="file-input" class="file-input"
multiple multiple
:accept=" :accept="
projectType.id === 'modpack' projectType.toLowerCase() === 'modpack'
? '.mrpack,application/x-modrinth-modpack+zip' ? '.mrpack,application/x-modrinth-modpack+zip'
: projectType.id === 'mod' : projectType.toLowerCase() === 'mod'
? '.jar,application/java-archive' ? '.jar,application/java-archive'
: '*' : '*'
" "
@ -1161,7 +1137,6 @@ export default {
body: '', body: '',
versions: [], versions: [],
categories: [], categories: [],
additional_categories: [],
issues_url: null, issues_url: null,
source_url: null, source_url: null,
wiki_url: null, wiki_url: null,
@ -1170,27 +1145,8 @@ export default {
license: null, license: null,
license_url: null, license_url: null,
selectableCategories: [], projectTypes: ['Mod', 'Modpack'],
selectableAdditionalCategories: [], projectType: 'Mod',
projectTypes: [
{
display: 'Mod / Plugin',
id: 'mod',
},
{
display: 'Modpack',
id: 'modpack',
},
{
display: 'Resource Pack',
id: 'resourcepack',
},
],
projectType: {
display: 'Mod / Plugin',
id: 'mod',
},
sideTypes: ['Required', 'Optional', 'Unsupported'], sideTypes: ['Required', 'Optional', 'Unsupported'],
clientSideType: 'Required', clientSideType: 'Required',
@ -1215,9 +1171,6 @@ export default {
savingAsDraft: false, savingAsDraft: false,
} }
}, },
fetch() {
this.setCategories()
},
watch: { watch: {
license(newValue, oldValue) { license(newValue, oldValue) {
if (newValue == null) { if (newValue == null) {
@ -1246,23 +1199,6 @@ export default {
}) })
}, },
methods: { methods: {
setCategories() {
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)
},
checkFields() { checkFields() {
const reviewConditions = this.body !== '' && this.versions.length > 0 const reviewConditions = this.body !== '' && this.versions.length > 0
if ( if (
@ -1320,7 +1256,7 @@ export default {
'data', 'data',
JSON.stringify({ JSON.stringify({
title: this.name, title: this.name,
project_type: this.projectType.id, project_type: this.projectType.toLowerCase(),
slug: this.slug, slug: this.slug,
description: this.description, description: this.description,
body: this.body, body: this.body,
@ -1333,7 +1269,6 @@ export default {
}, },
], ],
categories: this.categories, categories: this.categories,
additional_categories: this.additional_categories,
issues_url: this.issues_url ? this.issues_url : null, issues_url: this.issues_url ? this.issues_url : null,
source_url: this.source_url ? this.source_url : null, source_url: this.source_url ? this.source_url : null,
wiki_url: this.wiki_url ? this.wiki_url : null, wiki_url: this.wiki_url ? this.wiki_url : null,

View File

@ -267,7 +267,7 @@
:icon-url="result.icon_url" :icon-url="result.icon_url"
:client-side="result.client_side" :client-side="result.client_side"
:server-side="result.server_side" :server-side="result.server_side"
:categories="result.display_categories" :categories="result.categories"
/> />
<div v-if="results && results.length === 0" class="no-results"> <div v-if="results && results.length === 0" class="no-results">
<p>No results found for your query!</p> <p>No results found for your query!</p>

View File

@ -1,34 +0,0 @@
<template>
<div></div>
</template>
<script>
export default {
name: 'ResourcePacks',
asyncData(ctx) {
ctx.params.projectType = 'resourcepack'
},
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>