From dbf6954da0a3dc30ddd9bd6f8f2a78ba45ae4fb7 Mon Sep 17 00:00:00 2001 From: Innei Date: Wed, 16 Apr 2025 21:58:21 +0800 Subject: [PATCH] feat(mobile): trending screen - Updated imports for EntryDetailScreen and FeedScreen to reflect new file structure. - Introduced OnboardingScreen and PlayerScreen components to improve user onboarding and media playback experience. - Added PhUsersBold icon component for enhanced UI consistency. - Adjusted animation timing in ItemPressableModule for better touch feedback. - Updated sitemap to reflect new screen paths. Signed-off-by: Innei --- .../ItemPressable/ItemPressableModule.swift | 2 +- .../src/components/icons/PhUsersBold.tsx | 15 ++ .../src/components/ui/grouped/GroupedList.tsx | 22 +- .../mobile/src/modules/context-menu/entry.tsx | 2 +- .../mobile/src/modules/context-menu/feeds.tsx | 2 +- apps/mobile/src/modules/discover/GoodLuck.tsx | 2 +- apps/mobile/src/modules/discover/search.tsx | 15 +- .../entry-list/templates/EntryNormalItem.tsx | 2 +- .../entry-list/templates/EntrySocialItem.tsx | 4 +- .../src/modules/player/PlayerTabBar.tsx | 2 +- .../modules/subscription/CategoryGrouped.tsx | 2 +- .../subscription/SubscriptionLists.tsx | 2 +- .../modules/subscription/items/InboxItem.tsx | 2 +- .../items/ListSubscriptionItem.tsx | 2 +- .../subscription/items/SubscriptionItem.tsx | 2 +- apps/mobile/src/screens/(modal)/profile.tsx | 26 ++- .../src/screens/(stack)/(tabs)/discover.tsx | 46 ----- .../{index.tsx => EntryDetailScreen.tsx} | 0 .../[feedId]/{index.tsx => FeedScreen.tsx} | 0 .../(stack)/trending/TrendingScreen.tsx | 191 ++++++++++++++++++ .../{onboarding.tsx => OnboardingScreen.tsx} | 0 .../screens/{player.tsx => PlayerScreen.tsx} | 0 apps/mobile/src/sitemap.tsx | 2 +- apps/mobile/src/store/messaging/hooks.ts | 2 +- apps/mobile/src/store/user/hooks.ts | 2 +- apps/mobile/src/store/user/store.ts | 16 ++ 26 files changed, 290 insertions(+), 73 deletions(-) create mode 100644 apps/mobile/src/components/icons/PhUsersBold.tsx rename apps/mobile/src/screens/(stack)/entries/[entryId]/{index.tsx => EntryDetailScreen.tsx} (100%) rename apps/mobile/src/screens/(stack)/feeds/[feedId]/{index.tsx => FeedScreen.tsx} (100%) create mode 100644 apps/mobile/src/screens/(stack)/trending/TrendingScreen.tsx rename apps/mobile/src/screens/{onboarding.tsx => OnboardingScreen.tsx} (100%) rename apps/mobile/src/screens/{player.tsx => PlayerScreen.tsx} (100%) diff --git a/apps/mobile/native/ios/Modules/ItemPressable/ItemPressableModule.swift b/apps/mobile/native/ios/Modules/ItemPressable/ItemPressableModule.swift index b19d40829..6ea7b4fb6 100644 --- a/apps/mobile/native/ios/Modules/ItemPressable/ItemPressableModule.swift +++ b/apps/mobile/native/ios/Modules/ItemPressable/ItemPressableModule.swift @@ -49,7 +49,7 @@ class ItemPressableView: ExpoView { if touchHighlight { layer.backgroundColor = UIColor.systemGray5.cgColor - UIView.animate(withDuration: 0.2, delay: 0.5, options: [.curveEaseOut]) { + UIView.animate(withDuration: 0.2, delay: 0.1, options: [.curveEaseOut]) { self.layer.backgroundColor = bgColor } } diff --git a/apps/mobile/src/components/icons/PhUsersBold.tsx b/apps/mobile/src/components/icons/PhUsersBold.tsx new file mode 100644 index 000000000..0fe5581ad --- /dev/null +++ b/apps/mobile/src/components/icons/PhUsersBold.tsx @@ -0,0 +1,15 @@ +import * as React from "react" +import type { SvgProps } from "react-native-svg" +import Svg, { Path } from "react-native-svg" + +export function PhUsersBold(props: SvgProps & { size?: number; color?: string }) { + const { size = 24, color = "currentColor", ...rest } = props + return ( + + + + ) +} diff --git a/apps/mobile/src/components/ui/grouped/GroupedList.tsx b/apps/mobile/src/components/ui/grouped/GroupedList.tsx index 161445de5..099dc417a 100644 --- a/apps/mobile/src/components/ui/grouped/GroupedList.tsx +++ b/apps/mobile/src/components/ui/grouped/GroupedList.tsx @@ -23,6 +23,7 @@ import { GroupedInsetListCardItemStyle } from "./GroupedInsetListCardItemStyle" interface GroupedInsetListCardProps { showSeparator?: boolean SeparatorComponent?: FC + SeparatorElement?: React.ReactNode } interface BaseCellClassNames { @@ -38,7 +39,14 @@ export const GroupedOutlineDescription: FC<{ export const GroupedInsetListCard: FC< PropsWithChildren & ViewProps & GroupedInsetListCardProps -> = ({ children, className, showSeparator = true, SeparatorComponent, ...props }) => { +> = ({ + children, + className, + showSeparator = true, + SeparatorComponent, + SeparatorElement, + ...props +}) => { const nextChildren = React.useMemo( () => React.Children.toArray(children).filter(Boolean), [children], @@ -63,13 +71,19 @@ export const GroupedInsetListCard: FC< ((child.type as Function).name === GroupedInsetListNavigationLink.name || (child.type as any).itemStyle === GroupedInsetListCardItemStyle.NavigationLink) + const NextSeparatorComponent = + typeof SeparatorComponent === "function" ? : undefined + const NextSeparatorElement = SeparatorElement + ? React.isValidElement(SeparatorElement) + ? SeparatorElement + : NextSeparatorComponent + : NextSeparatorComponent + return ( {child} {!isLast && - (SeparatorComponent ? ( - - ) : ( + (NextSeparatorElement ?? ( { return ( {isLoading ? ( - + ) : ( diff --git a/apps/mobile/src/modules/discover/search.tsx b/apps/mobile/src/modules/discover/search.tsx index 7943e9515..f2de61ddf 100644 --- a/apps/mobile/src/modules/discover/search.tsx +++ b/apps/mobile/src/modules/discover/search.tsx @@ -13,12 +13,15 @@ import Animated, { import { useSafeAreaFrame, useSafeAreaInsets } from "react-native-safe-area-context" import { BlurEffect } from "@/src/components/common/BlurEffect" +import { UINavigationHeaderActionButton } from "@/src/components/layouts/header/NavigationHeader" import { getDefaultHeaderHeight } from "@/src/components/layouts/utils" import { Search2CuteReIcon } from "@/src/icons/search_2_cute_re" -import { useScreenIsInSheetModal } from "@/src/lib/navigation/hooks" +import { TrendingUpCuteReIcon } from "@/src/icons/trending_up_cute_re" +import { useNavigation, useScreenIsInSheetModal } from "@/src/lib/navigation/hooks" import { Navigation } from "@/src/lib/navigation/Navigation" import { ScreenItemContext } from "@/src/lib/navigation/ScreenItemContext" import SearchScreen from "@/src/screens/(headless)/search" +import { TrendingScreen } from "@/src/screens/(stack)/trending/TrendingScreen" import { accentColor, useColor } from "@/src/theme/colors" import { useSearchPageContext } from "./ctx" @@ -62,10 +65,8 @@ const DynamicBlurEffect = () => { ) } + export const DiscoverHeader = () => { - return -} -const DiscoverHeaderImpl = () => { const frame = useSafeAreaFrame() const insets = useSafeAreaInsets() const sheetModal = useScreenIsInSheetModal() @@ -74,6 +75,7 @@ const DiscoverHeaderImpl = () => { const setHeaderHeight = useSetAtom(headerHeightAtom) + const navigation = useNavigation() return ( { + navigation.pushControllerView(TrendingScreen)} + > + + ) diff --git a/apps/mobile/src/modules/entry-list/templates/EntryNormalItem.tsx b/apps/mobile/src/modules/entry-list/templates/EntryNormalItem.tsx index 04d0b06a5..9251dd2fc 100644 --- a/apps/mobile/src/modules/entry-list/templates/EntryNormalItem.tsx +++ b/apps/mobile/src/modules/entry-list/templates/EntryNormalItem.tsx @@ -18,7 +18,7 @@ import { PlayCuteFiIcon } from "@/src/icons/play_cute_fi" import { useNavigation } from "@/src/lib/navigation/hooks" import { getAttachmentState, player } from "@/src/lib/player" import { getHorizontalScrolling } from "@/src/modules/screen/atoms" -import { EntryDetailScreen } from "@/src/screens/(stack)/entries/[entryId]" +import { EntryDetailScreen } from "@/src/screens/(stack)/entries/[entryId]/EntryDetailScreen" import { useEntry } from "@/src/store/entry/hooks" import { getInboxFrom } from "@/src/store/entry/utils" import { useFeed } from "@/src/store/feed/hooks" diff --git a/apps/mobile/src/modules/entry-list/templates/EntrySocialItem.tsx b/apps/mobile/src/modules/entry-list/templates/EntrySocialItem.tsx index e9ec4328e..bfd8a7df2 100644 --- a/apps/mobile/src/modules/entry-list/templates/EntrySocialItem.tsx +++ b/apps/mobile/src/modules/entry-list/templates/EntrySocialItem.tsx @@ -13,8 +13,8 @@ import { ItemPressableStyle } from "@/src/components/ui/pressable/enum" import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable" import { useNavigation } from "@/src/lib/navigation/hooks" import { getHorizontalScrolling } from "@/src/modules/screen/atoms" -import { EntryDetailScreen } from "@/src/screens/(stack)/entries/[entryId]" -import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]" +import { EntryDetailScreen } from "@/src/screens/(stack)/entries/[entryId]/EntryDetailScreen" +import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]/FeedScreen" import { useEntry } from "@/src/store/entry/hooks" import { useFeed } from "@/src/store/feed/hooks" import { useEntryTranslation } from "@/src/store/translation/hooks" diff --git a/apps/mobile/src/modules/player/PlayerTabBar.tsx b/apps/mobile/src/modules/player/PlayerTabBar.tsx index 6f267f2d7..75f6980ab 100644 --- a/apps/mobile/src/modules/player/PlayerTabBar.tsx +++ b/apps/mobile/src/modules/player/PlayerTabBar.tsx @@ -13,7 +13,7 @@ import { Image } from "@/src/components/ui/image/Image" import { BottomTabContext } from "@/src/lib/navigation/bottom-tab/BottomTabContext" import { useNavigation } from "@/src/lib/navigation/hooks" import { useActiveTrack } from "@/src/lib/player" -import { PlayerScreen } from "@/src/screens/player" +import { PlayerScreen } from "@/src/screens/PlayerScreen" import { usePrefetchImageColors } from "@/src/store/image/hooks" import { PlayPauseButton, SeekButton } from "./control" diff --git a/apps/mobile/src/modules/subscription/CategoryGrouped.tsx b/apps/mobile/src/modules/subscription/CategoryGrouped.tsx index 9143625b5..916b09338 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 { RightCuteFiIcon } from "@/src/icons/right_cute_fi" import { useNavigation } from "@/src/lib/navigation/hooks" import { closeDrawer, getHorizontalScrolling, selectFeed } from "@/src/modules/screen/atoms" -import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]" +import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]/FeedScreen" import { useUnreadCounts } from "@/src/store/unread/hooks" import { useColor } from "@/src/theme/colors" diff --git a/apps/mobile/src/modules/subscription/SubscriptionLists.tsx b/apps/mobile/src/modules/subscription/SubscriptionLists.tsx index ca377ae60..fef7cd783 100644 --- a/apps/mobile/src/modules/subscription/SubscriptionLists.tsx +++ b/apps/mobile/src/modules/subscription/SubscriptionLists.tsx @@ -21,7 +21,7 @@ import { StarCuteFiIcon } from "@/src/icons/star_cute_fi" import { useNavigation } from "@/src/lib/navigation/hooks" import { closeDrawer, getHorizontalScrolling, selectFeed } from "@/src/modules/screen/atoms" import { TimelineSelectorList } from "@/src/modules/screen/TimelineSelectorList" -import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]" +import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]/FeedScreen" import { FEED_COLLECTION_LIST } from "@/src/store/entry/utils" import { useGroupedSubscription, diff --git a/apps/mobile/src/modules/subscription/items/InboxItem.tsx b/apps/mobile/src/modules/subscription/items/InboxItem.tsx index e1a4ccd35..0a9c5a1f4 100644 --- a/apps/mobile/src/modules/subscription/items/InboxItem.tsx +++ b/apps/mobile/src/modules/subscription/items/InboxItem.tsx @@ -10,7 +10,7 @@ import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable" import { InboxCuteFiIcon } from "@/src/icons/inbox_cute_fi" import { useNavigation } from "@/src/lib/navigation/hooks" import { getHorizontalScrolling, selectFeed } from "@/src/modules/screen/atoms" -import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]" +import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]/FeedScreen" import { useSubscription } from "@/src/store/subscription/hooks" import { getInboxStoreId } from "@/src/store/subscription/utils" import { useUnreadCount } from "@/src/store/unread/hooks" diff --git a/apps/mobile/src/modules/subscription/items/ListSubscriptionItem.tsx b/apps/mobile/src/modules/subscription/items/ListSubscriptionItem.tsx index b174b9e60..13e6ac950 100644 --- a/apps/mobile/src/modules/subscription/items/ListSubscriptionItem.tsx +++ b/apps/mobile/src/modules/subscription/items/ListSubscriptionItem.tsx @@ -9,7 +9,7 @@ import { Image } from "@/src/components/ui/image/Image" import { ItemPressableStyle } from "@/src/components/ui/pressable/enum" import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable" import { useNavigation } from "@/src/lib/navigation/hooks" -import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]" +import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]/FeedScreen" import { useList } from "@/src/store/list/hooks" import { useListUnreadCount } from "@/src/store/unread/hooks" diff --git a/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx b/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx index 1efc20b9e..c755a04a7 100644 --- a/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx +++ b/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx @@ -12,7 +12,7 @@ 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, getHorizontalScrolling, selectFeed } from "@/src/modules/screen/atoms" -import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]" +import { FeedScreen } from "@/src/screens/(stack)/feeds/[feedId]/FeedScreen" import { useFeed, usePrefetchFeed } from "@/src/store/feed/hooks" import { useSubscription } from "@/src/store/subscription/hooks" import { useUnreadCount } from "@/src/store/unread/hooks" diff --git a/apps/mobile/src/screens/(modal)/profile.tsx b/apps/mobile/src/screens/(modal)/profile.tsx index b93a1cac9..571424d6d 100644 --- a/apps/mobile/src/screens/(modal)/profile.tsx +++ b/apps/mobile/src/screens/(modal)/profile.tsx @@ -1,4 +1,5 @@ import type { FeedViewType } from "@follow/constants" +import { useQuery } from "@tanstack/react-query" import { Fragment, useCallback, useEffect, useMemo } from "react" import { useTranslation } from "react-i18next" import { FlatList, Image, Share, Text, TouchableOpacity, View } from "react-native" @@ -40,6 +41,7 @@ import { ItemSeparator } from "@/src/modules/subscription/ItemSeparator" import type { FeedModel } from "@/src/store/feed/types" import type { ListModel } from "@/src/store/list/store" import { useUser, useWhoami } from "@/src/store/user/hooks" +import { userSyncService } from "@/src/store/user/store" import { useColor } from "@/src/theme/colors" type Subscription = Awaited>["data"][number] @@ -55,6 +57,15 @@ export const ProfileScreen: NavigationControllerView<{ return } +const usePrefetchUser = (userId: string) => { + const { data } = useQuery({ + queryKey: ["user", userId], + queryFn: () => userSyncService.fetchUser(userId), + enabled: !!userId, + staleTime: 1000 * 60 * 5, + }) + return data +} function ProfileScreenImpl(props: { userId: string }) { const { t } = useTranslation() const scrollY = useSharedValue(0) @@ -72,6 +83,7 @@ function ProfileScreenImpl(props: { userId: string }) { headerOpacity.value = scrollY.value / 100 }) + usePrefetchUser(props.userId) const user = useUser(props.userId) useEffect(() => { if (isError) { @@ -103,7 +115,7 @@ function ProfileScreenImpl(props: { userId: string }) { @@ -258,7 +270,11 @@ const renderListItems = ({ item }: { item: PickedListModel }) => ( {!item.image && } - + {item.title} @@ -284,7 +300,11 @@ const renderFeedItems = ({ item }: { item: PickedFeedModel }) => ( size={24} /> - + {item.title} diff --git a/apps/mobile/src/screens/(stack)/(tabs)/discover.tsx b/apps/mobile/src/screens/(stack)/(tabs)/discover.tsx index 738d204af..6fbee81f6 100644 --- a/apps/mobile/src/screens/(stack)/(tabs)/discover.tsx +++ b/apps/mobile/src/screens/(stack)/(tabs)/discover.tsx @@ -32,19 +32,6 @@ export default function Discover() { } > - {/* { - navigation.pushControllerView(Recommendations) - }} - > - Trending - - - */} - - {/* */} - Good Luck @@ -127,39 +114,6 @@ const styles = StyleSheet.create({ aspectRatio: 1.6, }, }) - -// const TrendingRecommendations = () => { -// const { data, isLoading } = useQuery({ -// queryKey: ["trending"], -// queryFn: () => getTrendingAggregates({ language: "en" }), -// }) -// const array = data?.trendingFeeds.slice(0, 4) -// return ( -// -// {array?.map((feed, index) => ( -// -// -// -// -// -// {feed.title} -// -// {!!feed.description && ( -// -// {feed.description} -// -// )} -// -// -// {index !== array.length - 1 && ( -// -// )} -// -// ))} -// -// ) -// } - export const DiscoverTabScreen: TabScreenComponent = Discover DiscoverTabScreen.tabBarIcon = ({ focused, color }) => { const Icon = !focused ? Search3CuteReIcon : Search3CuteFiIcon diff --git a/apps/mobile/src/screens/(stack)/entries/[entryId]/index.tsx b/apps/mobile/src/screens/(stack)/entries/[entryId]/EntryDetailScreen.tsx similarity index 100% rename from apps/mobile/src/screens/(stack)/entries/[entryId]/index.tsx rename to apps/mobile/src/screens/(stack)/entries/[entryId]/EntryDetailScreen.tsx diff --git a/apps/mobile/src/screens/(stack)/feeds/[feedId]/index.tsx b/apps/mobile/src/screens/(stack)/feeds/[feedId]/FeedScreen.tsx similarity index 100% rename from apps/mobile/src/screens/(stack)/feeds/[feedId]/index.tsx rename to apps/mobile/src/screens/(stack)/feeds/[feedId]/FeedScreen.tsx diff --git a/apps/mobile/src/screens/(stack)/trending/TrendingScreen.tsx b/apps/mobile/src/screens/(stack)/trending/TrendingScreen.tsx new file mode 100644 index 000000000..88441ddc0 --- /dev/null +++ b/apps/mobile/src/screens/(stack)/trending/TrendingScreen.tsx @@ -0,0 +1,191 @@ +import { useQuery } from "@tanstack/react-query" +import { Text, View } from "react-native" +import { useColor } from "react-native-uikit-colors" + +import { getTrendingAggregates } from "@/src/api/trending" +import { PhUsersBold } from "@/src/components/icons/PhUsersBold" +import { + NavigationBlurEffectHeaderView, + SafeNavigationScrollView, +} from "@/src/components/layouts/views/SafeNavigationScrollView" +import { UserAvatar } from "@/src/components/ui/avatar/UserAvatar" +import { + GroupedInsetListCard, + GroupedInsetListSectionHeader, +} from "@/src/components/ui/grouped/GroupedList" +import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon" +import { FeedIcon } from "@/src/components/ui/icon/feed-icon" +import { Image } from "@/src/components/ui/image/Image" +import { PlatformActivityIndicator } from "@/src/components/ui/loading/PlatformActivityIndicator" +import { ItemPressable } from "@/src/components/ui/pressable/ItemPressable" +import { openLink } from "@/src/lib/native" +import { useNavigation } from "@/src/lib/navigation/hooks" +import type { NavigationControllerView } from "@/src/lib/navigation/types" + +import { FollowScreen } from "../../(modal)/follow" +import { ProfileScreen } from "../../(modal)/profile" + +const UserCount = ({ count, className }: { count: number; className?: string }) => { + const secondaryLabelColor = useColor("secondaryLabel") + return ( + + + {count} + + ) +} + +export const TrendingScreen: NavigationControllerView = () => { + const { data, isLoading } = useQuery({ + queryKey: ["trending"], + queryFn: () => getTrendingAggregates({ language: "en" }), + }) + const navigation = useNavigation() + + return ( + }> + {isLoading ? ( + + + + ) : ( + <> + {/* Trending Users Section */} + {data && data.trendingUsers.length > 0 && ( + + + + } + > + {/* Remaining Users */} + {data.trendingUsers.map((user) => ( + + navigation.presentControllerView(ProfileScreen, { + userId: user.id, + }) + } + className="flex-row items-center px-4 py-2.5" + > + + {user.name} + + ))} + + + )} + + {/* Trending Lists Section */} + {data && data.trendingLists.length > 0 && ( + + + + {data.trendingLists.map((item) => ( + + navigation.presentControllerView(FollowScreen, { + type: "list", + id: item.id, + }) + } + className="flex-row items-center px-4 py-3.5" + > + + {!!item.image && ( + + )} + {!item.image && } + + + + {item.title} + + {!!item.description && ( + + {item.description} + + )} + {/* @ts-ignore */} + {!!item.subscriberCount && } + + + ))} + + + )} + + {/* Trending Feeds Section */} + {data && data.trendingFeeds.length > 0 && ( + + + + {data.trendingFeeds.map((feed) => ( + + navigation.presentControllerView(FollowScreen, { + type: "feed", + id: feed.id, + }) + } + className="flex-row items-center justify-between px-4 py-3" + > + + + + {feed.title} + + + {!!(feed as any).subscriberCount && ( + + )} + + ))} + + + )} + + {/* Trending Entries Section */} + {data && data.trendingEntries.length > 0 && ( + + + + {data.trendingEntries.map((entry) => ( + openLink(entry.url)} + className="flex-row items-center justify-between px-4 py-3" + > + + {entry.title} + + + {entry.readCount} + + + ))} + + + )} + + )} + + ) +} diff --git a/apps/mobile/src/screens/onboarding.tsx b/apps/mobile/src/screens/OnboardingScreen.tsx similarity index 100% rename from apps/mobile/src/screens/onboarding.tsx rename to apps/mobile/src/screens/OnboardingScreen.tsx diff --git a/apps/mobile/src/screens/player.tsx b/apps/mobile/src/screens/PlayerScreen.tsx similarity index 100% rename from apps/mobile/src/screens/player.tsx rename to apps/mobile/src/screens/PlayerScreen.tsx diff --git a/apps/mobile/src/sitemap.tsx b/apps/mobile/src/sitemap.tsx index 108255f17..2fa7717d9 100644 --- a/apps/mobile/src/sitemap.tsx +++ b/apps/mobile/src/sitemap.tsx @@ -12,7 +12,7 @@ import { ForgetPasswordScreen } from "./screens/(modal)/forget-password" import { InvitationScreen } from "./screens/(modal)/invitation" import { LoginScreen } from "./screens/(modal)/login" import { SignUpScreen } from "./screens/(modal)/sign-up" -import { OnboardingScreen } from "./screens/onboarding" +import { OnboardingScreen } from "./screens/OnboardingScreen" export function registerSitemap() { ;[TermsScreen].forEach((Component) => { diff --git a/apps/mobile/src/store/messaging/hooks.ts b/apps/mobile/src/store/messaging/hooks.ts index 4315e8618..6c6f23b47 100644 --- a/apps/mobile/src/store/messaging/hooks.ts +++ b/apps/mobile/src/store/messaging/hooks.ts @@ -8,7 +8,7 @@ import { apiClient } from "@/src/lib/api-fetch" import { kv } from "@/src/lib/kv" import { useNavigation } from "@/src/lib/navigation/hooks" import { requestNotificationPermission } from "@/src/lib/permission" -import { EntryDetailScreen } from "@/src/screens/(stack)/entries/[entryId]" +import { EntryDetailScreen } from "@/src/screens/(stack)/entries/[entryId]/EntryDetailScreen" import { useHasNotificationActions } from "../action/hooks" import { useWhoami } from "../user/hooks" diff --git a/apps/mobile/src/store/user/hooks.ts b/apps/mobile/src/store/user/hooks.ts index 8d72f2c59..b8039fd43 100644 --- a/apps/mobile/src/store/user/hooks.ts +++ b/apps/mobile/src/store/user/hooks.ts @@ -5,7 +5,7 @@ import { useEffect } from "react" import { apiClient } from "@/src/lib/api-fetch" import { kv } from "@/src/lib/kv" import { useNavigation } from "@/src/lib/navigation/hooks" -import { OnboardingScreen } from "@/src/screens/onboarding" +import { OnboardingScreen } from "@/src/screens/OnboardingScreen" import { isNewUserQueryKey, isOnboardingFinishedStorageKey } from "./constants" import { userSyncService, useUserStore } from "./store" diff --git a/apps/mobile/src/store/user/store.ts b/apps/mobile/src/store/user/store.ts index 956fe4b42..dab251149 100644 --- a/apps/mobile/src/store/user/store.ts +++ b/apps/mobile/src/store/user/store.ts @@ -153,6 +153,22 @@ class UserSyncService { return res } + + async fetchUser(userId: string) { + const res = await apiClient.profiles.$get({ query: { id: userId } }) + if (res.code === 0) { + const { whoami } = get() + immerSet((state) => { + state.users[userId] = { + email: null, + isMe: whoami?.id === userId ? 1 : 0, + ...res.data, + } + }) + } + + return res.data + } } class UserActions {