ソースを参照

feat(settings): Dominican Peso (DOP) as a currency (issue #3388)

- Adds DOP with the symbol RD$ to the currency table, which the cost
  tracking currency picker is built from.
maziggy 2 日 前
親
コミット
1ef66f368b

+ 1 - 0
CHANGELOG.md

@@ -21,6 +21,7 @@ All notable changes to Bambuddy will be documented in this file.
   - **Cameras button:** a camera icon at the end of the sidebar's **Printers** row (on hover when the sidebar is collapsed), in the header on narrow screens, or the **C** key, lists the printers you can see and opens one as an overlay. A camera already open is ticked and closes from the same list. Users without `camera:view` and `printers:read` don't see it, or any overlay.
   - **Pop out and back in:** a new button in the overlay moves the camera into its own window. The camera window has a button that moves it back as an overlay into the Bambuddy tab it came from, or another open one whose user can see that printer, and closes. With no Bambuddy tab open, the window stays and says so.
   - Overlays left open for a deleted printer, or one the signed-in user can't see, are dropped. Wiki updated.
+- **Dominican Peso (DOP) as a currency (#3388, requested by @rogerabm)** — Costs can now be shown in Dominican Pesos (RD$). Pick it under Settings > General > Cost Tracking.
 - **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.

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

@@ -42,6 +42,10 @@ describe('getCurrencySymbol', () => {
     expect(getCurrencySymbol('EGP')).toBe('E£');
   });
 
+  it('returns RD$ for DOP', () => {
+    expect(getCurrencySymbol('DOP')).toBe('RD$');
+  });
+
   it('returns the code itself for unknown currencies', () => {
     expect(getCurrencySymbol('XYZ')).toBe('XYZ');
   });
@@ -61,6 +65,10 @@ describe('SUPPORTED_CURRENCIES', () => {
     expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'EGP')).toBeDefined();
   });
 
+  it('contains DOP', () => {
+    expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'DOP')).toEqual({ code: 'DOP', label: 'DOP (RD$)' });
+  });
+
   it('contains MYR', () => {
     expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'MYR')).toBeDefined();
   });
@@ -77,7 +85,7 @@ describe('SUPPORTED_CURRENCIES', () => {
     expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'PHP')).toEqual({ code: 'PHP', label: 'PHP (₱)' });
   });
 
-  it('has 33 entries', () => {
-    expect(SUPPORTED_CURRENCIES).toHaveLength(33);
+  it('has 34 entries', () => {
+    expect(SUPPORTED_CURRENCIES).toHaveLength(34);
   });
 });

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

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