Seventh plugin out, and the first that was already dead. Soulseek had been switched off since 2026-08-13: hono.ts had the router import and its mount commented out, so createSidecarProxy never ran, registerProxiedPrefix was never called, the slskd:server announcement fired into a void, and officer-slskd was not in the ecosystem at all. The permission entry had been reduced to api: [], which is why assertPermissionTotality was satisfied and the server booted clean. The UI rendered perfectly and every request 404'd. So this is a resurrection as well as a move. The mount is now /api/soulseek, derived via mountPrefix from the appName — all 47 frontend call sites repointed from /slskd/. The credential key in service_connections stays 'slskd': it names the daemon, not the route. Those two strings differ on purpose and conflating them reads the wrong row. The connection stays in core service_connections, as transmission does, so 'slskd' remains in a platform union this plugin cannot extend. Recorded in PLUGIN.md. Unlike transmission this plugin does own a schema: favourites and the two halves of the cached browse tree, which slskd has no concept of. Those three tables had been dropped from the drizzle barrel, so bun db:push would have deleted them on any server holding data. 313 palette classes converted to the semantic tone set, including a shared PHASE_TONE the three transfer views previously each copied.
60 lines
2.4 KiB
TypeScript
60 lines
2.4 KiB
TypeScript
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=<name> — 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 (
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<button
|
|
type="button"
|
|
title={`Actions for ${username}`}
|
|
className="min-w-0 max-w-full truncate rounded text-sm font-medium text-foreground underline decoration-dotted decoration-muted-foreground underline-offset-4 outline-none transition hover:decoration-foreground focus-visible:ring-2 focus-visible:ring-primary/40"
|
|
>
|
|
{username}
|
|
{favorited && <Star className="ml-1.5 inline h-3 w-3 fill-warning align-baseline text-warning" />}
|
|
</button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="start" className="w-56">
|
|
<DropdownMenuLabel className="truncate">{username}</DropdownMenuLabel>
|
|
<DropdownMenuSeparator />
|
|
<DropdownMenuItem asChild>
|
|
<Link to={soulseekUserPath(username)}>
|
|
<FolderOpen className="mr-2 h-4 w-4" />
|
|
View profile & shares
|
|
</Link>
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem onSelect={toggleFavorite}>
|
|
{favorited ? <StarOff className="mr-2 h-4 w-4" /> : <Star className="mr-2 h-4 w-4" />}
|
|
{favorited ? 'Remove from favorites' : 'Add user to favorites'}
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
);
|
|
};
|