diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2025-05-11 02:08:38 -0400 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2025-05-11 02:08:38 -0400 |
commit | 59678e34dad0b6587f28ec642c84f6c6ee06543b (patch) | |
tree | 2597f29d9dca5dbbd8f29be589f56d7f005c927d | |
parent | 6e66ab2ab9b5b6f988230aac83ac712b43ccfe3a (diff) |
firefly templates correctly loading
3 files changed, 13 insertions, 13 deletions
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplateEditingWindow.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplateEditingWindow.tsx index f34b7efcf..fa84616cc 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplateEditingWindow.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplateEditingWindow.tsx @@ -75,10 +75,11 @@ export class TemplateEditingWindow extends ObservableReactComponent<TemplateEdit <TemplatePreviewGrid menu={this._props.menu} title={'Generate Variations'} + loading={this._loading} templates={this._props.menu._variations} optionsButtonOpts={['gear', this.func]} setupButtonClick={this._props.setupButtonClick} - previewBoxRightButtonOpts={['gear', (component: ObservableReactComponent<TemplatePreviewBoxProps>) => {component.forceUpdate();}]} + previewBoxRightButtonOpts={['gear', (template: Template) => {this.forceUpdate();}]} /> <div className="docCreatorMenu-section"> <div className="docCreatorMenu-variation-prompt-input"> @@ -93,18 +94,17 @@ export class TemplateEditingWindow extends ObservableReactComponent<TemplateEdit this._props.menu._variations = []; this._loading = true; this._variationURLs = await this._props.menu.generateVariations(this._props.template.getRenderedDoc()!, this.fireflyPrompt); - const templates: Template[] = []; this._variationURLs.forEach(url => { const newTemplate: Template = this._props.template.cloneBase(); - newTemplate.setImageAsBackground(url, true); - templates.push(newTemplate); + this._props.menu._variations.push(newTemplate); }); this._loading = false; setTimeout(() => { - console.log('setting') - this._props.menu._variations = templates; + this._variationURLs.forEach((url, i) => { + this._props.menu._variations[i].setImageAsBackground(url, true); + }); this.forceUpdate(); - }, 1000); + }); }) }> <FontAwesomeIcon icon="arrows-rotate" /> diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplatePreviewBox.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplatePreviewBox.tsx index a7270e540..e94ddfc15 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplatePreviewBox.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplatePreviewBox.tsx @@ -19,8 +19,8 @@ import { ImageCast } from "../../../../../../fields/Types"; export interface TemplatePreviewBoxProps { template: Template; menu: DocCreatorMenu; - leftButtonOpts?: [icon: IconProp, func: (template: Template) => void] - rightButtonOpts?: [icon: IconProp, func: (template: Template) => void] + leftButtonOpts?: [icon: IconProp, func: (...args: any) => void] + rightButtonOpts?: [icon: IconProp, func: (...args: any) => void] } export class TemplatePreviewBox extends ObservableReactComponent<TemplatePreviewBoxProps> { diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplatePreviewGrid.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplatePreviewGrid.tsx index fb246a0a0..e78109b62 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplatePreviewGrid.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Menu/TemplatePreviewGrid.tsx @@ -17,9 +17,9 @@ export interface SuggestedTemplatesProps { loading?: boolean; templates: Template[]; title: string; - optionsButtonOpts?: [string, (...args: any) => any]; - previewBoxLeftButtonOpts?: [string, (...args: any) => any]; - previewBoxRightButtonOpts?: [string, (...args: any) => any]; + optionsButtonOpts?: [IconProp, (...args: any) => any]; + previewBoxLeftButtonOpts?: [IconProp, (...args: any) => any]; + previewBoxRightButtonOpts?: [IconProp, (...args: any) => any]; setupButtonClick: (e: React.PointerEvent, func: () => void) => void; } @@ -45,7 +45,7 @@ export class TemplatePreviewGrid extends ObservableReactComponent<SuggestedTempl template={template} menu={this.props.menu} leftButtonOpts={["magnifying-glass", (template: Template) => { this.props.menu.setExpandedView(template); this.forceUpdate(); }]} - rightButtonOpts={["plus", (template: Template) => {}]} + rightButtonOpts={this._props.previewBoxRightButtonOpts} /> ))} </div> |