aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/CollectionNoteTakingView.tsx27
-rw-r--r--src/client/views/collections/CollectionNoteTakingViewFieldColumn.tsx16
2 files changed, 21 insertions, 22 deletions
diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx
index ff9e22ce1..5f9a4f4d0 100644
--- a/src/client/views/collections/CollectionNoteTakingView.tsx
+++ b/src/client/views/collections/CollectionNoteTakingView.tsx
@@ -66,7 +66,7 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
@computed get xMargin() { return NumCast(this.layoutDoc._xMargin, 2 * Math.min(this.gridGap, .05 * this.props.PanelWidth())); }
@computed get yMargin() { return this.props.yPadding || NumCast(this.layoutDoc._yMargin, 5); } // 2 * this.gridGap)); }
@computed get gridGap() { return NumCast(this.layoutDoc._gridGap, 10); }
- @computed get numGroupColumns() { return this.Sections.size; }
+ @computed get numGroupColumns() { return this.columnHeaders.length; }
@computed get columnWidth() {return this.props.PanelWidth() - 2 * this.xMargin;}
//-------------------------------------------- Parker's Playground --------------------------------------------//
@@ -99,6 +99,7 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
return docs.map((d, i) => {
const height = () => this.getDocHeight(d);
const width = () => this.getDocWidth(d);
+ //TODO change style here so that
const style = { width: width(), marginTop: i ? this.gridGap : 0, height: height() };
return <div className={`collectionNoteTakingView-columnDoc`} key={d[Id]} style={style} >
{this.getDisplayDoc(d, width)}
@@ -291,7 +292,7 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
return new Transform(- translateX + (dref?.centeringX || 0), - translateY + (dref?.centeringY || 0), 1).scale(this.props.ScreenToLocalTransform().Scale);
}
- //TODO do we actually want to update the doc width on this?
+ //TODO need to adjust so that we're basing off number of columns and dividers.
getDocWidth(d: Doc) {
const heading = d[this.pivotField] as object
const castedSectionValue = heading.toString()
@@ -326,15 +327,16 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
}
// This following three functions must be from the view Mehek showed
- columnDividerDown = (e: React.PointerEvent) => {
- runInAction(() => this._cursor = "grabbing");
- setupMoveUpEvents(this, e, this.onDividerMove, action(() => this._cursor = "grab"), emptyFunction);
- }
- @action
- onDividerMove = (e: PointerEvent, down: number[], delta: number[]) => {
- this.layoutDoc._columnWidth = Math.max(10, this.columnWidth + delta[0]);
- return false;
- }
+ // columnDividerDown = (e: React.PointerEvent) => {
+ // runInAction(() => this._cursor = "grabbing");
+ // setupMoveUpEvents(this, e, this.onDividerMove, action(() => this._cursor = "grab"), emptyFunction);
+ // }
+
+ // @action
+ // onDividerMove = (e: PointerEvent, down: number[], delta: number[]) => {
+ // this.layoutDoc._columnWidth = Math.max(10, this.columnWidth + delta[0]);
+ // return false;
+ // }
//TODO: currently unused. How can we make use of it?
// @computed get columnDragger() {
@@ -498,6 +500,7 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
return true;
}
+ // TODO: need this, but not using atm
@undoBatch
@action
//What is the difference between internal and external drop?? Does internal mean we're dropping inside of a collection?
@@ -523,6 +526,7 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
}
});
}
+
// sections are important
headings = () => Array.from(this.Sections);
refList: any[] = [];
@@ -629,7 +633,6 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
// }
}
return eles
- // return sections.map((section) => this.sectionNoteTaking(section[0], section[1]));
}
@computed get buttonMenu() {
diff --git a/src/client/views/collections/CollectionNoteTakingViewFieldColumn.tsx b/src/client/views/collections/CollectionNoteTakingViewFieldColumn.tsx
index b4e0aac60..452af2ddf 100644
--- a/src/client/views/collections/CollectionNoteTakingViewFieldColumn.tsx
+++ b/src/client/views/collections/CollectionNoteTakingViewFieldColumn.tsx
@@ -119,9 +119,10 @@ export class CollectionNoteTakingViewFieldColumn extends React.Component<CSVFiel
const key = this.props.pivotField;
const newDoc = Docs.Create.TextDocument(value, { _height: 18, _width: 200, _fitWidth: true, title: value, _autoHeight: true });
newDoc[key] = this.getValue(this.props.heading);
- const maxHeading = this.props.docList.reduce((maxHeading, doc) => NumCast(doc.heading) > maxHeading ? NumCast(doc.heading) : maxHeading, 0);
- const heading = maxHeading === 0 || this.props.docList.length === 0 ? 1 : maxHeading === 1 ? 2 : 3;
- newDoc.heading = heading;
+ // TODO not sure why we have all of this "maxHeading stuff"
+ // const maxHeading = this.props.docList.reduce((maxHeading, doc) => NumCast(doc.heading) > maxHeading ? NumCast(doc.heading) : maxHeading, 0);
+ // const heading = maxHeading === 0 || this.props.docList.length === 0 ? 1 : maxHeading === 1 ? 2 : 3;
+ // newDoc.heading = heading;
FormattedTextBox.SelectOnLoad = newDoc[Id];
FormattedTextBox.SelectOnLoadChar = forceEmptyNote ? "" : " ";
return this.props.addDocument?.(newDoc) || false;
@@ -132,11 +133,6 @@ export class CollectionNoteTakingViewFieldColumn extends React.Component<CSVFiel
if (!this.props.columnHeaders) {
return
}
- if (this.props.columnHeaders.length == 1) {
- alert("You can't delete the last column! Going to remove delete button soon")
- return
- }
-
if (this.props.headingObject) {
const index = this.props.columnHeaders.indexOf(this.props.headingObject);
const newIndex = index == 0 ? 1 : index - 1
@@ -303,9 +299,9 @@ export class CollectionNoteTakingViewFieldColumn extends React.Component<CSVFiel
return (
<div className={"collectionNoteTakingViewFieldColumn" + (SnappingManager.GetIsDragging() ? "Dragging" : "")} key={heading}
style={{
- //TODO: change this to be slightly different
+ //TODO: change this so that it's based on the column width
width: `${100 / (uniqueHeadings.length || 1)}%`,
- height: undefined, // DraggingManager.GetIsDragging() ? "100%" : undefined,
+ height: "100%",
background: this._background
}}
ref={this.createColumnDropRef} onPointerEnter={this.pointerEntered} onPointerLeave={this.pointerLeave}>