feat: improve redemption feature i18n and error code handling

- Complete internationalization for redemption records dialog
  - Add i18n for table headers and unit time translations
  - Optimize redemption form validation error messages with i18n
  - Add 50003 error code handling for coupon plan incompatibility
  - Fix TypeScript errors in redemption-related components
  - Fix TypeScript errors in user announcement page
This commit is contained in:
EUForest
2026-01-07 15:38:42 +08:00
parent 93926d9c99
commit 585874777f
8 changed files with 46 additions and 22 deletions
@@ -1,4 +1,3 @@
import { Badge } from "@workspace/ui/components/badge";
import {
Dialog,
DialogContent,
@@ -81,7 +80,7 @@ export default function RedemptionRecords({
<Table>
<TableHeader>
<TableRow>
<TableHead>ID</TableHead>
<TableHead>{t("id", "ID")}</TableHead>
<TableHead>{t("userId", "User ID")}</TableHead>
<TableHead>{t("subscribeId", "Subscribe ID")}</TableHead>
<TableHead>{t("unitTime", "Unit Time")}</TableHead>
@@ -90,20 +89,29 @@ export default function RedemptionRecords({
</TableRow>
</TableHeader>
<TableBody>
{records.map((record) => (
<TableRow key={record.id}>
<TableCell>{record.id}</TableCell>
<TableCell>{record.user_id}</TableCell>
<TableCell>{record.subscribe_id}</TableCell>
<TableCell>{record.unit_time}</TableCell>
<TableCell>{record.quantity}</TableCell>
<TableCell>
{record.redeemed_at
? formatDate(record.redeemed_at)
: "--"}
</TableCell>
</TableRow>
))}
{records.map((record) => {
const unitTimeMap: Record<string, string> = {
day: t("form.day", "Day"),
month: t("form.month", "Month"),
quarter: t("form.quarter", "Quarter"),
half_year: t("form.halfYear", "Half Year"),
year: t("form.year", "Year"),
};
return (
<TableRow key={record.id}>
<TableCell>{record.id}</TableCell>
<TableCell>{record.user_id}</TableCell>
<TableCell>{record.subscribe_id}</TableCell>
<TableCell>{unitTimeMap[record.unit_time] || record.unit_time}</TableCell>
<TableCell>{record.quantity}</TableCell>
<TableCell>
{record.redeemed_at
? formatDate(record.redeemed_at)
: "--"}
</TableCell>
</TableRow>
);
})}
</TableBody>
</Table>
{total > pagination.size && (