Browse Source

Added total priner hours to printer card

Martin Ziegler 5 months ago
parent
commit
16bb3d488a

+ 11 - 1
frontend/src/pages/PrintersPage.tsx

@@ -87,6 +87,7 @@ function CoverImage({ url, printName }: { url: string | null; printName?: string
 interface PrinterMaintenanceInfo {
   due_count: number;
   warning_count: number;
+  total_print_hours: number;
 }
 
 function PrinterCard({
@@ -175,7 +176,15 @@ function PrinterCard({
         <div className="flex items-start justify-between mb-4">
           <div>
             <h3 className="text-lg font-semibold text-white">{printer.name}</h3>
-            <p className="text-sm text-bambu-gray">{printer.model || 'Unknown Model'}</p>
+            <p className="text-sm text-bambu-gray">
+              {printer.model || 'Unknown Model'}
+              {maintenanceInfo && maintenanceInfo.total_print_hours > 0 && (
+                <span className="ml-2 text-bambu-gray">
+                  <Clock className="w-3 h-3 inline-block mr-1" />
+                  {Math.round(maintenanceInfo.total_print_hours)}h
+                </span>
+              )}
+            </p>
           </div>
           <div className="flex items-center gap-2">
             <span
@@ -726,6 +735,7 @@ export function PrintersPage() {
       acc[overview.printer_id] = {
         due_count: overview.due_count,
         warning_count: overview.warning_count,
+        total_print_hours: overview.total_print_hours,
       };
       return acc;
     },

File diff suppressed because it is too large
+ 0 - 0
static/assets/index-4olH2ask.css


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


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


+ 2 - 2
static/index.html

@@ -7,8 +7,8 @@
     <link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png" />
     <link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png" />
     <link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png" />
-    <script type="module" crossorigin src="/assets/index-eHK2TMOH.js"></script>
-    <link rel="stylesheet" crossorigin href="/assets/index-BF_tKqob.css">
+    <script type="module" crossorigin src="/assets/index-soeWpmRO.js"></script>
+    <link rel="stylesheet" crossorigin href="/assets/index-4olH2ask.css">
   </head>
   <body>
     <div id="root"></div>

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