feat: Enhance Oxygen Saturation Card with health permissions and loading state management
feat(i18n): Add common translations and mood-related strings in English and Chinese fix(i18n): Update metabolism titles for consistency in health translations chore: Update Podfile.lock to include SDWebImage 5.21.4 and other dependency versions refactor(moodCheckins): Improve mood configuration retrieval with optional translation support refactor(sleepHealthKit): Replace useI18n with direct i18n import for sleep quality descriptions
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import i18n from '@/i18n';
|
||||
import dayjs from 'dayjs';
|
||||
import HealthKitManager, { HealthKitUtils } from './healthKit';
|
||||
|
||||
@@ -341,27 +341,25 @@ export const calculateSleepScore = (
|
||||
* 获取睡眠质量描述和建议
|
||||
*/
|
||||
export const getSleepQualityInfo = (sleepScore: number): { description: string; recommendation: string } => {
|
||||
const { t } = useI18n();
|
||||
|
||||
if (sleepScore >= 85) {
|
||||
return {
|
||||
description: t('sleepQuality.excellent.description'),
|
||||
recommendation: t('sleepQuality.excellent.recommendation')
|
||||
description: i18n.t('sleepQuality.excellent.description'),
|
||||
recommendation: i18n.t('sleepQuality.excellent.recommendation')
|
||||
};
|
||||
} else if (sleepScore >= 70) {
|
||||
return {
|
||||
description: t('sleepQuality.good.description'),
|
||||
recommendation: t('sleepQuality.good.recommendation')
|
||||
description: i18n.t('sleepQuality.good.description'),
|
||||
recommendation: i18n.t('sleepQuality.good.recommendation')
|
||||
};
|
||||
} else if (sleepScore >= 50) {
|
||||
return {
|
||||
description: t('sleepQuality.fair.description'),
|
||||
recommendation: t('sleepQuality.fair.recommendation')
|
||||
description: i18n.t('sleepQuality.fair.description'),
|
||||
recommendation: i18n.t('sleepQuality.fair.recommendation')
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
description: t('sleepQuality.poor.description'),
|
||||
recommendation: t('sleepQuality.poor.recommendation')
|
||||
description: i18n.t('sleepQuality.poor.description'),
|
||||
recommendation: i18n.t('sleepQuality.poor.recommendation')
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user