import { Link } from 'react-router'; import { toast } from 'sonner'; import { FolderOpen, Star, StarOff } from 'lucide-react'; import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, } from '@/components/ui/dropdown-menu'; import { useSoulseekFavorites } from './useSoulseekFavorites'; import { soulseekUserPath } from './shared'; // The peer dropdown, shared by search results and downloads: click a username anywhere in the workspace // and act on that peer. Opening a peer is a real link to /soulseek/users?user= — the Users section // still owns the lookup and the cached share tree, it just reads who from the URL. Favouriting is a // mutation, so it stays a menu item that acts rather than navigates. type UserMenuProps = { username: string }; export const UserMenu = ({ username }: UserMenuProps) => { const { isFavorite, toggle } = useSoulseekFavorites(); const favorited = isFavorite(username); const toggleFavorite = () => { toggle(username); toast.success(favorited ? `Removed ${username} from favorites` : `Added ${username} to favorites`); }; return ( {username} View profile & shares {favorited ? : } {favorited ? 'Remove from favorites' : 'Add user to favorites'} ); };