chore:build

This commit is contained in:
2026-06-14 16:34:34 +02:00
parent b9a532abd5
commit 1a1d62a1c1
8 changed files with 96 additions and 52 deletions
+8
View File
@@ -936,10 +936,18 @@ export type PointsPoolInfo = {
eligible_configs: RewardCategoryConfig[];
};
export type RewardItemConfig = {
product_id: number;
product_name: string;
quantity: number;
price: number;
};
export type PointsRewardConfig = {
threshold: number;
type: string;
description: string;
reward_items: RewardItemConfig[];
};
export const getMyPointsRewards = async (): Promise<{
@@ -20,7 +20,7 @@ import {
formatOrderDate,
formatPrice,
} from "../../api/api";
import type { PublicSettings, PointsPoolInfo, PointsRewardConfig } from "../../api/api";
import type { PublicSettings, PointsPoolInfo, PointsRewardConfig, RewardItemConfig } from "../../api/api";
import type {
CompletedOrder,
ClientStats,
@@ -482,6 +482,18 @@ export default function OrderHistoryScreen() {
{pointsRewards.reward.description !== "" && (
<Text style={styles.rewardsSectionDesc}>{pointsRewards.reward.description}</Text>
)}
{(pointsRewards.reward.reward_items ?? []).filter((it) => it.price > 0 || it.product_name).length > 0 && (
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 4, marginBottom: spacing.s }}>
{(pointsRewards.reward.reward_items ?? []).map((it: RewardItemConfig, idx: number) => (
<View key={idx} style={[styles.rewardAmountBadge, { flexDirection: "row", alignItems: "center", gap: 4 }]}>
<Ionicons name="gift-outline" size={11} color="#f59e0b" />
<Text style={styles.rewardAmountText}>
{it.product_name}{it.quantity > 0 && it.quantity !== 1 ? ` ×${it.quantity}` : ""}{it.price > 0 ? `${it.price}` : ""}
</Text>
</View>
))}
</View>
)}
{pointsRewards.pools.map((pool) => {
const threshold = pointsRewards.reward!.threshold;
const progress = Math.min(1, (pool.points % threshold) / threshold);
@@ -499,9 +511,7 @@ export default function OrderHistoryScreen() {
{pool.eligible_configs.flatMap((cfg) =>
cfg.all_products
? [<View key={cfg.category} style={styles.rewardAmountBadge}>
<Text style={styles.rewardAmountText}>
{cfg.category}{cfg.amount > 0 ? `${cfg.amount}` : ""}
</Text>
<Text style={styles.rewardAmountText}>{cfg.category}</Text>
</View>]
: (cfg.product_names ?? []).map((name) => (
<View key={`${cfg.category}-${name}`} style={styles.rewardAmountBadge}>