Skip to content

Commit

Permalink
autofill bedrock edition field
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Apr 19, 2024
1 parent a399aa2 commit 61df2f7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pages/addon/edit-addon-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default {
});
},
async handleScreenshot(screenshots, index, remove = false, id) {
if (!screenshots.length) return;
if (Array.isArray(screenshots) && screenshots.length === 0) return;
let promise;
if (remove) {
Expand Down
35 changes: 19 additions & 16 deletions pages/texture/path-modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,9 @@ export default {
type: Object,
required: true,
},
versions: {
type: Array,
edition: {
type: String,
required: false,
default() {
return [...settings.versions.java, ...settings.versions.bedrock];
},
},
useID: {
type: String,
Expand All @@ -120,16 +117,6 @@ export default {
},
};
},
computed: {
dialogTitle() {
return this.add
? this.$root.lang().database.titles.add_path
: this.$root.lang().database.titles.change_path;
},
sortedVersions() {
return this.versions.sort(this.MinecraftSorter);
},
},
methods: {
onCancel() {
this.modalOpened = false;
Expand Down Expand Up @@ -198,6 +185,18 @@ export default {
});
},
},
computed: {
dialogTitle() {
return this.add
? this.$root.lang().database.titles.add_path
: this.$root.lang().database.titles.change_path;
},
sortedVersions() {
return (
settings.versions[this.edition] || [...settings.versions.java, ...settings.versions.bedrock]
).sort(this.MinecraftSorter);
},
},
watch: {
value(newValue) {
this.modalOpened = newValue;
Expand All @@ -210,7 +209,11 @@ export default {
this.formData.name = this.data.name;
this.formData.use = this.data.use;
this.formData.mcmeta = this.data.mcmeta;
} else this.$refs.form.reset();
} else {
this.$refs.form.reset();
// autofill bedrock paths
if (this.sortedVersions.length === 1) this.formData.versions = this.sortedVersions;
}
});
this.$emit("input", newValue);
},
Expand Down
1 change: 1 addition & 0 deletions pages/texture/use-modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:add="Object.keys(pathModalData).length == 0"
:first="add"
:useID="formData.id"
:edition="data.edition"
:data="pathModalData"
@pathAdded="pathAdded"
/>
Expand Down

0 comments on commit 61df2f7

Please sign in to comment.