chore: build
This commit is contained in:
@@ -47,6 +47,8 @@ interface ProductCardProps {
|
||||
quantity: number;
|
||||
price: number;
|
||||
active_price?: boolean;
|
||||
promo_price?: number | null;
|
||||
promo_percent?: number;
|
||||
}>;
|
||||
media?: Array<{ url: string; type: string }>;
|
||||
};
|
||||
@@ -67,6 +69,11 @@ export default function ProductCard({
|
||||
const activePrices =
|
||||
product.prices?.filter((p) => p.active_price !== false) ?? [];
|
||||
const firstPrice = activePrices[0]?.price ?? null;
|
||||
const firstPromoPrice =
|
||||
activePrices[0]?.promo_price != null &&
|
||||
activePrices[0].promo_price < activePrices[0].price
|
||||
? activePrices[0].promo_price
|
||||
: null;
|
||||
|
||||
const imageMedia = product.media?.find((m) => m.type === "image");
|
||||
const videoMedia = product.media?.find((m) => m.type === "video");
|
||||
@@ -198,11 +205,33 @@ export default function ProductCard({
|
||||
>
|
||||
{product.name}
|
||||
</Text>
|
||||
<Text style={[styles.price, { color: colors.success }]}>
|
||||
{firstPrice !== null
|
||||
? `${firstPrice.toFixed(2)} €`
|
||||
: "Prix non disponible"}
|
||||
</Text>
|
||||
{firstPrice !== null ? (
|
||||
firstPromoPrice !== null ? (
|
||||
<View style={styles.priceRow}>
|
||||
<Text
|
||||
style={[
|
||||
styles.priceStrike,
|
||||
{ color: colors.textMuted },
|
||||
]}
|
||||
>
|
||||
{firstPrice.toFixed(2)} €
|
||||
</Text>
|
||||
<Text
|
||||
style={[styles.price, { color: colors.success }]}
|
||||
>
|
||||
{firstPromoPrice.toFixed(2)} €
|
||||
</Text>
|
||||
</View>
|
||||
) : (
|
||||
<Text style={[styles.price, { color: colors.success }]}>
|
||||
{firstPrice.toFixed(2)} €
|
||||
</Text>
|
||||
)
|
||||
) : (
|
||||
<Text style={[styles.price, { color: colors.success }]}>
|
||||
Prix non disponible
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<View
|
||||
@@ -317,14 +346,39 @@ export default function ProductCard({
|
||||
{p.quantity}
|
||||
{product.unit || "g"}
|
||||
</Text>
|
||||
<Text
|
||||
style={[
|
||||
styles.pickerOptionPrice,
|
||||
{ color: catColor },
|
||||
]}
|
||||
>
|
||||
{p.price.toFixed(2)} €
|
||||
</Text>
|
||||
{p.promo_price != null &&
|
||||
p.promo_price < p.price ? (
|
||||
<View style={styles.pickerPriceRow}>
|
||||
<Text
|
||||
style={[
|
||||
styles.priceStrike,
|
||||
{ color: colors.textMuted },
|
||||
]}
|
||||
>
|
||||
{p.price.toFixed(2)} €
|
||||
</Text>
|
||||
<Text
|
||||
style={[
|
||||
styles.pickerOptionPrice,
|
||||
{ color: catColor },
|
||||
]}
|
||||
>
|
||||
{p.promo_price.toFixed(2)} €
|
||||
{p.promo_percent
|
||||
? ` (-${p.promo_percent}%)`
|
||||
: ""}
|
||||
</Text>
|
||||
</View>
|
||||
) : (
|
||||
<Text
|
||||
style={[
|
||||
styles.pickerOptionPrice,
|
||||
{ color: catColor },
|
||||
]}
|
||||
>
|
||||
{p.price.toFixed(2)} €
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
<Ionicons
|
||||
name="add-circle"
|
||||
@@ -515,6 +569,21 @@ const styles = StyleSheet.create({
|
||||
fontWeight: fontWeight.bold,
|
||||
textAlign: "center",
|
||||
},
|
||||
priceRow: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
gap: spacing.xs,
|
||||
},
|
||||
pickerPriceRow: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: spacing.xs,
|
||||
},
|
||||
priceStrike: {
|
||||
fontSize: fontSize.md,
|
||||
textDecorationLine: "line-through",
|
||||
},
|
||||
quickAddSection: { padding: spacing.m, borderTopWidth: 1 },
|
||||
quickAddBtn: {
|
||||
width: "100%",
|
||||
|
||||
Reference in New Issue
Block a user