Фронт

This commit is contained in:
Халимов Рустам
2026-03-27 16:04:46 +03:00
parent 28fb8c25de
commit 030ae1e4e4
19 changed files with 234 additions and 174 deletions

View File

@@ -350,9 +350,9 @@ export default function UserProfile({ userId, chatId, onClose, onGoToMessage, is
try {
setTabLoading(true);
await UserApi.removeAvatar();
const updatedUser = { ...profile!, avatar: null };
const updatedUser = { ...profile!, avatar: null, avatarUrl: null };
setProfile(updatedUser);
useAuthStore.getState().updateUser({ avatar: null });
useAuthStore.getState().updateUser({ avatar: null, avatarUrl: null });
} catch (err) {
console.error(err);
} finally {
@@ -360,7 +360,7 @@ export default function UserProfile({ userId, chatId, onClose, onGoToMessage, is
}
};
const initials = (profile?.displayName || profile?.username || '??')
const initials = (profile?.displayName || profile?.userName || profile?.username || '??')
.split(' ')
.map((w: string) => w[0])
.join('')
@@ -448,9 +448,9 @@ export default function UserProfile({ userId, chatId, onClose, onGoToMessage, is
<div className="relative group">
<div className="relative">
{profile.avatar ? (
{ (profile.avatarUrl || profile.avatar) ? (
<img
src={getMediaUrl(profile.avatar)}
src={getMediaUrl(profile.avatarUrl || profile.avatar!)}
alt=""
className="w-32 h-32 rounded-full object-cover border-4 border-surface bg-surface"
/>
@@ -501,14 +501,14 @@ export default function UserProfile({ userId, chatId, onClose, onGoToMessage, is
</div>
) : (
<h3 className="mt-5 text-[24px] font-semibold text-white tracking-tight text-center px-4">
{profile.displayName || profile.username}
{profile.displayName || profile.userName || profile.username}
</h3>
)}
{/* Username (неизменяемый) */}
<div className="flex items-center gap-1.5 mt-2 bg-accent/10 px-4 py-1.5 rounded-full border border-accent/20 cursor-default">
<AtSign size={14} className="text-accent" />
<span className="text-sm font-medium text-accent">{profile.username}</span>
<span className="text-sm font-medium text-accent">{profile.userName || profile.username}</span>
</div>
{/* Онлайн статус */}
@@ -984,9 +984,11 @@ export default function UserProfile({ userId, chatId, onClose, onGoToMessage, is
stories={[{
user: {
id: profile.id,
userName: profile.userName || profile.username || '',
username: profile.username,
displayName: profile.displayName,
avatar: profile.avatar
avatar: profile.avatar,
avatarUrl: profile.avatarUrl || profile.avatar
},
stories: sortedStories,
hasUnviewed: false