From d8c13a98ab7bac98ef29f263ca749f28291b4647 Mon Sep 17 00:00:00 2001 From: Developer Date: Thu, 19 Mar 2026 20:45:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E7=83=AD=E9=97=A8=E5=88=97=E8=A1=A8=20Big?= =?UTF-8?q?VideoCard=20=E4=B8=8B=E6=96=B9=E7=A9=BF=E6=8F=92=E5=8F=8C?= =?UTF-8?q?=E5=88=97=E7=9B=B4=E6=92=AD=E5=8D=A1=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index.tsx | 27 +++++++++++++++++---------- utils/videoRows.ts | 32 +++++++++++++++++++------------- 2 files changed, 36 insertions(+), 23 deletions(-) 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;