feat: complete the thirteen-stage learning experience and E2E journey
Play levels 7-13 in the app and pin E2E to the local thirteen-stage backend commit. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
const PERSIAN_DIGITS = '۰۱۲۳۴۵۶۷۸۹'
|
||||
|
||||
export function formatCoinTenths(tenths: number): string {
|
||||
const abs = Math.abs(Math.trunc(tenths))
|
||||
const whole = Math.floor(abs / 10)
|
||||
const fraction = abs % 10
|
||||
const plain = fraction === 0 ? String(whole) : `${whole}.${fraction}`
|
||||
return plain.replace(/\d/g, (digit) => PERSIAN_DIGITS[Number(digit)] ?? digit).replace('.', '٫')
|
||||
}
|
||||
|
||||
export function revealPeriods<T>(periods: T[], shown: number): T[] {
|
||||
return periods.slice(0, Math.max(0, Math.min(shown, periods.length)))
|
||||
}
|
||||
|
||||
export function nextShown(shown: number, total: number): number {
|
||||
return Math.min(total, shown + 1)
|
||||
}
|
||||
|
||||
export function previousShown(shown: number): number {
|
||||
return Math.max(1, shown - 1)
|
||||
}
|
||||
Reference in New Issue
Block a user