import MaterialIcons from '@expo/vector-icons/MaterialIcons';
import { router } from 'expo-router';
import React from 'react';
import { TouchableOpacity, View } from 'react-native';
import { ThemedText } from '@/components/themed-text';
import { useColorScheme } from '@/hooks/use-color-scheme';
type BillingMode = 'monthly' | 'lifetime';
const BILLING_OPTIONS: { key: BillingMode; label: string }[] = [
{ key: 'monthly', label: '月付' },
];
export function ProfileHeader({
billingMode,
onChangeBilling,
credits,
}: {
billingMode: BillingMode;
onChangeBilling: (mode: BillingMode) => void;
credits: number;
}) {
const colorScheme = useColorScheme();
const palette = colorScheme === 'dark' ? darkPalette : lightPalette;
return (
router.push('/settings/account')}
style={[styles.settingsButton, { backgroundColor: palette.pill }]}
activeOpacity={0.85}
>
);
}
function BillingBadge({
palette,
billingMode,
onChangeBilling,
credits,
}: {
palette: any;
billingMode: BillingMode;
onChangeBilling: (mode: BillingMode) => void;
credits: number;
}) {
return (
{BILLING_OPTIONS.map(option => {
const isActive = option.key === billingMode;
return (
router.push('/exchange')}
activeOpacity={0.85}
style={[
styles.billingOption,
{
backgroundColor: isActive ? palette.tabActive : 'transparent',
},
]}
>
{option.label}
);
})}
router.push('/exchange')}
activeOpacity={0.85}
style={[
styles.lightningShell,
{
backgroundColor: palette.elevated,
borderColor: palette.border,
},
]}
>
{credits}
);
}
const darkPalette = {
pill: '#16171C',
border: '#1D1E24',
tabActive: '#FFFFFF',
onAccent: '#050505',
textSecondary: '#8E9098',
textPrimary: '#F6F7FA',
accent: '#B7FF2F',
elevated: '#101014',
};
const lightPalette = {
pill: '#E8EBF4',
border: '#E2E5ED',
tabActive: '#FFFFFF',
onAccent: '#FFFFFF',
textSecondary: '#5E6474',
textPrimary: '#0F1320',
accent: '#405CFF',
elevated: '#F0F2F8',
};
const styles = {
headerRow: {
flexDirection: 'row' as const,
alignItems: 'center' as const,
justifyContent: 'space-between' as const,
marginBottom: 14,
marginTop: 14
},
settingsButton: {
width: 44,
height: 44,
borderRadius: 22,
alignItems: 'center' as const,
justifyContent: 'center' as const,
},
billingShell: {
flexDirection: 'row' as const,
alignItems: 'center' as const,
padding: 4,
borderWidth: 1,
borderRadius: 999,
},
billingOptions: {
flexDirection: 'row' as const,
alignItems: 'center' as const,
},
billingOption: {
paddingHorizontal: 16,
paddingVertical: 6,
borderRadius: 999,
},
billingLabel: {
fontSize: 13,
fontWeight: '600' as const,
},
lightningShell: {
flexDirection: 'row' as const,
alignItems: 'center' as const,
borderWidth: 1,
borderRadius: 999,
paddingHorizontal: 12,
paddingVertical: 6,
marginLeft: 8,
},
lightningValue: {
fontSize: 13,
fontWeight: '600' as const,
marginLeft: 6,
},
};