chore: build
This commit is contained in:
@@ -379,6 +379,8 @@ export const getMyStats = async (): Promise<{
|
|||||||
by_day?: StatPoint[];
|
by_day?: StatPoint[];
|
||||||
by_week?: StatPoint[];
|
by_week?: StatPoint[];
|
||||||
by_month?: StatPoint[];
|
by_month?: StatPoint[];
|
||||||
|
today_count?: number;
|
||||||
|
today_revenue?: number;
|
||||||
error?: string;
|
error?: string;
|
||||||
}> => {
|
}> => {
|
||||||
try {
|
try {
|
||||||
@@ -388,6 +390,8 @@ export const getMyStats = async (): Promise<{
|
|||||||
by_day: data.by_day || [],
|
by_day: data.by_day || [],
|
||||||
by_week: data.by_week || [],
|
by_week: data.by_week || [],
|
||||||
by_month: data.by_month || [],
|
by_month: data.by_month || [],
|
||||||
|
today_count: data.today_count || 0,
|
||||||
|
today_revenue: data.today_revenue || 0,
|
||||||
};
|
};
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
return { success: false, error: error.response?.data?.error || "Erreur réseau" };
|
return { success: false, error: error.response?.data?.error || "Erreur réseau" };
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ export default function StatsScreen() {
|
|||||||
const [byDay, setByDay] = useState<StatPoint[]>([]);
|
const [byDay, setByDay] = useState<StatPoint[]>([]);
|
||||||
const [byWeek, setByWeek] = useState<StatPoint[]>([]);
|
const [byWeek, setByWeek] = useState<StatPoint[]>([]);
|
||||||
const [byMonth, setByMonth] = useState<StatPoint[]>([]);
|
const [byMonth, setByMonth] = useState<StatPoint[]>([]);
|
||||||
|
const [todayCount, setTodayCount] = useState(0);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
const [period, setPeriod] = useState<Period>("week");
|
const [period, setPeriod] = useState<Period>("week");
|
||||||
@@ -104,6 +105,7 @@ export default function StatsScreen() {
|
|||||||
setByDay(statsRes.by_day ?? []);
|
setByDay(statsRes.by_day ?? []);
|
||||||
setByWeek(statsRes.by_week ?? []);
|
setByWeek(statsRes.by_week ?? []);
|
||||||
setByMonth(statsRes.by_month ?? []);
|
setByMonth(statsRes.by_month ?? []);
|
||||||
|
setTodayCount(statsRes.today_count ?? 0);
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
/* ignore */
|
/* ignore */
|
||||||
@@ -205,6 +207,7 @@ export default function StatsScreen() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const summaryCards = [
|
const summaryCards = [
|
||||||
|
{ label: "Livraisons du jour", value: todayCount.toString(), icon: "today-outline" as const, color: colors.accent },
|
||||||
{ label: "Total livraisons", value: total.toString(), icon: "cube-outline" as const, color: colors.accent },
|
{ label: "Total livraisons", value: total.toString(), icon: "cube-outline" as const, color: colors.accent },
|
||||||
{ label: "Complétées", value: completed.toString(), icon: "checkmark-circle-outline" as const, color: colors.success },
|
{ label: "Complétées", value: completed.toString(), icon: "checkmark-circle-outline" as const, color: colors.success },
|
||||||
{ label: "En cours", value: inProgress.toString(), icon: "time-outline" as const, color: colors.warning },
|
{ label: "En cours", value: inProgress.toString(), icon: "time-outline" as const, color: colors.warning },
|
||||||
|
|||||||
@@ -50,16 +50,19 @@ export default function ProductsScreen() {
|
|||||||
const carouselRef = useRef<FlatList>(null);
|
const carouselRef = useRef<FlatList>(null);
|
||||||
const scaleAnim = useRef(new Animated.Value(1)).current;
|
const scaleAnim = useRef(new Animated.Value(1)).current;
|
||||||
|
|
||||||
useEffect(() => {
|
const loadCategories = useCallback(async () => {
|
||||||
getCategories().then((cats) => {
|
const cats = await getCategories();
|
||||||
const sorted = [...cats].sort((a, b) => {
|
const sorted = [...cats].sort((a, b) => {
|
||||||
if (a.is_coming_soon === b.is_coming_soon) return 0;
|
if (a.is_coming_soon === b.is_coming_soon) return 0;
|
||||||
return a.is_coming_soon ? 1 : -1;
|
return a.is_coming_soon ? 1 : -1;
|
||||||
});
|
});
|
||||||
setCategories(sorted);
|
setCategories(sorted);
|
||||||
});
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
loadCategories();
|
||||||
|
}, [loadCategories]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const pulse = Animated.loop(
|
const pulse = Animated.loop(
|
||||||
Animated.sequence([
|
Animated.sequence([
|
||||||
@@ -118,7 +121,9 @@ export default function ProductsScreen() {
|
|||||||
|
|
||||||
const onRefresh = () => {
|
const onRefresh = () => {
|
||||||
setRefreshing(true);
|
setRefreshing(true);
|
||||||
fetchProducts();
|
// Le rechargement des produits est déclenché par l'effet ci-dessus
|
||||||
|
// dès que `categories` change (nouvelle référence à chaque appel).
|
||||||
|
loadCategories();
|
||||||
};
|
};
|
||||||
|
|
||||||
const styles = useMemo(
|
const styles = useMemo(
|
||||||
|
|||||||
Reference in New Issue
Block a user