diff --git a/app/index.tsx b/app/index.tsx index e13b3a7..38de403 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -207,13 +207,23 @@ export default function HomeScreen() { } if (row.type === "live") { return ( - - router.push(`/live/${row.left.roomid}` as any)} - /> + + + router.push(`/live/${row.left.roomid}` as any)} + /> + + {row.right && ( + + router.push(`/live/${row.right!.roomid}` as any)} + /> + + )} ); } @@ -559,9 +569,6 @@ const styles = StyleSheet.create({ }, leftCol: { marginLeft: 4, marginRight: 2 }, rightCol: { marginLeft: 2, marginRight: 4 }, - liveRow: { - paddingHorizontal: 4, - }, footer: { height: 48, alignItems: "center", diff --git a/utils/videoRows.ts b/utils/videoRows.ts index 6f75524..8a1429f 100644 --- a/utils/videoRows.ts +++ b/utils/videoRows.ts @@ -46,21 +46,27 @@ export function toListRows(pages: VideoItem[][], liveRooms?: LiveRoom[]): ListRo - // if (liveRooms && roomIdx < liveRooms.length && pairs.length > 0) { - // const seed = chunk[0]?.aid ?? 0; - // const insertAt = seed % (pairs.length + 1); - // pairs.splice(insertAt, 0, { - // type: 'live', - // left: liveRooms[roomIdx], - // }); - // roomIdx++; - // } + if (liveRooms && liveRooms.length >= 2) { + const a = liveRooms[roomIdx % liveRooms.length]; + const b = liveRooms[(roomIdx + 1) % liveRooms.length]; + roomIdx += 2; - - if (rows.length < 20) { - rows.push({ type: 'big', item: bigItem }, ...pairs); + if (rows.length < 20) { + rows.push({ type: 'big', item: bigItem }); + rows.push({ type: 'live', left: a, right: b }); + rows.push(...pairs); + } else { + rows.push(...pairs); + rows.push({ type: 'big', item: bigItem }); + rows.push({ type: 'live', left: a, right: b }); + } } else { - rows.push(...pairs, { type: 'big', item: bigItem }); + // No live data, fall back to original logic + if (rows.length < 20) { + rows.push({ type: 'big', item: bigItem }, ...pairs); + } else { + rows.push(...pairs, { type: 'big', item: bigItem }); + } } } return rows;