UI: Telegram-стиль, синий акцент, bubble-карточки

This commit is contained in:
2026-05-29 10:42:13 +03:00
parent ea0df060e8
commit b277e0f177
13 changed files with 524 additions and 694 deletions

View File

@@ -6,7 +6,7 @@ import CatModal from '@/components/CatModal';
import { Button } from '@/components/ui/button';
import { Skeleton } from '@/components/ui/skeleton';
import { Avatar, AvatarFallback } from '@/components/ui/avatar';
import { Heart, Plus, ArrowLeft, Grid3X3, Bookmark } from 'lucide-react';
import { ArrowLeft, Plus, Heart } from 'lucide-react';
export default function ProfilePage() {
const { id: paramId } = useParams<{ id?: string }>();
@@ -27,16 +27,16 @@ export default function ProfilePage() {
if (isLoading) {
return (
<div className="mx-auto max-w-4xl px-4 py-10">
<div className="flex items-center gap-6 mb-10">
<div className="mx-auto max-w-[660px] px-4 py-8">
<div className="flex items-center gap-4 mb-8">
<Skeleton className="h-16 w-16 rounded-full" />
<div className="space-y-2">
<Skeleton className="h-6 w-32" />
<div className="flex gap-4"><Skeleton className="h-4 w-16" /><Skeleton className="h-4 w-16" /><Skeleton className="h-4 w-16" /></div>
<Skeleton className="h-5 w-32 rounded" />
<Skeleton className="h-4 w-40 rounded" />
</div>
</div>
<div className="grid grid-cols-3 gap-1">
{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-lg" />))}
</div>
</div>
);
@@ -45,8 +45,8 @@ export default function ProfilePage() {
if (!profileUser && !isMe) {
return (
<div className="flex flex-col items-center justify-center py-20">
<p className="text-muted-foreground mb-4">Пользователь не найден</p>
<Button variant="outline" onClick={() => navigate('/feed')}>Перейти в ленту</Button>
<p className="text-[15px] text-[#8e8e93] mb-4">Пользователь не найден</p>
<Button variant="outline" onClick={() => navigate('/feed')} className="rounded-full text-[13px]">Перейти в ленту</Button>
</div>
);
}
@@ -55,89 +55,68 @@ export default function ProfilePage() {
const initials = profileUser?.username?.charAt(0).toUpperCase() || '?';
const totalLikes = cats.reduce((sum, c) => sum + c.likes_count, 0);
const declension = (n: number, forms: [string, string, string]) => {
n = Math.abs(n) % 100;
const n1 = n % 10;
if (n > 10 && n < 20) return forms[2];
if (n1 > 1 && n1 < 5) return forms[1];
if (n1 === 1) return forms[0];
return forms[2];
};
return (
<div className="mx-auto max-w-4xl px-4 py-10">
<div className="mx-auto max-w-[660px] px-4 py-8">
{!isMe && (
<button onClick={() => navigate(-1)} className="mb-6 flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors">
<ArrowLeft className="h-4 w-4" />
<button onClick={() => navigate(-1)} className="mb-5 flex items-center gap-1.5 text-[14px] text-[#8e8e93] hover:text-black transition-colors">
<ArrowLeft className="h-4 w-4" strokeWidth={1.5} />
Назад
</button>
)}
{/* Profile header */}
<div className="flex items-start gap-8 mb-10">
<Avatar className="h-20 w-20 shrink-0 ring-2 ring-offset-2 ring-orange-200">
<AvatarFallback className="text-2xl font-bold bg-gradient-to-br from-orange-400 to-rose-500 text-white">
<div className="flex items-center gap-5 mb-8">
<Avatar className="h-16 w-16 shrink-0">
<AvatarFallback className="text-xl font-semibold bg-[#2aabee] text-white">
{initials}
</AvatarFallback>
</Avatar>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-3 mb-4">
<h1 className="text-xl font-semibold">@{profileUser?.username}</h1>
<div className="flex items-center gap-3 mb-1.5">
<h1 className="text-[18px] font-semibold">@{profileUser?.username}</h1>
{isMe && (
<Button variant="outline" size="sm" className="rounded-xl text-xs h-8">
Редактировать профиль
<Button variant="outline" size="sm" className="rounded-full text-[12px] h-7 px-3">
Редактировать
</Button>
)}
</div>
<div className="flex items-center gap-6 text-sm mb-4">
<div className="flex items-center gap-4 text-[14px]">
<div>
<span className="font-bold">{cats.length}</span>{' '}
<span className="text-muted-foreground">{declension(cats.length, ['публикация', 'публикации', 'публикаций'])}</span>
<span className="font-semibold">{cats.length}</span>{' '}
<span className="text-[#8e8e93]">публикаций</span>
</div>
<div>
<span className="font-bold">{totalLikes}</span>{' '}
<span className="text-muted-foreground">{declension(totalLikes, ['лайк', 'лайка', 'лайков'])}</span>
<span className="font-semibold">{totalLikes}</span>{' '}
<span className="text-[#8e8e93]">лайков</span>
</div>
<div>
<span className="font-bold">🏆 {profileUser?.points ?? 0}</span>{' '}
<span className="text-muted-foreground">{declension(profileUser?.points ?? 0, ['балл', 'балла', 'баллов'])}</span>
<span className="font-semibold">🏆{profileUser?.points ?? 0}</span>{' '}
<span className="text-[#8e8e93]">баллов</span>
</div>
</div>
{isMe && (
<Link to="/upload">
<Button size="sm" className="rounded-xl bg-gradient-to-r from-orange-400 to-rose-500 text-white hover:from-orange-500 hover:to-rose-600 shadow-sm gap-1">
<Plus className="h-4 w-4" />
Новая публикация
</Button>
</Link>
<div className="mt-3">
<Link to="/upload">
<Button size="sm" className="rounded-full text-[13px] h-8 bg-[#2aabee] hover:bg-[#1d9bd9] gap-1">
<Plus className="h-3.5 w-3.5" strokeWidth={2} />
Новая публикация
</Button>
</Link>
</div>
)}
</div>
</div>
{/* Tabs */}
<div className="flex items-center gap-6 border-t pt-4 mb-1">
<button className="flex items-center gap-1.5 text-xs font-bold tracking-wider uppercase text-foreground">
<Grid3X3 className="h-3 w-3" />
Публикации
</button>
<button className="flex items-center gap-1.5 text-xs font-bold tracking-wider uppercase text-muted-foreground hover:text-foreground transition-colors">
<Bookmark className="h-3 w-3" />
Сохранённое
</button>
</div>
{/* Grid */}
{cats.length === 0 ? (
<div className="flex flex-col items-center justify-center py-20 text-center border-t">
<p className="text-base font-medium mb-1">Пока нет котов</p>
<p className="text-sm text-muted-foreground mb-4">
<div className="flex flex-col items-center justify-center py-16 text-center">
<p className="text-[15px] font-medium mb-1">Пока нет котов</p>
<p className="text-[13px] text-[#8e8e93] mb-4">
{isMe ? 'Поделитесь первым фото кота' : 'У пользователя пока нет котов'}
</p>
{isMe && (
<Link to="/upload">
<Button size="sm" className="rounded-xl">Загрузить кота</Button>
<Button size="sm" className="rounded-full text-[13px] bg-[#2aabee] hover:bg-[#1d9bd9]">Загрузить кота</Button>
</Link>
)}
</div>
@@ -147,11 +126,11 @@ export default function ProfilePage() {
<button
key={cat.id}
onClick={() => setModalCatId(cat.id)}
className="group relative aspect-square overflow-hidden rounded-xl bg-muted"
className="group relative aspect-square overflow-hidden bg-[#f0f0f0]"
>
<img src={cat.image_url} alt={cat.caption || 'Фото кота'} className="h-full w-full object-cover transition-transform group-hover:scale-105" loading="lazy" />
<div className="absolute inset-0 flex items-center justify-center bg-black/20 opacity-0 group-hover:opacity-100 transition-opacity rounded-xl">
<div className="flex items-center gap-1.5 text-white text-sm font-bold">
<div className="absolute inset-0 flex items-center justify-center bg-black/10 opacity-0 group-hover:opacity-100 transition-opacity">
<div className="flex items-center gap-1 text-white text-[13px] font-semibold drop-shadow-lg">
<Heart className="h-4 w-4 fill-white" strokeWidth={2} />
<span>{cat.likes_count}</span>
</div>