diff --git a/client/src/components/CatCard.tsx b/client/src/components/CatCard.tsx index f2b4c34..6062c3a 100644 --- a/client/src/components/CatCard.tsx +++ b/client/src/components/CatCard.tsx @@ -4,7 +4,7 @@ import { useAuth } from '@/hooks/useAuth'; import { useLikeCat, useUnlikeCat } from '@/hooks/useLikes'; import { useToast } from '@/components/Toast'; import { Avatar, AvatarFallback } from '@/components/ui/avatar'; -import { Heart, MessageCircle } from 'lucide-react'; +import { Heart } from 'lucide-react'; interface CatCardProps { cat: Cat; @@ -23,14 +23,12 @@ export default function CatCard({ cat, onOpen }: CatCardProps) { const toggleLike = async () => { if (isOwner || !user) return; if (liked) { - setLiked(false); - setLikeCount((c) => c - 1); + setLiked(false); setLikeCount((c) => c - 1); try { await unlikeMutation.mutateAsync(); } catch { setLiked(true); setLikeCount((c) => c + 1); } } else { - setLiked(true); - setLikeCount((c) => c + 1); - toast('Нравится ❤️'); + setLiked(true); setLikeCount((c) => c + 1); + toast('❤️'); try { await likeMutation.mutateAsync(); } catch { setLiked(false); setLikeCount((c) => c - 1); } } @@ -41,28 +39,24 @@ export default function CatCard({ cat, onOpen }: CatCardProps) { }); return ( -
-
+
+
onOpen(cat.id)} > -
- - - {cat.username.charAt(0).toUpperCase()} - - -
-

- @{cat.username} -

- -
+ + + {cat.username.charAt(0).toUpperCase()} + + +
+

@{cat.username}

+
-
onOpen(cat.id)}> +
onOpen(cat.id)}> {cat.caption {cat.caption && ( -
onOpen(cat.id)}> -

+

onOpen(cat.id)}> +

@{cat.username} {cat.caption}

@@ -82,11 +76,11 @@ export default function CatCard({ cat, onOpen }: CatCardProps) { )}
-
+
- + 🏆 - {cat.user_points} + {cat.user_points}
diff --git a/client/src/components/CatModal.tsx b/client/src/components/CatModal.tsx index d25902c..dfdb12c 100644 --- a/client/src/components/CatModal.tsx +++ b/client/src/components/CatModal.tsx @@ -28,9 +28,9 @@ export default function CatModal({ catId, onClose }: CatModalProps) { useEffect(() => { if (data?.cat) setLikeCount(data.cat.likes_count); }, [data]); useEffect(() => { document.body.style.overflow = 'hidden'; return () => { document.body.style.overflow = ''; }; }, []); useEffect(() => { - const handler = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; - window.addEventListener('keydown', handler); - return () => window.removeEventListener('keydown', handler); + const h = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; + window.addEventListener('keydown', h); + return () => window.removeEventListener('keydown', h); }, [onClose]); const cat = data?.cat; @@ -44,7 +44,7 @@ export default function CatModal({ catId, onClose }: CatModalProps) { catch { setLiked(true); setLikeCount((c) => c + 1); } } else { setLiked(true); setLikeCount((c) => c + 1); - toast('Нравится ❤️'); + toast('❤️'); try { await likeMutation.mutateAsync(); refetchLike(); } catch { setLiked(false); setLikeCount((c) => c - 1); } } @@ -52,19 +52,16 @@ export default function CatModal({ catId, onClose }: CatModalProps) { const handleDelete = async () => { if (!isOwner || !cat) return; - try { - await deleteMutation.mutateAsync(cat.id); - toast('Удалено'); - onClose(); - } catch { toast('Ошибка удаления', 'error'); } + try { await deleteMutation.mutateAsync(cat.id); toast('Удалено'); onClose(); } + catch { toast('Ошибка удаления', 'error'); } }; if (isLoading || !cat) { return ( -
+
- Загрузка... + Загрузка...
); @@ -75,18 +72,18 @@ export default function CatModal({ catId, onClose }: CatModalProps) { }); return ( -
+
e.stopPropagation()} >
- - {cat.username.charAt(0).toUpperCase()} + + {cat.username.charAt(0).toUpperCase()}
- @{cat.username} + @{cat.username}

{dateStr}

@@ -118,11 +115,11 @@ export default function CatModal({ catId, onClose }: CatModalProps) {
- - {cat.username.charAt(0).toUpperCase()} + + {cat.username.charAt(0).toUpperCase()}
-

+

@{cat.username} {cat.caption || 'Без подписи'}

@@ -135,18 +132,14 @@ export default function CatModal({ catId, onClose }: CatModalProps) { - + 🏆 {cat.user_points} баллов diff --git a/client/src/components/FeedSidebar.tsx b/client/src/components/FeedSidebar.tsx index c0d619e..8132b7a 100644 --- a/client/src/components/FeedSidebar.tsx +++ b/client/src/components/FeedSidebar.tsx @@ -2,14 +2,9 @@ import { useAuth } from '@/hooks/useAuth'; import { useCats } from '@/hooks/useCats'; import { Avatar, AvatarFallback } from '@/components/ui/avatar'; import { Link } from 'react-router-dom'; -import { Trophy, Sparkles } from 'lucide-react'; -function MedalBadge({ rank }: { rank: number }) { - const colors = [ - 'bg-amber-100 text-amber-600 shadow-[0_0_0_1px_rgba(217,119,6,0.15)]', - 'bg-gray-100 text-gray-500 shadow-[0_0_0_1px_rgba(107,114,128,0.15)]', - 'bg-orange-100 text-orange-600 shadow-[0_0_0_1px_rgba(234,88,12,0.15)]', - ]; +function Medal({ rank }: { rank: number }) { + const colors = ['bg-blue-100 text-blue-700', 'bg-stone-100 text-stone-500', 'bg-amber-100 text-amber-700']; return ( {rank + 1} @@ -36,49 +31,43 @@ export default function FeedSidebar() { return (
{user && ( - - - + + + {user.username.charAt(0).toUpperCase()}
-

{user.username}

-

🏆 {user.points} баллов

+

{user.username}

+

🏆 {user.points} баллов

)} -
-
- -

Лидеры

-
+
+

+ 🏆 Лидеры +

{topUsers.length === 0 ? ( -

Пока нет пользователей

+

Пока нет пользователей

) : (
{topUsers.map(([id, u], i) => ( - - - {u.username.charAt(0).toUpperCase()} + + + {u.username.charAt(0).toUpperCase()} - {u.username} - {u.points} + {u.username} + {u.points} ))}
)}
-
-
- - Catstagram · Сообщество котоводов -
-
+

Catstagram · сообщество котоводов

); } \ No newline at end of file diff --git a/client/src/components/Navbar.tsx b/client/src/components/Navbar.tsx index 1cfa341..ca89250 100644 --- a/client/src/components/Navbar.tsx +++ b/client/src/components/Navbar.tsx @@ -10,25 +10,25 @@ export default function Navbar() { if (!user) return null; return ( -