From e5b641ce31703b3af0238ff93645fcfa9a3f9168 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Sun, 17 Dec 2023 22:32:22 -0500
Subject: small change to calendarView to render calendars

---
 .../views/collections/CollectionCalendarView.tsx      | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

(limited to 'src/client/views/collections/CollectionCalendarView.tsx')

diff --git a/src/client/views/collections/CollectionCalendarView.tsx b/src/client/views/collections/CollectionCalendarView.tsx
index ad880b815..2cec29669 100644
--- a/src/client/views/collections/CollectionCalendarView.tsx
+++ b/src/client/views/collections/CollectionCalendarView.tsx
@@ -39,17 +39,13 @@ export class CollectionCalendarView extends CollectionSubView() {
     _stackRef = React.createRef<CollectionStackingView>();
 
     panelHeight = () => {
-        return 0; // TODO: change
-    };
-
-    panelWidth = () => {
-        return 0; // TODO: change
+        return this._props.PanelHeight() - 40; // this should be the height of the stacking view. For now, it's the hieight of the calendar view minus 40 to allow for a title
     };
 
     // most recent calendar should come first
     sortByMostRecentDate = (calendarA: Doc, calendarB: Doc) => {
-        const aDateRangeStr = StrCast(calendarA.date_range);
-        const bDateRangeStr = StrCast(calendarB.date_range);
+        const aDateRangeStr = StrCast(DocListCast(calendarA.data).lastElement()?.date_range);
+        const bDateRangeStr = StrCast(DocListCast(calendarB.data).lastElement()?.date_range);
 
         const [aFromDate, aToDate] = dateRangeStrToDates(aDateRangeStr);
         const [bFromDate, bToDate] = dateRangeStrToDates(bDateRangeStr);
@@ -77,24 +73,23 @@ export class CollectionCalendarView extends CollectionSubView() {
             .scale(this._props.NativeDimScaling?.() || 1);
 
     get calendarsKey() {
-        return this._props.fieldKey + '_calendars';
+        return this._props.fieldKey;
     }
 
     render() {
         return (
-            <div>
+            <div className="collectionCalendarView">
                 <CollectionStackingView
                     {...this._props}
                     setContentView={emptyFunction}
                     ref={this._stackRef}
                     PanelHeight={this.panelHeight}
-                    PanelWidth={this.panelWidth}
+                    PanelWidth={this._props.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={}
@@ -104,9 +99,7 @@ export class CollectionCalendarView extends CollectionSubView() {
                     addDocument={this.addCalendar}
                     ScreenToLocalTransform={this.screenToLocalTransform}
                     renderDepth={this._props.renderDepth + 1}
-                    type_collection={CollectionViewType.Stacking}
                     fieldKey={this.calendarsKey}
-                    pointerEvents={returnAll}
                 />
             </div>
         );
-- 
cgit v1.2.3-70-g09d2

