feat(challenges): 添加自定义挑战功能和多语言支持

- 新增自定义挑战创建页面,支持设置挑战类型、时间范围、目标值等
- 实现挑战邀请码系统,支持通过邀请码加入自定义挑战
- 完善挑战详情页面的多语言翻译支持
- 优化用户认证状态检查逻辑,使用token作为主要判断依据
- 添加阿里字体文件支持,提升UI显示效果
- 改进确认弹窗组件,支持Liquid Glass效果和自定义内容
- 优化应用启动流程,直接读取onboarding状态而非预加载用户数据
This commit is contained in:
richarjiang
2025-11-26 16:39:01 +08:00
parent 3ad0e08d58
commit 39671ed70f
24 changed files with 3124 additions and 727 deletions

View File

@@ -851,6 +851,222 @@ const medicationsResources = {
},
};
const challengeDetailResources = {
title: '挑战详情',
notFound: '未找到该挑战,稍后再试试吧。',
loading: '加载挑战详情中…',
retry: '重新加载',
share: {
generating: '正在生成分享卡片...',
failed: '分享失败,请稍后重试',
messageJoined: '我正在参与「{{title}}」挑战,已完成 {{completed}}/{{target}} 天!一起加入吧!',
messageNotJoined: '发现一个很棒的挑战「{{title}}」,一起来参与吧!',
},
dateRange: {
format: '{{start}} - {{end}}',
monthDay: '{{month}}月{{day}}日',
ongoing: '持续更新中',
},
participants: {
count: '{{count}} 人正在参与',
ongoing: '持续更新中',
more: '更多',
},
detail: {
requirement: '按日打卡自动累计',
viewAllRanking: '查看全部',
},
checkIn: {
title: '挑战打卡',
todayChecked: '今日已打卡',
subtitle: '每日打卡会累计进度,达成目标天数',
subtitleChecked: '已记录今日进度,明天继续保持',
button: {
checkIn: '立即打卡',
checking: '打卡中…',
checked: '今日已打卡',
notJoined: '加入后打卡',
upcoming: '挑战未开始',
expired: '挑战已结束',
},
toast: {
alreadyChecked: '今日已打卡',
notStarted: '挑战未开始,开始后再来打卡',
expired: '挑战已结束,无法打卡',
mustJoin: '加入挑战后才能打卡',
success: '打卡成功,继续坚持!',
failed: '打卡失败,请稍后再试',
},
},
cta: {
join: '立即加入挑战',
joining: '加入中…',
leave: '退出挑战',
leaving: '退出中…',
upcoming: '挑战即将开始',
expired: '挑战已结束',
},
highlight: {
join: {
title: '立即加入挑战',
subtitle: '邀请好友一起坚持,更容易收获成果',
},
leave: {
title: '先别急着离开',
subtitle: '再坚持一下,下一个里程碑就要出现了',
},
upcoming: {
title: '挑战即将开始',
subtitle: '{{date}} 开始,敬请期待',
subtitleFallback: '挑战即将开启,敬请期待',
},
expired: {
title: '挑战已结束',
subtitle: '{{date}} 已截止,期待下一次挑战',
subtitleFallback: '本轮挑战已结束,期待下一次挑战',
},
},
alert: {
leaveConfirm: {
title: '确认退出挑战?',
message: '退出后需要重新加入才能继续坚持。',
cancel: '取消',
confirm: '退出挑战',
},
joinFailed: '加入挑战失败',
leaveFailed: '退出挑战失败',
},
ranking: {
title: '排行榜',
description: '',
empty: '榜单即将开启,快来抢占席位。',
},
shareCard: {
footer: 'Out Live · 超越生命',
progress: {
label: '我的坚持进度',
days: '{{completed}} / {{target}} 天',
completed: '🎉 已完成挑战!',
remaining: '还差 {{remaining}} 天完成挑战',
},
info: {
checkInDaily: '按日打卡',
joinUs: '快来一起坚持吧',
},
shareCode: {
copied: '分享码已复制',
},
},
};
const challengeDetailResourcesEn = {
title: 'Challenge Details',
notFound: 'Challenge not found, please try again later.',
loading: 'Loading challenge details…',
retry: 'Reload',
share: {
generating: 'Generating share card...',
failed: 'Share failed, please try again later',
messageJoined: 'I\'m participating in "{{title}}" challenge, completed {{completed}}/{{target}} days! Join me!',
messageNotJoined: 'Found an amazing challenge "{{title}}", let\'s join together!',
},
dateRange: {
format: '{{start}} - {{end}}',
monthDay: 'Month {{month}} Day {{day}}',
ongoing: 'Ongoing updates',
},
participants: {
count: '{{count}} participants',
ongoing: 'Ongoing updates',
more: 'More',
},
detail: {
requirement: 'Daily check-in auto accumulates',
viewAllRanking: 'View All',
},
checkIn: {
title: 'Challenge Check-in',
todayChecked: 'Checked in today',
subtitle: 'Daily check-ins accumulate progress towards goal',
subtitleChecked: 'Today\'s progress recorded, keep it up tomorrow',
button: {
checkIn: 'Check In Now',
checking: 'Checking in…',
checked: 'Checked in today',
notJoined: 'Join to check in',
upcoming: 'Not started yet',
expired: 'Challenge ended',
},
toast: {
alreadyChecked: 'Already checked in today',
notStarted: 'Challenge not started yet, check in after it begins',
expired: 'Challenge has ended, cannot check in',
mustJoin: 'Join the challenge to check in',
success: 'Check-in successful, keep going!',
failed: 'Check-in failed, please try again',
},
},
cta: {
join: 'Join Challenge',
joining: 'Joining…',
leave: 'Leave Challenge',
leaving: 'Leaving…',
upcoming: 'Starting Soon',
expired: 'Challenge Ended',
},
highlight: {
join: {
title: 'Join Challenge Now',
subtitle: 'Invite friends to persist together, achieve more easily',
},
leave: {
title: 'Don\'t leave just yet',
subtitle: 'Keep going, the next milestone is around the corner',
},
upcoming: {
title: 'Challenge Starting Soon',
subtitle: 'Starts on {{date}}, stay tuned',
subtitleFallback: 'Challenge coming soon, stay tuned',
},
expired: {
title: 'Challenge Ended',
subtitle: 'Ended on {{date}}, look forward to the next one',
subtitleFallback: 'This round has ended, look forward to the next challenge',
},
},
alert: {
leaveConfirm: {
title: 'Confirm leaving challenge?',
message: 'You will need to rejoin to continue.',
cancel: 'Cancel',
confirm: 'Leave Challenge',
},
joinFailed: 'Failed to join challenge',
leaveFailed: 'Failed to leave challenge',
},
ranking: {
title: 'Leaderboard',
description: '',
empty: 'Leaderboard opening soon, grab your spot.',
},
shareCard: {
footer: 'Out Live · Beyond Life',
progress: {
label: 'My Progress',
days: '{{completed}} / {{target}} days',
completed: '🎉 Challenge Completed!',
remaining: '{{remaining}} days to complete',
},
info: {
checkInDaily: 'Daily check-in',
joinUs: 'Join us!',
},
shareCode: {
copied: 'Share code copied',
},
},
};
const notificationSettingsResources = {
title: '通知设置',
loading: '加载中...',
@@ -926,6 +1142,37 @@ const resources = {
statistics: statisticsResources,
medications: medicationsResources,
notificationSettings: notificationSettingsResources,
challengeDetail: challengeDetailResources,
challenges: {
title: '挑战',
subtitle: '参与精选活动,保持每日动力',
loading: '加载挑战中…',
loadFailed: '加载挑战失败,请稍后重试',
retry: '重新加载',
empty: '暂无挑战,稍后再来探索。',
customChallenges: '自定义挑战',
officialChallenges: '暂无官方挑战,稍后再来探索。',
officialChallengesTitle: '官方挑战',
join: '加入',
create: '创建',
joined: '已加入',
invalidInviteCode: '请输入有效的邀请码',
joinSuccess: '加入挑战成功',
joinFailed: '加入失败,请稍后再试',
joinModal: {
title: '加入自定义挑战',
description: '输入 6-12 位邀请码,加入好友的挑战',
placeholder: '如A3K9P2',
confirm: '确认加入',
cancel: '取消',
joining: '加入中…',
},
statusLabels: {
upcoming: '即将开始',
ongoing: '进行中',
expired: '已结束',
},
},
},
},
en: {
@@ -1753,6 +2000,37 @@ const resources = {
},
resetSuccess: 'Settings reset to default',
},
challengeDetail: challengeDetailResourcesEn,
challenges: {
title: 'Challenges',
subtitle: 'Join curated activities, stay motivated daily',
loading: 'Loading challenges…',
loadFailed: 'Failed to load challenges, please try again later',
retry: 'Retry',
empty: 'No challenges available, check back later.',
customChallenges: 'Custom Challenges',
officialChallenges: 'No official challenges available, check back later.',
officialChallengesTitle: 'Official Challenges',
join: 'Join',
create: 'Create',
joined: 'Joined',
invalidInviteCode: 'Please enter a valid invite code',
joinSuccess: 'Successfully joined challenge',
joinFailed: 'Failed to join challenge, please try again later',
joinModal: {
title: 'Join Custom Challenge',
description: 'Enter 6-12 digit invite code to join friend\'s challenge',
placeholder: 'e.g., A3K9P2',
confirm: 'Confirm Join',
cancel: 'Cancel',
joining: 'Joining…',
},
statusLabels: {
upcoming: 'Upcoming',
ongoing: 'Ongoing',
expired: 'Expired',
},
},
},
},
};