|
|
@@ -43,7 +43,8 @@ const FirstRoute = ({
|
|
|
loading: boolean;
|
|
|
handleCouponClick: (couponName: string, couponDescription: string) => void;
|
|
|
}) => {
|
|
|
- const { t } = useTranslation(); // 使用翻译钩子
|
|
|
+ const { t, getCurrentLanguageConfig } = useTranslation(); // 使用翻译钩子
|
|
|
+ const isEn = getCurrentLanguageConfig()?.code === 'en';
|
|
|
|
|
|
return (
|
|
|
<View className="flex-1">
|
|
|
@@ -57,7 +58,7 @@ const FirstRoute = ({
|
|
|
<ActivityIndicator />
|
|
|
</View>
|
|
|
) : (
|
|
|
- <View className="">
|
|
|
+ <View>
|
|
|
<View>
|
|
|
{coupons.filter(
|
|
|
(coupon: any) =>
|
|
|
@@ -82,13 +83,13 @@ const FirstRoute = ({
|
|
|
.map((coupon: any, index: any) => (
|
|
|
<IndividualCouponComponent
|
|
|
onCouponClick={() =>
|
|
|
- handleCouponClick(coupon.coupon.name, coupon.coupon.description)
|
|
|
+ handleCouponClick(isEn? coupon.coupon.name_en:coupon.coupon.name, isEn?coupon.coupon.description_en:coupon.coupon.description)
|
|
|
}
|
|
|
// key={coupon.redeem_code}
|
|
|
key={`${coupon.id}-${index}`}
|
|
|
- title={coupon.coupon.name}
|
|
|
+ title={isEn? coupon.coupon.name_en:coupon.coupon.name}
|
|
|
price={coupon.coupon.amount}
|
|
|
- detail={coupon.coupon.description}
|
|
|
+ detail={isEn?coupon.coupon.description_en:coupon.coupon.description}
|
|
|
date={formatCouponDate(coupon.expire_date)}
|
|
|
setOpacity={false}
|
|
|
noCircle={true}
|
|
|
@@ -105,26 +106,30 @@ const FirstRoute = ({
|
|
|
);
|
|
|
};
|
|
|
|
|
|
-const SecondRoute = ({ coupons }: { coupons: any }) => (
|
|
|
- <ScrollView style={{ flex: 1, backgroundColor: 'white', marginTop: 14 }}>
|
|
|
- <View className="flex-1 flex-col">
|
|
|
- {coupons
|
|
|
- .filter((coupon: any) => coupon.is_consumed === true || new Date(coupon.expire_date) < new Date())
|
|
|
- .slice(0, 30)
|
|
|
- .map((coupon: any, index: any) => (
|
|
|
- <IndividualCouponComponent
|
|
|
- key={`${coupon.id}-${index}`}
|
|
|
- title={coupon.coupon.name}
|
|
|
- price={coupon.coupon.amount}
|
|
|
- detail={coupon.coupon.description}
|
|
|
- date={formatCouponDate(coupon.expire_date)}
|
|
|
- setOpacity={true}
|
|
|
- noCircle={true}
|
|
|
- />
|
|
|
- ))}
|
|
|
- </View>
|
|
|
- </ScrollView>
|
|
|
-);
|
|
|
+const SecondRoute = ({ coupons }: { coupons: any }) => {
|
|
|
+ const { t, getCurrentLanguageConfig } = useTranslation(); // 使用翻译钩子
|
|
|
+ const isEn = getCurrentLanguageConfig()?.code === 'en';
|
|
|
+ return (
|
|
|
+ <ScrollView style={{ flex: 1, backgroundColor: 'white', marginTop: 14 }}>
|
|
|
+ <View className="flex-1 flex-col">
|
|
|
+ {coupons
|
|
|
+ .filter((coupon: any) => coupon.is_consumed === true || new Date(coupon.expire_date) < new Date())
|
|
|
+ .slice(0, 30)
|
|
|
+ .map((coupon: any, index: any) => (
|
|
|
+ <IndividualCouponComponent
|
|
|
+ key={`${coupon.id}-${index}`}
|
|
|
+ title={isEn? coupon.coupon.name_en:coupon.coupon.name}
|
|
|
+ price={coupon.coupon.amount}
|
|
|
+ detail={isEn?coupon.coupon.description_en:coupon.coupon.description}
|
|
|
+ date={formatCouponDate(coupon.expire_date)}
|
|
|
+ setOpacity={true}
|
|
|
+ noCircle={true}
|
|
|
+ />
|
|
|
+ ))}
|
|
|
+ </View>
|
|
|
+ </ScrollView>
|
|
|
+ );
|
|
|
+}
|
|
|
|
|
|
const DisplayedOnlyCouponTabView: React.FC<TabViewComponentProps> = ({ titles }) => {
|
|
|
const layout = useWindowDimensions();
|