Browse Source

Additional fixes made:
- Comprehensive hex-based color mapping (~200 Bambu colors from CSV)
- Fixed tooltips to use Bambu color lookup
- Widened modals (max-w-md → max-w-lg)
- Adjusted grid layout to fit long color names
- Service worker bumped to v21

Pending changes in bambuddy repo:
- CHANGELOG.md, README.md
- backend/app/api/routes/print_queue.py
- backend/tests/integration/test_print_queue_api.py
- frontend components (ReprintModal, AddToQueueModal, EditQueueItemModal)
- sw.js (v21)

maziggy 4 months ago
parent
commit
56cfdc50a0

+ 1 - 1
CHANGELOG.md

@@ -12,7 +12,7 @@ All notable changes to Bambuddy will be documented in this file.
   - Blue ring indicator shows manually selected slots vs auto-matched
   - Status indicators: green (match), yellow (type only), orange (not found)
   - Re-read button to refresh AMS status if spools were swapped
-  - Color names shown in dropdowns (decoded from Bambu filament codes or derived from hex)
+  - Color names shown in dropdowns and tooltips (decoded from Bambu filament codes or derived from hex)
 
 ## [0.1.6b9] - 2026-01-09
 

+ 1 - 1
README.md

@@ -49,7 +49,7 @@
 - Duplicate detection & full-text search
 - Photo attachments & failure analysis
 - Timelapse editor (trim, speed, music)
-- Re-print to any connected printer with AMS filament preview
+- Re-print to any connected printer with AMS mapping (auto-match or manual slot selection)
 - Archive comparison (side-by-side diff)
 
 ### 📊 Monitoring & Control

+ 23 - 4
backend/app/api/routes/print_queue.py

@@ -27,13 +27,32 @@ router = APIRouter(prefix="/queue", tags=["queue"])
 
 def _enrich_response(item: PrintQueueItem) -> PrintQueueItemResponse:
     """Add nested archive/printer info to response."""
-    response = PrintQueueItemResponse.model_validate(item)
-    # Parse ams_mapping from JSON string
+    # Parse ams_mapping from JSON string BEFORE model_validate
+    ams_mapping_parsed = None
     if item.ams_mapping:
         try:
-            response.ams_mapping = json.loads(item.ams_mapping)
+            ams_mapping_parsed = json.loads(item.ams_mapping)
         except json.JSONDecodeError:
-            response.ams_mapping = None
+            ams_mapping_parsed = None
+
+    # Create response with parsed ams_mapping
+    item_dict = {
+        "id": item.id,
+        "printer_id": item.printer_id,
+        "archive_id": item.archive_id,
+        "position": item.position,
+        "scheduled_time": item.scheduled_time,
+        "require_previous_success": item.require_previous_success,
+        "auto_off_after": item.auto_off_after,
+        "manual_start": item.manual_start,
+        "ams_mapping": ams_mapping_parsed,
+        "status": item.status,
+        "started_at": item.started_at,
+        "completed_at": item.completed_at,
+        "error_message": item.error_message,
+        "created_at": item.created_at,
+    }
+    response = PrintQueueItemResponse(**item_dict)
     if item.archive:
         response.archive_name = item.archive.print_name or item.archive.filename
         response.archive_thumbnail = item.archive.thumbnail_path

+ 21 - 0
backend/tests/integration/test_print_queue_api.py

@@ -147,6 +147,27 @@ class TestPrintQueueAPI:
         assert result["status"] == "pending"
         assert result["manual_start"] is True
 
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_add_to_queue_with_ams_mapping(
+        self, async_client: AsyncClient, printer_factory, archive_factory, db_session
+    ):
+        """Verify item can be added to queue with ams_mapping."""
+        printer = await printer_factory()
+        archive = await archive_factory()
+
+        data = {
+            "printer_id": printer.id,
+            "archive_id": archive.id,
+            "ams_mapping": [5, -1, 2, -1],  # Slot 1 -> tray 5, slot 3 -> tray 2
+        }
+        response = await async_client.post("/api/v1/queue/", json=data)
+        assert response.status_code == 200
+        result = response.json()
+        assert result["printer_id"] == printer.id
+        assert result["archive_id"] == archive.id
+        assert result["ams_mapping"] == [5, -1, 2, -1]
+
     @pytest.mark.asyncio
     @pytest.mark.integration
     async def test_get_queue_item(self, async_client: AsyncClient, queue_item_factory, db_session):

+ 2 - 2
frontend/public/sw.js

@@ -1,6 +1,6 @@
 // Bambuddy Service Worker
-const CACHE_NAME = 'bambuddy-v19';
-const STATIC_CACHE = 'bambuddy-static-v19';
+const CACHE_NAME = 'bambuddy-v21';
+const STATIC_CACHE = 'bambuddy-static-v21';
 
 // Static assets to cache on install
 const STATIC_ASSETS = [

+ 61 - 32
frontend/src/components/AddToQueueModal.tsx

@@ -7,36 +7,65 @@ import { Card, CardContent } from './Card';
 import { Button } from './Button';
 import { useToast } from '../contexts/ToastContext';
 
-// Bambu Lab filament color mapping by tray_id_name (subset of most common)
-const BAMBU_COLORS: Record<string, string> = {
-  'A00-W1': 'Jade White', 'A00-Y2': 'Sunflower Yellow', 'A00-R0': 'Red', 'A00-K0': 'Black',
-  'A00-G1': 'Bambu Green', 'A00-B3': 'Cobalt Blue', 'A00-D0': 'Gray', 'A00-D3': 'Dark Gray',
-  'A01-W2': 'Ivory White', 'A01-R1': 'Scarlet Red', 'A01-G1': 'Grass Green', 'A01-B3': 'Marine Blue',
-  'G02-W0': 'White', 'G02-K0': 'Black', 'G02-R0': 'Red', 'G02-D0': 'Gray', 'G02-B0': 'Blue',
-  'B00-W0': 'White', 'B00-K0': 'Black', 'B00-R0': 'Red',
+// Bambu Lab filament hex color to name mapping (from bambu-color-names.csv)
+const BAMBU_HEX_COLORS: Record<string, string> = {
+  '000000': 'Black', '001489': 'Blue', '002e96': 'Blue', '0047bb': 'Blue', '00482b': 'Pine Green',
+  '004ea8': 'Blue', '0056b8': 'Cobalt Blue', '0069b1': 'Lake Blue', '0072ce': 'Blue', '0078bf': 'Marine Blue',
+  '0085ad': 'Light Blue', '0086d6': 'Cyan', '008bda': 'Blue', '009639': 'Green', '009bd8': 'Cyan',
+  '009fa1': 'Teal', '00a6a0': 'Green', '00ae42': 'Bambu Green', '00b1b7': 'Turquoise', '00bb31': 'Green',
+  '018814': 'Candy Green', '042f56': 'Dark Blue', '0a2989': 'Blue', '0a2ca5': 'Blue', '0c2340': 'Navy Blue',
+  '0c3b95': 'Blue', '101820': 'Black', '147bd1': 'Blue', '164b35': 'Green', '16b08e': 'Malachite Green',
+  '1d7c6a': 'Oxide Green Metallic', '1f79e5': 'Lake Blue', '2140b4': 'Blue', '25282a': 'Black', '2842ad': 'Royal Blue',
+  '2d2b28': 'Onyx Black Sparkle', '324585': 'Indigo Blue', '353533': 'Gray', '39541a': 'Forest Green',
+  '39699e': 'Cobalt Blue Metallic', '3b665e': 'Green', '3f5443': 'Alpine Green Sparkle', '3f8e43': 'Mistletoe Green',
+  '424379': 'Nebulae', '43403d': 'Iron Gray Metallic', '482960': 'Indigo Purple', '483d8b': 'Royal Purple Sparkle',
+  '489fdf': 'Azure', '4c241c': 'Rosewood', '4ce4a0': 'Green', '4d3324': 'Dark Chocolate', '4d5054': 'Lava Gray',
+  '4dafda': 'Cyan', '4f3f24': 'Black Walnut', '515151': 'Dark Gray', '515a6c': 'Gray', '545454': 'Dark Gray',
+  '565656': 'Titan Gray', '56b7e6': 'Sky Blue', '583061': 'Violet Purple', '5898dd': 'Blue', '594177': 'Purple',
+  '5b492f': 'Brown', '5b6579': 'Blue Gray', '5c9748': 'Matcha Green', '5e43b7': 'Purple', '5e4b3c': 'Copper',
+  '5f6367': 'Titan Gray', '61b0ff': 'Translucent Light Blue', '61bf36': 'Green', '61c680': 'Grass Green',
+  '6667ab': 'Lavender Blue', '684a43': 'Brown', '686865': 'Black', '68724d': 'Dark Green', '688197': 'Blue Gray',
+  '69398e': 'Iris Purple', '6e88bc': 'Jeans Blue', '6ee53c': 'Lime Green', '6f5034': 'Cocoa Brown', '7248bd': 'Lavender',
+  '748c45': 'Translucent Olive', '757575': 'Nardo Gray', '75aed8': 'Blue', '77edd7': 'Translucent Teal', '789d4a': 'Olive',
+  '792b36': 'Crimson Red Sparkle', '7ac0e9': 'Glow Blue', '7ae1bf': 'Mint', '7cd82b': 'Lime Green', '7d6556': 'Dark Brown',
+  '8344b0': 'Purple', '847d48': 'Bronze', '854ce4': 'Purple', '8671cb': 'Purple', '875718': 'Peanut Brown',
+  '87909a': 'Silver', '898d8d': 'Gray', '8a949e': 'Gray', '8e8e8e': 'Translucent Gray', '8e9089': 'Gray',
+  '90ff1a': 'Neon Green', '918669': 'Classic Birch', '939393': 'Gray', '950051': 'Plum', '951e23': 'Burgundy Red',
+  '959698': 'Silver', '96d8af': 'Light Jade', '96dcb9': 'Mint', '995f11': 'Clay Brown', '999d9d': 'Gray',
+  '9b9ea0': 'Ash Gray', '9d2235': 'Maroon Red', '9d432c': 'Brown', '9e007e': 'Purple', '9ea2a2': 'Gray',
+  '9f332a': 'Brick Red', 'a1ffac': 'Glow Green', 'a3d8e1': 'Ice Blue', 'a6a9aa': 'Silver', 'a8a8aa': 'Gray',
+  'a8c6ee': 'Baby Blue', 'aa6443': 'Copper Brown Metallic', 'ad4e38': 'Red Granite', 'adb1b2': 'Gray',
+  'ae835b': 'Caramel', 'ae96d4': 'Lilac Purple', 'af1685': 'Purple', 'afb1ae': 'Gray', 'b15533': 'Terracotta',
+  'b28b33': 'Gold', 'b39b84': 'Iridium Gold Metallic', 'b50011': 'Red', 'b8acd6': 'Lavender', 'b8cde9': 'Ice Blue',
+  'ba9594': 'Rose Gold', 'bb3d43': 'Dark Red', 'bc0900': 'Red', 'becf00': 'Bright Green', 'c0df16': 'Green',
+  'c12e1f': 'Red', 'c2e189': 'Apple Green', 'c3e2d6': 'Light Cyan', 'c5ed48': 'Lime', 'c6001a': 'Red',
+  'c6c6c6': 'Gray', 'c8102e': 'Red', 'c8c8c8': 'Silver', 'c98935': 'Ochre Yellow', 'c9a381': 'Translucent Brown',
+  'cbc6b8': 'Bone White', 'cdceca': 'Gray', 'cea629': 'Classic Gold Sparkle', 'd02727': 'Candy Red',
+  'd1d3d5': 'Light Gray', 'd32941': 'Red', 'd3b7a7': 'Latte Brown', 'd6001c': 'Red', 'd6abff': 'Translucent Purple',
+  'd6cca3': 'White Oak', 'dc3a27': 'Orange', 'dd3c22': 'Vermilion Red', 'de4343': 'Scarlet Red', 'dfd1a7': 'Beige',
+  'e02928': 'Red', 'e4bd68': 'Gold', 'e5b03d': 'Gold', 'e83100': 'Red', 'e8afcf': 'Sakura Pink', 'e8dbb7': 'Desert Tan',
+  'eaeae4': 'White', 'eaeceb': 'Silver', 'ec008c': 'Magenta', 'ed0000': 'Red', 'eeb1c1': 'Pink', 'efe255': 'Yellow',
+  'f0f1a8': 'Clear', 'f17b8f': 'Glow Pink', 'f3cfb2': 'Champagne', 'f3e600': 'Yellow', 'f48438': 'Orange',
+  'f4a925': 'Gold', 'f4d53f': 'Yellow', 'f4ee2a': 'Yellow', 'f5547c': 'Hot Pink', 'f55a74': 'Pink',
+  'f5b6cd': 'Cherry Pink', 'f5dbab': 'Mellow Yellow', 'f5f1dd': 'White', 'f68b1b': 'Neon Orange', 'f74e02': 'Orange',
+  'f75403': 'Orange', 'f7ada6': 'Pink', 'f7d959': 'Lemon Yellow', 'f7e6de': 'Beige', 'f7f3f0': 'White Marble',
+  'f8ff80': 'Glow Yellow', 'f99963': 'Mandarin Orange', 'f9c1bd': 'Translucent Pink', 'f9dfb9': 'Cream',
+  'f9ef41': 'Yellow', 'f9f7f2': 'Nature', 'f9f7f4': 'White', 'fce300': 'Yellow', 'fce900': 'Yellow',
+  'fec600': 'Sunflower Yellow', 'fedb00': 'Yellow', 'ff4800': 'Orange', 'ff671f': 'Orange', 'ff6a13': 'Orange',
+  'ff7f41': 'Orange', 'ff9016': 'Pumpkin Orange', 'ff911a': 'Translucent Orange', 'ff9d5b': 'Glow Orange',
+  'ffb549': 'Sunflower Yellow', 'ffc72c': 'Tangerine Yellow', 'ffce00': 'Yellow', 'ffd00b': 'Yellow',
+  'ffe133': 'Yellow', 'fffaf2': 'White', 'ffffff': 'White',
 };
 
-// Fallback color codes
-const COLOR_CODE_FALLBACK: Record<string, string> = {
-  'W0': 'White', 'W1': 'Jade White', 'K0': 'Black', 'R0': 'Red', 'B0': 'Blue',
-  'G0': 'Green', 'G1': 'Green', 'Y0': 'Yellow', 'Y2': 'Yellow', 'D0': 'Gray',
-  'D1': 'Silver', 'D3': 'Dark Gray', 'A0': 'Orange', 'P0': 'Purple', 'N0': 'Brown',
-};
-
-// Get color name from Bambu tray_id_name or hex
-function getColorName(trayIdName: string | null | undefined, hexColor: string): string {
-  // Try exact Bambu lookup first
-  if (trayIdName && BAMBU_COLORS[trayIdName]) {
-    return BAMBU_COLORS[trayIdName];
-  }
-  // Try color code fallback (e.g., "A00-Y2" -> "Y2")
-  if (trayIdName) {
-    const parts = trayIdName.split('-');
-    if (parts.length >= 2 && COLOR_CODE_FALLBACK[parts[1]]) {
-      return COLOR_CODE_FALLBACK[parts[1]];
-    }
+// Get color name from hex color (lookup Bambu database, then fallback to HSL-based name)
+function getColorName(hexColor: string): string {
+  // Normalize hex: lowercase, strip # and alpha channel
+  const hex = hexColor.replace('#', '').toLowerCase().substring(0, 6);
+  // Try Bambu color lookup
+  if (BAMBU_HEX_COLORS[hex]) {
+    return BAMBU_HEX_COLORS[hex];
   }
-  // Fall back to hex-based name
+  // Fall back to HSL-based name
   return hexToColorName(hexColor);
 }
 
@@ -185,7 +214,7 @@ export function AddToQueueModal({ archiveId, archiveName, onClose }: AddToQueueM
           filaments.push({
             type: tray.tray_type,
             color,
-            colorName: getColorName(tray.tray_id_name, color),
+            colorName: getColorName(color),
             amsId: amsUnit.id,
             trayId: tray.id,
             isHt,
@@ -202,7 +231,7 @@ export function AddToQueueModal({ archiveId, archiveName, onClose }: AddToQueueM
       filaments.push({
         type: printerStatus.vt_tray.tray_type,
         color,
-        colorName: getColorName(printerStatus.vt_tray.tray_id_name, color),
+        colorName: getColorName(color),
         amsId: -1,
         trayId: 0,
         isHt: false,
@@ -390,7 +419,7 @@ export function AddToQueueModal({ archiveId, archiveName, onClose }: AddToQueueM
       className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"
       onClick={onClose}
     >
-      <Card className="w-full max-w-md max-h-[90vh] overflow-y-auto" onClick={(e) => e.stopPropagation()}>
+      <Card className="w-full max-w-lg max-h-[90vh] overflow-y-auto" onClick={(e) => e.stopPropagation()}>
         <CardContent className="p-0">
           {/* Header */}
           <div className="flex items-center justify-between p-4 border-b border-bambu-dark-tertiary">
@@ -485,9 +514,9 @@ export function AddToQueueModal({ archiveId, archiveName, onClose }: AddToQueueM
                       <div
                         key={idx}
                         className="grid items-center gap-2 text-xs"
-                        style={{ gridTemplateColumns: '16px 1fr auto 1fr 16px' }}
+                        style={{ gridTemplateColumns: '16px minmax(70px, 1fr) auto 2fr 16px' }}
                       >
-                        <span title={`Required: ${item.color}`}>
+                        <span title={`Required: ${item.type} - ${getColorName(item.color)}`}>
                           <Circle className="w-3 h-3" fill={item.color} stroke={item.color} />
                         </span>
                         <span className="text-white truncate">

+ 1 - 1
frontend/src/components/EditQueueItemModal.tsx

@@ -95,7 +95,7 @@ export function EditQueueItemModal({ item, onClose }: EditQueueItemModalProps) {
       className="fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4"
       onClick={onClose}
     >
-      <Card className="w-full max-w-md" onClick={(e) => e.stopPropagation()}>
+      <Card className="w-full max-w-lg" onClick={(e) => e.stopPropagation()}>
         <CardContent className="p-0">
           {/* Header */}
           <div className="flex items-center justify-between p-4 border-b border-bambu-dark-tertiary">

+ 61 - 32
frontend/src/components/ReprintModal.tsx

@@ -29,36 +29,65 @@ const DEFAULT_PRINT_OPTIONS: PrintOptions = {
   timelapse: false,
 };
 
-// Bambu Lab filament color mapping by tray_id_name (subset of most common)
-const BAMBU_COLORS: Record<string, string> = {
-  'A00-W1': 'Jade White', 'A00-Y2': 'Sunflower Yellow', 'A00-R0': 'Red', 'A00-K0': 'Black',
-  'A00-G1': 'Bambu Green', 'A00-B3': 'Cobalt Blue', 'A00-D0': 'Gray', 'A00-D3': 'Dark Gray',
-  'A01-W2': 'Ivory White', 'A01-R1': 'Scarlet Red', 'A01-G1': 'Grass Green', 'A01-B3': 'Marine Blue',
-  'G02-W0': 'White', 'G02-K0': 'Black', 'G02-R0': 'Red', 'G02-D0': 'Gray', 'G02-B0': 'Blue',
-  'B00-W0': 'White', 'B00-K0': 'Black', 'B00-R0': 'Red',
+// Bambu Lab filament hex color to name mapping (from bambu-color-names.csv)
+const BAMBU_HEX_COLORS: Record<string, string> = {
+  '000000': 'Black', '001489': 'Blue', '002e96': 'Blue', '0047bb': 'Blue', '00482b': 'Pine Green',
+  '004ea8': 'Blue', '0056b8': 'Cobalt Blue', '0069b1': 'Lake Blue', '0072ce': 'Blue', '0078bf': 'Marine Blue',
+  '0085ad': 'Light Blue', '0086d6': 'Cyan', '008bda': 'Blue', '009639': 'Green', '009bd8': 'Cyan',
+  '009fa1': 'Teal', '00a6a0': 'Green', '00ae42': 'Bambu Green', '00b1b7': 'Turquoise', '00bb31': 'Green',
+  '018814': 'Candy Green', '042f56': 'Dark Blue', '0a2989': 'Blue', '0a2ca5': 'Blue', '0c2340': 'Navy Blue',
+  '0c3b95': 'Blue', '101820': 'Black', '147bd1': 'Blue', '164b35': 'Green', '16b08e': 'Malachite Green',
+  '1d7c6a': 'Oxide Green Metallic', '1f79e5': 'Lake Blue', '2140b4': 'Blue', '25282a': 'Black', '2842ad': 'Royal Blue',
+  '2d2b28': 'Onyx Black Sparkle', '324585': 'Indigo Blue', '353533': 'Gray', '39541a': 'Forest Green',
+  '39699e': 'Cobalt Blue Metallic', '3b665e': 'Green', '3f5443': 'Alpine Green Sparkle', '3f8e43': 'Mistletoe Green',
+  '424379': 'Nebulae', '43403d': 'Iron Gray Metallic', '482960': 'Indigo Purple', '483d8b': 'Royal Purple Sparkle',
+  '489fdf': 'Azure', '4c241c': 'Rosewood', '4ce4a0': 'Green', '4d3324': 'Dark Chocolate', '4d5054': 'Lava Gray',
+  '4dafda': 'Cyan', '4f3f24': 'Black Walnut', '515151': 'Dark Gray', '515a6c': 'Gray', '545454': 'Dark Gray',
+  '565656': 'Titan Gray', '56b7e6': 'Sky Blue', '583061': 'Violet Purple', '5898dd': 'Blue', '594177': 'Purple',
+  '5b492f': 'Brown', '5b6579': 'Blue Gray', '5c9748': 'Matcha Green', '5e43b7': 'Purple', '5e4b3c': 'Copper',
+  '5f6367': 'Titan Gray', '61b0ff': 'Translucent Light Blue', '61bf36': 'Green', '61c680': 'Grass Green',
+  '6667ab': 'Lavender Blue', '684a43': 'Brown', '686865': 'Black', '68724d': 'Dark Green', '688197': 'Blue Gray',
+  '69398e': 'Iris Purple', '6e88bc': 'Jeans Blue', '6ee53c': 'Lime Green', '6f5034': 'Cocoa Brown', '7248bd': 'Lavender',
+  '748c45': 'Translucent Olive', '757575': 'Nardo Gray', '75aed8': 'Blue', '77edd7': 'Translucent Teal', '789d4a': 'Olive',
+  '792b36': 'Crimson Red Sparkle', '7ac0e9': 'Glow Blue', '7ae1bf': 'Mint', '7cd82b': 'Lime Green', '7d6556': 'Dark Brown',
+  '8344b0': 'Purple', '847d48': 'Bronze', '854ce4': 'Purple', '8671cb': 'Purple', '875718': 'Peanut Brown',
+  '87909a': 'Silver', '898d8d': 'Gray', '8a949e': 'Gray', '8e8e8e': 'Translucent Gray', '8e9089': 'Gray',
+  '90ff1a': 'Neon Green', '918669': 'Classic Birch', '939393': 'Gray', '950051': 'Plum', '951e23': 'Burgundy Red',
+  '959698': 'Silver', '96d8af': 'Light Jade', '96dcb9': 'Mint', '995f11': 'Clay Brown', '999d9d': 'Gray',
+  '9b9ea0': 'Ash Gray', '9d2235': 'Maroon Red', '9d432c': 'Brown', '9e007e': 'Purple', '9ea2a2': 'Gray',
+  '9f332a': 'Brick Red', 'a1ffac': 'Glow Green', 'a3d8e1': 'Ice Blue', 'a6a9aa': 'Silver', 'a8a8aa': 'Gray',
+  'a8c6ee': 'Baby Blue', 'aa6443': 'Copper Brown Metallic', 'ad4e38': 'Red Granite', 'adb1b2': 'Gray',
+  'ae835b': 'Caramel', 'ae96d4': 'Lilac Purple', 'af1685': 'Purple', 'afb1ae': 'Gray', 'b15533': 'Terracotta',
+  'b28b33': 'Gold', 'b39b84': 'Iridium Gold Metallic', 'b50011': 'Red', 'b8acd6': 'Lavender', 'b8cde9': 'Ice Blue',
+  'ba9594': 'Rose Gold', 'bb3d43': 'Dark Red', 'bc0900': 'Red', 'becf00': 'Bright Green', 'c0df16': 'Green',
+  'c12e1f': 'Red', 'c2e189': 'Apple Green', 'c3e2d6': 'Light Cyan', 'c5ed48': 'Lime', 'c6001a': 'Red',
+  'c6c6c6': 'Gray', 'c8102e': 'Red', 'c8c8c8': 'Silver', 'c98935': 'Ochre Yellow', 'c9a381': 'Translucent Brown',
+  'cbc6b8': 'Bone White', 'cdceca': 'Gray', 'cea629': 'Classic Gold Sparkle', 'd02727': 'Candy Red',
+  'd1d3d5': 'Light Gray', 'd32941': 'Red', 'd3b7a7': 'Latte Brown', 'd6001c': 'Red', 'd6abff': 'Translucent Purple',
+  'd6cca3': 'White Oak', 'dc3a27': 'Orange', 'dd3c22': 'Vermilion Red', 'de4343': 'Scarlet Red', 'dfd1a7': 'Beige',
+  'e02928': 'Red', 'e4bd68': 'Gold', 'e5b03d': 'Gold', 'e83100': 'Red', 'e8afcf': 'Sakura Pink', 'e8dbb7': 'Desert Tan',
+  'eaeae4': 'White', 'eaeceb': 'Silver', 'ec008c': 'Magenta', 'ed0000': 'Red', 'eeb1c1': 'Pink', 'efe255': 'Yellow',
+  'f0f1a8': 'Clear', 'f17b8f': 'Glow Pink', 'f3cfb2': 'Champagne', 'f3e600': 'Yellow', 'f48438': 'Orange',
+  'f4a925': 'Gold', 'f4d53f': 'Yellow', 'f4ee2a': 'Yellow', 'f5547c': 'Hot Pink', 'f55a74': 'Pink',
+  'f5b6cd': 'Cherry Pink', 'f5dbab': 'Mellow Yellow', 'f5f1dd': 'White', 'f68b1b': 'Neon Orange', 'f74e02': 'Orange',
+  'f75403': 'Orange', 'f7ada6': 'Pink', 'f7d959': 'Lemon Yellow', 'f7e6de': 'Beige', 'f7f3f0': 'White Marble',
+  'f8ff80': 'Glow Yellow', 'f99963': 'Mandarin Orange', 'f9c1bd': 'Translucent Pink', 'f9dfb9': 'Cream',
+  'f9ef41': 'Yellow', 'f9f7f2': 'Nature', 'f9f7f4': 'White', 'fce300': 'Yellow', 'fce900': 'Yellow',
+  'fec600': 'Sunflower Yellow', 'fedb00': 'Yellow', 'ff4800': 'Orange', 'ff671f': 'Orange', 'ff6a13': 'Orange',
+  'ff7f41': 'Orange', 'ff9016': 'Pumpkin Orange', 'ff911a': 'Translucent Orange', 'ff9d5b': 'Glow Orange',
+  'ffb549': 'Sunflower Yellow', 'ffc72c': 'Tangerine Yellow', 'ffce00': 'Yellow', 'ffd00b': 'Yellow',
+  'ffe133': 'Yellow', 'fffaf2': 'White', 'ffffff': 'White',
 };
 
-// Fallback color codes
-const COLOR_CODE_FALLBACK: Record<string, string> = {
-  'W0': 'White', 'W1': 'Jade White', 'K0': 'Black', 'R0': 'Red', 'B0': 'Blue',
-  'G0': 'Green', 'G1': 'Green', 'Y0': 'Yellow', 'Y2': 'Yellow', 'D0': 'Gray',
-  'D1': 'Silver', 'D3': 'Dark Gray', 'A0': 'Orange', 'P0': 'Purple', 'N0': 'Brown',
-};
-
-// Get color name from Bambu tray_id_name or hex
-function getColorName(trayIdName: string | null | undefined, hexColor: string): string {
-  // Try exact Bambu lookup first
-  if (trayIdName && BAMBU_COLORS[trayIdName]) {
-    return BAMBU_COLORS[trayIdName];
-  }
-  // Try color code fallback (e.g., "A00-Y2" -> "Y2")
-  if (trayIdName) {
-    const parts = trayIdName.split('-');
-    if (parts.length >= 2 && COLOR_CODE_FALLBACK[parts[1]]) {
-      return COLOR_CODE_FALLBACK[parts[1]];
-    }
+// Get color name from hex color (lookup Bambu database, then fallback to HSL-based name)
+function getColorName(hexColor: string): string {
+  // Normalize hex: lowercase, strip # and alpha channel
+  const hex = hexColor.replace('#', '').toLowerCase().substring(0, 6);
+  // Try Bambu color lookup
+  if (BAMBU_HEX_COLORS[hex]) {
+    return BAMBU_HEX_COLORS[hex];
   }
-  // Fall back to hex-based name
+  // Fall back to HSL-based name
   return hexToColorName(hexColor);
 }
 
@@ -208,7 +237,7 @@ export function ReprintModal({ archiveId, archiveName, onClose, onSuccess }: Rep
           filaments.push({
             type: tray.tray_type,
             color,
-            colorName: getColorName(tray.tray_id_name, color),
+            colorName: getColorName(color),
             amsId: amsUnit.id,
             trayId: tray.id,
             isHt,
@@ -226,7 +255,7 @@ export function ReprintModal({ archiveId, archiveName, onClose, onSuccess }: Rep
       filaments.push({
         type: printerStatus.vt_tray.tray_type,
         color,
-        colorName: getColorName(printerStatus.vt_tray.tray_id_name, color),
+        colorName: getColorName(color),
         amsId: -1,
         trayId: 0,
         isHt: false,
@@ -386,7 +415,7 @@ export function ReprintModal({ archiveId, archiveName, onClose, onSuccess }: Rep
 
   return (
     <div className="fixed inset-0 bg-black/70 flex items-center justify-center z-50 p-8">
-      <Card className="w-full max-w-md">
+      <Card className="w-full max-w-lg">
         <CardContent>
           {/* Header */}
           <div className="flex items-center justify-between mb-4">
@@ -495,10 +524,10 @@ export function ReprintModal({ archiveId, archiveName, onClose, onSuccess }: Rep
                   <div
                     key={idx}
                     className="grid items-center gap-2"
-                    style={{ gridTemplateColumns: '16px 1fr auto 1fr 16px' }}
+                    style={{ gridTemplateColumns: '16px minmax(70px, 1fr) auto 2fr 16px' }}
                   >
                     {/* Required color */}
-                    <span title={`Required: ${item.color}`}>
+                    <span title={`Required: ${item.type} - ${getColorName(item.color)}`}>
                       <Circle
                         className="w-3 h-3 flex-shrink-0"
                         fill={item.color}

File diff suppressed because it is too large
+ 0 - 0
static/assets/index-BQZgdf1x.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-C_Su2_85.js"></script>
+    <script type="module" crossorigin src="/assets/index-BQZgdf1x.js"></script>
     <link rel="stylesheet" crossorigin href="/assets/index-DSlUhPr3.css">
   </head>
   <body>

+ 2 - 2
static/sw.js

@@ -1,6 +1,6 @@
 // Bambuddy Service Worker
-const CACHE_NAME = 'bambuddy-v19';
-const STATIC_CACHE = 'bambuddy-static-v19';
+const CACHE_NAME = 'bambuddy-v21';
+const STATIC_CACHE = 'bambuddy-static-v21';
 
 // Static assets to cache on install
 const STATIC_ASSETS = [

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