feat: add reset buttons for heures/jours/doses stats, fix home button color
Frontend Admin - EAS Build / build (push) Failing after 59m23s
Frontend Client - EAS Build / build (push) Failing after 57m18s

- StatsScreen: SectionResetBtn for heures d'affluence, jours d'affluence, doses populaires
- api_admin.ts: extend StatSection and AdminStats with heures/jours/doses fields
- HomeScreen (mobile client): use colors.accent for Se connecter button

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 21:54:41 +02:00
co-authored by Claude Sonnet 4.6
parent 68bd0d57d6
commit 70988be353
3 changed files with 20 additions and 3 deletions
+4 -1
View File
@@ -104,7 +104,7 @@ export interface ProductQuantityBreakdown {
quantities: QuantityStat[];
}
export type StatSection = "commandes" | "revenus" | "produits";
export type StatSection = "commandes" | "revenus" | "produits" | "heures" | "jours" | "doses";
export interface AdminStats {
summary: StatsSummary;
@@ -117,6 +117,9 @@ export interface AdminStats {
reset_at_commandes?: string;
reset_at_revenus?: string;
reset_at_produits?: string;
reset_at_heures?: string;
reset_at_jours?: string;
reset_at_doses?: string;
}
export const getAdminStats = async (): Promise<AdminStats> => {
@@ -395,6 +395,11 @@ export default function StatsScreen() {
const hourMax = maxOf(hourData.map((h) => h.count));
return (
<Section title="Heures d'affluence" icon="time-outline">
<SectionResetBtn
onPress={() => handleReset("heures", "Heures d'affluence")}
loading={resetting === "heures"}
resetAt={stats?.reset_at_heures}
/>
{hourData.some((h) => h.count > 0) ? (
<>
{hourData.map((h) => (
@@ -428,6 +433,11 @@ export default function StatsScreen() {
{/* ── Commandes par jour de la semaine ── */}
<Section title="Jours d'affluence" icon="calendar-outline">
<SectionResetBtn
onPress={() => handleReset("jours", "Jours d'affluence")}
loading={resetting === "jours"}
resetAt={stats?.reset_at_jours}
/>
{(stats?.by_weekday ?? []).map((w: WeekdayStat) => (
<HBar
key={w.weekday}
@@ -456,6 +466,11 @@ export default function StatsScreen() {
if (!qtyData.length) return null;
return (
<Section title="Doses populaires par produit" icon="flask-outline">
<SectionResetBtn
onPress={() => handleReset("doses", "Doses populaires")}
loading={resetting === "doses"}
resetAt={stats?.reset_at_doses}
/>
{qtyData.map((product) => {
const peakCount = product.quantities[0]?.order_count ?? 1;
return (
+1 -2
View File
@@ -22,7 +22,7 @@ export default function HomeScreen({ navigation }: Props) {
</Text>
<TouchableOpacity
style={styles.button}
style={[styles.button, { backgroundColor: colors.accent }]}
onPress={() => navigation.navigate("login")}
>
<Text style={styles.buttonText}>Se connecter</Text>
@@ -58,7 +58,6 @@ const styles = StyleSheet.create({
textAlign: "center",
},
button: {
backgroundColor: "#7c3aed",
borderRadius: 8,
paddingVertical: 12,
paddingHorizontal: 24,