refactor: trim long browser and profile names

This commit is contained in:
zhom
2025-07-28 02:15:27 +04:00
parent dddf8e2e39
commit b5dfe1233e
2 changed files with 61 additions and 28 deletions
+9
View File
@@ -0,0 +1,9 @@
/**
* Trims a name to a maximum length and adds ellipsis if needed
* @param name The name to trim
* @param maxLength Maximum length before truncation (default: 30)
* @returns Trimmed name with ellipsis if truncated
*/
export function trimName(name: string, maxLength: number = 30): string {
return name.length > maxLength ? `${name.substring(0, maxLength)}...` : name;
}