Дизайн
This commit is contained in:
@@ -41,6 +41,9 @@ const translations = {
|
||||
noChats: 'Нет чатов — создайте первый!',
|
||||
nothingFound: 'Ничего не найдено',
|
||||
selectChat: 'Выберите чат для начала общения',
|
||||
selectChatTitle: 'Выберите чат',
|
||||
selectChatSubtext: 'Начните общение прямо сейчас. Все ваши сообщения защищены сквозным шифрованием.',
|
||||
newMessage: 'Новое сообщение',
|
||||
noMessages: 'Нет сообщений — напишите первое!',
|
||||
typing: 'печатает...',
|
||||
online: 'в сети',
|
||||
@@ -328,6 +331,9 @@ const translations = {
|
||||
noChats: 'No chats — create one!',
|
||||
nothingFound: 'Nothing found',
|
||||
selectChat: 'Select a chat to start messaging',
|
||||
selectChatTitle: 'Select a chat',
|
||||
selectChatSubtext: 'Start communicating right now. All your messages are protected with end-to-end encryption.',
|
||||
newMessage: 'New message',
|
||||
noMessages: 'No messages — write the first one!',
|
||||
typing: 'typing...',
|
||||
online: 'online',
|
||||
|
||||
@@ -59,10 +59,14 @@ export default function Sidebar() {
|
||||
};
|
||||
|
||||
socket?.on('story_viewed', onStoryViewed);
|
||||
|
||||
const handleOpenNewChat = () => setShowNewChat(true);
|
||||
window.addEventListener('OPEN_NEW_CHAT', handleOpenNewChat);
|
||||
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
socket?.off('story_viewed', onStoryViewed);
|
||||
window.removeEventListener('OPEN_NEW_CHAT', handleOpenNewChat);
|
||||
};
|
||||
}, [user?.id]);
|
||||
|
||||
@@ -185,7 +189,7 @@ export default function Sidebar() {
|
||||
{/* Float Action Button equivalent for Web */}
|
||||
<button
|
||||
onClick={() => setShowNewChat(true)}
|
||||
className="absolute bottom-6 right-6 w-14 h-14 rounded-2xl bg-primary text-on-primary-container shadow-lg shadow-primary/20 flex items-center justify-center hover:scale-105 active:scale-95 transition-transform slide-on-ice"
|
||||
className="absolute bottom-6 right-6 w-14 h-14 rounded-2xl bg-primary text-black shadow-lg shadow-primary/20 flex items-center justify-center hover:scale-105 active:scale-95 transition-transform slide-on-ice"
|
||||
title={t('newChat')}
|
||||
>
|
||||
<span className="material-symbols-outlined text-2xl">add</span>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user