mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-19 12:00:32 +02:00
Merge branch 'next' into nip-72
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import dayjs from "dayjs";
|
||||
import { Kind, nip19 } from "nostr-tools";
|
||||
import { Kind } from "nostr-tools";
|
||||
import { AddressPointer } from "nostr-tools/lib/nip19";
|
||||
|
||||
import { DraftNostrEvent, NostrEvent, isATag, isDTag, isETag, isPTag } from "../../types/nostr-event";
|
||||
import { DraftNostrEvent, NostrEvent, isATag, isDTag, isETag, isPTag, isRTag } from "../../types/nostr-event";
|
||||
import { parseCoordinate } from "./events";
|
||||
|
||||
export const PEOPLE_LIST_KIND = 30000;
|
||||
@@ -31,6 +31,9 @@ export function getPubkeysFromList(event: NostrEvent) {
|
||||
export function getEventsFromList(event: NostrEvent) {
|
||||
return event.tags.filter(isETag).map((t) => ({ id: t[1], relay: t[2] }));
|
||||
}
|
||||
export function getReferencesFromList(event: NostrEvent) {
|
||||
return event.tags.filter(isRTag).map((t) => ({ url: t[1], petname: t[2] }));
|
||||
}
|
||||
export function getCoordinatesFromList(event: NostrEvent) {
|
||||
return event.tags.filter(isATag).map((t) => ({ coordinate: t[1], relay: t[2] }));
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ import {
|
||||
getListName,
|
||||
getParsedCordsFromList,
|
||||
getPubkeysFromList,
|
||||
getReferencesFromList,
|
||||
isSpecialListKind,
|
||||
} from "../../../helpers/nostr/lists";
|
||||
import { getSharableEventAddress } from "../../../helpers/nip19";
|
||||
@@ -42,6 +43,7 @@ function ListCardRender({ list, ...props }: Omit<CardProps, "children"> & { list
|
||||
const notes = getEventsFromList(list);
|
||||
const coordinates = getParsedCordsFromList(list);
|
||||
const communities = coordinates.filter((cord) => cord.kind === COMMUNITY_DEFINITION_KIND);
|
||||
const references = getReferencesFromList(list);
|
||||
const link = isSpecialListKind(list.kind) ? createCoordinate(list.kind, list.pubkey) : getSharableEventAddress(list);
|
||||
|
||||
// if there is a parent intersection observer, register this card
|
||||
@@ -90,6 +92,11 @@ function ListCardRender({ list, ...props }: Omit<CardProps, "children"> & { list
|
||||
</Flex>
|
||||
</>
|
||||
)}
|
||||
{references.length > 0 && (
|
||||
<>
|
||||
<Text>References ({references.length})</Text>
|
||||
</>
|
||||
)}
|
||||
{communities.length > 0 && (
|
||||
<>
|
||||
<Text>Communities ({communities.length}):</Text>
|
||||
|
@@ -7,9 +7,16 @@ import { ArrowLeftSIcon } from "../../components/icons";
|
||||
import { useCurrentAccount } from "../../hooks/use-current-account";
|
||||
import { useDeleteEventContext } from "../../providers/delete-event-provider";
|
||||
import { parseCoordinate } from "../../helpers/nostr/events";
|
||||
import { getEventsFromList, getListName, getParsedCordsFromList, getPubkeysFromList } from "../../helpers/nostr/lists";
|
||||
import {
|
||||
getEventsFromList,
|
||||
getListName,
|
||||
getParsedCordsFromList,
|
||||
getPubkeysFromList,
|
||||
getReferencesFromList,
|
||||
} from "../../helpers/nostr/lists";
|
||||
import useReplaceableEvent from "../../hooks/use-replaceable-event";
|
||||
import UserCard from "./components/user-card";
|
||||
import OpenGraphCard from "../../components/open-graph-card";
|
||||
import NoteCard from "./components/note-card";
|
||||
import { TrustProvider } from "../../providers/trust";
|
||||
import ListMenu from "./components/list-menu";
|
||||
@@ -53,6 +60,7 @@ export default function ListDetailsView() {
|
||||
const notes = getEventsFromList(list);
|
||||
const coordinates = getParsedCordsFromList(list);
|
||||
const communities = coordinates.filter((cord) => cord.kind === COMMUNITY_DEFINITION_KIND);
|
||||
const references = getReferencesFromList(list);
|
||||
|
||||
return (
|
||||
<VerticalPageLayout overflow="hidden" h="full">
|
||||
@@ -103,6 +111,23 @@ export default function ListDetailsView() {
|
||||
</>
|
||||
)}
|
||||
|
||||
{references.length > 0 && (
|
||||
<>
|
||||
<Heading size="md">References</Heading>
|
||||
<Divider />
|
||||
<TrustProvider trust>
|
||||
<Flex gap="2" direction="column">
|
||||
{references.map(({ url, petname }) => (
|
||||
<>
|
||||
{petname && <Heading size="md">{petname}</Heading>}
|
||||
<OpenGraphCard url={new URL(url)} />
|
||||
</>
|
||||
))}
|
||||
</Flex>
|
||||
</TrustProvider>
|
||||
</>
|
||||
)}
|
||||
|
||||
{communities.length > 0 && (
|
||||
<>
|
||||
<Heading size="md">Communities</Heading>
|
||||
|
@@ -23,6 +23,7 @@ import { unique } from "../../../helpers/array";
|
||||
import MagicTextArea from "../../../components/magic-textarea";
|
||||
import { useContextEmojis } from "../../../providers/emoji-provider";
|
||||
import UserDirectoryProvider from "../../../providers/user-directory-provider";
|
||||
import { TrustProvider } from "../../../providers/trust";
|
||||
|
||||
export type ReplyFormProps = {
|
||||
item: ThreadItem;
|
||||
@@ -81,7 +82,9 @@ export default function ReplyForm({ item, onCancel, onSubmitted }: ReplyFormProp
|
||||
/>
|
||||
{getValues().content.length > 0 && (
|
||||
<Box p="2" borderWidth={1} borderRadius="md" mb="2">
|
||||
<NoteContents event={draft} />
|
||||
<TrustProvider trust>
|
||||
<NoteContents event={draft} />
|
||||
</TrustProvider>
|
||||
</Box>
|
||||
)}
|
||||
<Flex gap="2" alignItems="center">
|
||||
|
@@ -302,6 +302,15 @@ export default function UserAboutTab() {
|
||||
>
|
||||
Slidestr Slideshow
|
||||
</Button>
|
||||
<Button
|
||||
as={Link}
|
||||
href={`https://nostree.me/${npub}`}
|
||||
leftIcon={<Image src="https://nostree.me/favicon.svg" w="1.2em" />}
|
||||
rightIcon={<ExternalLinkIcon />}
|
||||
isExternal
|
||||
>
|
||||
Nostree page
|
||||
</Button>
|
||||
</Flex>
|
||||
</Flex>
|
||||
);
|
||||
|
Reference in New Issue
Block a user