feat: show public classes with discount, start countdown, and free spots
Add a landing page classes section fed by the public classes API with pricing and availability details.
This commit is contained in:
@@ -17,6 +17,14 @@ export function formatPrice(amount) {
|
||||
return `${toPersianDigits(Number(amount).toLocaleString('en-US'))} تومان`
|
||||
}
|
||||
|
||||
export function formatDaysUntilStart(days) {
|
||||
if (days == null || Number.isNaN(Number(days))) return null
|
||||
const value = Number(days)
|
||||
if (value > 0) return `${toPersianDigits(value)} روز تا شروع`
|
||||
if (value === 0) return 'امروز شروع میشود'
|
||||
return `${toPersianDigits(Math.abs(value))} روز از شروع گذشته`
|
||||
}
|
||||
|
||||
export function getApiErrorMessage(error, fallback = 'خطایی رخ داد. دوباره تلاش کنید.') {
|
||||
return (
|
||||
error?.response?.data?.error?.message ||
|
||||
|
||||
Reference in New Issue
Block a user