This commit is contained in:
yuchenglong
2026-01-19 14:38:43 +08:00

View File

@@ -1,5 +1,4 @@
import { HomeHeader } from "@/components/home-header"; import { HomeHeader } from "@/components/home-header";
import { LeagueModal } from "@/components/league-modal";
import { MatchCard } from "@/components/match-card"; import { MatchCard } from "@/components/match-card";
import { MatchCardLeague } from "@/components/match-card-league"; import { MatchCardLeague } from "@/components/match-card-league";
import { SelectionModal } from "@/components/selection-modal"; import { SelectionModal } from "@/components/selection-modal";
@@ -77,7 +76,6 @@ export default function HomeScreen() {
// Modal Visibilities // Modal Visibilities
const [showSportModal, setShowSportModal] = useState(false); const [showSportModal, setShowSportModal] = useState(false);
const [showCalendarModal, setShowCalendarModal] = useState(false); const [showCalendarModal, setShowCalendarModal] = useState(false);
const [showLeagueModal, setShowLeagueModal] = useState(false);
// Load Sports and Leagues // Load Sports and Leagues
useEffect(() => { useEffect(() => {
@@ -532,43 +530,18 @@ export default function HomeScreen() {
</ThemedText> </ThemedText>
</TouchableOpacity> </TouchableOpacity>
{/* Date/League Selector */} {/* Date Selector */}
{filterMode === "time" ? ( <TouchableOpacity
<TouchableOpacity style={[styles.filterBtn, { backgroundColor: filterBg }]}
style={[styles.filterBtn, { backgroundColor: filterBg }]} onPress={() => setShowCalendarModal(true)}
onPress={() => setShowCalendarModal(true)} >
> <ThemedText style={styles.dateDayText}>
<ThemedText style={styles.dateDayText}> {selectedDate.getDate()}
{selectedDate.getDate()} </ThemedText>
</ThemedText> <ThemedText style={styles.dateMonthText}>
<ThemedText style={styles.dateMonthText}> {timezoneLabel} {nowTimeText}
{timezoneLabel} {nowTimeText} </ThemedText>
</ThemedText> </TouchableOpacity>
</TouchableOpacity>
) : (
<TouchableOpacity
style={[styles.filterBtn, { backgroundColor: filterBg }]}
onPress={() => {
// 立即显示弹窗
setShowLeagueModal(true);
// 如果联赛列表为空立即设置loading状态并加载
if (selectedSportId !== null) {
if (leagues.length === 0) {
setLoadingLeagues(true);
}
loadLeagues();
}
}}
>
<IconSymbol name="trophy-outline" size={18} color={iconColor} />
<ThemedText style={styles.filterText} numberOfLines={1}>
{selectedLeagueKey
? leagues.find((l) => l.key === selectedLeagueKey)?.name ||
t("home.select_league")
: t("home.select_league")}
</ThemedText>
</TouchableOpacity>
)}
</View> </View>
); );
@@ -624,16 +597,6 @@ export default function HomeScreen() {
/> />
)} )}
{showLeagueModal && (
<LeagueModal
visible={showLeagueModal}
onClose={() => setShowLeagueModal(false)}
leagues={leagues}
selectedLeagueKey={selectedLeagueKey}
loading={loadingLeagues}
onSelect={handleLeagueSelect}
/>
)}
</ThemedView> </ThemedView>
); );
} }