瀏覽代碼

feat(settings): Egyptian Pound (EGP) as a currency (issue #3334)

- Adds EGP with the symbol E£ to the currency table, which the cost
  tracking currency picker is built from.
maziggy 1 天之前
父節點
當前提交
a3bd8f7250
共有 3 個文件被更改,包括 12 次插入 和 2 次删除
  1. 1 0
      CHANGELOG.md
  2. 10 2
      frontend/src/__tests__/utils/currency.test.ts
  3. 1 0
      frontend/src/utils/currency.ts

+ 1 - 0
CHANGELOG.md

@@ -5,6 +5,7 @@ All notable changes to Bambuddy will be documented in this file.
 ## [1.3.0b1] - Unreleased
 
 ### Added
+- **Egyptian Pound (EGP) as a currency (#3334, requested by @aammash)** — Costs can now be shown in Egyptian Pounds (E£). Pick it under Settings > General > Cost Tracking.
 - **Larger queue thumbnails on hover (#3313, requested by @humplemann)** — A job's thumbnail on a **Queue** card is the quickest way to tell jobs apart, but it is small. Hovering it now shows it at 256x256 next to the card, as the **History** rows already did at 192x192 (now 256x256 too). The preview opens to the left when there is no room on the right, is no longer cut off inside a batch group, and closes when you move away or scroll. Desktop only, as touch screens have no hover. Wiki updated.
 - **The queue says when a job printed in a colour the file didn't ask for (#3279, requested by @Lioncat55)** — With no spool of a slot's colour loaded, the queue can still send the job with another spool of the same material. Nothing showed this until the print came out.
   - **On the queue row:** an amber line per slot, for example "Slot 1 printed in Black (#000000), the file asks for Silver (#A4AAAC)". It stays on the job in **History**.

+ 10 - 2
frontend/src/__tests__/utils/currency.test.ts

@@ -38,6 +38,10 @@ describe('getCurrencySymbol', () => {
     expect(getCurrencySymbol('PHP')).toBe('₱');
   });
 
+  it('returns E£ for EGP', () => {
+    expect(getCurrencySymbol('EGP')).toBe('E£');
+  });
+
   it('returns the code itself for unknown currencies', () => {
     expect(getCurrencySymbol('XYZ')).toBe('XYZ');
   });
@@ -53,6 +57,10 @@ describe('SUPPORTED_CURRENCIES', () => {
     expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'INR')).toBeDefined();
   });
 
+  it('contains EGP', () => {
+    expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'EGP')).toBeDefined();
+  });
+
   it('contains MYR', () => {
     expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'MYR')).toBeDefined();
   });
@@ -69,7 +77,7 @@ describe('SUPPORTED_CURRENCIES', () => {
     expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'PHP')).toEqual({ code: 'PHP', label: 'PHP (₱)' });
   });
 
-  it('has 32 entries', () => {
-    expect(SUPPORTED_CURRENCIES).toHaveLength(32);
+  it('has 33 entries', () => {
+    expect(SUPPORTED_CURRENCIES).toHaveLength(33);
   });
 });

+ 1 - 0
frontend/src/utils/currency.ts

@@ -31,6 +31,7 @@ const CURRENCY_SYMBOLS: Record<string, string> = {
   UAH: '₴',
   IDR: 'Rp',
   PHP: '₱',
+  EGP: 'E£',
 };
 
 export function getCurrencySymbol(currencyCode: string): string {