diff --git a/apps/mobile/src/modules/screen/atoms.ts b/apps/mobile/src/modules/screen/atoms.ts index 1a5fa50c8..abfb2b401 100644 --- a/apps/mobile/src/modules/screen/atoms.ts +++ b/apps/mobile/src/modules/screen/atoms.ts @@ -1,9 +1,9 @@ import { FeedViewType } from "@follow/constants" import { jotaiStore } from "@follow/utils" import { EventBus } from "@follow/utils/src/event-bus" -import { atom, useAtom, useAtomValue, useSetAtom } from "jotai" +import { atom, useAtomValue } from "jotai" import { selectAtom } from "jotai/utils" -import { createContext, use, useCallback, useMemo, useState } from "react" +import { createContext, use, useMemo, useState } from "react" import { useTranslation } from "react-i18next" import { views } from "@/src/constants/views" @@ -13,36 +13,6 @@ 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" -// drawer open state - -const drawerOpenAtom = atom(false) - -export function useFeedDrawer() { - const [state, setState] = useAtom(drawerOpenAtom) - - return { - isDrawerOpen: state, - openDrawer: useCallback(() => setState(true), [setState]), - closeDrawer: useCallback(() => setState(false), [setState]), - toggleDrawer: useCallback(() => setState(!state), [setState, state]), - } -} - -export const closeDrawer = () => jotaiStore.set(drawerOpenAtom, false) - -// is drawer swipe disabled - -const isDrawerSwipeDisabledAtom = atom(true) - -export function useIsDrawerSwipeDisabled() { - return useAtomValue(isDrawerSwipeDisabledAtom) -} - -export function useSetDrawerSwipeDisabled() { - return useSetAtom(isDrawerSwipeDisabledAtom) -} - -// feed panel selected state export type SelectedTimeline = { type: "view" diff --git a/apps/mobile/src/modules/subscription/CategoryGrouped.tsx b/apps/mobile/src/modules/subscription/CategoryGrouped.tsx index f592b9d3f..83baf1684 100644 --- a/apps/mobile/src/modules/subscription/CategoryGrouped.tsx +++ b/apps/mobile/src/modules/subscription/CategoryGrouped.tsx @@ -9,7 +9,7 @@ import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable" import { NativePressable } from "@/src/components/ui/pressable/NativePressable" import { RightCuteFiIcon } from "@/src/icons/right_cute_fi" import { useNavigation } from "@/src/lib/navigation/hooks" -import { closeDrawer, selectFeed } from "@/src/modules/screen/atoms" +import { selectFeed } from "@/src/modules/screen/atoms" import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]/FeedScreen" import { useUnreadCounts } from "@/src/store/unread/hooks" import { useColor } from "@/src/theme/colors" @@ -55,7 +55,7 @@ export const CategoryGrouped = memo( type: "category", categoryName: category, }) - closeDrawer() + navigation.pushControllerView(FeedScreen, { feedId: category, }) @@ -83,10 +83,11 @@ export const CategoryGrouped = memo( - {!isLast && } + {/* FIXME: This separator is not visible when expanded and will add a unexpected space under grouped list */} + {!isLast && !expanded && } {expanded && ( - + )} diff --git a/apps/mobile/src/modules/subscription/SubscriptionLists.tsx b/apps/mobile/src/modules/subscription/SubscriptionLists.tsx index bda15d575..c6011472a 100644 --- a/apps/mobile/src/modules/subscription/SubscriptionLists.tsx +++ b/apps/mobile/src/modules/subscription/SubscriptionLists.tsx @@ -19,7 +19,7 @@ import { ItemPressableStyle } from "@/src/components/ui/pressable/enum" import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable" import { StarCuteFiIcon } from "@/src/icons/star_cute_fi" import { useNavigation } from "@/src/lib/navigation/hooks" -import { closeDrawer, selectFeed } from "@/src/modules/screen/atoms" +import { selectFeed } from "@/src/modules/screen/atoms" import { TimelineSelectorList } from "@/src/modules/screen/TimelineSelectorList" import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]/FeedScreen" import { FEED_COLLECTION_LIST } from "@/src/store/entry/utils" @@ -237,7 +237,7 @@ const StarItem = () => { itemStyle={ItemPressableStyle.Grouped} onPress={() => { selectFeed({ type: "feed", feedId: FEED_COLLECTION_LIST }) - closeDrawer() + navigation.pushControllerView(FeedScreen, { feedId: FEED_COLLECTION_LIST, }) diff --git a/apps/mobile/src/modules/subscription/UnGroupedList.tsx b/apps/mobile/src/modules/subscription/UnGroupedList.tsx index c462f4935..0e70aabdd 100644 --- a/apps/mobile/src/modules/subscription/UnGroupedList.tsx +++ b/apps/mobile/src/modules/subscription/UnGroupedList.tsx @@ -7,8 +7,8 @@ import { SubscriptionItem } from "./items/SubscriptionItem" export const UnGroupedList: FC<{ subscriptionIds: string[] - isGroupLast?: boolean -}> = ({ subscriptionIds, isGroupLast }) => { + isLastGroup?: boolean +}> = ({ subscriptionIds, isLastGroup }) => { const sortBy = useFeedListSortMethod() const sortOrder = useFeedListSortOrder() const sortedSubscriptionIds = useSortedUngroupedSubscription(subscriptionIds, sortBy, sortOrder) @@ -18,7 +18,7 @@ export const UnGroupedList: FC<{ key={id} id={id} isFirst={false} - isLast={!!isGroupLast && index === sortedSubscriptionIds.length - 1} + isLast={!!isLastGroup && index === sortedSubscriptionIds.length - 1} /> )) } diff --git a/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx b/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx index 2dc217c51..9c053bdf6 100644 --- a/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx +++ b/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx @@ -12,7 +12,7 @@ import { ItemPressableStyle } from "@/src/components/ui/pressable/enum" import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable" import { WifiOffCuteReIcon } from "@/src/icons/wifi_off_cute_re" import { useNavigation } from "@/src/lib/navigation/hooks" -import { closeDrawer, selectFeed } from "@/src/modules/screen/atoms" +import { selectFeed } from "@/src/modules/screen/atoms" import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]/FeedScreen" import { useFeed, usePrefetchFeed } from "@/src/store/feed/hooks" import { useSubscription } from "@/src/store/subscription/hooks" @@ -69,7 +69,7 @@ export const SubscriptionItem = memo( type: "feed", feedId: id, }) - closeDrawer() + navigation.pushControllerView(FeedScreen, { feedId: id, })