update ar currency

This commit is contained in:
root
2026-06-02 01:45:05 -04:00
parent 8f57ca9d76
commit 29886c3397
9 changed files with 49 additions and 21 deletions
@@ -2,7 +2,7 @@
import { useEffect, useState } from 'react'
import dayjs from 'dayjs'
import { formatCurrency } from '@rentaldrivego/types'
import { formatCurrency, getCurrencyLabel } from '@rentaldrivego/types'
import { apiFetch } from '@/lib/api'
import { useDashboardI18n } from '@/components/I18nProvider'
@@ -296,11 +296,11 @@ const copy = {
},
}
function discountLabel(offer: Offer, t: typeof copy['en']): string {
function discountLabel(offer: Offer, t: typeof copy['en'], language: 'en' | 'fr' | 'ar'): string {
if (offer.type === 'PERCENTAGE') return `${offer.discountValue}%`
if (offer.type === 'FIXED_AMOUNT') return formatCurrency(offer.discountValue, 'MAD')
if (offer.type === 'FIXED_AMOUNT') return formatCurrency(offer.discountValue, 'MAD', language)
if (offer.type === 'FREE_DAY') return t.freeDay
if (offer.type === 'SPECIAL_RATE') return `${offer.specialRate ?? offer.discountValue} MAD/day`
if (offer.type === 'SPECIAL_RATE') return `${offer.specialRate ?? offer.discountValue} ${getCurrencyLabel(language)}${language === 'fr' ? '/jour' : language === 'ar' ? '/يوم' : '/day'}`
return String(offer.discountValue)
}
@@ -507,7 +507,7 @@ export default function OffersPage() {
</span>
</div>
<p className="text-2xl font-bold text-slate-900">{discountLabel(offer, t)}</p>
<p className="text-2xl font-bold text-slate-900">{discountLabel(offer, t, language)}</p>
{offer.description && (
<p className="text-sm text-slate-500 line-clamp-2">{offer.description}</p>