瀏覽代碼

feature: display p2s artwork (#3369)

Andy Sorge 2 天之前
父節點
當前提交
a9b72e6b6b
共有 3 個文件被更改,包括 8 次插入 和 5 次删除
  1. 二進制
      frontend/public/img/printers/p2s.png
  2. 7 4
      frontend/src/__tests__/utils/printer.test.ts
  3. 1 1
      frontend/src/utils/printer.ts

二進制
frontend/public/img/printers/p2s.png


+ 7 - 4
frontend/src/__tests__/utils/printer.test.ts

@@ -74,10 +74,13 @@ describe('getPrinterImage', () => {
       expect(getPrinterImage('H2D Pro')).toBe('/img/printers/h2dpro.png');
     });
 
-    it('P2S → p1s.png (shared with P1S)', () => {
-      // Pre-existing behaviour: P2S currently reuses the P1S artwork. Not
-      // changed by the X2D diff; asserted to catch accidental regressions.
-      expect(getPrinterImage('P2S')).toBe('/img/printers/p1s.png');
+    it('P2S → p2s.png', () => {
+      expect(getPrinterImage('P2S')).toBe('/img/printers/p2s.png');
+    });
+
+    it('P1S → p1s.png', () => {
+      // Ensure that P1S still resolves correctly
+      expect(getPrinterImage('P1S')).toBe('/img/printers/p1s.png');
     });
 
     it('A1 Mini → a1mini.png (not a1.png)', () => {

+ 1 - 1
frontend/src/utils/printer.ts

@@ -9,7 +9,7 @@ export function getPrinterImage(model: string | null | undefined): string {
   if (m.includes('h2d')) return '/img/printers/h2d.png';
   if (m.includes('h2c')) return '/img/printers/h2c.png';
   if (m.includes('h2s')) return '/img/printers/h2d.png';
-  if (m.includes('p2s')) return '/img/printers/p1s.png';
+  if (m.includes('p2s')) return '/img/printers/p2s.png';
   if (m.includes('p1s')) return '/img/printers/p1s.png';
   if (m.includes('p1p')) return '/img/printers/p1p.png';
   if (m.includes('a2l') || m === 'n9') return '/img/printers/a2l.png';