update
This commit is contained in:
@@ -269,30 +269,45 @@ export default function StatsScreen() {
|
||||
</Section>
|
||||
|
||||
{/* ── Revenus par jour (30 jours) ── */}
|
||||
<Section title="Revenus par jour (30j)" icon="trending-up-outline">
|
||||
{stats?.by_day_revenue?.length ? (
|
||||
<>
|
||||
<SparkLineRevenue data={stats.by_day_revenue} color={CHART_GREEN} />
|
||||
{(() => {
|
||||
const best = [...(stats.by_day_revenue ?? [])].sort((a, b) => b.revenue - a.revenue)[0];
|
||||
if (!best) return null;
|
||||
return (
|
||||
<View style={{ flexDirection: "row", alignItems: "center", gap: spacing.xs, marginTop: spacing.s }}>
|
||||
<Ionicons name="star-outline" size={13} color={CHART_GREEN} />
|
||||
<Text style={{ color: colors.textMuted, fontSize: fontSize.xs }}>
|
||||
Meilleure journée :{" "}
|
||||
<Text style={{ color: CHART_GREEN, fontWeight: "600" }}>
|
||||
{best.label} · {fmtEuro(best.revenue)}
|
||||
</Text>
|
||||
</Text>
|
||||
{(() => {
|
||||
const revData = stats?.by_day_revenue ?? [];
|
||||
const revMax = Math.max(...revData.map((d) => d.revenue), 1);
|
||||
const best = [...revData].sort((a, b) => b.revenue - a.revenue)[0];
|
||||
return (
|
||||
<Section title="Revenus par jour (30j)" icon="trending-up-outline">
|
||||
{revData.length ? (
|
||||
<>
|
||||
<SparkLineRevenue data={revData} color={CHART_GREEN} />
|
||||
<View style={{ marginTop: spacing.m }}>
|
||||
{[...revData].reverse().map((d) => (
|
||||
<HBar
|
||||
key={d.day}
|
||||
label={d.label}
|
||||
value={d.revenue}
|
||||
max={revMax}
|
||||
color={best && d.day === best.day ? CHART_GREEN : CHART_ACCENT + "bb"}
|
||||
right={fmtEuro(d.revenue)}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
);
|
||||
})()}
|
||||
</>
|
||||
) : (
|
||||
<Text style={styles.emptyText}>Aucune donnée de revenu</Text>
|
||||
)}
|
||||
</Section>
|
||||
{best && (
|
||||
<View style={{ flexDirection: "row", alignItems: "center", gap: spacing.xs, marginTop: spacing.s }}>
|
||||
<Ionicons name="star-outline" size={13} color={CHART_GREEN} />
|
||||
<Text style={{ color: colors.textMuted, fontSize: fontSize.xs }}>
|
||||
Meilleure journée :{" "}
|
||||
<Text style={{ color: CHART_GREEN, fontWeight: "600" }}>
|
||||
{best.label} · {fmtEuro(best.revenue)}
|
||||
</Text>
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<Text style={styles.emptyText}>Aucune donnée de revenu</Text>
|
||||
)}
|
||||
</Section>
|
||||
);
|
||||
})()}
|
||||
|
||||
{/* ── Heures d'affluence ── */}
|
||||
{(() => {
|
||||
|
||||
Reference in New Issue
Block a user