Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Jan 22, 2025
1 parent bd213b8 commit eb0a1af
Showing 1 changed file with 20 additions and 32 deletions.
52 changes: 20 additions & 32 deletions apps/mobile/src/screens/(stack)/feeds/[feedId]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,37 @@
import { Stack, useLocalSearchParams } from "expo-router"
import { useState } from "react"
import { View } from "react-native"
import { ScrollView, Text, View } from "react-native"

import { BlurEffect } from "@/src/components/common/BlurEffect"
import { EntryListContentGrid } from "@/src/modules/entry-list/entry-list-gird"
import { getEntry } from "@/src/store/entry/getter"
import { useEntryIdsByFeedId, usePrefetchEntries } from "@/src/store/entry/hooks"
import { useFeed } from "@/src/store/feed/hooks"

function FeedEntryList({ feedId }: { feedId: string }) {
const [pageParam, setPageParam] = useState<string | undefined>()
usePrefetchEntries({ feedId, pageParam })
const feed = useFeed(feedId)
const entryIds = useEntryIdsByFeedId(feedId)
export default function Feed() {
const { feedId } = useLocalSearchParams()

return (
<View className="flex-1 flex-row bg-gray-50">
<View>
<Stack.Screen
options={{
headerShown: true,
headerBackTitle: "Subscriptions",
headerBackground: BlurEffect,

headerTransparent: true,
headerTitle: feed?.title ?? "Feed",
}}
/>
<EntryListContentGrid
entryIds={entryIds}
onEndReached={() => {
const lastEntryId = entryIds.at(-1)
if (!lastEntryId) return
const lastEntry = getEntry(lastEntryId)
if (!lastEntry) return
setPageParam(lastEntry.publishedAt.toISOString())
headerTitle: "Feed",
}}
/>
<ScrollView contentInsetAdjustmentBehavior="automatic" className="h-full">
<Text>Feed {feedId}</Text>
<Text>Feed {feedId}</Text>
<Text>Feed {feedId}</Text>
<Text>Feed {feedId}</Text>
<Text>Feed {feedId}</Text>
<Text>Feed {feedId}</Text>
<Text>Feed {feedId}</Text>
<Text>Feed {feedId}</Text>
<Text>Feed {feedId}</Text>
<Text>Feed {feedId}</Text>
<Text>Feed {feedId}</Text>
<Text>Feed {feedId}</Text>
</ScrollView>
</View>
)
}

export default function Feed() {
const { feedId } = useLocalSearchParams()
if (!feedId || Array.isArray(feedId)) {
return null
}

return <FeedEntryList feedId={feedId} />
}

0 comments on commit eb0a1af

Please sign in to comment.