diff --git a/src/components/BlossomViewer.tsx b/src/components/BlossomViewer.tsx index 1f17c40..05d17a1 100644 --- a/src/components/BlossomViewer.tsx +++ b/src/components/BlossomViewer.tsx @@ -72,7 +72,7 @@ export function BlossomViewer({ case "upload": return ; case "list": - return ; + return ; case "blob": return ; case "mirror": @@ -753,7 +753,13 @@ function formatSize(bytes: number): string { /** * ListBlobsView - List blobs for a user */ -function ListBlobsView({ pubkey }: { pubkey?: string }) { +function ListBlobsView({ + pubkey, + serverUrl, +}: { + pubkey?: string; + serverUrl?: string; +}) { const { state } = useGrimoire(); const eventStore = useEventStore(); const accountPubkey = state.activeAccount?.pubkey; @@ -762,7 +768,9 @@ function ListBlobsView({ pubkey }: { pubkey?: string }) { const [servers, setServers] = useState([]); const [blobs, setBlobs] = useState([]); const [loading, setLoading] = useState(true); - const [selectedServer, setSelectedServer] = useState(null); + const [selectedServer, setSelectedServer] = useState( + serverUrl || null, + ); const [selectedBlob, setSelectedBlob] = useState(null); // Fetch servers for the target pubkey @@ -780,7 +788,8 @@ function ListBlobsView({ pubkey }: { pubkey?: string }) { if (event) { const s = getServersFromEvent(event); setServers(s); - if (s.length > 0 && !selectedServer) { + // Only set default server if no serverUrl was provided and no server is selected + if (s.length > 0 && !selectedServer && !serverUrl) { setSelectedServer(s[0]); } } @@ -799,7 +808,8 @@ function ListBlobsView({ pubkey }: { pubkey?: string }) { if (e) { const s = getServersFromEvent(e); setServers(s); - if (s.length > 0 && !selectedServer) { + // Only set default server if no serverUrl was provided and no server is selected + if (s.length > 0 && !selectedServer && !serverUrl) { setSelectedServer(s[0]); } } diff --git a/src/components/ProfileViewer.tsx b/src/components/ProfileViewer.tsx index 667fce3..a5223f4 100644 --- a/src/components/ProfileViewer.tsx +++ b/src/components/ProfileViewer.tsx @@ -10,7 +10,6 @@ import { Send, Wifi, HardDrive, - ExternalLink, } from "lucide-react"; import { kinds, nip19 } from "nostr-tools"; import { useEventStore, use$ } from "applesauce-react/hooks"; @@ -43,7 +42,7 @@ export interface ProfileViewerProps { * Shows profile metadata, inbox/outbox relays, and raw JSON */ export function ProfileViewer({ pubkey }: ProfileViewerProps) { - const { state } = useGrimoire(); + const { state, addWindow } = useGrimoire(); const accountPubkey = state.activeAccount?.pubkey; // Resolve $me alias @@ -336,14 +335,25 @@ export function ProfileViewer({ pubkey }: ProfileViewerProps) { {blossomServers.map((url) => ( window.open(url, "_blank")} + className="flex items-center justify-between gap-2 cursor-crosshair" + onClick={() => { + if (resolvedPubkey) { + addWindow( + "blossom", + { + subcommand: "list", + pubkey: resolvedPubkey, + serverUrl: url, + }, + `Files on ${url}`, + ); + } + }} >
{url}
-
))} diff --git a/src/components/nostr/user-menu.tsx b/src/components/nostr/user-menu.tsx index ac3ae8f..7439458 100644 --- a/src/components/nostr/user-menu.tsx +++ b/src/components/nostr/user-menu.tsx @@ -1,4 +1,4 @@ -import { User, HardDrive, ExternalLink } from "lucide-react"; +import { User, HardDrive } from "lucide-react"; import accounts from "@/services/accounts"; import { useProfile } from "@/hooks/useProfile"; import { use$ } from "applesauce-react/hooks"; @@ -131,23 +131,21 @@ export default function UserMenu() { Blossom Servers - ({blossomServers.length}) {blossomServers.map((server) => ( { + addWindow( + "blossom", + { subcommand: "list", serverUrl: server }, + `Files on ${server}`, + ); + }} > - - - {server} - + + {server} ))}