diff --git a/js/app/components/home/cards.tsx b/js/app/components/home/cards.tsx index 88beac26..630c34e1 100644 --- a/js/app/components/home/cards.tsx +++ b/js/app/components/home/cards.tsx @@ -108,7 +108,7 @@ const StreamCard = ({ s === null) && cols > 0) { - // ensure segs is not just [null] if segments is empty - segs = []; - } + let rows: (PlaceStreamLivestream.LivestreamView | null)[][] = []; - // assemble rows - const rows: (PlaceStreamLivestream.LivestreamView | null)[][] = []; - for (let i = 0; i < cutSegs.length; i += cols) { - let row = cutSegs.slice(i, i + cols); - // pad the last row with nulls if it's not full - if (i + cols >= cutSegs.length && row.length < cols) { - const paddingNeeded = cols - row.length; - row = [...row, ...Array(paddingNeeded).fill(null)]; + if (!useHorizontalAll) { + for (let i = 0; i < cutSegs.length; i += cols) { + let row = cutSegs.slice(i, i + cols); + if (i + cols >= cutSegs.length && row.length < cols) { + const paddingNeeded = cols - row.length; + row = [...row, ...Array(paddingNeeded).fill(null)]; + } + rows.push(row); } - rows.push(row); } const indicatorTop = safeAreaInsets.top; @@ -335,15 +327,28 @@ export default function HomeScreen({ Check back later? )} - {firstRowItems.length > 0 && ( + {useHorizontalAll + ? segments.map((item) => ( + + + + )) + : null} + + {!useHorizontalAll && firstRowItems.length > 0 && ( {firstRowItems.map((item, itemIndex) => ( @@ -363,14 +368,11 @@ export default function HomeScreen({ item={item} size={size} avatarUrl={avis[item.author.did]?.avatar} - horizontal={ - useHorizontalAll || (itemIndex == 0 && useHorizontalFirst) - } - showAvatar={!useHorizontalAll} + horizontal={itemIndex == 0 && useHorizontalFirst} + showAvatar={true} /> ))} - {/* Pad the first row to match the column count */} {Array( useHorizontalFirst ? cols - firstRowItems.length - 1 @@ -385,14 +387,14 @@ export default function HomeScreen({ )} - {segments.length > 0 && ( + {!useHorizontalAll && segments.length > 0 && ( {rows.map((row, rowIndex) => ( {row.map((item, itemIndex) => @@ -405,8 +407,8 @@ export default function HomeScreen({ item={item} size={size} avatarUrl={avis[item.author.did]?.avatar} - horizontal={useHorizontalAll} - showAvatar={!useHorizontalAll} + horizontal={false} + showAvatar={true} /> ) : (