fix:补充多语言遗漏
This commit is contained in:
@@ -30,8 +30,7 @@ function App() {
|
|||||||
|
|
||||||
if (previousLanguage && previousLanguage !== normalizedLanguage) {
|
if (previousLanguage && previousLanguage !== normalizedLanguage) {
|
||||||
await queryClient.cancelQueries()
|
await queryClient.cancelQueries()
|
||||||
await queryClient.invalidateQueries()
|
await queryClient.invalidateQueries({refetchType: 'active'})
|
||||||
await queryClient.refetchQueries({type: 'active'})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
previousLanguageRef.current = normalizedLanguage
|
previousLanguageRef.current = normalizedLanguage
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export function GoodsCategoryList({
|
|||||||
className="flex h-[36px] w-[36px] items-center justify-center rounded-[12px] bg-[#FA6A00]/15 text-[#FE9F00]">
|
className="flex h-[36px] w-[36px] items-center justify-center rounded-[12px] bg-[#FA6A00]/15 text-[#FE9F00]">
|
||||||
<CategoryIcon className="h-[18px] w-[18px]" aria-hidden="true"/>
|
<CategoryIcon className="h-[18px] w-[18px]" aria-hidden="true"/>
|
||||||
</div>
|
</div>
|
||||||
<div className="truncate text-[15px] font-semibold text-white">{category.name}</div>
|
<div className="truncate text-[15px] font-semibold text-white">{t(HOME_CATEGORY_META_MAP[category.id].nameKey)}</div>
|
||||||
</div>
|
</div>
|
||||||
{showMore && onMoreClick ? (
|
{showMore && onMoreClick ? (
|
||||||
<button
|
<button
|
||||||
@@ -116,12 +116,12 @@ export function GoodsCategoryList({
|
|||||||
<div className="text-[16px] font-medium text-white">{product.title}</div>
|
<div className="text-[16px] font-medium text-white">{product.title}</div>
|
||||||
<div className="text-[13px] text-white/52">{product.subtitle}</div>
|
<div className="text-[13px] text-white/52">{product.subtitle}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-[16px] font-semibold text-[#FA6A00]">{product.score}</div>
|
<div className="text-[16px] font-semibold text-[#FA6A00]">{product.scoreValue} {t('common.points')}</div>
|
||||||
<Button
|
<Button
|
||||||
className="h-[36px] w-full text-[13px]"
|
className="h-[36px] w-full text-[13px]"
|
||||||
onClick={() => onRedeem(product, category.id)}
|
onClick={() => onRedeem(product, category.id)}
|
||||||
>
|
>
|
||||||
{product.ctaLabel}
|
{t(HOME_CATEGORY_META_MAP[category.id].ctaLabelKey)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ export function GoodsRedeemModal({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between py-[14px] text-white">
|
<div className="flex items-center justify-between py-[14px] text-white">
|
||||||
<div className="text-[18px]">{t('goods.pointsRequired')}</div>
|
<div className="text-[18px]">{t('goods.pointsRequired')}</div>
|
||||||
<div className="text-[18px]">{getNumericValue(selectedProductData.score)}</div>
|
<div className="text-[18px]">{getNumericValue(String(selectedProductData.scoreValue))}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between py-[14px] text-white">
|
<div className="flex items-center justify-between py-[14px] text-white">
|
||||||
<div className="text-[18px] underline decoration-[#1E90FF] underline-offset-[3px]">
|
<div className="text-[18px] underline decoration-[#1E90FF] underline-offset-[3px]">
|
||||||
@@ -262,7 +262,7 @@ export function GoodsRedeemModal({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between py-[14px] text-white">
|
<div className="flex items-center justify-between py-[14px] text-white">
|
||||||
<div className="text-[13px] text-white/78">{t('goods.pointsRequired')}</div>
|
<div className="text-[13px] text-white/78">{t('goods.pointsRequired')}</div>
|
||||||
<div className="text-[14px]">{getNumericValue(selectedProductData.score)}</div>
|
<div className="text-[14px]">{getNumericValue(String(selectedProductData.scoreValue))}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between py-[14px] text-white">
|
<div className="flex items-center justify-between py-[14px] text-white">
|
||||||
<div className="text-[13px] text-white/78">{t('goods.turnoverRequirement')}</div>
|
<div className="text-[13px] text-white/78">{t('goods.turnoverRequirement')}</div>
|
||||||
@@ -287,7 +287,7 @@ export function GoodsRedeemModal({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between py-[12px]">
|
<div className="flex items-center justify-between py-[12px]">
|
||||||
<div className="text-[13px] text-white/82">{t('goods.pointsCost')}</div>
|
<div className="text-[13px] text-white/82">{t('goods.pointsCost')}</div>
|
||||||
<div className="text-[15px] text-white">{getNumericValue(selectedProductData.score)}</div>
|
<div className="text-[15px] text-white">{getNumericValue(String(selectedProductData.scoreValue))}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import {useQuery} from '@tanstack/react-query'
|
import {useQuery} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {goodList} from '@/api/business.ts'
|
import {goodList} from '@/api/business.ts'
|
||||||
import i18n from '@/lib/i18n'
|
|
||||||
import {
|
import {
|
||||||
API_ORIGIN,
|
API_ORIGIN,
|
||||||
HOME_CATEGORY_META_MAP,
|
HOME_CATEGORY_META_MAP,
|
||||||
@@ -23,15 +22,12 @@ function getProductImageUrl(image?: string) {
|
|||||||
return new URL(image, API_ORIGIN).toString()
|
return new URL(image, API_ORIGIN).toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapGoodItemToProductItem(item: GoodsItem, type: goodsType): ProductItem {
|
function mapGoodItemToProductItem(item: GoodsItem): ProductItem {
|
||||||
const categoryMeta = HOME_CATEGORY_META_MAP[type]
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: String(item.id),
|
id: String(item.id),
|
||||||
title: item.title,
|
title: item.title,
|
||||||
subtitle: item.description,
|
subtitle: item.description,
|
||||||
score: `${item.score} ${i18n.t('common.points')}`,
|
scoreValue: item.score,
|
||||||
ctaLabel: i18n.t(categoryMeta.ctaLabelKey),
|
|
||||||
imageUrl: getProductImageUrl(item.image),
|
imageUrl: getProductImageUrl(item.image),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,8 +35,8 @@ function mapGoodItemToProductItem(item: GoodsItem, type: goodsType): ProductItem
|
|||||||
function buildProductCategories(groups: Record<goodsType, GoodsItem[]>): ProductCategory[] {
|
function buildProductCategories(groups: Record<goodsType, GoodsItem[]>): ProductCategory[] {
|
||||||
return HOME_GOOD_TYPE_ORDER.map((type) => ({
|
return HOME_GOOD_TYPE_ORDER.map((type) => ({
|
||||||
id: type,
|
id: type,
|
||||||
name: i18n.t(HOME_CATEGORY_META_MAP[type].nameKey),
|
name: HOME_CATEGORY_META_MAP[type].nameKey,
|
||||||
items: groups[type].map((item) => mapGoodItemToProductItem(item, type)),
|
items: groups[type].map((item) => mapGoodItemToProductItem(item)),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,7 @@ export type ProductItem = {
|
|||||||
id: string
|
id: string
|
||||||
title: string
|
title: string
|
||||||
subtitle: string
|
subtitle: string
|
||||||
score: string
|
scoreValue: number | string
|
||||||
ctaLabel: string
|
|
||||||
imageClassName?: string
|
imageClassName?: string
|
||||||
imageUrl?: string
|
imageUrl?: string
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user