UI: modern editorial redesign — stone palette, blue-purple gradient, clean typography
This commit is contained in:
@@ -6,14 +6,13 @@ 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 { ArrowLeft, Plus, LogOut, Heart, Shield } from 'lucide-react';
|
||||
import { ArrowLeft, Plus, LogOut, Shield } from 'lucide-react';
|
||||
|
||||
export default function ProfilePage() {
|
||||
const { id: paramId } = useParams<{ id?: string }>();
|
||||
const navigate = useNavigate();
|
||||
const { user: me, logout } = useAuth();
|
||||
const [modalCatId, setModalCatId] = useState<number | null>(null);
|
||||
const [tab, setTab] = useState<'photos'>('photos');
|
||||
|
||||
const profileUserId = paramId ? parseInt(paramId) : me?.id;
|
||||
const isMe = !paramId || (me && profileUserId === me.id);
|
||||
@@ -45,10 +44,10 @@ export default function ProfilePage() {
|
||||
|
||||
if (!profileUser && !isMe) {
|
||||
return (
|
||||
<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>
|
||||
<div className="flex flex-col items-center justify-center py-24 animate-rise">
|
||||
<div className="mb-4 flex h-14 w-14 items-center justify-center rounded-xl bg-[var(--secondary)]"><span className="text-xl">🔍</span></div>
|
||||
<p className="text-base font-semibold mb-1">Пользователь не найден</p>
|
||||
<Button variant="outline" onClick={() => navigate('/feed')} className="rounded-lg text-xs mt-2">Вернуться в ленту</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -58,23 +57,22 @@ 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 animate-fade-in-up">
|
||||
<div className="mx-auto max-w-[660px] px-4 py-6 animate-rise">
|
||||
{!isMe && (
|
||||
<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 onClick={() => navigate(-1)} className="mb-4 flex items-center gap-1.5 text-xs text-[var(--fg-secondary)] hover:text-[var(--fg)] transition-colors">
|
||||
<ArrowLeft className="h-4 w-4 stroke-[1.5]" /> Назад
|
||||
</button>
|
||||
)}
|
||||
|
||||
<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" style={{ background: 'linear-gradient(135deg, #007aff, #5856d6)', color: 'white', borderRadius: '50%', display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100%', height: '100%' }}>
|
||||
<Avatar className="h-20 w-20 shrink-0">
|
||||
<AvatarFallback className="text-2xl font-bold avatar" style={{ borderRadius: '50%' }}>
|
||||
{initials}
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-3 mb-2">
|
||||
<h1 className="text-[20px] font-bold truncate">@{profileUser?.username}</h1>
|
||||
<div className="flex items-center gap-3 mb-3">
|
||||
<h1 className="text-xl font-bold truncate">@{profileUser?.username}</h1>
|
||||
<div className="flex items-center gap-1 ml-auto">
|
||||
{isMe && me?.is_admin && (
|
||||
<Link to="/admin" className="btn-icon h-8 w-8 text-[var(--primary)] hover:bg-[var(--primary-light)]" title="Админ-панель">
|
||||
@@ -89,66 +87,44 @@ export default function ProfilePage() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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-[11px] text-[var(--fg-secondary)]">публикаций</p>
|
||||
</div>
|
||||
<div className="text-center">
|
||||
<p className="font-bold text-[16px]">{totalLikes}</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-[11px] text-[var(--fg-secondary)]">баллов</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-6">
|
||||
<div><span className="font-bold">{cats.length}</span><span className="text-xs text-[var(--fg-secondary)] ml-1">фото</span></div>
|
||||
<div><span className="font-bold">{totalLikes}</span><span className="text-xs text-[var(--fg-secondary)] ml-1">❤️</span></div>
|
||||
<div><span className="font-bold">🏆{profileUser?.points ?? 0}</span></div>
|
||||
</div>
|
||||
|
||||
{isMe && (
|
||||
<Link to="/upload">
|
||||
<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>
|
||||
</Link>
|
||||
<div className="mt-3">
|
||||
<Link to="/upload">
|
||||
<Button size="sm" className="rounded-lg text-xs h-8 gap-1.5"
|
||||
style={{ background: 'linear-gradient(135deg, #2563eb, #7c3aed)' }}>
|
||||
<Plus className="h-3.5 w-3.5" strokeWidth={2} /> Новая публикация
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
{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>
|
||||
<div className="flex flex-col items-center justify-center py-16 text-center animate-rise">
|
||||
<div className="mb-4 flex h-14 w-14 items-center justify-center rounded-xl bg-[var(--secondary)]"><span className="text-xl">📸</span></div>
|
||||
<p className="text-sm font-medium mb-1">Пока нет котов</p>
|
||||
<p className="text-xs text-[var(--fg-secondary)] mb-5">{isMe ? 'Поделитесь первым фото' : 'У пользователя пока нет котов'}</p>
|
||||
{isMe && (
|
||||
<Link to="/upload"><Button size="sm" className="rounded-full text-[13px]"
|
||||
style={{ background: 'linear-gradient(135deg, #007aff, #5856d6)' }}>Загрузить кота</Button></Link>
|
||||
<Link to="/upload"><Button size="sm" className="rounded-lg text-xs"
|
||||
style={{ background: 'linear-gradient(135deg, #2563eb, #7c3aed)' }}>Загрузить кота</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">
|
||||
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 drop-shadow-sm">
|
||||
<Heart className="h-4 w-4 fill-white" strokeWidth={2} />
|
||||
<span>{cat.likes_count}</span>
|
||||
</div>
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/30 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-end p-2.5">
|
||||
<span className="text-white text-xs font-semibold drop-shadow">❤️ {cat.likes_count}</span>
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user