import React from "react"; import { useAppSelector } from "redux/hooks"; import ProText from "../ProText"; import { formatPriceUi } from "utils/helpers"; interface ArabicPriceProps { price: number | string; style?: React.CSSProperties; strong?: boolean; type?: "secondary" | "success" | "warning" | "danger"; className?: string; hideCurrency?: boolean; textStyle?: React.CSSProperties; } const ArabicPrice: React.FC = ({ price, style = {}, strong = false, type, className, hideCurrency = false, textStyle = {}, }) => { const { isRTL } = useAppSelector((state) => state.locale); const { restaurant } = useAppSelector((state) => state.order); // Format the price to ensure it has 2 decimal places const formattedPrice = typeof price === "number" ? formatPriceUi(price, restaurant?.currency_decimals ?? 3) : price; const { textDecoration, ...restStyle } = style; const decorationStyle = textDecoration ? ({ textDecoration } as React.CSSProperties) : undefined; return ( {isRTL && !hideCurrency ? ( <> {formattedPrice} {isRTL ? restaurant.local_currency : restaurant.global_currency} ) : !hideCurrency ? ( <> {formattedPrice} {isRTL ? restaurant.local_currency : restaurant.global_currency} ) : ( {formattedPrice} )} ); }; export default ArabicPrice;