diff options
Diffstat (limited to 'src/client/views')
| -rw-r--r-- | src/client/views/collections/CollectionCalendarView.tsx | 101 | ||||
| -rw-r--r-- | src/client/views/collections/CollectionSubView.tsx | 2 |
2 files changed, 45 insertions, 58 deletions
diff --git a/src/client/views/collections/CollectionCalendarView.tsx b/src/client/views/collections/CollectionCalendarView.tsx index f28154486..ad880b815 100644 --- a/src/client/views/collections/CollectionCalendarView.tsx +++ b/src/client/views/collections/CollectionCalendarView.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { CollectionSubView } from "./CollectionSubView"; +import { CollectionSubView } from './CollectionSubView'; import { observer } from 'mobx-react'; import { computed, makeObservable, observable } from 'mobx'; import { Doc, DocListCast, Opt } from '../../../fields/Doc'; @@ -15,43 +15,36 @@ import { StyleProp } from '../StyleProvider'; import { CollectionFreeFormDocumentView } from '../nodes/CollectionFreeFormDocumentView'; @observer -export class CollectionCalendarView extends CollectionSubView(){ - - constructor(props: any){ +export class CollectionCalendarView extends CollectionSubView() { + constructor(props: any) { super(props); makeObservable(this); } - componentDidMount(): void { - - } + componentDidMount(): void {} - componentWillUnmount(): void { - - } + componentWillUnmount(): void {} - @computed get allCalendars(){ + @computed get allCalendars() { return this.childDocs; // returns a list of docs (i.e. calendars) } - removeCalendar = () => { - - } + removeCalendar = () => {}; addCalendar = (doc: Doc | Doc[], annotationKey?: string | undefined): boolean => { - // bring up calendar modal with option to create a calendar + // bring up calendar modal with option to create a calendar return true; - } + }; _stackRef = React.createRef<CollectionStackingView>(); panelHeight = () => { return 0; // TODO: change - } + }; panelWidth = () => { return 0; // TODO: change - } + }; // most recent calendar should come first sortByMostRecentDate = (calendarA: Doc, calendarB: Doc) => { @@ -60,12 +53,13 @@ export class CollectionCalendarView extends CollectionSubView(){ const [aFromDate, aToDate] = dateRangeStrToDates(aDateRangeStr); const [bFromDate, bToDate] = dateRangeStrToDates(bDateRangeStr); - - if (aFromDate > bFromDate) { + + if (aFromDate > bFromDate) { return -1; // a comes first } else if (aFromDate < bFromDate) { return 1; // b comes first - } else { // start dates are the same + } else { + // start dates are the same if (aToDate > bToDate) { return -1; // a comes first } else if (aToDate < bToDate) { @@ -74,11 +68,7 @@ export class CollectionCalendarView extends CollectionSubView(){ return 0; // same start and end dates } } - - - } - - + }; screenToLocalTransform = () => this._props @@ -90,38 +80,35 @@ export class CollectionCalendarView extends CollectionSubView(){ return this._props.fieldKey + '_calendars'; } - render(){ + render() { return ( <div> - <CollectionStackingView - {...this._props} - setContentView={emptyFunction} - NativeWidth={} - NativeHeight={} - ref={this._stackRef} - PanelHeight={this.panelHeight} - PanelWidth={this.panelWidth} - // childFilters={this.childFilters} DO I NEED THIS? - sortFunc={this.sortByMostRecentDate} - setHeight={this.setHeightCallback} - isAnnotationOverlay={false} - // select={emptyFunction} What does this mean? - NativeDimScaling={returnOne} - isAnyChildContentActive={returnTrue} // ?? - // childDocumentsActive={} - // whenChildContentsActiveChanged={} - childHideDecorationTitle={false} - removeDocument={this.removeDocument} // will calendar automatically be removed from myCalendars - moveDocument={this.moveDocument} - addDocument={this.addCalendar} - ScreenToLocalTransform={this.screenToLocalTransform} - renderDepth={this._props.renderDepth + 1} - type_collection={CollectionViewType.Stacking} - fieldKey={this.calendarsKey} - pointerEvents={returnAll} - /> + <CollectionStackingView + {...this._props} + setContentView={emptyFunction} + ref={this._stackRef} + PanelHeight={this.panelHeight} + PanelWidth={this.panelWidth} + // childFilters={this.childFilters} DO I NEED THIS? + sortFunc={this.sortByMostRecentDate} + setHeight={undefined} + isAnnotationOverlay={false} + // select={emptyFunction} What does this mean? + NativeDimScaling={returnOne} + isAnyChildContentActive={returnTrue} // ?? + // childDocumentsActive={} + // whenChildContentsActiveChanged={} + childHideDecorationTitle={false} + removeDocument={this.removeDocument} // will calendar automatically be removed from myCalendars + moveDocument={this.moveDocument} + addDocument={this.addCalendar} + ScreenToLocalTransform={this.screenToLocalTransform} + renderDepth={this._props.renderDepth + 1} + type_collection={CollectionViewType.Stacking} + fieldKey={this.calendarsKey} + pointerEvents={returnAll} + /> </div> - - ) + ); } -}
\ No newline at end of file +} diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index 0131af6f2..b56973dc6 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -212,7 +212,7 @@ export function CollectionSubView<X>(moreProps?: X) { addDocument = (doc: Doc | Doc[], annotationKey?: string) => this._props.addDocument?.(doc, annotationKey) || false; removeDocument = (doc: Doc | Doc[], annotationKey?: string) => this._props.removeDocument?.(doc, annotationKey) || false; - moveDocument = (doc: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (doc: Doc | Doc[], annotationKey?: string) => boolean, annotationKey?: string) => this._props.moveDocument?.(doc, targetCollection, addDocument); + moveDocument = (doc: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (doc: Doc | Doc[], annotationKey?: string) => boolean, annotationKey?: string) => this._props.moveDocument?.(doc, targetCollection, addDocument) || false; protected onInternalDrop(e: Event, de: DragManager.DropEvent): boolean { const docDragData = de.complete.docDragData; |
