codacus commited on
Commit
995fb81
·
unverified ·
2 Parent(s): 9766763 c2766cb

Merge pull request #760 from Stijnus/main

Browse files

fix: UI bug debug tab : System Information

app/commit.json CHANGED
@@ -1 +1 @@
1
- { "commit": "78505ed2f347dd3a7778b4c1c7c38c89ecacedd3" , "version": "" }
 
1
+ { "commit": "f752bf7da532ec6196dafff1c388250d44db4de5" , "version": "" }
app/components/settings/debug/DebugTab.tsx CHANGED
@@ -22,6 +22,12 @@ interface SystemInfo {
22
  timezone: string;
23
  memory: string;
24
  cores: number;
 
 
 
 
 
 
25
  }
26
 
27
  interface IProviderConfig {
@@ -62,14 +68,100 @@ function getSystemInfo(): SystemInfo {
62
  return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
63
  };
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  return {
66
- os: navigator.platform,
67
- browser: navigator.userAgent.split(' ').slice(-1)[0],
68
  screen: `${window.screen.width}x${window.screen.height}`,
69
  language: navigator.language,
70
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
71
- memory: formatBytes(performance?.memory?.jsHeapSizeLimit || 0),
72
  cores: navigator.hardwareConcurrency || 0,
 
 
 
 
 
 
 
 
73
  };
74
  }
75
 
@@ -384,10 +476,31 @@ export default function DebugTab() {
384
  <p className="text-xs text-bolt-elements-textSecondary">Operating System</p>
385
  <p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.os}</p>
386
  </div>
 
 
 
 
387
  <div>
388
  <p className="text-xs text-bolt-elements-textSecondary">Browser</p>
389
  <p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.browser}</p>
390
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  <div>
392
  <p className="text-xs text-bolt-elements-textSecondary">Screen Resolution</p>
393
  <p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.screen}</p>
 
22
  timezone: string;
23
  memory: string;
24
  cores: number;
25
+ deviceType: string;
26
+ colorDepth: string;
27
+ pixelRatio: number;
28
+ online: boolean;
29
+ cookiesEnabled: boolean;
30
+ doNotTrack: boolean;
31
  }
32
 
33
  interface IProviderConfig {
 
68
  return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
69
  };
70
 
71
+ const getBrowserInfo = (): string => {
72
+ const ua = navigator.userAgent;
73
+ let browser = 'Unknown';
74
+
75
+ if (ua.includes('Firefox/')) {
76
+ browser = 'Firefox';
77
+ } else if (ua.includes('Chrome/')) {
78
+ if (ua.includes('Edg/')) {
79
+ browser = 'Edge';
80
+ } else if (ua.includes('OPR/')) {
81
+ browser = 'Opera';
82
+ } else {
83
+ browser = 'Chrome';
84
+ }
85
+ } else if (ua.includes('Safari/')) {
86
+ if (!ua.includes('Chrome')) {
87
+ browser = 'Safari';
88
+ }
89
+ }
90
+
91
+ // Extract version number
92
+ const match = ua.match(new RegExp(`${browser}\\/([\\d.]+)`));
93
+ const version = match ? ` ${match[1]}` : '';
94
+
95
+ return `${browser}${version}`;
96
+ };
97
+
98
+ const getOperatingSystem = (): string => {
99
+ const ua = navigator.userAgent;
100
+ const platform = navigator.platform;
101
+
102
+ if (ua.includes('Win')) {
103
+ return 'Windows';
104
+ }
105
+
106
+ if (ua.includes('Mac')) {
107
+ if (ua.includes('iPhone') || ua.includes('iPad')) {
108
+ return 'iOS';
109
+ }
110
+
111
+ return 'macOS';
112
+ }
113
+
114
+ if (ua.includes('Linux')) {
115
+ return 'Linux';
116
+ }
117
+
118
+ if (ua.includes('Android')) {
119
+ return 'Android';
120
+ }
121
+
122
+ return platform || 'Unknown';
123
+ };
124
+
125
+ const getDeviceType = (): string => {
126
+ const ua = navigator.userAgent;
127
+
128
+ if (ua.includes('Mobile')) {
129
+ return 'Mobile';
130
+ }
131
+
132
+ if (ua.includes('Tablet')) {
133
+ return 'Tablet';
134
+ }
135
+
136
+ return 'Desktop';
137
+ };
138
+
139
+ // Get more detailed memory info if available
140
+ const getMemoryInfo = (): string => {
141
+ if ('memory' in performance) {
142
+ const memory = (performance as any).memory;
143
+ return `${formatBytes(memory.jsHeapSizeLimit)} (Used: ${formatBytes(memory.usedJSHeapSize)})`;
144
+ }
145
+
146
+ return 'Not available';
147
+ };
148
+
149
  return {
150
+ os: getOperatingSystem(),
151
+ browser: getBrowserInfo(),
152
  screen: `${window.screen.width}x${window.screen.height}`,
153
  language: navigator.language,
154
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
155
+ memory: getMemoryInfo(),
156
  cores: navigator.hardwareConcurrency || 0,
157
+ deviceType: getDeviceType(),
158
+
159
+ // Add new fields
160
+ colorDepth: `${window.screen.colorDepth}-bit`,
161
+ pixelRatio: window.devicePixelRatio,
162
+ online: navigator.onLine,
163
+ cookiesEnabled: navigator.cookieEnabled,
164
+ doNotTrack: navigator.doNotTrack === '1',
165
  };
166
  }
167
 
 
476
  <p className="text-xs text-bolt-elements-textSecondary">Operating System</p>
477
  <p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.os}</p>
478
  </div>
479
+ <div>
480
+ <p className="text-xs text-bolt-elements-textSecondary">Device Type</p>
481
+ <p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.deviceType}</p>
482
+ </div>
483
  <div>
484
  <p className="text-xs text-bolt-elements-textSecondary">Browser</p>
485
  <p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.browser}</p>
486
  </div>
487
+ <div>
488
+ <p className="text-xs text-bolt-elements-textSecondary">Display</p>
489
+ <p className="text-sm font-medium text-bolt-elements-textPrimary">
490
+ {systemInfo.screen} ({systemInfo.colorDepth}) @{systemInfo.pixelRatio}x
491
+ </p>
492
+ </div>
493
+ <div>
494
+ <p className="text-xs text-bolt-elements-textSecondary">Connection</p>
495
+ <p className="text-sm font-medium flex items-center gap-2">
496
+ <span
497
+ className={`inline-block w-2 h-2 rounded-full ${systemInfo.online ? 'bg-green-500' : 'bg-red-500'}`}
498
+ />
499
+ <span className={`${systemInfo.online ? 'text-green-600' : 'text-red-600'}`}>
500
+ {systemInfo.online ? 'Online' : 'Offline'}
501
+ </span>
502
+ </p>
503
+ </div>
504
  <div>
505
  <p className="text-xs text-bolt-elements-textSecondary">Screen Resolution</p>
506
  <p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.screen}</p>