chore: finish features comming soon

This commit is contained in:
2026-05-19 20:11:54 +02:00
parent 929dea7249
commit 8df5bd66d3
4 changed files with 160 additions and 67 deletions
+24 -8
View File
@@ -13,7 +13,13 @@ import {
function getTextColor(hex: string): string {
const h = hex.replace("#", "");
const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
const full =
h.length === 3
? h
.split("")
.map((c) => c + c)
.join("")
: h;
const r = parseInt(full.slice(0, 2), 16);
const g = parseInt(full.slice(2, 4), 16);
const b = parseInt(full.slice(4, 6), 16);
@@ -37,20 +43,29 @@ interface ProductCardProps {
stock: number;
unit?: string;
coming_soon?: boolean;
prices?: Array<{ quantity: number; price: number; active_price?: boolean }>;
prices?: Array<{
quantity: number;
price: number;
active_price?: boolean;
}>;
media?: Array<{ url: string; type: string }>;
};
onPress: () => void;
categoryColor?: string;
}
export default function ProductCard({ product, onPress, categoryColor }: ProductCardProps) {
export default function ProductCard({
product,
onPress,
categoryColor,
}: ProductCardProps) {
const { colors } = useTheme();
const { addToCart } = useCart();
const catColor = categoryColor ?? colors.accent;
const isSoldOut = product.stock <= 0;
const isComingSoon = product.coming_soon === true;
const activePrices = product.prices?.filter((p) => p.active_price !== false) ?? [];
const activePrices =
product.prices?.filter((p) => p.active_price !== false) ?? [];
const firstPrice = activePrices[0]?.price ?? null;
const imageMedia = product.media?.find((m) => m.type === "image");
@@ -161,7 +176,7 @@ export default function ProductCard({ product, onPress, categoryColor }: Product
)}
{isComingSoon && (
<View style={styles.comingSoonOverlay}>
<Text style={styles.comingSoonText}>À VENIR</Text>
<Text style={styles.comingSoonText}>COMMING SOON</Text>
</View>
)}
</View>
@@ -236,8 +251,8 @@ export default function ProductCard({ product, onPress, categoryColor }: Product
{isSoldOut
? "Rupture de stock"
: isComingSoon
? "Bientôt disponible"
: "Ajouter rapidement"}
? "Bientôt disponible"
: "Ajouter rapidement"}
</Text>
</TouchableOpacity>
)}
@@ -297,7 +312,8 @@ export default function ProductCard({ product, onPress, categoryColor }: Product
{ color: colors.textWhite },
]}
>
{p.quantity}{product.unit || "g"}
{p.quantity}
{product.unit || "g"}
</Text>
<Text
style={[