mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-25 19:23:45 +02:00
immprove user profile debug modal
This commit is contained in:
5
.changeset/clever-socks-chew.md
Normal file
5
.changeset/clever-socks-chew.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"nostrudel": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove brb.io link from user profiles
|
@@ -1,12 +1,10 @@
|
|||||||
import { createIcon, IconProps } from "@chakra-ui/icons";
|
import { createIcon, IconProps } from "@chakra-ui/icons";
|
||||||
|
|
||||||
import nostrGuruIcon from "./icons/nostr-guru.jpg";
|
import nostrGuruIcon from "./icons/nostr-guru.jpg";
|
||||||
import brbIcon from "./icons/brb.png";
|
|
||||||
import snortSocialIcon from "./icons/snort-social.png";
|
import snortSocialIcon from "./icons/snort-social.png";
|
||||||
|
|
||||||
export const IMAGE_ICONS = {
|
export const IMAGE_ICONS = {
|
||||||
nostrGuruIcon,
|
nostrGuruIcon,
|
||||||
brbIcon,
|
|
||||||
snortSocialIcon,
|
snortSocialIcon,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
@@ -47,8 +47,12 @@ function finalizeNote(draft: DraftNostrEvent) {
|
|||||||
|
|
||||||
const hex = normalizeToHex(match[1]);
|
const hex = normalizeToHex(match[1]);
|
||||||
if (!hex) continue;
|
if (!hex) continue;
|
||||||
|
const mentionType = match[2] === "npub1" ? "p" : "e";
|
||||||
// TODO: find the best relay for this user or note
|
// TODO: find the best relay for this user or note
|
||||||
const index = updatedDraft.tags.push([match[2] === "npub1" ? "p" : "e", hex, "", "mention"]) - 1;
|
const existingMention = updatedDraft.tags.find((t) => t[0] === mentionType && t[1] === hex);
|
||||||
|
const index = existingMention
|
||||||
|
? updatedDraft.tags.indexOf(existingMention)
|
||||||
|
: updatedDraft.tags.push([mentionType, hex, "", "mention"]) - 1;
|
||||||
|
|
||||||
// replace the npub1 or note1 with a mention tag #[0]
|
// replace the npub1 or note1 with a mention tag #[0]
|
||||||
const c = updatedDraft.content;
|
const c = updatedDraft.content;
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
|
Code,
|
||||||
|
Flex,
|
||||||
|
Heading,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Modal,
|
Modal,
|
||||||
ModalBody,
|
ModalBody,
|
||||||
@@ -17,6 +20,7 @@ import { useUserMetadata } from "../../../hooks/use-user-metadata";
|
|||||||
import { getUserDisplayName } from "../../../helpers/user-metadata";
|
import { getUserDisplayName } from "../../../helpers/user-metadata";
|
||||||
import { useUserRelays } from "../../../hooks/use-user-relays";
|
import { useUserRelays } from "../../../hooks/use-user-relays";
|
||||||
import { RelayMode } from "../../../classes/relay";
|
import { RelayMode } from "../../../classes/relay";
|
||||||
|
import { CopyIconButton } from "../../../components/copy-icon-button";
|
||||||
|
|
||||||
export const UserProfileMenu = ({ pubkey, ...props }: { pubkey: string } & Omit<MenuIconButtonProps, "children">) => {
|
export const UserProfileMenu = ({ pubkey, ...props }: { pubkey: string } & Omit<MenuIconButtonProps, "children">) => {
|
||||||
const npub = normalizeToBech32(pubkey, Bech32Prefix.Pubkey);
|
const npub = normalizeToBech32(pubkey, Bech32Prefix.Pubkey);
|
||||||
@@ -42,6 +46,9 @@ export const UserProfileMenu = ({ pubkey, ...props }: { pubkey: string } & Omit<
|
|||||||
<MenuItem icon={<SpyIcon fontSize="1.5em" />} onClick={() => loginAsUser()}>
|
<MenuItem icon={<SpyIcon fontSize="1.5em" />} onClick={() => loginAsUser()}>
|
||||||
Login as {getUserDisplayName(metadata, pubkey)}
|
Login as {getUserDisplayName(metadata, pubkey)}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem onClick={infoModal.onOpen} icon={<CodeIcon />}>
|
||||||
|
View Raw
|
||||||
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
as="a"
|
as="a"
|
||||||
icon={<Avatar src={IMAGE_ICONS.nostrGuruIcon} size="xs" />}
|
icon={<Avatar src={IMAGE_ICONS.nostrGuruIcon} size="xs" />}
|
||||||
@@ -50,14 +57,6 @@ export const UserProfileMenu = ({ pubkey, ...props }: { pubkey: string } & Omit<
|
|||||||
>
|
>
|
||||||
Open in Nostr.guru
|
Open in Nostr.guru
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
|
||||||
as="a"
|
|
||||||
icon={<Avatar src={IMAGE_ICONS.brbIcon} size="xs" />}
|
|
||||||
href={`https://brb.io/u/${npub}`}
|
|
||||||
target="_blank"
|
|
||||||
>
|
|
||||||
Open in BRB
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem
|
<MenuItem
|
||||||
as="a"
|
as="a"
|
||||||
icon={<Avatar src={IMAGE_ICONS.snortSocialIcon} size="xs" />}
|
icon={<Avatar src={IMAGE_ICONS.snortSocialIcon} size="xs" />}
|
||||||
@@ -66,9 +65,6 @@ export const UserProfileMenu = ({ pubkey, ...props }: { pubkey: string } & Omit<
|
|||||||
>
|
>
|
||||||
Open in snort.social
|
Open in snort.social
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem onClick={infoModal.onOpen} icon={<CodeIcon />}>
|
|
||||||
View Raw
|
|
||||||
</MenuItem>
|
|
||||||
</MenuIconButton>
|
</MenuIconButton>
|
||||||
{infoModal.isOpen && (
|
{infoModal.isOpen && (
|
||||||
<Modal isOpen={infoModal.isOpen} onClose={infoModal.onClose} size="6xl">
|
<Modal isOpen={infoModal.isOpen} onClose={infoModal.onClose} size="6xl">
|
||||||
@@ -76,7 +72,38 @@ export const UserProfileMenu = ({ pubkey, ...props }: { pubkey: string } & Omit<
|
|||||||
<ModalContent>
|
<ModalContent>
|
||||||
<ModalCloseButton />
|
<ModalCloseButton />
|
||||||
<ModalBody overflow="auto" fontSize="sm" padding="2">
|
<ModalBody overflow="auto" fontSize="sm" padding="2">
|
||||||
<pre>{JSON.stringify(metadata, null, 2)}</pre>
|
<Flex gap="2" direction="column">
|
||||||
|
<Heading size="sm" mt="2">
|
||||||
|
Hex pubkey
|
||||||
|
</Heading>
|
||||||
|
<Flex gap="2">
|
||||||
|
<Code fontSize="md" wordBreak="break-all">
|
||||||
|
{pubkey}
|
||||||
|
</Code>
|
||||||
|
<CopyIconButton text={pubkey} size="xs" aria-label="copy hex" />
|
||||||
|
</Flex>
|
||||||
|
|
||||||
|
{npub && (
|
||||||
|
<>
|
||||||
|
<Heading size="sm" mt="2">
|
||||||
|
Encoded pubkey (NIP-19)
|
||||||
|
</Heading>
|
||||||
|
<Flex gap="2">
|
||||||
|
<Code fontSize="md" wordBreak="break-all">
|
||||||
|
{npub}
|
||||||
|
</Code>
|
||||||
|
<CopyIconButton text={npub} size="xs" aria-label="copy npub" />
|
||||||
|
</Flex>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Heading size="sm" mt="2">
|
||||||
|
Metadata (kind 0)
|
||||||
|
</Heading>
|
||||||
|
<Code whiteSpace="pre" overflowX="auto">
|
||||||
|
{JSON.stringify(metadata, null, 2)}
|
||||||
|
</Code>
|
||||||
|
</Flex>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
Reference in New Issue
Block a user