Browse Source

- Fixed maintenance interval display on status page

maziggy 4 months ago
parent
commit
d3686a1b60
3 changed files with 14 additions and 4 deletions
  1. 13 3
      frontend/src/pages/MaintenancePage.tsx
  2. 0 0
      static/assets/index-DhHo5MXv.js
  3. 1 1
      static/index.html

+ 13 - 3
frontend/src/pages/MaintenancePage.tsx

@@ -76,12 +76,22 @@ function formatDuration(value: number, type: 'hours' | 'days'): string {
     if (value < 1) return 'Today';
     if (value === 1) return '1 day';
     if (value < 7) return `${Math.round(value)} days`;
-    if (value < 30) return `${Math.round(value / 7)} weeks`;
+    // Show weeks for anything under 6 months for better precision
+    if (value < 180) return `${Math.round(value / 7)} weeks`;
+    // 6+ months show as months
     return `${Math.round(value / 30)} months`;
   } else {
+    // Print hours - convert to readable units
     if (value < 1) return `${Math.round(value * 60)}m`;
-    if (value < 10) return `${value.toFixed(1)}h`;
-    return `${Math.round(value)}h`;
+    if (value < 24) return `${value < 10 ? value.toFixed(1) : Math.round(value)}h`;
+    // 24+ hours: show as days of print time
+    const days = value / 24;
+    if (days < 7) return `${days < 2 ? days.toFixed(1) : Math.round(days)}d`;
+    // 7+ days: show as weeks of print time
+    const weeks = days / 7;
+    if (weeks < 12) return `${weeks < 2 ? weeks.toFixed(1) : Math.round(weeks)}w`;
+    // 12+ weeks: show as months of print time
+    return `${Math.round(weeks / 4)}mo`;
   }
 }
 

File diff suppressed because it is too large
+ 0 - 0
static/assets/index-DhHo5MXv.js


+ 1 - 1
static/index.html

@@ -23,7 +23,7 @@
 
     <!-- Splash screens for iOS -->
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
-    <script type="module" crossorigin src="/assets/index-CA7HMY_J.js"></script>
+    <script type="module" crossorigin src="/assets/index-DhHo5MXv.js"></script>
     <link rel="stylesheet" crossorigin href="/assets/index-CCbBv2VC.css">
   </head>
   <body>

Some files were not shown because too many files changed in this diff