Merge pull request 'profile fixes' (#18) from verbiricha/stream:profile into main

Reviewed-on: Kieran/stream#18
This commit is contained in:
2023-07-01 17:40:50 +00:00
3 changed files with 18 additions and 17 deletions

View File

@ -1,8 +1,8 @@
import { useMemo } from "react"; import { useMemo } from "react";
import { import {
RequestBuilder, RequestBuilder,
ReplaceableNoteStore,
FlatNoteStore, FlatNoteStore,
ParameterizedReplaceableNoteStore,
NostrLink, NostrLink,
EventKind, EventKind,
parseZap, parseZap,
@ -24,20 +24,19 @@ export function useProfile(link: NostrLink, leaveOpen = false) {
return b; return b;
}, [link, leaveOpen]); }, [link, leaveOpen]);
const { data: streamsData } = useRequestBuilder<ReplaceableNoteStore>( const { data: streamsData } =
useRequestBuilder<ParameterizedReplaceableNoteStore>(
System, System,
ReplaceableNoteStore, ParameterizedReplaceableNoteStore,
sub sub
); );
const streams = streamsData ?? [];
const streams = Array.isArray(streamsData)
? streamsData
: streamsData
? [streamsData]
: [];
const addresses = useMemo(() => { const addresses = useMemo(() => {
return streams.map((e) => `${e.kind}:${e.pubkey}:${findTag(e, "d")}`); if (streamsData) {
return streamsData.map((e) => `${e.kind}:${e.pubkey}:${findTag(e, "d")}`);
}
return [];
}, [streamsData]); }, [streamsData]);
const zapsSub = useMemo(() => { const zapsSub = useMemo(() => {

View File

@ -3,8 +3,11 @@
justify-content: center; justify-content: center;
} }
.profile-page .profile-container {
max-width: 620px; @media (min-width: 768px) {
.profile-page .profile-container {
width: 620px;
}
} }
.profile-page .profile-content { .profile-page .profile-content {

View File

@ -69,8 +69,7 @@ export function ProfilePage() {
function goToLive() { function goToLive() {
if (liveEvent) { if (liveEvent) {
const d = const d = findTag(liveEvent, "d") || "";
liveEvent.tags?.find((t: string[]) => t?.at(0) === "d")?.at(1) || "";
const naddr = encodeTLV( const naddr = encodeTLV(
NostrPrefix.Address, NostrPrefix.Address,
d, d,