From 7ae6431a59604085c4117622c4f5e466daf541a3 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 29 Mar 2024 12:53:08 -0400
Subject: filter links out of carousel views.

---
 src/client/views/collections/CollectionCarousel3DView.tsx | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

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

diff --git a/src/client/views/collections/CollectionCarousel3DView.tsx b/src/client/views/collections/CollectionCarousel3DView.tsx
index 7e484f3df..5454c6f9f 100644
--- a/src/client/views/collections/CollectionCarousel3DView.tsx
+++ b/src/client/views/collections/CollectionCarousel3DView.tsx
@@ -38,6 +38,10 @@ export class CollectionCarousel3DView extends CollectionSubView() {
         }
     };
 
+    @computed get carouselItems() {
+        return this.childLayoutPairs.filter(pair => pair.layout.type !== DocumentType.LINK);
+    }
+
     centerScale = Number(CAROUSEL3D_CENTER_SCALE);
     panelWidth = () => this._props.PanelWidth() / 3;
     panelHeight = () => this._props.PanelHeight() * Number(CAROUSEL3D_SIDE_SCALE);
@@ -85,7 +89,7 @@ export class CollectionCarousel3DView extends CollectionSubView() {
             );
         };
 
-        return this.childLayoutPairs.map((childPair, index) => {
+        return this.carouselItems.map((childPair, index) => {
             return (
                 <div key={childPair.layout[Id]} className={`collectionCarousel3DView-item${index === currentIndex ? '-active' : ''} ${index}`} style={{ width: this.panelWidth() }}>
                     {displayDoc(childPair)}
@@ -96,7 +100,7 @@ export class CollectionCarousel3DView extends CollectionSubView() {
 
     changeSlide = (direction: number) => {
         SelectionManager.DeselectAll();
-        this.layoutDoc._carousel_index = (NumCast(this.layoutDoc._carousel_index) + direction + this.childLayoutPairs.length) % this.childLayoutPairs.length;
+        this.layoutDoc._carousel_index = (NumCast(this.layoutDoc._carousel_index) + direction + this.carouselItems.length) % this.carouselItems.length;
     };
 
     onArrowClick = (direction: number) => {
@@ -154,7 +158,7 @@ export class CollectionCarousel3DView extends CollectionSubView() {
     }
 
     @computed get dots() {
-        return this.childLayoutPairs.map((_child, index) => <div key={Utils.GenerateGuid()} className={`dot${index === NumCast(this.layoutDoc._carousel_index) ? '-active' : ''}`} onClick={() => (this.layoutDoc._carousel_index = index)} />);
+        return this.carouselItems.map((_child, index) => <div key={Utils.GenerateGuid()} className={`dot${index === NumCast(this.layoutDoc._carousel_index) ? '-active' : ''}`} onClick={() => (this.layoutDoc._carousel_index = index)} />);
     }
     @computed get translateX() {
         const index = NumCast(this.layoutDoc._carousel_index);
-- 
cgit v1.2.3-70-g09d2

