diff --git a/app/_layout.tsx b/app/_layout.tsx index 70115df..4041c1f 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -63,7 +63,7 @@ export default function RootLayout() { - {/* */} + diff --git a/app/detail.tsx b/app/detail.tsx index ddae6bc..7a67ee1 100644 --- a/app/detail.tsx +++ b/app/detail.tsx @@ -77,17 +77,23 @@ export default function DetailScreen() { - - {detail.title} - + + + {detail.title} + + + + + {detail.year} {detail.type_name} - {/* - - {isFavorited ? "已收藏" : "收藏"} - */} + {detail.desc} @@ -167,11 +173,15 @@ const styles = StyleSheet.create({ marginLeft: 20, justifyContent: "flex-start", }, + titleContainer: { + flexDirection: "row", + alignItems: "center", + }, title: { + paddingTop: 16, fontSize: 28, fontWeight: "bold", - marginBottom: 10, - paddingTop: 20, + flexShrink: 1, }, metaContainer: { flexDirection: "row", @@ -191,13 +201,9 @@ const styles = StyleSheet.create({ lineHeight: 22, }, favoriteButton: { - flexDirection: "row", - alignItems: "center", - marginTop: 10, padding: 10, - backgroundColor: "rgba(255, 255, 255, 0.1)", - borderRadius: 5, - alignSelf: "flex-start", + marginLeft: 10, + backgroundColor: "transparent", }, favoriteButtonText: { marginLeft: 8, diff --git a/app/favorites.tsx b/app/favorites.tsx index f656caa..0a83091 100644 --- a/app/favorites.tsx +++ b/app/favorites.tsx @@ -1,27 +1,19 @@ import React, { useEffect } from "react"; -import { View, FlatList, StyleSheet, ActivityIndicator, Image, Pressable } from "react-native"; -import { useRouter } from "expo-router"; +import { View, FlatList, StyleSheet, ActivityIndicator } from "react-native"; import { ThemedView } from "@/components/ThemedView"; import { ThemedText } from "@/components/ThemedText"; import useFavoritesStore from "@/stores/favoritesStore"; import { Favorite } from "@/services/storage"; +import VideoCard from "@/components/VideoCard.tv"; +import { api } from "@/services/api"; export default function FavoritesScreen() { - const router = useRouter(); const { favorites, loading, error, fetchFavorites } = useFavoritesStore(); useEffect(() => { fetchFavorites(); }, [fetchFavorites]); - const handlePress = (favorite: Favorite & { key: string }) => { - const [source, id] = favorite.key.split("+"); - router.push({ - pathname: "/detail", - params: { q: favorite.title, source, id }, - }); - }; - if (loading) { return ( @@ -46,17 +38,22 @@ export default function FavoritesScreen() { ); } - const renderItem = ({ item }: { item: Favorite & { key: string } }) => ( - handlePress(item)} style={styles.itemContainer}> - - - - {item.title} - - {item.year} - - - ); + const renderItem = ({ item }: { item: Favorite & { key: string } }) => { + const [source, id] = item.key.split("+"); + return ( + + ); + }; return ( @@ -67,7 +64,7 @@ export default function FavoritesScreen() { data={favorites} renderItem={renderItem} keyExtractor={(item) => item.key} - numColumns={3} + numColumns={5} contentContainerStyle={styles.list} /> @@ -99,26 +96,4 @@ const styles = StyleSheet.create({ list: { padding: 10, }, - itemContainer: { - flex: 1, - margin: 10, - alignItems: "center", - }, - poster: { - width: 120, - height: 180, - borderRadius: 8, - }, - infoContainer: { - marginTop: 8, - alignItems: "center", - }, - title: { - fontSize: 16, - fontWeight: "bold", - }, - year: { - fontSize: 14, - color: "#888", - }, }); diff --git a/app/index.tsx b/app/index.tsx index 7fd91d8..0ba550a 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -124,9 +124,9 @@ export default function HomeScreen() { - {/* router.push("/favorites")} variant="ghost"> + router.push("/favorites")} variant="ghost"> - */} + router.push({ pathname: "/search" })} diff --git a/app/settings.tsx b/app/settings.tsx index 54c3d7a..b153bc6 100644 --- a/app/settings.tsx +++ b/app/settings.tsx @@ -6,18 +6,17 @@ import { ThemedView } from "@/components/ThemedView"; import { StyledButton } from "@/components/StyledButton"; import { useThemeColor } from "@/hooks/useThemeColor"; import { useSettingsStore } from "@/stores/settingsStore"; -import useAuthStore from "@/stores/authStore"; +// import useAuthStore from "@/stores/authStore"; import { useRemoteControlStore } from "@/stores/remoteControlStore"; import { APIConfigSection } from "@/components/settings/APIConfigSection"; import { LiveStreamSection } from "@/components/settings/LiveStreamSection"; import { RemoteInputSection } from "@/components/settings/RemoteInputSection"; -import { VideoSourceSection } from "@/components/settings/VideoSourceSection"; +// import { VideoSourceSection } from "@/components/settings/VideoSourceSection"; import Toast from "react-native-toast-message"; export default function SettingsScreen() { const { loadSettings, saveSettings, setApiBaseUrl, setM3uUrl } = useSettingsStore(); const { lastMessage } = useRemoteControlStore(); - const { isLoggedIn, logout } = useAuthStore(); const backgroundColor = useThemeColor({}, "background"); const [hasChanges, setHasChanges] = useState(false); diff --git a/services/api.ts b/services/api.ts index 621a264..04e6c1a 100644 --- a/services/api.ts +++ b/services/api.ts @@ -43,7 +43,6 @@ export interface SearchResult { export interface Favorite { cover: string; title: string; - poster: string; source_name: string; total_episodes: number; search_title: string; diff --git a/stores/detailStore.ts b/stores/detailStore.ts index 413c315..03647ac 100644 --- a/stores/detailStore.ts +++ b/stores/detailStore.ts @@ -133,11 +133,11 @@ const useDetailStore = create((set, get) => ({ set({ error: "未找到任何播放源" }); } - // if (get().detail) { - // const { source, id } = get().detail!; - // const isFavorited = await FavoriteManager.isFavorited(source, id.toString()); - // set({ isFavorited }); - // } + if (get().detail) { + const { source, id } = get().detail!; + const isFavorited = await FavoriteManager.isFavorited(source, id.toString()); + set({ isFavorited }); + } } catch (e) { if ((e as Error).name !== "AbortError") { set({ error: e instanceof Error ? e.message : "获取数据失败" }); @@ -151,9 +151,9 @@ const useDetailStore = create((set, get) => ({ setDetail: async (detail) => { set({ detail }); - // const { source, id } = detail; - // const isFavorited = await FavoriteManager.isFavorited(source, id.toString()); - // set({ isFavorited }); + const { source, id } = detail; + const isFavorited = await FavoriteManager.isFavorited(source, id.toString()); + set({ isFavorited }); }, abort: () => {