chore: build
Frontend Admin - EAS Build / build (push) Failing after 5m39s

This commit is contained in:
Xor290
2026-10-03 14:21:15 +02:00
parent 2278423861
commit c38ed9c476
5 changed files with 100 additions and 13 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ import axios from "axios";
import { getToken, getAdminToken } from "../auth/tokenStorage";
export const API_BASE_URL =
process.env.EXPO_PUBLIC_API_URL ?? "https://uber-demo.club";
process.env.EXPO_PUBLIC_API_URL ?? "https://mln-uber.club";
const apiClient = axios.create({
baseURL: API_BASE_URL,
+1
View File
@@ -142,6 +142,7 @@ export interface DeliveryItem {
adresse: string;
total_prix: number;
referral_used?: number;
is_new_client?: boolean;
created_at: string;
updated_at: string;
eta?: string;
@@ -73,6 +73,7 @@ export default function OrderDetailScreen() {
setCommand(cmdRes.command);
setItems(itemsRes.items ?? []);
// If livreur assigned, fetch their location and calc route
const cmd = cmdRes.command;
if (cmd?.livreur_assign && cmd?.adresse) {
loadLivreurRoute(cmd.livreur_assign, cmd.adresse);
@@ -48,6 +48,7 @@ import { useAlert } from "../../hooks/useAlert";
// --------------------------------------------------
// Types
// --------------------------------------------------
interface UserItem {
id: number;
username: string;
@@ -22,7 +22,7 @@ import {
useWindowDimensions,
} from "react-native";
import Geolocation from "@react-native-community/geolocation";
import { Ionicons } from "@expo/vector-icons";
import { Ionicons, FontAwesome5 } from "@expo/vector-icons";
import * as Location from "expo-location";
import { spacing, fontSize, borderRadius } from "../../theme";
import { useTheme } from "../../context/ThemeContext";
@@ -75,7 +75,7 @@ interface EnrichedDelivery extends DeliveryItem {
clientUsername?: string;
clientNom?: string;
clientPrenom?: string;
items?: Array<{ produit: string; quantite: number; prix: number; unit?: string; is_reward?: boolean }>;
items?: Array<{ produit: string; quantite: number; prix: number; unit?: string; is_reward?: boolean; promo_discount?: number }>;
}
export default function DashboardScreen() {
@@ -271,6 +271,8 @@ export default function DashboardScreen() {
[],
referral_used:
detail.delivery?.referral_used || 0,
is_new_client:
detail.delivery?.is_new_client || false,
};
}
} catch {
@@ -623,6 +625,38 @@ export default function DashboardScreen() {
{item.clientName}
</Text>
)}
{item.is_new_client && (
<View
style={{
flexDirection: "row",
alignItems: "center",
alignSelf: "flex-start",
gap: spacing.xs,
marginTop: spacing.xs,
paddingHorizontal: spacing.m,
paddingVertical: spacing.xs,
borderRadius: borderRadius.xl,
borderWidth: 1,
borderColor: "#EF4444",
backgroundColor: "#EF444422",
}}
>
<FontAwesome5
name="user-plus"
size={11}
color={"#EF4444"}
/>
<Text
style={{
color: "#EF4444",
fontSize: fontSize.xs,
fontWeight: "600",
}}
>
NEW
</Text>
</View>
)}
</View>
<Badge
label={
@@ -707,7 +741,14 @@ export default function DashboardScreen() {
</Text>
</View>
)}
{item.items.map((prod, idx) => (
{item.items.map((prod, idx) => {
const promoDiscount = prod.promo_discount ?? 0;
const hasPromo = !prod.is_reward && promoDiscount > 0;
const originalPrice = (prod.prix ?? 0) + promoDiscount;
const promoPercent = hasPromo && originalPrice > 0
? Math.round((promoDiscount / originalPrice) * 100)
: 0;
return (
<View key={idx} style={styles.itemRow}>
<View style={{ flex: 1 }}>
<View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
@@ -718,16 +759,34 @@ export default function DashboardScreen() {
<Text style={{ fontSize: 10, color: "#f59e0b", fontWeight: "700" }}>Récompense</Text>
</View>
)}
{hasPromo && (
<View style={{ flexDirection: "row", alignItems: "center", gap: 2, backgroundColor: "rgba(34,197,94,0.15)", borderRadius: 4, paddingHorizontal: 4, paddingVertical: 1 }}>
<Ionicons name="pricetag-outline" size={10} color="#22c55e" />
<Text style={{ fontSize: 10, color: "#22c55e", fontWeight: "700" }}>-{promoPercent}%</Text>
</View>
)}
</View>
<Text style={styles.itemQty}>
Quantité: {prod.quantite}{prod.unit || ""}
</Text>
</View>
<Text style={[styles.itemPrice, prod.is_reward ? { color: "#10b981" } : {}]}>
{prod.is_reward && (prod.prix ?? 0) === 0 ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}€`}
</Text>
{hasPromo ? (
<View style={{ alignItems: "flex-end" }}>
<Text style={{ fontSize: 12, color: colors.textMuted, textDecorationLine: "line-through" }}>
{originalPrice.toFixed(2)}€
</Text>
<Text style={[styles.itemPrice, { color: "#22c55e" }]}>
{(prod.prix ?? 0).toFixed(2)}€
</Text>
</View>
) : (
<Text style={[styles.itemPrice, prod.is_reward ? { color: "#10b981" } : {}]}>
{prod.is_reward && (prod.prix ?? 0) === 0 ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}€`}
</Text>
)}
</View>
))}
);
})}
<View style={styles.totalRow}>
<Text style={styles.totalLabel}>Total</Text>
<Text style={styles.totalValue}>
@@ -2010,7 +2069,14 @@ export default function DashboardScreen() {
</Text>
</View>
)}
{detailsDelivery.items.map((prod, idx) => (
{detailsDelivery.items.map((prod, idx) => {
const promoDiscount = prod.promo_discount ?? 0;
const hasPromo = !prod.is_reward && promoDiscount > 0;
const originalPrice = (prod.prix ?? 0) + promoDiscount;
const promoPercent = hasPromo && originalPrice > 0
? Math.round((promoDiscount / originalPrice) * 100)
: 0;
return (
<View key={idx} style={styles.detailProductRow}>
<View style={{ flex: 1 }}>
<View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
@@ -2021,16 +2087,34 @@ export default function DashboardScreen() {
<Text style={{ fontSize: 11, color: "#f59e0b", fontWeight: "700" }}>Récompense</Text>
</View>
)}
{hasPromo && (
<View style={{ flexDirection: "row", alignItems: "center", gap: 2, backgroundColor: "rgba(34,197,94,0.15)", borderRadius: 4, paddingHorizontal: 4, paddingVertical: 1 }}>
<Ionicons name="pricetag-outline" size={11} color="#22c55e" />
<Text style={{ fontSize: 11, color: "#22c55e", fontWeight: "700" }}>-{promoPercent}%</Text>
</View>
)}
</View>
<Text style={styles.detailProductQty}>
Quantité : {prod.quantite}{prod.unit || ""}
</Text>
</View>
<Text style={[styles.detailProductPrice, prod.is_reward ? { color: "#10b981" } : {}]}>
{prod.is_reward && (prod.prix ?? 0) === 0 ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}€`}
</Text>
{hasPromo ? (
<View style={{ alignItems: "flex-end" }}>
<Text style={{ fontSize: 12, color: colors.textMuted, textDecorationLine: "line-through" }}>
{originalPrice.toFixed(2)}€
</Text>
<Text style={[styles.detailProductPrice, { color: "#22c55e" }]}>
{(prod.prix ?? 0).toFixed(2)}€
</Text>
</View>
) : (
<Text style={[styles.detailProductPrice, prod.is_reward ? { color: "#10b981" } : {}]}>
{prod.is_reward && (prod.prix ?? 0) === 0 ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}€`}
</Text>
)}
</View>
))}
);
})}
</>
) : (
<Text style={styles.detailEmpty}>Aucun produit</Text>