UI: доработано оформление — тени, анимации, градиенты, iOS-стиль

This commit is contained in:
2026-05-29 11:52:04 +03:00
parent a67b8c3341
commit f8f220469c
13 changed files with 362 additions and 727 deletions

View File

@@ -13,7 +13,7 @@ export default function ProfilePage() {
const navigate = useNavigate();
const { user: me, logout } = useAuth();
const [modalCatId, setModalCatId] = useState<number | null>(null);
const [tab, setTab] = useState<'photos' | 'likes'>('photos');
const [tab, setTab] = useState<'photos'>('photos');
const profileUserId = paramId ? parseInt(paramId) : me?.id;
const isMe = !paramId || (me && profileUserId === me.id);
@@ -37,9 +37,7 @@ export default function ProfilePage() {
</div>
</div>
<div className="grid grid-cols-3 gap-2">
{Array.from({ length: 6 }).map((_, i) => (
<Skeleton key={i} className="aspect-square rounded-xl" />
))}
{Array.from({ length: 6 }).map((_, i) => (<Skeleton key={i} className="aspect-square rounded-xl" />))}
</div>
</div>
);
@@ -47,14 +45,10 @@ export default function ProfilePage() {
if (!profileUser && !isMe) {
return (
<div className="flex flex-col items-center justify-center py-24 animate-fade-in">
<div className="mb-5 flex h-16 w-16 items-center justify-center rounded-full bg-[var(--secondary)]">
<span className="text-2xl">🔍</span>
</div>
<div className="flex flex-col items-center justify-center py-24 animate-fade-in-up">
<div className="mb-5 flex h-16 w-16 items-center justify-center rounded-full bg-[var(--secondary)]"><span className="text-2xl">🔍</span></div>
<p className="text-[17px] font-semibold mb-1.5">Пользователь не найден</p>
<Button variant="outline" onClick={() => navigate('/feed')} className="rounded-full text-[13px] mt-2">
Вернуться в ленту
</Button>
<Button variant="outline" onClick={() => navigate('/feed')} className="rounded-full text-[13px] mt-2">Вернуться в ленту</Button>
</div>
);
}
@@ -64,21 +58,17 @@ export default function ProfilePage() {
const totalLikes = cats.reduce((sum, c) => sum + c.likes_count, 0);
return (
<div className="mx-auto max-w-[660px] px-4 py-6">
<div className="mx-auto max-w-[660px] px-4 py-6 animate-fade-in-up">
{!isMe && (
<button
onClick={() => navigate(-1)}
className="mb-4 flex items-center gap-1.5 text-[14px] text-[var(--foreground-secondary)] hover:text-[var(--foreground)] transition-colors"
>
<ArrowLeft className="h-4 w-4" strokeWidth={1.5} />
<button onClick={() => navigate(-1)} className="mb-4 flex items-center gap-1.5 text-[14px] text-[var(--fg-secondary)] hover:text-[var(--fg)] transition-colors group">
<ArrowLeft className="h-4 w-4 stroke-[1.5] group-hover:-translate-x-0.5 transition-transform" />
Назад
</button>
)}
{/* Profile header */}
<div className="flex items-center gap-6 mb-8">
<Avatar className="h-20 w-20 shrink-0 ring-2 ring-[var(--primary)]/20 ring-offset-2">
<AvatarFallback className="text-[26px] font-bold avatar-initials">
<AvatarFallback className="text-[26px] font-bold" style={{ background: 'linear-gradient(135deg, #007aff, #5856d6)', color: 'white', borderRadius: '50%', display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%', height: '100%' }}>
{initials}
</AvatarFallback>
</Avatar>
@@ -86,11 +76,7 @@ export default function ProfilePage() {
<div className="flex items-center gap-3 mb-2">
<h1 className="text-[20px] font-bold truncate">@{profileUser?.username}</h1>
{isMe && (
<button
onClick={logout}
className="btn-icon h-8 w-8 text-[var(--foreground-secondary)] hover:text-[var(--danger)] hover:bg-[var(--danger-light)] ml-auto"
title="Выйти"
>
<button onClick={logout} className="btn-icon h-8 w-8 text-[var(--fg-secondary)] hover:text-[var(--danger)] hover:bg-[var(--danger-light)] ml-auto" title="Выйти">
<LogOut className="h-4 w-4" strokeWidth={1.5} />
</button>
)}
@@ -99,21 +85,22 @@ export default function ProfilePage() {
<div className="flex items-center gap-6 text-[14px] mb-3">
<div className="text-center">
<p className="font-bold text-[16px]">{cats.length}</p>
<p className="text-[12px] text-[var(--foreground-secondary)]">публикаций</p>
<p className="text-[11px] text-[var(--fg-secondary)]">публикаций</p>
</div>
<div className="text-center">
<p className="font-bold text-[16px]">{totalLikes}</p>
<p className="text-[12px] text-[var(--foreground-secondary)]">лайков</p>
<p className="text-[11px] text-[var(--fg-secondary)]">лайков</p>
</div>
<div className="text-center">
<p className="font-bold text-[16px]">🏆{profileUser?.points ?? 0}</p>
<p className="text-[12px] text-[var(--foreground-secondary)]">баллов</p>
<p className="text-[11px] text-[var(--fg-secondary)]">баллов</p>
</div>
</div>
{isMe && (
<Link to="/upload">
<Button size="sm" className="rounded-full text-[13px] h-8 bg-[var(--primary)] hover:bg-[var(--primary-hover)] gap-1.5">
<Button size="sm" className="rounded-full text-[13px] h-8 gap-1.5"
style={{ background: 'linear-gradient(135deg, #007aff, #5856d6)' }}>
<Plus className="h-3.5 w-3.5" strokeWidth={2} />
Новая публикация
</Button>
@@ -122,84 +109,42 @@ export default function ProfilePage() {
</div>
</div>
{/* Tabs */}
<div className="flex gap-1 mb-5 border-b border-[var(--border)]">
<button
onClick={() => setTab('photos')}
className={`px-5 py-3 text-[14px] font-medium border-b-2 transition-all ${
tab === 'photos'
? 'border-[var(--primary)] text-[var(--primary)]'
: 'border-transparent text-[var(--foreground-secondary)] hover:text-[var(--foreground)]'
}`}
>
<div className="flex gap-1 mb-5">
<button onClick={() => setTab('photos')}
className={`px-5 py-2.5 text-[14px] font-medium rounded-lg transition-all ${
tab === 'photos' ? 'bg-[var(--primary-soft)] text-[var(--primary)]' : 'text-[var(--fg-secondary)] hover:text-[var(--fg)] hover:bg-[var(--secondary)]'
}`}>
Фото
</button>
<button
onClick={() => setTab('likes')}
className={`px-5 py-3 text-[14px] font-medium border-b-2 transition-all ${
tab === 'likes'
? 'border-[var(--primary)] text-[var(--primary)]'
: 'border-transparent text-[var(--foreground-secondary)] hover:text-[var(--foreground)]'
}`}
>
Избранное
</button>
</div>
{/* Content */}
{tab === 'photos' && (
cats.length === 0 ? (
<div className="flex flex-col items-center justify-center py-16 text-center animate-fade-in">
<div className="mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-[var(--secondary)]">
<span className="text-xl">📸</span>
</div>
<p className="text-[15px] font-medium mb-1">Пока нет котов</p>
<p className="text-[13px] text-[var(--foreground-secondary)] mb-5 max-w-xs">
{isMe ? 'Поделитесь первым фото кота' : 'У пользователя пока нет котов'}
</p>
{isMe && (
<Link to="/upload">
<Button size="sm" className="rounded-full text-[13px] bg-[var(--primary)] hover:bg-[var(--primary-hover)]">
Загрузить кота
</Button>
</Link>
)}
</div>
) : (
<div className="grid grid-cols-3 gap-2">
{cats.map((cat) => (
<button
key={cat.id}
onClick={() => setModalCatId(cat.id)}
className="group relative aspect-square overflow-hidden bg-[var(--secondary)] rounded-xl"
>
<img
src={cat.image_url}
alt={cat.caption || 'Фото кота'}
className="h-full w-full object-cover transition-all duration-300 group-hover:scale-105"
loading="lazy"
/>
<div className="absolute inset-0 bg-gradient-to-t from-black/40 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-end p-3">
<div className="flex items-center gap-1.5 text-white text-[13px] font-semibold">
<Heart className="h-4 w-4 fill-white" strokeWidth={2} />
<span>{cat.likes_count}</span>
</div>
</div>
</button>
))}
</div>
)
)}
{tab === 'likes' && (
<div className="flex flex-col items-center justify-center py-16 text-center animate-fade-in">
<div className="mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-[var(--primary-light)]">
<Heart className="h-6 w-6 text-[var(--primary)]" strokeWidth={1.5} />
</div>
<p className="text-[15px] font-medium mb-1">Скоро</p>
<p className="text-[13px] text-[var(--foreground-secondary)]">
Здесь появятся понравившиеся коты
{cats.length === 0 ? (
<div className="flex flex-col items-center justify-center py-16 text-center animate-fade-in-up">
<div className="mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-[var(--secondary)]"><span className="text-xl">📸</span></div>
<p className="text-[15px] font-medium mb-1">Пока нет котов</p>
<p className="text-[13px] text-[var(--fg-secondary)] mb-5 max-w-xs">
{isMe ? 'Поделитесь первым фото кота' : 'У пользователя пока нет котов'}
</p>
{isMe && (
<Link to="/upload"><Button size="sm" className="rounded-full text-[13px]"
style={{ background: 'linear-gradient(135deg, #007aff, #5856d6)' }}>Загрузить кота</Button></Link>
)}
</div>
) : (
<div className="grid grid-cols-3 gap-1.5">
{cats.map((cat) => (
<button key={cat.id} onClick={() => setModalCatId(cat.id)}
className="group relative aspect-square overflow-hidden bg-[var(--secondary)] rounded-xl shadow-sm">
<img src={cat.image_url} alt={cat.caption || 'Фото кота'}
className="h-full w-full object-cover transition-all duration-300 group-hover:scale-105" loading="lazy" />
<div className="absolute inset-0 bg-gradient-to-t from-black/40 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-end p-3">
<div className="flex items-center gap-1.5 text-white text-[13px] font-semibold drop-shadow-sm">
<Heart className="h-4 w-4 fill-white" strokeWidth={2} />
<span>{cat.likes_count}</span>
</div>
</div>
</button>
))}
</div>
)}