chore: build
Frontend Admin - EAS Build / build (push) Has been cancelled
Frontend Client - EAS Build / build (push) Has been cancelled

This commit is contained in:
2026-06-20 21:17:59 +02:00
parent 768de08f87
commit 403e765a51
4 changed files with 35 additions and 18 deletions
@@ -1,4 +1,5 @@
import React, { useState, useEffect, useCallback, useRef } from "react"; import React, { useState, useEffect, useCallback, useRef } from "react";
import { useFocusEffect } from "@react-navigation/native";
import { import {
View, View,
Text, Text,
@@ -1290,9 +1291,13 @@ export default function SettingsScreen() {
} }
}, []); }, []);
useEffect(() => { useFocusEffect(
loadData(); useCallback(() => {
}, [loadData]); if (!isDirty.current) {
loadData();
}
}, [loadData])
);
// Retourne l'index du pool auquel la catégorie est assignée, ou -1 si aucun // Retourne l'index du pool auquel la catégorie est assignée, ou -1 si aucun
const getPoolIndexFor = (catName: string): number => { const getPoolIndexFor = (catName: string): number => {
@@ -1366,6 +1371,7 @@ export default function SettingsScreen() {
setSaving(false); setSaving(false);
if (res.success) { if (res.success) {
isDirty.current = false; isDirty.current = false;
await loadData();
await refreshColors(); await refreshColors();
showSuccess("Succès", "Paramètres sauvegardés"); showSuccess("Succès", "Paramètres sauvegardés");
} else { } else {
+18 -9
View File
@@ -420,10 +420,6 @@ export const respondToAddressProposal = async (
} }
}; };
// ============================================
// TRACKING
// ============================================
export const getOrderTracking = async ( export const getOrderTracking = async (
commandId: number, commandId: number,
): Promise<TrackingResponse> => { ): Promise<TrackingResponse> => {
@@ -984,7 +980,10 @@ export const getMyPointsRewards = async (): Promise<{
} }
}; };
export const claimMyReward = async (poolKey: string, productId?: number): Promise<{ export const claimMyReward = async (
poolKey: string,
productId?: number,
): Promise<{
success: boolean; success: boolean;
description?: string; description?: string;
remaining_rewards?: number; remaining_rewards?: number;
@@ -993,7 +992,9 @@ export const claimMyReward = async (poolKey: string, productId?: number): Promis
error?: string; error?: string;
}> => { }> => {
try { try {
const body: { pool_key: string; product_id?: number } = { pool_key: poolKey }; const body: { pool_key: string; product_id?: number } = {
pool_key: poolKey,
};
if (productId !== undefined) body.product_id = productId; if (productId !== undefined) body.product_id = productId;
const { data } = await apiClient.post(`${V1}/points/claim`, body); const { data } = await apiClient.post(`${V1}/points/claim`, body);
return { return {
@@ -1014,7 +1015,10 @@ export const submitLivreurRating = async (
comment: string, comment: string,
): Promise<{ success: boolean; error?: string }> => { ): Promise<{ success: boolean; error?: string }> => {
try { try {
await apiClient.post(`${V1}/orders/${orderId}/rate`, { rating, comment }); await apiClient.post(`${V1}/orders/${orderId}/rate`, {
rating,
comment,
});
return { success: true }; return { success: true };
} catch (e: any) { } catch (e: any) {
return { success: false, error: e?.response?.data?.error || "Erreur" }; return { success: false, error: e?.response?.data?.error || "Erreur" };
@@ -1033,11 +1037,16 @@ export const getOrderRatingStatus = async (
}; };
export const calculateOrderTotal = (order: any): number => { export const calculateOrderTotal = (order: any): number => {
if (typeof order.total_prix === "number" && order.total_prix > 0) return order.total_prix; if (typeof order.total_prix === "number" && order.total_prix > 0)
return order.total_prix;
if (typeof order.total === "number" && order.total > 0) return order.total; if (typeof order.total === "number" && order.total > 0) return order.total;
if (Array.isArray(order.items) && order.items.length > 0) { if (Array.isArray(order.items) && order.items.length > 0) {
return order.items.reduce((sum: number, item: any) => { return order.items.reduce((sum: number, item: any) => {
return sum + (item.prix || item.price || 0) * (item.quantite || item.quantity || 1); return (
sum +
(item.prix || item.price || 0) *
(item.quantite || item.quantity || 1)
);
}, 0); }, 0);
} }
return 0; return 0;
+7 -6
View File
@@ -24,12 +24,13 @@ export function ThemeProvider({ children }: { children: ReactNode }) {
const fetchClientColors = useCallback(async () => { const fetchClientColors = useCallback(async () => {
try { try {
const s = await getPublicSettings(); const s = await getPublicSettings();
const overrides: Partial<Colors> = {}; const overrides: Partial<Colors> = {
if (s.client_color_primary) overrides.accent = s.client_color_primary; ...(s.client_color_primary && { accent: s.client_color_primary }),
if (s.client_color_secondary) overrides.secondary = s.client_color_secondary; ...(s.client_color_secondary && { secondary: s.client_color_secondary }),
if (s.client_color_success) overrides.success = s.client_color_success; ...(s.client_color_success && { success: s.client_color_success }),
if (s.client_color_danger) overrides.danger = s.client_color_danger; ...(s.client_color_danger && { danger: s.client_color_danger }),
if (s.client_color_warning) overrides.warning = s.client_color_warning; ...(s.client_color_warning && { warning: s.client_color_warning }),
};
setColorOverrides(overrides); setColorOverrides(overrides);
AsyncStorage.setItem(COLORS_CACHE_KEY, JSON.stringify(overrides)).catch(() => {}); AsyncStorage.setItem(COLORS_CACHE_KEY, JSON.stringify(overrides)).catch(() => {});
} catch {} } catch {}
@@ -6,6 +6,7 @@ import {
ScrollView, ScrollView,
StyleSheet, StyleSheet,
TouchableOpacity, TouchableOpacity,
Pressable,
Switch, Switch,
Alert, Alert,
Modal, Modal,