import { useState } from "react"; import { useTranslation } from 'react-i18next'; import ProfileAvatar from "./profile/ProfileAvatar"; function FollowButton() { const [following, setFollowing] = useState(false); const { t } = useTranslation(); return ( ); } export default function RightSidebar({ ads, profileData, isAuthenticated, onProfileClick, onLoginClick, onNavClick }) { const { t } = useTranslation(); const suggestions = [...(ads || [])] .sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt)) .slice(0, 4); const profileName = isAuthenticated ? `${profileData?.firstName || ""} ${profileData?.lastName || ""}`.trim() || profileData?.login : null; return (
{isAuthenticated ? ( <>
{profileName}
{profileData?.login}
) : ( <>
👤
{t('rightSidebar.guest')}
{t('rightSidebar.guestSub')}
)}
{t('rightSidebar.suggestions')}
{suggestions.length === 0 && (
{t('rightSidebar.empty')}
)} {suggestions.map(ad => (
{ad.emoji || "📋"}
{ad.title}
{ad.city || (ad.type === "loss" ? t('postCard.loss') : t('postCard.found'))}
))}
© {new Date().getFullYear()} {t('app.name')} {t('rightSidebar.footRules')} {t('rightSidebar.footPrivacy')} {t('rightSidebar.footSupport')}
); }