guild settings

This commit is contained in:
MathMan05 2024-09-10 14:52:30 -05:00
parent 72ac3a14ed
commit 68ab121d63
7 changed files with 45 additions and 62 deletions

View file

@ -71,6 +71,14 @@ class Guild extends SnowFlake {
method: "PATCH"
});
form.addTextInput("Name:", "name", { initText: this.properties.name });
form.addMDInput("Description:", "description", { initText: this.properties.description });
form.addFileInput("Banner:", "banner", { clear: true });
form.addFileInput("Icon:", "icon", { clear: true });
let region = this.properties.region;
if (!region) {
region = "";
}
form.addTextInput("Region:", "region", { initText: region });
}
const s1 = settings.addButton("roles");
const permlist = [];

View file

@ -299,8 +299,8 @@ class Message extends SnowFlake {
next.generateMessage();
next = this.channel.messages.get(this.channel.idToNext.get(next.id));
}
if (this.channel.infinite.div && scroll) {
this.channel.infinite.div.scrollTop = scroll;
if (this.channel.infinite.scollDiv && scroll) {
this.channel.infinite.scollDiv.scrollTop = scroll;
}
};
}
@ -333,9 +333,9 @@ class Message extends SnowFlake {
next = this.channel.messages.get(this.channel.idToNext.get(next.id));
console.log("loopy");
}
if (this.channel.infinite.div && scroll) {
if (this.channel.infinite.scollDiv && scroll) {
func();
this.channel.infinite.div.scrollTop = scroll;
this.channel.infinite.scollDiv.scrollTop = scroll;
}
};
div.appendChild(build);

View file

@ -390,9 +390,11 @@ class FileInput {
onChange(ev) {
this.owner.changed();
const input = this.input.deref();
if (this.onchange && input) {
if (input) {
this.value = input.files;
this.onchange(input.files);
if (this.onchange) {
this.onchange(input.files);
}
}
}
onchange = null;
@ -698,8 +700,10 @@ class Form {
return select;
}
fileOptions = new Map();
addFileInput(label, formName, { required, files } = { required: false, files: "multi" }) {
const FI = this.options.addFileInput(label, _ => { }, {});
addFileInput(label, formName, { required = false, files = "one", clear = false } = {}) {
const FI = this.options.addFileInput(label, _ => { }, { clear });
if (files !== "one" && files !== "multi")
throw new Error("files should equal one or multi");
this.fileOptions.set(FI, { files });
this.names.set(formName, FI);
if (required) {
@ -808,6 +812,7 @@ class Form {
throw new Error("FileInput without its options is in this form, this should never happen.");
}
if (options.files === "one") {
console.log(input.value);
if (input.value) {
const reader = new FileReader();
reader.readAsDataURL(input.value[0]);