aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionStackingView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-08-03 09:52:05 -0400
committerbobzel <zzzman@gmail.com>2022-08-03 09:52:05 -0400
commit4ad4936393d11227934fdda2c18bea3446b20795 (patch)
tree6a3c333e5ab3cee32d9a42a9c0519a34252baf2b /src/client/views/collections/CollectionStackingView.tsx
parente48286293fb37e8af5c448c65c1926e813e8ee1f (diff)
more cleanup of parker branch
Diffstat (limited to 'src/client/views/collections/CollectionStackingView.tsx')
-rw-r--r--src/client/views/collections/CollectionStackingView.tsx39
1 files changed, 4 insertions, 35 deletions
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index d3a8af03a..1927db51e 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -90,7 +90,7 @@ export class CollectionStackingView extends CollectionSubView<Partial<collection
}
// are we stacking or masonry?
@computed get isStackingView() {
- return (this.props.viewType ?? this.layoutDoc._viewType) === (CollectionViewType.Stacking || CollectionViewType.NoteTaking);
+ return (this.props.viewType ?? this.layoutDoc._viewType) === CollectionViewType.Stacking;
}
// this is the number of StackingViewFieldColumns that we have
@computed get numGroupColumns() {
@@ -370,13 +370,7 @@ export class CollectionStackingView extends CollectionSubView<Partial<collection
getDocWidth(d?: Doc) {
if (!d) return 0;
const childLayoutDoc = Doc.Layout(d, this.props.childLayoutTemplate?.());
- // TODO: pj - replace with a better way to calculate the margin
- let margin = 25;
- d.margin = 25;
- if (this.columnWidth < 150) {
- margin = 0;
- }
- const maxWidth = this.columnWidth / this.numGroupColumns - margin * 2;
+ const maxWidth = this.columnWidth / this.numGroupColumns;
if (!this.layoutDoc._columnsFill && !(childLayoutDoc._fitWidth || this.props.childFitWidth?.(d))) {
return Math.min(d[WidthSym](), maxWidth);
}
@@ -424,33 +418,10 @@ export class CollectionStackingView extends CollectionSubView<Partial<collection
);
}
- // TODO: plj
- @action
- onPointerOver = (e: React.PointerEvent) => {
- // console.log("hovering over something")
- if (DragManager.docsBeingDragged.length) {
- // essentially copying code from onInternalDrop for this:
- const doc = DragManager.docsBeingDragged[0];
- // console.log(doc[LayoutSym]())
-
- console.log(doc[DataSym]);
- console.log(Doc.IndexOf(doc, this.childDocs));
- }
- };
-
- //used in onPointerOver to swap two nodes in the rendered filtered children list
- swapNodes = (i: number, j: number) => {};
-
- //plj added this
- @action
- onPointerDown = (e: React.PointerEvent) => {};
-
- // TODO: plj - look at this. Start with making changes to db, and then transition to client side
@undoBatch
@action
onInternalDrop = (e: Event, de: DragManager.DropEvent) => {
// Fairly confident that this is where the swapping of nodes in the various arrays happens
- console.log('drop');
const where = [de.x, de.y];
// start at -1 until we're sure we want to add it to the column
let dropInd = -1;
@@ -505,12 +476,10 @@ export class CollectionStackingView extends CollectionSubView<Partial<collection
return true;
}
+ /// an item from outside of Dash is being dropped onto this stacking view (e.g, a document from the file system)
@undoBatch
@action
- //What is the difference between internal and external drop?? Does internal mean we're dropping inside of a collection?
- // I take it back: external drop means we took it out of column/collection that we were just in
onExternalDrop = async (e: React.DragEvent): Promise<void> => {
- console.log('external drop');
const where = [e.clientX, e.clientY];
let targInd = -1;
this._docXfs.map((cd, i) => {
@@ -633,8 +602,8 @@ export class CollectionStackingView extends CollectionSubView<Partial<collection
);
};
+ /// add a new group category (column) to the active set of note categories. (e.g., if the pivot field is 'transportation', groups might be 'car', 'plane', 'bike', etc)
@action
- // What are we adding a group to?
addGroup = (value: string) => {
if (value && this.columnHeaders) {
const schemaHdrField = new SchemaHeaderField(value);