aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm
diff options
context:
space:
mode:
authorSophie Zhang <sophie_zhang@brown.edu>2024-04-10 15:54:26 -0400
committerSophie Zhang <sophie_zhang@brown.edu>2024-04-10 15:54:26 -0400
commit6fc9e5b8eb766ca509f09a5ac7d752be57a864dd (patch)
tree187843cdecc87518a4553d8aa697b6361bf4ba86 /src/client/views/collections/collectionFreeForm
parent9e221fdb995d5a489fb34133d2ab98d7907219bd (diff)
remove collection color styling from this branch
Diffstat (limited to 'src/client/views/collections/collectionFreeForm')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx68
1 files changed, 2 insertions, 66 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index c5102070a..958117b91 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -55,7 +55,6 @@ import './CollectionFreeFormView.scss';
import { MarqueeView } from './MarqueeView';
import { PropertiesView } from '../../PropertiesView';
import { ExtractColors } from '../../ExtractColors';
-import { smartLayout, smartLayout2, StyleInputDocument } from '../../../apis/gpt/customization';
import { extname } from 'path';
import { RichTextField } from '../../../../fields/RichTextField';
@@ -1688,74 +1687,11 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
// gpt layout
@action
- gptLayout = async () => {
- const docLayouts = this.childDocs.map(doc => ({
- width: this.roundToRoundNumber(NumCast(doc.width)),
- height: this.roundToRoundNumber(NumCast(doc.height)),
- // content: StrCast(doc.title),
- }));
- console.log('Doc layouts', docLayouts);
-
- const res = await smartLayout2(docLayouts);
- console.log('Smart layout result', res);
- // make type-safe
- const resObj = JSON.parse(res) as any[];
- resObj.forEach((elem, i) => {
- this.childDocs[i].x = elem.x;
- this.childDocs[i].y = elem.y;
- });
-
- // refit collection
- setTimeout(() => {
- this.fitContentOnce();
- }, 500);
- };
+ gptLayout = async () => {};
// gpt styling
@action
- gptStyling = async () => {
- // clear it in properties instead
- if (!PropertiesView.Instance) return;
- this.openProperties();
- PropertiesView.Instance.setGeneratedStyles([]);
- PropertiesView.Instance.selectedStyle = -1;
- PropertiesView.Instance.useImageData = false;
-
- console.log('Title', this.Document.title);
- console.log('bgcolor', this.layoutDoc._backgroundColor);
- // doc.backgroundColor
- const inputDocs = this.childDocs.filter(doc => doc.type == 'rich text');
- const imgDocs = this.childDocs.filter(doc => doc.type == 'image');
- const imgUrls = imgDocs.map(doc => this.choosePath((doc.data as ImageField).url));
-
- const imageElements = await ExtractColors.loadImagesUrl(imgUrls);
- const colors = await Promise.all(imageElements.map(elem => ExtractColors.getImgColors(elem)));
- let colorHexes = colors
- .reduce((acc, curr) => acc.concat(curr), [])
- .map(color => color.hex)
- .slice(0, 10);
- console.log('Hexes', colorHexes);
-
- PropertiesView.Instance?.setInputDocs(inputDocs);
-
- // also pass it colors
- const gptInput: StyleInputDocument[] = inputDocs.map((doc, i) => ({
- id: i,
- textContent: (doc.text as RichTextField)?.Text,
- textSize: 16,
- }));
-
- const collectionDescription = StrCast(this.Document.title);
-
- const styleInput = {
- collectionDescription,
- documents: gptInput,
- imageColors: colorHexes,
- };
-
- PropertiesView.Instance.styleInput = styleInput;
- PropertiesView.Instance.gptStyling();
- };
+ gptStyling = async () => {};
onContextMenu = (e: React.MouseEvent) => {
if (this._props.isAnnotationOverlay || !ContextMenu.Instance) return;