From 12e7f3648e2c386d7be91d3b4663197664c99ad9 Mon Sep 17 00:00:00 2001 From: johnqiao Date: Fri, 24 Nov 2023 17:15:21 -0700 Subject: [PATCH] Add checkbox for participating the contest --- js/comfyui-share-openart.js | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/js/comfyui-share-openart.js b/js/comfyui-share-openart.js index f2fe1e2f..9fcc5d37 100644 --- a/js/comfyui-share-openart.js +++ b/js/comfyui-share-openart.js @@ -245,6 +245,31 @@ export class OpenArtShareDialog extends ComfyDialog { 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 this.message = $el( "div", @@ -303,6 +328,7 @@ export class OpenArtShareDialog extends ComfyDialog { outputUploadSection, this.outputsSection, additionalInputsSection, + contestSection, this.message, buttonsSection, ]; @@ -439,6 +465,8 @@ export class OpenArtShareDialog extends ComfyDialog { } } + const join_contest = this.joinContestCheckbox.checked; + try { const response = await this.fetchApi( "/workflows/publish", @@ -452,7 +480,8 @@ export class OpenArtShareDialog extends ComfyDialog { advanced_config: { workflow_api_json: workflowAPIJSON, snapshot: current_snapshot, - } + }, + join_contest, }), }, "Uploading workflow..." @@ -507,7 +536,7 @@ export class OpenArtShareDialog extends ComfyDialog { sorted_potential_outputs.push(value[1]); } 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.textContent = "";