fix(mobile): separator style, clean useless code (#3723)
This commit is contained in:
parent
20049b0150
commit
56d65f473f
|
|
@ -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<boolean>(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<boolean>(true)
|
||||
|
||||
export function useIsDrawerSwipeDisabled() {
|
||||
return useAtomValue(isDrawerSwipeDisabledAtom)
|
||||
}
|
||||
|
||||
export function useSetDrawerSwipeDisabled() {
|
||||
return useSetAtom(isDrawerSwipeDisabledAtom)
|
||||
}
|
||||
|
||||
// feed panel selected state
|
||||
|
||||
export type SelectedTimeline = {
|
||||
type: "view"
|
||||
|
|
|
|||
|
|
@ -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(
|
|||
</SubscriptionFeedCategoryContextMenu>
|
||||
</View>
|
||||
|
||||
{!isLast && <ItemSeparator />}
|
||||
{/* FIXME: This separator is not visible when expanded and will add a unexpected space under grouped list */}
|
||||
{!isLast && !expanded && <ItemSeparator />}
|
||||
{expanded && (
|
||||
<GroupedContext value={category}>
|
||||
<UnGroupedList subscriptionIds={subscriptionIds} isGroupLast={isLast} />
|
||||
<UnGroupedList subscriptionIds={subscriptionIds} isLastGroup={isLast} />
|
||||
</GroupedContext>
|
||||
)}
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
/>
|
||||
))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue