This commit is contained in:
imeepos
2026-01-21 16:25:26 +08:00
parent 54867492a7
commit 4c01d8e9e7
14 changed files with 76 additions and 165 deletions

View File

@@ -21,7 +21,6 @@ import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context'
import { DownArrowIcon, PointsIcon, SearchIcon } from '@/components/icon';
import ErrorState from '@/components/ErrorState';
import LoadingState from '@/components/LoadingState';
import RefreshControl from '@/components/RefreshControl';
import { useActivates } from '@/hooks/use-activates';
import { useCategories } from '@/hooks/use-categories';
import { CategoryTemplate } from '@repo/sdk';
@@ -84,7 +83,6 @@ export default function HomeScreen() {
const params = useLocalSearchParams()
const [activeTab, setActiveTab] = useState(0)
const [selectedCategoryId, setSelectedCategoryId] = useState<string | null>(null)
const [refreshing, setRefreshing] = useState(false)
const { load: loadCategories, data: categoriesData, loading: categoriesLoading, error: categoriesError } = useCategories()
const { load, data: activatesData, error } = useActivates()
@@ -94,12 +92,6 @@ export default function HomeScreen() {
loadCategories()
}, [])
const handleRefresh = async () => {
setRefreshing(true)
await Promise.all([load(), loadCategories()])
setRefreshing(false)
}
useEffect(() => {
// 当分类数据加载完成后,默认选中第一个分类
if (categoriesData?.categories && categoriesData.categories.length > 0 && !selectedCategoryId) {
@@ -144,14 +136,6 @@ export default function HomeScreen() {
// 过滤掉视频类型的模板,只显示图片
const previewUrl = (template as any).webpPreviewUrl || template.previewUrl || template.coverImageUrl || ``
const isVideo = previewUrl.includes('.mp4') || previewUrl.includes('.mov') || previewUrl.includes('.webm')
console.log(`[HOME PAGE] Filtering ${template.title}:`, {
webpPreviewUrl: (template as any).webpPreviewUrl,
previewUrl: template.previewUrl,
coverImageUrl: template.coverImageUrl,
finalPreviewUrl: previewUrl,
isVideo,
shouldKeep: !isVideo
})
return !isVideo
})
: []
@@ -297,9 +281,6 @@ export default function HomeScreen() {
style={styles.scrollView}
contentContainerStyle={styles.scrollContent}
showsVerticalScrollIndicator={false}
refreshControl={
<RefreshControl refreshing={refreshing} onRefresh={handleRefresh} />
}
onScroll={(event) => {
const scrollY = event.nativeEvent.contentOffset.y
if (scrollY >= tabsPositionRef.current) {
@@ -488,6 +469,7 @@ const styles = StyleSheet.create({
backgroundColor: '#090A0B',
},
scrollContent: {
flexGrow: 1,
backgroundColor: '#090A0B',
},
heroSection: {
@@ -615,10 +597,8 @@ const styles = StyleSheet.create({
justifyContent: 'center',
},
gridContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
flex: 1,
paddingHorizontal: 8,
justifyContent: 'space-between',
},
card: {
marginBottom: 12,