Add checkbox for participating the contest

This commit is contained in:
johnqiao 2023-11-24 17:15:21 -07:00
parent 24dee526e9
commit 12e7f3648e

View File

@ -245,6 +245,31 @@ export class OpenArtShareDialog extends ComfyDialog {
this.descriptionInput, this.descriptionInput,
]); ]);
// OpenArt Contest Section
this.joinContestCheckbox = $el("input",{type:'checkbox', id:"join_contest"},[])
this.joinContestDescription = $el("a", {
style: {
...hyperLinkStyle,
display: 'inline-block',
color: "#59E8C6",
fontSize: '12px',
marginLeft: '10px',
marginBottom: 0,
},
href: "https://contest.openart.ai/",
target: "_blank"
}, ["🏆 I'm participating in the OpenArt workflow contest"])
this.joinContestLabel = $el("label", {
style: {
display: 'flex',
alignItems: 'center',
cursor: 'pointer',
}
},[this.joinContestCheckbox, this.joinContestDescription])
const contestSection = $el("div", { style: sectionStyle }, [
this.joinContestLabel,
]);
// Message Section // Message Section
this.message = $el( this.message = $el(
"div", "div",
@ -303,6 +328,7 @@ export class OpenArtShareDialog extends ComfyDialog {
outputUploadSection, outputUploadSection,
this.outputsSection, this.outputsSection,
additionalInputsSection, additionalInputsSection,
contestSection,
this.message, this.message,
buttonsSection, buttonsSection,
]; ];
@ -439,6 +465,8 @@ export class OpenArtShareDialog extends ComfyDialog {
} }
} }
const join_contest = this.joinContestCheckbox.checked;
try { try {
const response = await this.fetchApi( const response = await this.fetchApi(
"/workflows/publish", "/workflows/publish",
@ -452,7 +480,8 @@ export class OpenArtShareDialog extends ComfyDialog {
advanced_config: { advanced_config: {
workflow_api_json: workflowAPIJSON, workflow_api_json: workflowAPIJSON,
snapshot: current_snapshot, snapshot: current_snapshot,
} },
join_contest,
}), }),
}, },
"Uploading workflow..." "Uploading workflow..."
@ -507,7 +536,7 @@ export class OpenArtShareDialog extends ComfyDialog {
sorted_potential_outputs.push(value[1]); sorted_potential_outputs.push(value[1]);
} }
potential_output_nodes = sorted_potential_output_nodes; potential_output_nodes = sorted_potential_output_nodes;
potential_outputs = sorted_potential_outputs; potential_outputs = sorted_potential_outputs.filter((output) => !!output);
this.message.innerHTML = ""; this.message.innerHTML = "";
this.message.textContent = ""; this.message.textContent = "";