fix(ui): thème, textes et lisibilité restants de la revue
All checks were successful
CI / Lint, Unit Tests & Build (push) Successful in 6m57s
CI / Deploy production (on server) (push) Successful in 24s

Les boutons suivent la couleur d’apparence, les libellés trop petits ou trop techniques sont clarifiés, et le catalogue des fournisseurs se met à jour tout seul.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Antigravity
2026-08-30 21:13:07 +00:00
parent ebf6f16fde
commit afbb0dfc2d
77 changed files with 2842 additions and 1546 deletions

View File

@@ -0,0 +1,56 @@
/** Avance une date dun mois, en gardant le jour du mois (ou le dernier jour si besoin). */
export function addUtcMonths(date: Date, months: number): Date {
const year = date.getUTCFullYear()
const month = date.getUTCMonth() + months
const day = date.getUTCDate()
const lastDay = new Date(Date.UTC(year, month + 1, 0)).getUTCDate()
return new Date(Date.UTC(
year,
month,
Math.min(day, lastDay),
date.getUTCHours(),
date.getUTCMinutes(),
date.getUTCSeconds(),
date.getUTCMilliseconds(),
))
}
/**
* Recalcule la période en cours à partir de la date dorigine.
* Sans fiche de paiement, les dates étaient écrites une fois (souvent +1 an) et ne bougeaient plus.
*/
export function rollBillingPeriod(
periodStart: Date,
now: Date = new Date(),
): { currentPeriodStart: Date; currentPeriodEnd: Date } {
if (Number.isNaN(periodStart.getTime())) {
const start = new Date(now)
return { currentPeriodStart: start, currentPeriodEnd: addUtcMonths(start, 1) }
}
let start = new Date(periodStart)
let end = addUtcMonths(start, 1)
if (start.getTime() > now.getTime()) {
return { currentPeriodStart: start, currentPeriodEnd: end }
}
let guard = 0
while (end.getTime() <= now.getTime() && guard < 240) {
start = end
end = addUtcMonths(start, 1)
guard += 1
}
return { currentPeriodStart: start, currentPeriodEnd: end }
}
export function periodsDiffer(
a: { currentPeriodStart: Date; currentPeriodEnd: Date },
b: { currentPeriodStart: Date; currentPeriodEnd: Date },
): boolean {
return (
a.currentPeriodStart.getTime() !== b.currentPeriodStart.getTime()
|| a.currentPeriodEnd.getTime() !== b.currentPeriodEnd.getTime()
)
}