feat: 添加用户登录和法律协议页面
- 新增登录页面,支持 Apple 登录和游客登录功能 - 添加用户协议和隐私政策页面,用户需同意后才能登录 - 更新首页逻辑,首次进入时自动跳转到登录页面 - 修改个人信息页面,移除单位选择功能,统一使用 kg 和 cm - 更新依赖,添加 expo-apple-authentication 库以支持 Apple 登录 - 更新布局以适应新功能的展示和交互
This commit is contained in:
@@ -31,8 +31,6 @@ export default function PersonalScreen() {
|
||||
const colorScheme = useColorScheme();
|
||||
const colors = Colors[colorScheme ?? 'light'];
|
||||
|
||||
type WeightUnit = 'kg' | 'lb';
|
||||
type HeightUnit = 'cm' | 'ft';
|
||||
type UserProfile = {
|
||||
fullName?: string;
|
||||
email?: string;
|
||||
@@ -40,7 +38,7 @@ export default function PersonalScreen() {
|
||||
age?: string;
|
||||
weightKg?: number;
|
||||
heightCm?: number;
|
||||
unitPref?: { weight: WeightUnit; height: HeightUnit };
|
||||
avatarUri?: string | null;
|
||||
};
|
||||
|
||||
const [profile, setProfile] = useState<UserProfile>({});
|
||||
@@ -78,16 +76,12 @@ export default function PersonalScreen() {
|
||||
|
||||
const formatHeight = () => {
|
||||
if (profile.heightCm == null) return '--';
|
||||
const unit = profile.unitPref?.height ?? 'cm';
|
||||
if (unit === 'cm') return `${Math.round(profile.heightCm)}cm`;
|
||||
return `${round(profile.heightCm / 30.48, 1)}ft`;
|
||||
return `${Math.round(profile.heightCm)}cm`;
|
||||
};
|
||||
|
||||
const formatWeight = () => {
|
||||
if (profile.weightKg == null) return '--';
|
||||
const unit = profile.unitPref?.weight ?? 'kg';
|
||||
if (unit === 'kg') return `${round(profile.weightKg, 1)}kg`;
|
||||
return `${round(profile.weightKg * 2.2046226218, 1)}lb`;
|
||||
return `${round(profile.weightKg, 1)}kg`;
|
||||
};
|
||||
|
||||
const formatAge = () => (profile.age ? `${profile.age}岁` : '--');
|
||||
|
||||
Reference in New Issue
Block a user