mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-04-07 03:18:02 +02:00
immprove user profile debug modal
This commit is contained in:
parent
0f96ee4755
commit
d4321c03fb
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 nostrGuruIcon from "./icons/nostr-guru.jpg";
|
||||
import brbIcon from "./icons/brb.png";
|
||||
import snortSocialIcon from "./icons/snort-social.png";
|
||||
|
||||
export const IMAGE_ICONS = {
|
||||
nostrGuruIcon,
|
||||
brbIcon,
|
||||
snortSocialIcon,
|
||||
};
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
@ -47,8 +47,12 @@ function finalizeNote(draft: DraftNostrEvent) {
|
||||
|
||||
const hex = normalizeToHex(match[1]);
|
||||
if (!hex) continue;
|
||||
const mentionType = match[2] === "npub1" ? "p" : "e";
|
||||
// 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]
|
||||
const c = updatedDraft.content;
|
||||
|
@ -1,5 +1,8 @@
|
||||
import {
|
||||
Avatar,
|
||||
Code,
|
||||
Flex,
|
||||
Heading,
|
||||
MenuItem,
|
||||
Modal,
|
||||
ModalBody,
|
||||
@ -17,6 +20,7 @@ import { useUserMetadata } from "../../../hooks/use-user-metadata";
|
||||
import { getUserDisplayName } from "../../../helpers/user-metadata";
|
||||
import { useUserRelays } from "../../../hooks/use-user-relays";
|
||||
import { RelayMode } from "../../../classes/relay";
|
||||
import { CopyIconButton } from "../../../components/copy-icon-button";
|
||||
|
||||
export const UserProfileMenu = ({ pubkey, ...props }: { pubkey: string } & Omit<MenuIconButtonProps, "children">) => {
|
||||
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()}>
|
||||
Login as {getUserDisplayName(metadata, pubkey)}
|
||||
</MenuItem>
|
||||
<MenuItem onClick={infoModal.onOpen} icon={<CodeIcon />}>
|
||||
View Raw
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
as="a"
|
||||
icon={<Avatar src={IMAGE_ICONS.nostrGuruIcon} size="xs" />}
|
||||
@ -50,14 +57,6 @@ export const UserProfileMenu = ({ pubkey, ...props }: { pubkey: string } & Omit<
|
||||
>
|
||||
Open in Nostr.guru
|
||||
</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
|
||||
as="a"
|
||||
icon={<Avatar src={IMAGE_ICONS.snortSocialIcon} size="xs" />}
|
||||
@ -66,9 +65,6 @@ export const UserProfileMenu = ({ pubkey, ...props }: { pubkey: string } & Omit<
|
||||
>
|
||||
Open in snort.social
|
||||
</MenuItem>
|
||||
<MenuItem onClick={infoModal.onOpen} icon={<CodeIcon />}>
|
||||
View Raw
|
||||
</MenuItem>
|
||||
</MenuIconButton>
|
||||
{infoModal.isOpen && (
|
||||
<Modal isOpen={infoModal.isOpen} onClose={infoModal.onClose} size="6xl">
|
||||
@ -76,7 +72,38 @@ export const UserProfileMenu = ({ pubkey, ...props }: { pubkey: string } & Omit<
|
||||
<ModalContent>
|
||||
<ModalCloseButton />
|
||||
<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>
|
||||
</ModalContent>
|
||||
</Modal>
|
||||
|
Loading…
x
Reference in New Issue
Block a user