diff --git a/apps/mobile/src/modules/entry-list/entry-list.tsx b/apps/mobile/src/modules/entry-list/entry-list.tsx
index 9de88db07..782c96922 100644
--- a/apps/mobile/src/modules/entry-list/entry-list.tsx
+++ b/apps/mobile/src/modules/entry-list/entry-list.tsx
@@ -15,11 +15,7 @@ import {
NavigationContext,
} from "@/src/components/common/SafeNavigationScrollView"
import { ItemPressable } from "@/src/components/ui/pressable/item-pressable"
-import {
- useSelectedFeed,
- useSetDrawerSwipeDisabled,
- useViewDefinition,
-} from "@/src/modules/feed-drawer/atoms"
+import { useSelectedFeed, useSetDrawerSwipeDisabled } from "@/src/modules/feed-drawer/atoms"
import {
useEntry,
useEntryIdsByCategory,
@@ -27,11 +23,9 @@ import {
useEntryIdsByInboxId,
useEntryIdsByView,
} from "@/src/store/entry/hooks"
-import { FEED_COLLECTION_LIST } from "@/src/store/entry/utils"
-import { useFeed } from "@/src/store/feed/hooks"
-import { useInbox } from "@/src/store/inbox/hooks"
import { useList } from "@/src/store/list/hooks"
+import { ViewSelector } from "../feed-drawer/view-selector"
import { LeftAction, RightAction } from "./action"
import { EntryListContentGrid } from "./entry-list-gird"
@@ -70,37 +64,33 @@ export function EntryList() {
function ViewEntryList({ viewId }: { viewId: FeedViewType }) {
const entryIds = useEntryIdsByView(viewId)
- const viewDef = useViewDefinition(viewId)
- return
+ return
}
function FeedEntryList({ feedId }: { feedId: string }) {
- const feed = useFeed(feedId)
const entryIds = useEntryIdsByFeedId(feedId)
- const title = feedId === FEED_COLLECTION_LIST ? "Collections" : (feed?.title ?? "")
- return
+ return
}
function CategoryEntryList({ categoryName }: { categoryName: string }) {
const entryIds = useEntryIdsByCategory(categoryName)
- return
+ return
}
function ListEntryList({ listId }: { listId: string }) {
const list = useList(listId)
if (!list) return null
- return
+ return
}
function InboxEntryList({ inboxId }: { inboxId: string }) {
- const inbox = useInbox(inboxId)
const entryIds = useEntryIdsByInboxId(inboxId)
- return
+ return
}
-function EntryListScreen({ title, entryIds }: { title: string; entryIds: string[] }) {
+function EntryListScreen({ entryIds }: { entryIds: string[] }) {
const scrollY = useAnimatedValue(0)
const selectedFeed = useSelectedFeed()
const view = selectedFeed.type === "view" ? selectedFeed.viewId : null
@@ -109,7 +99,7 @@ function EntryListScreen({ title, entryIds }: { title: string; entryIds: string[
({ scrollY }), [scrollY])}>
(
diff --git a/apps/mobile/src/modules/feed-drawer/atoms.ts b/apps/mobile/src/modules/feed-drawer/atoms.ts
index 00bb5536e..89e60deac 100644
--- a/apps/mobile/src/modules/feed-drawer/atoms.ts
+++ b/apps/mobile/src/modules/feed-drawer/atoms.ts
@@ -6,6 +6,10 @@ import { useCallback, useMemo } from "react"
import { views } from "@/src/constants/views"
import { usePrefetchEntries } from "@/src/store/entry/hooks"
import type { FetchEntriesProps } from "@/src/store/entry/types"
+import { FEED_COLLECTION_LIST } from "@/src/store/entry/utils"
+import { useFeed } from "@/src/store/feed/hooks"
+import { useInbox } from "@/src/store/inbox/hooks"
+import { useList } from "@/src/store/list/hooks"
import { getSubscriptionByCategory } from "@/src/store/subscription/getter"
// drawer open state
@@ -123,11 +127,37 @@ export function useSelectedFeed() {
return selectedFeed
}
+export const useSelectedFeedTitle = () => {
+ const selectedFeed = useSelectedFeed()
+ const viewDef = useViewDefinition(selectedFeed.type === "view" ? selectedFeed.viewId : undefined)
+ const feed = useFeed(selectedFeed.type === "feed" ? selectedFeed.feedId : "")
+ const list = useList(selectedFeed.type === "list" ? selectedFeed.listId : "")
+ const inbox = useInbox(selectedFeed.type === "inbox" ? selectedFeed.inboxId : "")
+
+ switch (selectedFeed.type) {
+ case "view": {
+ return viewDef?.name
+ }
+ case "feed": {
+ return selectedFeed.feedId === FEED_COLLECTION_LIST ? "Collections" : (feed?.title ?? "")
+ }
+ case "category": {
+ return selectedFeed.categoryName
+ }
+ case "list": {
+ return list?.title
+ }
+ case "inbox": {
+ return inbox?.title ?? "Inbox"
+ }
+ }
+}
+
export const selectFeed = (state: SelectedFeed) => {
jotaiStore.set(selectedFeedAtom, state)
}
-export const useViewDefinition = (view: FeedViewType) => {
+export const useViewDefinition = (view?: FeedViewType) => {
const viewDef = useMemo(() => views.find((v) => v.view === view), [view])
if (!viewDef) {
throw new Error(`View ${view} not found`)
diff --git a/apps/mobile/src/modules/feed-drawer/view-selector.tsx b/apps/mobile/src/modules/feed-drawer/view-selector.tsx
index c775ee351..446bf5d6b 100644
--- a/apps/mobile/src/modules/feed-drawer/view-selector.tsx
+++ b/apps/mobile/src/modules/feed-drawer/view-selector.tsx
@@ -1,10 +1,7 @@
-import { cn } from "@follow/utils"
import { Image } from "expo-image"
-import { Stack } from "expo-router"
-import { ScrollView, TouchableOpacity, View } from "react-native"
+import { ScrollView, TouchableOpacity } from "react-native"
import { Grayscale } from "react-native-color-matrix-image-filters"
-import { BlurEffect } from "@/src/components/common/BlurEffect"
import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon"
import type { ViewDefinition } from "@/src/constants/views"
import { views } from "@/src/constants/views"
@@ -12,29 +9,13 @@ import { useList } from "@/src/store/list/hooks"
import { useAllListSubscription } from "@/src/store/subscription/hooks"
import { useColor } from "@/src/theme/colors"
-import { LeftAction, RightAction } from "../entry-list/action"
import { selectFeed, useSelectedFeed } from "../feed-drawer/atoms"
export function ViewSelector() {
- return (
-
- )
-}
-
-function ViewItems() {
const lists = useAllListSubscription()
return (
-
+
{views.map((view) => (
))}
@@ -53,19 +34,13 @@ function ViewItem({ view }: { view: ViewDefinition }) {
return (
selectFeed({ type: "view", viewId: view.view })}
+ style={{
+ backgroundColor: isActive ? view.activeColor : bgColor,
+ }}
>
-
-
-
-
-
+
)
}
@@ -79,24 +54,20 @@ function ListItem({ listId }: { listId: string }) {
return (
selectFeed({ type: "list", listId })}
>
-
-
- {list.image ? (
- isActive ? (
-
- ) : (
-
-
-
- )
- ) : (
-
- )}
-
-
+ {list.image ? (
+ isActive ? (
+
+ ) : (
+
+
+
+ )
+ ) : (
+
+ )}
)
}
diff --git a/apps/mobile/src/screens/(stack)/(tabs)/index.tsx b/apps/mobile/src/screens/(stack)/(tabs)/index.tsx
index 28e3984df..d0c13866e 100644
--- a/apps/mobile/src/screens/(stack)/(tabs)/index.tsx
+++ b/apps/mobile/src/screens/(stack)/(tabs)/index.tsx
@@ -1,10 +1,5 @@
import { EntryList } from "@/src/modules/entry-list/entry-list"
export default function Index() {
- return (
- <>
- {/* */}
-
- >
- )
+ return
}