aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2025-05-12 02:32:28 -0400
committerNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2025-05-12 02:32:28 -0400
commit259aaed6bdb77872c40d5c1ea63af741eb52fd4c (patch)
treeaaded987a8eff9d6163c7351b5545b44b75c8792 /src
parent5be235c8ca1b4ad5d499fac96133e77c773b7c6d (diff)
styleref working hackily
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/DataVizBox/DocCreatorMenu/Backend/TemplateManager.ts2
-rw-r--r--src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx13
-rw-r--r--src/client/views/smartdraw/DrawingFillHandler.tsx5
3 files changed, 12 insertions, 8 deletions
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Backend/TemplateManager.ts b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Backend/TemplateManager.ts
index 760940127..6fcca7e30 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Backend/TemplateManager.ts
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Backend/TemplateManager.ts
@@ -9,7 +9,7 @@ import { TemplateMenuAIUtils } from './TemplateMenuAIUtils';
export type Conditional = {
field: string;
- operator: '=' | '>' | '<';
+ operator: '=' | '>' | '<' | 'contains';
condition: string;
target: string;
attribute: string;
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
index 873bfa734..b024a6e9b 100644
--- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
+++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx
@@ -80,7 +80,7 @@ export class DocCreatorMenu extends ObservableReactComponent<DocCreateMenuProps>
// eslint-disable-next-line no-use-before-define
static Instance: DocCreatorMenu;
- private DEBUG_MODE: boolean = false;
+ private DEBUG_MODE: boolean = true;
private _ref: HTMLDivElement | null = null;
private templateManager: TemplateManager;
@@ -589,6 +589,8 @@ export class DocCreatorMenu extends ObservableReactComponent<DocCreateMenuProps>
this.variations = [];
const mainCollection = this._dataViz?.DocumentView?.().containerViewPath?.().lastElement()?.ComponentView as CollectionFreeFormView;
+ console.log('styleref: ', useStyleRef);
+
const clone: Doc = (await Doc.MakeClone(onDoc)).clone;
mainCollection.addDocument(clone);
clone.x = 10000;
@@ -909,14 +911,14 @@ export class DocCreatorMenu extends ObservableReactComponent<DocCreateMenuProps>
}
get dashboardContents() {
- const contentFieldTitles = this.fieldsInfos.filter(field => field.type !== TemplateFieldType.DATA).map(field => field.title).concat('template');
+ const contentFieldTitles = this.fieldsInfos.filter(field => field.type !== TemplateFieldType.DATA).map(field => field.title).concat('Template');
const conditionForm = (title: string, parameters?: Conditional, empty: boolean = false) => {
const params: Conditional = parameters ?? this._currEditingConditional;
return (
- <div className='form'>
+ <div className='form' id={String(Math.random() * 100000)}>
<div className='form-row'>
<div className='form-row-plain-text'>If</div>
<div className='form-row-plain-text'>{title}</div>
@@ -925,6 +927,7 @@ export class DocCreatorMenu extends ObservableReactComponent<DocCreateMenuProps>
<div className='operator-dropdown-option' onPointerDown={() => {params.operator = '='}}>{'='}</div>
<div className='operator-dropdown-option' onPointerDown={() => {params.operator = '>'}}>{'>'}</div>
<div className='operator-dropdown-option' onPointerDown={() => {params.operator = '<'}}>{'<'}</div>
+ <div className='operator-dropdown-option' onPointerDown={() => {params.operator = 'contains'}}>{'has'}</div>
</div>
<textarea
className="form-row-textarea"
@@ -934,9 +937,9 @@ export class DocCreatorMenu extends ObservableReactComponent<DocCreateMenuProps>
/>
<div className='form-row-plain-text'>then</div>
<div className="operator-options-dropdown">
- <span className="operator-dropdown-current">{params.target ?? 'self'}</span>
+ <span className="operator-dropdown-current">{params.target ?? 'Own'}</span>
{contentFieldTitles.map(fieldTitle =>
- <div className='operator-dropdown-option' onPointerDown={() => {params.target = fieldTitle}}>{fieldTitle === title ? 'own' : fieldTitle}</div>
+ <div className='operator-dropdown-option' onPointerDown={() => {params.target = fieldTitle}}>{fieldTitle === title ? 'Own' : fieldTitle}</div>
)}
</div>
<textarea
diff --git a/src/client/views/smartdraw/DrawingFillHandler.tsx b/src/client/views/smartdraw/DrawingFillHandler.tsx
index 48107ff0d..73a47681a 100644
--- a/src/client/views/smartdraw/DrawingFillHandler.tsx
+++ b/src/client/views/smartdraw/DrawingFillHandler.tsx
@@ -25,8 +25,8 @@ export class DrawingFillHandler {
: []
: Doc.Links(drawing)
.map(link => Doc.getOppositeAnchor(link, drawing))
- .map(anchor => anchor && DocCast(anchor.embedContainer));
- const styleUrl = await DocumentView.GetDocImage(styleDocs.filter(doc => doc?.data instanceof ImageField).lastElement())?.then(styleImg => {
+ .map(anchor => anchor && DocCast(anchor.embedContainer));
+ const styyleUrl = await DocumentView.GetDocImage(styleDocs.lastElement())?.then(styleImg => {
const hrefParts = ImageCast(styleImg).url.href.split('.');
return `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}`;
});
@@ -42,6 +42,7 @@ export class DrawingFillHandler {
const { href } = ImageCast(imageField).url;
const hrefParts = href.split('.');
const structureUrl = `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}`;
+ const styleUrl = styleDoc ? `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}` : undefined;
return imageUrlToBase64(structureUrl)
.then(gptDescribeImage)
.then((prompt, newPrompt = user_prompt || prompt) =>