mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-02-11 10:04:44 +08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe05525805 | ||
|
|
1be777825b | ||
|
|
813ca40576 | ||
|
|
4c633febdc | ||
|
|
2fd30c8fd7 | ||
|
|
f09f103d59 |
@@ -63,7 +63,7 @@ export default function RootLayout() {
|
||||
<Stack.Screen name="search" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="live" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="settings" options={{ headerShown: false }} />
|
||||
{/* <Stack.Screen name="favorites" options={{ headerShown: false }} /> */}
|
||||
<Stack.Screen name="favorites" options={{ headerShown: false }} />
|
||||
<Stack.Screen name="+not-found" />
|
||||
</Stack>
|
||||
<Toast />
|
||||
|
||||
@@ -77,17 +77,23 @@ export default function DetailScreen() {
|
||||
<View style={styles.topContainer}>
|
||||
<Image source={{ uri: detail.poster }} style={styles.poster} />
|
||||
<View style={styles.infoContainer}>
|
||||
<ThemedText style={styles.title} numberOfLines={1}>
|
||||
{detail.title}
|
||||
</ThemedText>
|
||||
<View style={styles.titleContainer}>
|
||||
<ThemedText style={styles.title} numberOfLines={1} ellipsizeMode="tail">
|
||||
{detail.title}
|
||||
</ThemedText>
|
||||
<StyledButton onPress={toggleFavorite} variant="ghost" style={styles.favoriteButton}>
|
||||
<FontAwesome
|
||||
name={isFavorited ? "heart" : "heart-o"}
|
||||
size={24}
|
||||
color={isFavorited ? "#feff5f" : "#ccc"}
|
||||
/>
|
||||
</StyledButton>
|
||||
</View>
|
||||
<View style={styles.metaContainer}>
|
||||
<ThemedText style={styles.metaText}>{detail.year}</ThemedText>
|
||||
<ThemedText style={styles.metaText}>{detail.type_name}</ThemedText>
|
||||
</View>
|
||||
{/* <Pressable onPress={toggleFavorite} style={styles.favoriteButton}>
|
||||
<FontAwesome name={isFavorited ? "star" : "star-o"} size={24} color={isFavorited ? "#FFD700" : "#ccc"} />
|
||||
<ThemedText style={styles.favoriteButtonText}>{isFavorited ? "已收藏" : "收藏"}</ThemedText>
|
||||
</Pressable> */}
|
||||
|
||||
<ScrollView style={styles.descriptionScrollView}>
|
||||
<ThemedText style={styles.description}>{detail.desc}</ThemedText>
|
||||
</ScrollView>
|
||||
@@ -101,29 +107,32 @@ export default function DetailScreen() {
|
||||
{!allSourcesLoaded && <ActivityIndicator style={{ marginLeft: 10 }} />}
|
||||
</View>
|
||||
<View style={styles.sourceList}>
|
||||
{searchResults.map((item, index) => (
|
||||
<StyledButton
|
||||
key={index}
|
||||
onPress={() => setDetail(item)}
|
||||
hasTVPreferredFocus={index === 0}
|
||||
isSelected={detail?.source === item.source}
|
||||
style={styles.sourceButton}
|
||||
>
|
||||
<ThemedText style={styles.sourceButtonText}>{item.source_name}</ThemedText>
|
||||
{item.episodes.length > 1 && (
|
||||
<View style={styles.badge}>
|
||||
<Text style={styles.badgeText}>
|
||||
{item.episodes.length > 99 ? "99+" : `${item.episodes.length}`} 集
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
{item.resolution && (
|
||||
<View style={[styles.badge, { backgroundColor: "#28a745" }]}>
|
||||
<Text style={styles.badgeText}>{item.resolution}</Text>
|
||||
</View>
|
||||
)}
|
||||
</StyledButton>
|
||||
))}
|
||||
{searchResults.map((item, index) => {
|
||||
const isSelected = detail?.source === item.source;
|
||||
return (
|
||||
<StyledButton
|
||||
key={index}
|
||||
onPress={() => setDetail(item)}
|
||||
hasTVPreferredFocus={index === 0}
|
||||
isSelected={isSelected}
|
||||
style={styles.sourceButton}
|
||||
>
|
||||
<ThemedText style={styles.sourceButtonText}>{item.source_name}</ThemedText>
|
||||
{item.episodes.length > 1 && (
|
||||
<View style={[styles.badge, isSelected && styles.selectedBadge]}>
|
||||
<Text style={styles.badgeText}>
|
||||
{item.episodes.length > 99 ? "99+" : `${item.episodes.length}`} 集
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
{item.resolution && (
|
||||
<View style={[styles.badge, { backgroundColor: "#666" }, isSelected && styles.selectedBadge]}>
|
||||
<Text style={styles.badgeText}>{item.resolution}</Text>
|
||||
</View>
|
||||
)}
|
||||
</StyledButton>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
<View style={styles.episodesContainer}>
|
||||
@@ -167,11 +176,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 +204,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,
|
||||
@@ -230,16 +239,23 @@ const styles = StyleSheet.create({
|
||||
fontSize: 16,
|
||||
},
|
||||
badge: {
|
||||
backgroundColor: "red",
|
||||
backgroundColor: "#666",
|
||||
borderRadius: 10,
|
||||
paddingHorizontal: 6,
|
||||
paddingVertical: 2,
|
||||
marginLeft: 8,
|
||||
},
|
||||
badgeText: {
|
||||
color: "white",
|
||||
color: "#fff",
|
||||
fontSize: 12,
|
||||
fontWeight: "bold",
|
||||
paddingBottom: 2.5,
|
||||
},
|
||||
selectedBadge: {
|
||||
backgroundColor: "#4c4c4c",
|
||||
},
|
||||
selectedbadgeText: {
|
||||
color: "#333",
|
||||
},
|
||||
episodesContainer: {
|
||||
marginTop: 20,
|
||||
|
||||
@@ -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 (
|
||||
<ThemedView style={styles.centered}>
|
||||
@@ -46,17 +38,22 @@ export default function FavoritesScreen() {
|
||||
);
|
||||
}
|
||||
|
||||
const renderItem = ({ item }: { item: Favorite & { key: string } }) => (
|
||||
<Pressable onPress={() => handlePress(item)} style={styles.itemContainer}>
|
||||
<Image source={{ uri: item.poster }} style={styles.poster} />
|
||||
<View style={styles.infoContainer}>
|
||||
<ThemedText style={styles.title} numberOfLines={1}>
|
||||
{item.title}
|
||||
</ThemedText>
|
||||
<ThemedText style={styles.year}>{item.year}</ThemedText>
|
||||
</View>
|
||||
</Pressable>
|
||||
);
|
||||
const renderItem = ({ item }: { item: Favorite & { key: string } }) => {
|
||||
const [source, id] = item.key.split("+");
|
||||
return (
|
||||
<VideoCard
|
||||
id={id}
|
||||
source={source}
|
||||
title={item.title}
|
||||
sourceName={item.source_name}
|
||||
poster={item.cover}
|
||||
year={item.year}
|
||||
api={api}
|
||||
episodeIndex={1}
|
||||
progress={0}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemedView style={styles.container}>
|
||||
@@ -67,7 +64,7 @@ export default function FavoritesScreen() {
|
||||
data={favorites}
|
||||
renderItem={renderItem}
|
||||
keyExtractor={(item) => item.key}
|
||||
numColumns={3}
|
||||
numColumns={5}
|
||||
contentContainerStyle={styles.list}
|
||||
/>
|
||||
</ThemedView>
|
||||
@@ -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",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -124,9 +124,9 @@ export default function HomeScreen() {
|
||||
</Pressable>
|
||||
</View>
|
||||
<View style={styles.rightHeaderButtons}>
|
||||
{/* <StyledButton style={styles.searchButton} onPress={() => router.push("/favorites")} variant="ghost">
|
||||
<StyledButton style={styles.searchButton} onPress={() => router.push("/favorites")} variant="ghost">
|
||||
<Heart color={colorScheme === "dark" ? "white" : "black"} size={24} />
|
||||
</StyledButton> */}
|
||||
</StyledButton>
|
||||
<StyledButton
|
||||
style={styles.searchButton}
|
||||
onPress={() => router.push({ pathname: "/search" })}
|
||||
|
||||
@@ -11,6 +11,7 @@ import { useRemoteControlStore } from "@/stores/remoteControlStore";
|
||||
import { RemoteControlModal } from "@/components/RemoteControlModal";
|
||||
import { useSettingsStore } from "@/stores/settingsStore";
|
||||
import { useRouter } from "expo-router";
|
||||
import { Colors } from "@/constants/Colors";
|
||||
|
||||
export default function SearchScreen() {
|
||||
const [keyword, setKeyword] = useState("");
|
||||
@@ -101,7 +102,7 @@ export default function SearchScreen() {
|
||||
{
|
||||
backgroundColor: colorScheme === "dark" ? "#2c2c2e" : "#f0f0f0",
|
||||
color: colorScheme === "dark" ? "white" : "black",
|
||||
borderColor: isInputFocused ? "#007bff" : "transparent",
|
||||
borderColor: isInputFocused ? Colors.dark.primary : "transparent",
|
||||
},
|
||||
]}
|
||||
placeholder="搜索电影、剧集..."
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -168,7 +168,7 @@ const styles = StyleSheet.create({
|
||||
position: "absolute",
|
||||
left: 0,
|
||||
height: 8,
|
||||
backgroundColor: "#ff0000",
|
||||
backgroundColor: "#fff",
|
||||
borderRadius: 4,
|
||||
},
|
||||
progressBarTouchable: {
|
||||
|
||||
@@ -80,7 +80,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
seekingBarFilled: {
|
||||
height: "100%",
|
||||
backgroundColor: "#ff0000",
|
||||
backgroundColor: "#fff",
|
||||
borderRadius: 2.5,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -72,7 +72,9 @@ const styles = StyleSheet.create({
|
||||
sourceItem: {
|
||||
paddingVertical: 2,
|
||||
margin: 4,
|
||||
width: "31%",
|
||||
marginLeft: 10,
|
||||
marginRight: 8,
|
||||
width: "30%",
|
||||
},
|
||||
sourceItemText: {
|
||||
fontSize: 14,
|
||||
|
||||
@@ -29,11 +29,10 @@ export const StyledButton = forwardRef<View, StyledButtonProps>(
|
||||
color: colors.text,
|
||||
},
|
||||
selectedButton: {
|
||||
backgroundColor: colors.tint,
|
||||
backgroundColor: colors.primary,
|
||||
},
|
||||
focusedButton: {
|
||||
backgroundColor: colors.link,
|
||||
borderColor: colors.background,
|
||||
borderColor: colors.primary,
|
||||
},
|
||||
selectedText: {
|
||||
color: Colors.dark.text,
|
||||
@@ -47,11 +46,11 @@ export const StyledButton = forwardRef<View, StyledButtonProps>(
|
||||
color: colors.text,
|
||||
},
|
||||
focusedButton: {
|
||||
backgroundColor: colors.link,
|
||||
backgroundColor: colors.primary,
|
||||
borderColor: colors.background,
|
||||
},
|
||||
selectedButton: {
|
||||
backgroundColor: "rgba(0, 122, 255, 0.3)",
|
||||
backgroundColor: colors.primary,
|
||||
},
|
||||
selectedText: {
|
||||
color: colors.link,
|
||||
@@ -65,7 +64,8 @@ export const StyledButton = forwardRef<View, StyledButtonProps>(
|
||||
color: colors.text,
|
||||
},
|
||||
focusedButton: {
|
||||
backgroundColor: "rgba(119, 119, 119, 0.9)",
|
||||
backgroundColor: "rgba(119, 119, 119, 0.2)",
|
||||
borderColor: colors.primary,
|
||||
},
|
||||
selectedButton: {},
|
||||
selectedText: {},
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Heart, Star, Play, Trash2 } from "lucide-react-native";
|
||||
import { FavoriteManager, PlayRecordManager } from "@/services/storage";
|
||||
import { API, api } from "@/services/api";
|
||||
import { ThemedText } from "@/components/ThemedText";
|
||||
import { Colors } from "@/constants/Colors";
|
||||
|
||||
interface VideoCardProps {
|
||||
id: string;
|
||||
@@ -209,6 +210,9 @@ const styles = StyleSheet.create({
|
||||
overlay: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
backgroundColor: "rgba(0,0,0,0.3)",
|
||||
borderColor: Colors.dark.primary,
|
||||
borderWidth: 2,
|
||||
borderRadius: 8,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
},
|
||||
@@ -290,17 +294,17 @@ const styles = StyleSheet.create({
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: 3,
|
||||
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
||||
height: 4,
|
||||
backgroundColor: "rgba(0, 0, 0, 0.8)",
|
||||
},
|
||||
progressBar: {
|
||||
height: 3,
|
||||
backgroundColor: "#ff0000",
|
||||
height: 4,
|
||||
backgroundColor: Colors.dark.primary,
|
||||
},
|
||||
continueWatchingBadge: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
backgroundColor: "rgba(255, 0, 0, 0.8)",
|
||||
backgroundColor: Colors.dark.primary,
|
||||
paddingHorizontal: 10,
|
||||
paddingVertical: 5,
|
||||
borderRadius: 5,
|
||||
@@ -312,7 +316,7 @@ const styles = StyleSheet.create({
|
||||
fontWeight: "bold",
|
||||
},
|
||||
continueLabel: {
|
||||
color: "#ff5252",
|
||||
color: Colors.dark.primary,
|
||||
fontSize: 12,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -199,17 +199,17 @@ const VideoLoadingAnimation: React.FC<VideoLoadingAnimationProps> = ({ showProgr
|
||||
</View>
|
||||
</Animated.View>
|
||||
|
||||
<View style={styles.loadingDots}>
|
||||
{/* <View style={styles.loadingDots}>
|
||||
<Animated.View style={[styles.dot, animatedStyles.bounce[0]]} />
|
||||
<Animated.View style={[styles.dot, animatedStyles.bounce[1]]} />
|
||||
<Animated.View style={[styles.dot, animatedStyles.bounce[2]]} />
|
||||
</View>
|
||||
</View> */}
|
||||
|
||||
{showProgressBar && (
|
||||
<View style={styles.progressBar}>
|
||||
<Animated.View style={[styles.progressFill, animatedStyles.progress]}>
|
||||
<LinearGradient
|
||||
colors={["#4fd1c7", "#06b6d4", "#3b82f6", "#8b5cf6"]}
|
||||
colors={["#00bb5e", "#feff5f"]}
|
||||
style={StyleSheet.absoluteFill}
|
||||
start={{ x: 0, y: 0 }}
|
||||
end={{ x: 1, y: 0 }}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { SettingsSection } from "./SettingsSection";
|
||||
import { useSettingsStore } from "@/stores/settingsStore";
|
||||
import { useRemoteControlStore } from "@/stores/remoteControlStore";
|
||||
import { useButtonAnimation } from "@/hooks/useAnimation";
|
||||
import { Colors } from "@/constants/Colors";
|
||||
|
||||
interface APIConfigSectionProps {
|
||||
onChanged: () => void;
|
||||
@@ -126,8 +127,8 @@ const styles = StyleSheet.create({
|
||||
borderColor: "transparent",
|
||||
},
|
||||
inputFocused: {
|
||||
borderColor: "#007AFF",
|
||||
shadowColor: "#007AFF",
|
||||
borderColor: Colors.dark.primary,
|
||||
shadowColor: Colors.dark.primary,
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0.8,
|
||||
shadowRadius: 10,
|
||||
|
||||
@@ -6,6 +6,7 @@ import { SettingsSection } from "./SettingsSection";
|
||||
import { useSettingsStore } from "@/stores/settingsStore";
|
||||
import { useRemoteControlStore } from "@/stores/remoteControlStore";
|
||||
import { useButtonAnimation } from "@/hooks/useAnimation";
|
||||
import { Colors } from "@/constants/Colors";
|
||||
|
||||
interface LiveStreamSectionProps {
|
||||
onChanged: () => void;
|
||||
@@ -120,8 +121,8 @@ const styles = StyleSheet.create({
|
||||
borderColor: "transparent",
|
||||
},
|
||||
inputFocused: {
|
||||
borderColor: "#007AFF",
|
||||
shadowColor: "#007AFF",
|
||||
borderColor: Colors.dark.primary,
|
||||
shadowColor: Colors.dark.primary,
|
||||
shadowOffset: { width: 0, height: 0 },
|
||||
shadowOpacity: 0.8,
|
||||
shadowRadius: 10,
|
||||
|
||||
@@ -6,6 +6,7 @@ import { SettingsSection } from "./SettingsSection";
|
||||
import { useSettingsStore } from "@/stores/settingsStore";
|
||||
import { useRemoteControlStore } from "@/stores/remoteControlStore";
|
||||
import { useButtonAnimation } from "@/hooks/useAnimation";
|
||||
import { Colors } from "@/constants/Colors";
|
||||
|
||||
interface RemoteInputSectionProps {
|
||||
onChanged: () => void;
|
||||
@@ -59,7 +60,7 @@ export const RemoteInputSection: React.FC<RemoteInputSectionProps> = ({ onChange
|
||||
<Switch
|
||||
value={remoteInputEnabled}
|
||||
onValueChange={() => {}} // 禁用Switch的直接交互
|
||||
trackColor={{ false: "#767577", true: "#007AFF" }}
|
||||
trackColor={{ false: "#767577", true: Colors.dark.primary }}
|
||||
thumbColor={remoteInputEnabled ? "#ffffff" : "#f4f3f4"}
|
||||
pointerEvents="none"
|
||||
/>
|
||||
@@ -70,7 +71,7 @@ export const RemoteInputSection: React.FC<RemoteInputSectionProps> = ({ onChange
|
||||
<View style={styles.statusContainer}>
|
||||
<View style={styles.statusItem}>
|
||||
<ThemedText style={styles.statusLabel}>服务状态:</ThemedText>
|
||||
<ThemedText style={[styles.statusValue, { color: isServerRunning ? "#00FF00" : "#FF6B6B" }]}>
|
||||
<ThemedText style={[styles.statusValue, { color: isServerRunning ? Colors.dark.primary : "#FF6B6B" }]}>
|
||||
{isServerRunning ? "运行中" : "已停止"}
|
||||
</ThemedText>
|
||||
</View>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useState } from "react";
|
||||
import { StyleSheet, Pressable } from "react-native";
|
||||
import { ThemedView } from "@/components/ThemedView";
|
||||
import { Colors } from "@/constants/Colors";
|
||||
|
||||
interface SettingsSectionProps {
|
||||
children: React.ReactNode;
|
||||
@@ -9,12 +10,7 @@ interface SettingsSectionProps {
|
||||
focusable?: boolean;
|
||||
}
|
||||
|
||||
export const SettingsSection: React.FC<SettingsSectionProps> = ({
|
||||
children,
|
||||
onFocus,
|
||||
onBlur,
|
||||
focusable = false
|
||||
}) => {
|
||||
export const SettingsSection: React.FC<SettingsSectionProps> = ({ children, onFocus, onBlur, focusable = false }) => {
|
||||
const [isFocused, setIsFocused] = useState(false);
|
||||
|
||||
const handleFocus = () => {
|
||||
@@ -28,20 +24,12 @@ export const SettingsSection: React.FC<SettingsSectionProps> = ({
|
||||
};
|
||||
|
||||
if (!focusable) {
|
||||
return (
|
||||
<ThemedView style={styles.section}>
|
||||
{children}
|
||||
</ThemedView>
|
||||
);
|
||||
return <ThemedView style={styles.section}>{children}</ThemedView>;
|
||||
}
|
||||
|
||||
return (
|
||||
<ThemedView style={[styles.section, isFocused && styles.sectionFocused]}>
|
||||
<Pressable
|
||||
style={styles.sectionPressable}
|
||||
onFocus={handleFocus}
|
||||
onBlur={handleBlur}
|
||||
>
|
||||
<Pressable style={styles.sectionPressable} onFocus={handleFocus} onBlur={handleBlur}>
|
||||
{children}
|
||||
</Pressable>
|
||||
</ThemedView>
|
||||
@@ -57,10 +45,10 @@ const styles = StyleSheet.create({
|
||||
borderColor: "#333",
|
||||
},
|
||||
sectionFocused: {
|
||||
borderColor: "#007AFF",
|
||||
borderColor: Colors.dark.primary,
|
||||
backgroundColor: "#007AFF10",
|
||||
},
|
||||
sectionPressable: {
|
||||
width: "100%",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,5 +26,6 @@ export const Colors = {
|
||||
tabIconSelected: tintColorDark,
|
||||
link: "#0a7ea4",
|
||||
border: "#333",
|
||||
primary: "#00bb5e",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "OrionTV",
|
||||
"private": true,
|
||||
"main": "expo-router/entry",
|
||||
"version": "1.2.3",
|
||||
"version": "1.2.5",
|
||||
"scripts": {
|
||||
"start": "EXPO_USE_METRO_WORKSPACE_ROOT=1 expo start",
|
||||
"start-tv": "EXPO_TV=1 EXPO_USE_METRO_WORKSPACE_ROOT=1 expo start",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -133,11 +133,11 @@ const useDetailStore = create<DetailState>((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<DetailState>((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: () => {
|
||||
|
||||
Reference in New Issue
Block a user