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