添加卡牌设置功能,更新状态管理和界面显示逻辑

This commit is contained in:
yuchenglong
2026-01-20 10:12:12 +08:00
parent 97f61e68bd
commit 08d05df8be
7 changed files with 242 additions and 38 deletions

View File

@@ -37,7 +37,7 @@ const BOOKMAKERS = [
export default function ProfileScreen() {
const { theme, toggleTheme, setTheme, isSystemTheme, useSystemTheme } =
useTheme();
const { state, updateOddsSettings } = useAppState();
const { state, updateOddsSettings, updateCardsSettings } = useAppState();
const { t, i18n } = useTranslation();
const router = useRouter();
const isDark = theme === "dark";
@@ -55,6 +55,13 @@ export default function ProfileScreen() {
});
};
const toggleCards = () => {
updateCardsSettings({
...state.cardsSettings,
enabled: !state.cardsSettings.enabled,
});
};
const selectBookmaker = (name: string) => {
const current = state.oddsSettings.selectedBookmakers;
let next: string[];
@@ -429,6 +436,38 @@ export default function ProfileScreen() {
</View>
</View>
<ThemedText style={styles.sectionTitle}>
{t("settings.cards_title")}
</ThemedText>
<View
style={[
styles.section,
{ backgroundColor: isDark ? "#1c1c1e" : "#fff" },
]}
>
<View style={styles.settingItem}>
<View style={styles.settingLabel}>
<IconSymbol
name="id-card"
size={20}
color={iconColor}
style={{ marginRight: 10 }}
/>
<ThemedText>{t("settings.cards_show")}</ThemedText>
</View>
<View style={styles.settingControl}>
<TouchableOpacity onPress={toggleCards} style={styles.button}>
<ThemedText>
{state.cardsSettings.enabled
? t("settings.cards_enabled")
: t("settings.cards_disabled")}
</ThemedText>
</TouchableOpacity>
</View>
</View>
</View>
{/* <ThemedText style={styles.sectionTitle}>登录</ThemedText>
<View