Дизайн

This commit is contained in:
Халимов Рустам
2026-04-02 14:57:32 +03:00
parent 9df7d7aaf1
commit a42007df2d
6 changed files with 82 additions and 56 deletions

View File

@@ -61,32 +61,16 @@ export function stripMarkdown(text: string): string {
}
export function getInitials(name: string): string {
return name
.split(' ')
.map((part) => part[0])
.join('')
.toUpperCase()
.slice(0, 2);
if (!name) return '?';
const parts = name.trim().split(/\s+/);
if (parts.length >= 2) {
return (parts[0][0] + parts[1][0]).toUpperCase();
}
return parts[0].slice(0, 2).toUpperCase();
}
export function generateAvatarColor(name: string): string {
const colors = [
'bg-linear-to-br from-blue-400 to-blue-600',
'bg-linear-to-br from-sky-400 to-sky-600',
'bg-linear-to-br from-cyan-400 to-blue-600',
'bg-linear-to-br from-blue-500 to-indigo-600',
'bg-linear-to-br from-emerald-400 to-blue-600',
'bg-linear-to-br from-blue-600 to-primary-container',
'bg-linear-to-br from-primary to-primary-container',
'bg-linear-to-br from-blue-400 to-cyan-500',
];
let hash = 0;
for (let i = 0; i < name.length; i++) {
hash = name.charCodeAt(i) + ((hash << 5) - hash);
}
return colors[Math.abs(hash) % colors.length];
export function generateAvatarColor(_name: string): string {
return 'bg-gradient-to-br from-[#3096e5] to-[#1e6fb3]';
}
// Waveform cache so we don't decode the same audio twice