Maybe fix row generation
This commit is contained in:
@@ -323,37 +323,44 @@ let PostFeed = ({
|
|||||||
})
|
})
|
||||||
} else if (data) {
|
} else if (data) {
|
||||||
let sliceIndex = -1
|
let sliceIndex = -1
|
||||||
for (const page of data?.pages) {
|
|
||||||
if (isVideoFeed && isNative) {
|
|
||||||
const rows: FeedPostSliceItem[][] = []
|
|
||||||
for (let i = 0; i < page.slices.length; i++) {
|
|
||||||
const slice = page.slices[i]
|
|
||||||
const root = slice.items.at(0)
|
|
||||||
if (!root) continue
|
|
||||||
// TODO test this
|
|
||||||
if (!AppBskyEmbedVideo.isView(root.post.embed)) {
|
|
||||||
i--
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
const cols = gtMobile ? 3 : 2
|
|
||||||
if (i % cols === 0) {
|
|
||||||
rows.push([root])
|
|
||||||
} else {
|
|
||||||
rows[rows.length - 1].push(root)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const row of rows) {
|
if (isVideoFeed && isNative) {
|
||||||
sliceIndex++
|
const rows: FeedPostSliceItem[][] = []
|
||||||
|
let slices: {slice: FeedPostSlice; index: number}[] = []
|
||||||
arr.push({
|
for (const page of data.pages) {
|
||||||
type: 'videoGridRow',
|
for (const slice of page.slices) {
|
||||||
key: row.map(r => r._reactKey).join('-'),
|
slices.push({slice, index: sliceIndex++})
|
||||||
slices: row,
|
|
||||||
sourceFeedUri: feedUri,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < slices.length; i++) {
|
||||||
|
const slice = slices[i]
|
||||||
|
const root = slice.slice.items.at(0)
|
||||||
|
if (!root) continue
|
||||||
|
// TODO test this
|
||||||
|
if (!AppBskyEmbedVideo.isView(root.post.embed)) {
|
||||||
|
i--
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const cols = gtMobile ? 3 : 2
|
||||||
|
if (i % cols === 0) {
|
||||||
|
rows.push([root])
|
||||||
|
} else {
|
||||||
|
rows[rows.length - 1].push(root)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const row of rows) {
|
||||||
|
sliceIndex++
|
||||||
|
arr.push({
|
||||||
|
type: 'videoGridRow',
|
||||||
|
key: row.map(r => r._reactKey).join('-'),
|
||||||
|
slices: row,
|
||||||
|
sourceFeedUri: feedUri,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (const page of data?.pages) {
|
||||||
for (const slice of page.slices) {
|
for (const slice of page.slices) {
|
||||||
sliceIndex++
|
sliceIndex++
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user