chore: v1.0.0
Omnex Plateform App - EAS Build / build (push) Failing after 8m4s

This commit is contained in:
Xor290
2026-08-04 18:47:47 +02:00
parent 736ec86747
commit 877291e684
69 changed files with 35272 additions and 0 deletions
@@ -0,0 +1,30 @@
import type { Colors } from "../theme/colors";
export const STATUS_LABELS: Record<string, string> = {
pending: "En attente",
assigned: "Assignée",
en_route: "En route",
arrived: "Arrivée",
livre: "Livrée",
delivered: "Livré",
approved: "Terminée",
cancelled: "Annulé",
available: "Disponible",
busy: "Occupé",
offline: "Hors ligne",
};
export const getStatusColors = (colors: Colors): Record<string, string> => ({
pending: colors.warning,
assigned: colors.info,
en_route: colors.info,
arrived: colors.accent,
livre: colors.success,
delivered: colors.success,
approved: colors.successDark,
cancelled: colors.danger,
available: colors.success,
busy: colors.warning,
offline: colors.textMuted,
});
@@ -0,0 +1,36 @@
const PROTOCOL_RE = /^https?:\/\//i;
// Hostname label: alnum, may contain hyphens but not at the edges.
const HOST_RE =
/^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
const isValidPort = (port: string) => {
if (!/^\d{1,5}$/.test(port)) return false;
const n = Number(port);
return n >= 1 && n <= 65535;
};
// Accepts either a full URL ("https://exemple.com", "http://exemple.com:8080")
// or a bare host/IP with a port ("192.168.1.10:8000", "exemple.com:3000").
// Returns a normalized absolute base URL, or null if the input is invalid.
export function normalizeServerUrl(raw: string): string | null {
const trimmed = raw.trim();
if (!trimmed) return null;
const hasProtocol = PROTOCOL_RE.test(trimmed);
const withoutProtocol = trimmed.replace(PROTOCOL_RE, "");
const withoutTrailingSlash = withoutProtocol.replace(/\/+$/, "");
const parts = withoutTrailingSlash.split(":");
if (parts.length > 2) return null; // unsupported (e.g. raw IPv6)
const [host, port] = parts;
if (!host || !HOST_RE.test(host)) return null;
if (port !== undefined && !isValidPort(port)) return null;
const protocol = hasProtocol
? trimmed.match(PROTOCOL_RE)![0].toLowerCase()
: "http://";
return `${protocol}${withoutTrailingSlash}`;
}