aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm
diff options
context:
space:
mode:
authorSophie Zhang <sophie_zhang@brown.edu>2023-11-16 02:18:38 -0500
committerSophie Zhang <sophie_zhang@brown.edu>2023-11-16 02:18:38 -0500
commit7bde1b066a68fca6202b3f42c1cb54aa85c13890 (patch)
treeff4c00ffdc6ca5b99479f7e356783a573d560a50 /src/client/views/collections/collectionFreeForm
parent6a4de8d05ce46dc29ac69f696c419a57e604f516 (diff)
use image toggle
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index b0be060bd..f5ba0de96 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -1819,8 +1819,11 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
// gpt styling
@action
gptStyling = async () => {
+ // clear it in properties instead
+ if (!PropertiesView.Instance) return;
this.openProperties();
- PropertiesView.Instance?.setGeneratedStyles([]);
+ PropertiesView.Instance.setGeneratedStyles([]);
+ PropertiesView.Instance.selectedStyle = -1;
console.log('Title', this.rootDoc.title);
console.log('bgcolor', this.layoutDoc._backgroundColor);
// doc.backgroundColor
@@ -1847,29 +1850,29 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
const collectionDescription = StrCast(this.rootDoc.title);
- console.log({
+ const styleInput = {
collectionDescription,
documents: gptInput,
- });
+ imageColors: colorHexes,
+ };
- try {
- const res = await generatePalette({
- collectionDescription,
- documents: gptInput,
- imageColors: colorHexes,
- });
- if (typeof res === 'string') {
- console.log(res);
- const resObj = JSON.parse(res) as GeneratedResponse[];
- PropertiesView.Instance?.setGeneratedStyles(resObj);
- // const resObj = JSON.parse(res) as GeneratedResponse;
- // console.log('Result ', resObj);
- // this.rootDoc.backgroundColor = resObj.collectionBackgroundColor;
- // (resObj.documentsWithColors).forEach((elem, i) => (inputDocs[i].backgroundColor = elem.color));
- }
- } catch (err) {
- console.error(err);
- }
+ PropertiesView.Instance.styleInput = styleInput;
+ PropertiesView.Instance.gptStyling();
+
+ // try {
+ // const res = await generatePalette(styleInput);
+ // if (typeof res === 'string') {
+ // console.log(res);
+ // const resObj = JSON.parse(res) as GeneratedResponse[];
+ // PropertiesView.Instance.setGeneratedStyles(resObj);
+ // // const resObj = JSON.parse(res) as GeneratedResponse;
+ // // console.log('Result ', resObj);
+ // // this.rootDoc.backgroundColor = resObj.collectionBackgroundColor;
+ // // (resObj.documentsWithColors).forEach((elem, i) => (inputDocs[i].backgroundColor = elem.color));
+ // }
+ // } catch (err) {
+ // console.error(err);
+ // }
};
onContextMenu = (e: React.MouseEvent) => {