feat: initial

This commit is contained in:
2026-06-03 03:08:57 +03:30
parent 3d9585ac5c
commit 6fa30eb29a
45 changed files with 7053 additions and 86 deletions
+19
View File
@@ -0,0 +1,19 @@
// Tiny className combiner (avoids an extra dependency).
export function cn(...parts: Array<string | false | null | undefined>): string {
return parts.filter(Boolean).join(" ");
}
// Convert ASCII digits to Persian digits for display.
const FA_DIGITS = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"];
export function toFa(value: string | number | null | undefined): string {
if (value === null || value === undefined) return "";
return String(value).replace(/\d/g, (d) => FA_DIGITS[Number(d)]);
}
// Seconds -> "م:ث" style label (e.g. 90 -> ۱:۳۰).
export function formatDuration(seconds?: number | null): string {
if (!seconds && seconds !== 0) return "—";
const m = Math.floor(seconds / 60);
const s = Math.floor(seconds % 60);
return toFa(`${m}:${String(s).padStart(2, "0")}`);
}