diff --git a/frontend/src/pages/MonCompte.jsx b/frontend/src/pages/MonCompte.jsx
index 7aa1171..f9fd27e 100644
--- a/frontend/src/pages/MonCompte.jsx
+++ b/frontend/src/pages/MonCompte.jsx
@@ -506,28 +506,57 @@ function fmtRelative(isoStr) {
return d.toLocaleDateString('fr-FR', { day: '2-digit', month: '2-digit', year: 'numeric' });
}
+function parseBrowser(ua) {
+ if (/CriOS\//i.test(ua)) return 'Chrome ' + (ua.match(/CriOS\/(\d+)/)?.[1] || ''); // Chrome sur iOS
+ if (/FxiOS\//i.test(ua)) return 'Firefox ' + (ua.match(/FxiOS\/(\d+)/)?.[1] || ''); // Firefox sur iOS
+ if (/EdgiOS\//i.test(ua)) return 'Edge ' + (ua.match(/EdgiOS\/(\d+)/)?.[1] || ''); // Edge sur iOS
+ if (/OPR\//i.test(ua)) return 'Opera ' + (ua.match(/OPR\/(\d+)/)?.[1] || '');
+ if (/Edg\//i.test(ua)) return 'Edge ' + (ua.match(/Edg\/(\d+)/)?.[1] || '');
+ if (/Chrome\//i.test(ua)) return 'Chrome ' + (ua.match(/Chrome\/(\d+)/)?.[1] || '');
+ if (/Firefox\//i.test(ua)) return 'Firefox ' + (ua.match(/Firefox\/(\d+)/)?.[1] || '');
+ if (/Safari\//i.test(ua)) return 'Safari ' + (ua.match(/Version\/(\d+)/)?.[1] || '');
+ return '';
+}
+
function parseUA(ua) {
- if (!ua) return { device: 'Inconnu', browser: '', icon: 'desktop' };
- const isMobile = /mobile|android|iphone|ipad/i.test(ua);
- let browser = 'Navigateur inconnu';
- if (/Edg\//i.test(ua)) browser = 'Edge ' + (ua.match(/Edg\/([\d.]+)/)?.[1]?.split('.')[0] || '');
- else if (/Chrome\//i.test(ua)) browser = 'Chrome ' + (ua.match(/Chrome\/([\d.]+)/)?.[1]?.split('.')[0] || '');
- else if (/Firefox\//i.test(ua)) browser = 'Firefox ' + (ua.match(/Firefox\/([\d.]+)/)?.[1]?.split('.')[0] || '');
- else if (/Safari\//i.test(ua)) browser = 'Safari ' + (ua.match(/Version\/([\d.]+)/)?.[1]?.split('.')[0] || '');
+ if (!ua) return { device: 'Inconnu', icon: 'desktop' };
+ const br = parseBrowser(ua);
+ const suffix = br ? ` — ${br}` : '';
+
+ // ── iOS ─────────────────────────────────────────────────────────────────
+ if (/iPhone/i.test(ua)) return { device: `iPhone${suffix}`, icon: 'mobile' };
+ if (/iPad/i.test(ua)) return { device: `iPad${suffix}`, icon: 'tablet' };
+
+ // ── Android ─────────────────────────────────────────────────────────────
+ if (/Android/i.test(ua)) {
+ // Extrait "Pixel 9 Pro" / "SM-S918B" / etc. depuis "; DEVICE Build/" ou "; DEVICE)"
+ const m = ua.match(/Android[\s/][\d.]+;\s*([^;)]+?)(?:\s+Build\/|\s*\))/i);
+ const devName = m ? m[1].trim() : 'Android';
+ const isTablet = /tablet/i.test(ua) || !/mobile/i.test(ua);
+ return { device: `${devName}${suffix}`, icon: isTablet ? 'tablet' : 'mobile' };
+ }
+
+ // ── Desktop ─────────────────────────────────────────────────────────────
let os = 'Inconnu';
- if (/Windows/i.test(ua)) os = 'Windows';
- else if (/Macintosh/i.test(ua)) os = 'Mac';
- else if (/Linux/i.test(ua)) os = 'Linux';
- else if (/Android/i.test(ua)) os = 'Android';
- else if (/iPhone|iPad/i.test(ua)) os = 'iOS';
- return { device: os + (browser ? ' — ' + browser : ''), icon: isMobile ? 'mobile' : 'desktop' };
+ if (/Windows NT 10\.0/i.test(ua)) os = 'Windows 10/11';
+ else if (/Windows/i.test(ua)) os = 'Windows';
+ else if (/Macintosh/i.test(ua)) os = 'Mac';
+ else if (/CrOS/i.test(ua)) os = 'ChromeOS';
+ else if (/Linux/i.test(ua)) os = 'Linux';
+ return { device: `${os}${suffix}`, icon: 'desktop' };
}
function DeviceIcon({ type }) {
if (type === 'mobile') return (
+ );
+ if (type === 'tablet') return (
+
);
return (