import React, { useState } from 'react'; import { Link } from 'react-router-dom'; import { Plus, TrendingUp, Users, Eye } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { useForumData, useForumSelectors, useAuth, usePermissions, } from '@/hooks'; import { CypherImage } from '@/components/ui/CypherImage'; import { CreateCellDialog } from '@/components/CreateCellDialog'; import { useUserDisplay } from '@/hooks'; const FeedSidebar: React.FC = () => { // ✅ Use reactive hooks for data const forumData = useForumData(); const selectors = useForumSelectors(forumData); const { currentUser, verificationStatus } = useAuth(); const { canCreateCell } = usePermissions(); const [showCreateCell, setShowCreateCell] = useState(false); // Get user display information using the hook const { displayName, hasENS, hasOrdinal } = useUserDisplay( currentUser?.address || '' ); // ✅ Get pre-computed stats and trending data from selectors const stats = selectors.selectStats(); // Use cellsWithStats from forumData to get post counts const { cellsWithStats } = forumData; const trendingCells = cellsWithStats .sort((a, b) => b.recentActivity - a.recentActivity) .slice(0, 5); // User's verification status display const getVerificationBadge = () => { if (verificationStatus.level === 'verified-owner') { return { text: 'Verified Owner', color: 'bg-green-500' }; } else if (verificationStatus.level === 'verified-basic') { return { text: 'Verified', color: 'bg-blue-500' }; } else if (hasENS) { return { text: 'ENS User', color: 'bg-purple-500' }; } else if (hasOrdinal) { return { text: 'Ordinal User', color: 'bg-orange-500' }; } return { text: 'Unverified', color: 'bg-gray-500' }; }; const verificationBadge = getVerificationBadge(); return (