mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-03-17 21:31:43 +01:00
misc cleanup
This commit is contained in:
parent
569873ac3c
commit
d19c154013
@ -1,5 +0,0 @@
|
||||
---
|
||||
"nostrudel": minor
|
||||
---
|
||||
|
||||
Show fedimint tokens in content
|
@ -31,7 +31,6 @@
|
||||
"@codemirror/view": "^6.34.3",
|
||||
"@emotion/react": "^11.13.3",
|
||||
"@emotion/styled": "^11.13.0",
|
||||
"@fedimint/core-web": "^0.0.7",
|
||||
"@getalby/bitcoin-connect": "^3.6.2",
|
||||
"@getalby/bitcoin-connect-react": "^3.6.2",
|
||||
"@noble/ciphers": "^1.0.0",
|
||||
|
15
pnpm-lock.yaml
generated
15
pnpm-lock.yaml
generated
@ -57,9 +57,6 @@ importers:
|
||||
'@emotion/styled':
|
||||
specifier: ^11.13.0
|
||||
version: 11.13.0(@emotion/react@11.13.3(@types/react@18.3.12)(react@18.3.1))(@types/react@18.3.12)(react@18.3.1)
|
||||
'@fedimint/core-web':
|
||||
specifier: ^0.0.7
|
||||
version: 0.0.7
|
||||
'@getalby/bitcoin-connect':
|
||||
specifier: ^3.6.2
|
||||
version: 3.6.2(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)
|
||||
@ -1334,12 +1331,6 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@fedimint/core-web@0.0.7':
|
||||
resolution: {integrity: sha512-Sr4NUwOUDfQkopjkrAl+MeNR8taUzUaOdX4ZbCsOodT3gj4aNtJRLOTCotpCoHrmiqQZcfGkxYKY3ANgpgJsaw==}
|
||||
|
||||
'@fedimint/fedimint-client-wasm-bundler@0.0.2':
|
||||
resolution: {integrity: sha512-+6chBN4sItrPTS792na6ZZJL3OlZf+edzhy0W40B8PULesjRURV0DbCmR4mCdg+QHds3CkuKkISn/UQpN/cDdQ==}
|
||||
|
||||
'@getalby/bitcoin-connect-react@3.6.2':
|
||||
resolution: {integrity: sha512-5XeqBoiT7BuZHwGWSsCAMOrEqDrgJyyyOFnBi/hZZ+AsMBXRVqhgwst07Zbf4t7bNyXvphEYRTgisMvDQ42ErQ==}
|
||||
peerDependencies:
|
||||
@ -5626,12 +5617,6 @@ snapshots:
|
||||
'@esbuild/win32-x64@0.21.5':
|
||||
optional: true
|
||||
|
||||
'@fedimint/core-web@0.0.7':
|
||||
dependencies:
|
||||
'@fedimint/fedimint-client-wasm-bundler': 0.0.2
|
||||
|
||||
'@fedimint/fedimint-client-wasm-bundler@0.0.2': {}
|
||||
|
||||
'@getalby/bitcoin-connect-react@3.6.2(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)':
|
||||
dependencies:
|
||||
'@getalby/bitcoin-connect': 3.6.2(@types/react@18.3.12)(react@18.3.1)(typescript@5.6.3)
|
||||
|
@ -9,13 +9,11 @@ import { InlineEmoji } from "./components/ininle-emoji";
|
||||
import NipDefinition from "./components/nip";
|
||||
import { ImageGallery } from "./components/gallery";
|
||||
import LightningInvoice from "./components/lightning";
|
||||
const InlineFedimintCard = lazy(() => import("../fedimint/inline-fedimint-card"));
|
||||
|
||||
export const components: ComponentMap = {
|
||||
text: ({ node }) => <Text as="span">{node.value}</Text>,
|
||||
mention: Mention,
|
||||
cashu: Cashu,
|
||||
fedimint: ({ node }) => <InlineFedimintCard token={node.token} />,
|
||||
emoji: ({ node }) => <InlineEmoji url={node.url} code={node.code} />,
|
||||
hashtag: ({ node }) => (
|
||||
<Link as={RouterLink} to={`/t/${node.hashtag}`} color="blue.500">
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
} from "@chakra-ui/react";
|
||||
import { Link as RouterLink } from "react-router-dom";
|
||||
|
||||
import { getEmojisFromPack, getPackName } from "../../../helpers/nostr/emoji-packs";
|
||||
import { getEmojis, getPackName } from "../../../helpers/nostr/emoji-packs";
|
||||
import UserAvatarLink from "../../user/user-avatar-link";
|
||||
import UserLink from "../../user/user-link";
|
||||
import EmojiPackFavoriteButton from "../../../views/emoji-packs/components/emoji-pack-favorite-button";
|
||||
@ -23,7 +23,7 @@ import Timestamp from "../../timestamp";
|
||||
import { getSharableEventAddress } from "../../../services/event-relay-hint";
|
||||
|
||||
export default function EmbeddedEmojiPack({ pack, ...props }: Omit<CardProps, "children"> & { pack: NostrEvent }) {
|
||||
const emojis = getEmojisFromPack(pack);
|
||||
const emojis = getEmojis(pack);
|
||||
const naddr = getSharableEventAddress(pack);
|
||||
|
||||
return (
|
||||
|
@ -6,7 +6,7 @@ import { NostrEvent } from "../../../types/nostr-event";
|
||||
import UserLink from "../../user/user-link";
|
||||
import UserAvatar from "../../user/user-avatar";
|
||||
import { useBreakpointValue } from "../../../providers/global/breakpoint-provider";
|
||||
import { getVideoDuration, getVideoImages, getVideoSummary, getVideoTitle } from "../../../helpers/nostr/flare";
|
||||
import { getVideoDuration, getVideoImages, getVideoSummary, getVideoTitle } from "../../../helpers/nostr/video";
|
||||
import { getSharableEventAddress } from "../../../services/event-relay-hint";
|
||||
|
||||
export default function EmbeddedFlareVideo({ video, ...props }: Omit<CardProps, "children"> & { video: NostrEvent }) {
|
||||
|
@ -18,7 +18,7 @@ import {
|
||||
import { COMMUNITY_DEFINITION_KIND } from "../../helpers/nostr/communities";
|
||||
import { STEMSTR_TRACK_KIND } from "../../helpers/nostr/stemstr";
|
||||
import { TORRENT_COMMENT_KIND, TORRENT_KIND } from "../../helpers/nostr/torrents";
|
||||
import { FLARE_VIDEO_KIND } from "../../helpers/nostr/flare";
|
||||
import { FLARE_VIDEO_KIND } from "../../helpers/nostr/video";
|
||||
import { WIKI_PAGE_KIND } from "../../helpers/nostr/wiki";
|
||||
import useReplaceableEvent from "../../hooks/use-replaceable-event";
|
||||
import { safeDecode } from "../../helpers/nip19";
|
||||
|
@ -1,43 +0,0 @@
|
||||
import { Button, ButtonGroup, Card, CardProps, Heading, Link } from "@chakra-ui/react";
|
||||
|
||||
import { CopyIconButton } from "../copy-icon-button";
|
||||
import useCurrentAccount from "../../hooks/use-current-account";
|
||||
import { ECashIcon, WalletIcon } from "../icons";
|
||||
|
||||
export default function InlineFedimintCard({ token, ...props }: Omit<CardProps, "children"> & { token: string }) {
|
||||
const account = useCurrentAccount();
|
||||
|
||||
// const { value: amount } = useAsync(async () => {
|
||||
// const { FedimintWallet } = await import("@fedimint/core-web");
|
||||
// const wallet = new FedimintWallet();
|
||||
// const opened = await wallet.open("noStrudel");
|
||||
// if (opened) {
|
||||
// return await wallet.mint.parseNotes(token);
|
||||
// }
|
||||
// }, []);
|
||||
|
||||
let UnitIcon = ECashIcon;
|
||||
let unitColor = "green.500";
|
||||
|
||||
return (
|
||||
<Card p="2" flexDirection="row" borderColor="green.500" gap="2" {...props}>
|
||||
<UnitIcon boxSize={10} color={unitColor} mr="2" mb="1" />
|
||||
<Heading size="md" alignItems="center">
|
||||
ecash
|
||||
</Heading>
|
||||
<ButtonGroup ml="auto">
|
||||
<CopyIconButton value={token} title="Copy Token" aria-label="Copy Token" variant="ghost" />
|
||||
<Button
|
||||
as={Link}
|
||||
leftIcon={<WalletIcon boxSize={5} />}
|
||||
colorScheme="primary"
|
||||
title="Open Wallet"
|
||||
aria-label="Open Wallet"
|
||||
href={`fedi://` + token}
|
||||
>
|
||||
Redeem
|
||||
</Button>
|
||||
</ButtonGroup>
|
||||
</Card>
|
||||
);
|
||||
}
|
@ -3,7 +3,7 @@ import { Divider, Flex, IconButton, Image, Text } from "@chakra-ui/react";
|
||||
import { DislikeIcon, LikeIcon } from "./icons";
|
||||
import useCurrentAccount from "../hooks/use-current-account";
|
||||
import useReplaceableEvent from "../hooks/use-replaceable-event";
|
||||
import { getEmojisFromPack, getPackCordsFromFavorites, getPackName } from "../helpers/nostr/emoji-packs";
|
||||
import { getEmojis, getPackCordsFromFavorites, getPackName } from "../helpers/nostr/emoji-packs";
|
||||
import useFavoriteEmojiPacks from "../hooks/use-favorite-emoji-packs";
|
||||
import useAppSettings from "../hooks/use-app-settings";
|
||||
|
||||
@ -22,7 +22,7 @@ function EmojiPack({ cord, onSelect }: { cord: string; onSelect: ReactionPickerP
|
||||
<Divider />
|
||||
</Flex>
|
||||
<Flex wrap="wrap" gap="2">
|
||||
{getEmojisFromPack(pack).map((emoji) => (
|
||||
{getEmojis(pack).map((emoji) => (
|
||||
<IconButton
|
||||
key={emoji.name}
|
||||
icon={<Image src={emoji.url} height="1.2rem" />}
|
||||
|
@ -11,7 +11,7 @@ import BadgeAwardCard from "../../../views/badges/components/badge-award-card";
|
||||
import { isReply } from "../../../helpers/nostr/event";
|
||||
import { STREAM_KIND } from "../../../helpers/nostr/stream";
|
||||
import { NostrEvent } from "../../../types/nostr-event";
|
||||
import { FLARE_VIDEO_KIND } from "../../../helpers/nostr/flare";
|
||||
import { FLARE_VIDEO_KIND } from "../../../helpers/nostr/video";
|
||||
import EmbeddedFlareVideo from "../../embed-event/event-types/embedded-flare-video";
|
||||
import { TimelineNote } from "../../note/timeline-note";
|
||||
import useEventIntersectionRef from "../../../hooks/use-event-intersection-ref";
|
||||
|
@ -1,33 +0,0 @@
|
||||
import { Transformer } from "unified";
|
||||
import { Root, findAndReplace, Node } from "applesauce-content/nast";
|
||||
|
||||
declare module "applesauce-content/nast" {
|
||||
export interface FedimintToken extends Node {
|
||||
type: "fedimint";
|
||||
token: string;
|
||||
}
|
||||
|
||||
export interface ContentMap {
|
||||
fedimint: FedimintToken;
|
||||
}
|
||||
}
|
||||
|
||||
export function fedimintTokens(): Transformer<Root> {
|
||||
return (tree) => {
|
||||
findAndReplace(tree, [
|
||||
[
|
||||
/([A-Za-z0-9_+/-]{100,10000}={0,3})/gi,
|
||||
(_: string, $1: string) => {
|
||||
try {
|
||||
return {
|
||||
type: "fedimint",
|
||||
token: $1,
|
||||
};
|
||||
} catch (error) {}
|
||||
|
||||
return false;
|
||||
},
|
||||
],
|
||||
]);
|
||||
};
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
import { kinds, validateEvent } from "nostr-tools";
|
||||
import { NostrEvent, isATag, isDTag, isETag, isPTag } from "../../types/nostr-event";
|
||||
import { getMatchLink, getMatchNostrLink } from "../regexp";
|
||||
import { ReactionGroup } from "./reactions";
|
||||
import { parseCoordinate } from "./event";
|
||||
|
||||
/** @deprecated */
|
||||
|
@ -1,13 +1,14 @@
|
||||
import { getTagValue } from "applesauce-core/helpers";
|
||||
import { NostrEvent, isATag } from "../../types/nostr-event";
|
||||
|
||||
export const EMOJI_PACK_KIND = 30030;
|
||||
export const USER_EMOJI_LIST_KIND = 10030;
|
||||
|
||||
export function getPackName(event: NostrEvent) {
|
||||
return event.tags.find((t) => t[0] === "d")?.[1];
|
||||
export function getPackName(pack: NostrEvent) {
|
||||
return getTagValue(pack, "title") || getTagValue(pack, "d");
|
||||
}
|
||||
|
||||
export function getEmojisFromPack(pack: NostrEvent) {
|
||||
export function getEmojis(pack: NostrEvent) {
|
||||
return pack.tags
|
||||
.filter((t) => t[0] === "emoji" && t[1] && t[2])
|
||||
.map((t) => ({ name: t[1] as string, url: t[2] as string }));
|
||||
|
@ -10,7 +10,7 @@ import { NostrEvent } from "../../types/nostr-event";
|
||||
import IntersectionObserverProvider from "../../providers/local/intersection-observer";
|
||||
import { useTimelineCurserIntersectionCallback } from "../../hooks/use-timeline-cursor-intersection-callback";
|
||||
import EmojiPackCard from "./components/emoji-pack-card";
|
||||
import { EMOJI_PACK_KIND, getEmojisFromPack } from "../../helpers/nostr/emoji-packs";
|
||||
import { EMOJI_PACK_KIND, getEmojis } from "../../helpers/nostr/emoji-packs";
|
||||
import VerticalPageLayout from "../../components/vertical-page-layout";
|
||||
|
||||
function EmojiPacksBrowsePage() {
|
||||
@ -19,7 +19,7 @@ function EmojiPacksBrowsePage() {
|
||||
|
||||
const eventFilter = useCallback(
|
||||
(event: NostrEvent) => {
|
||||
if (!showEmpty.isOpen && getEmojisFromPack(event).length === 0) return false;
|
||||
if (!showEmpty.isOpen && getEmojis(event).length === 0) return false;
|
||||
return true;
|
||||
},
|
||||
[showEmpty.isOpen],
|
||||
|
@ -16,7 +16,7 @@ import UserAvatarLink from "../../../components/user/user-avatar-link";
|
||||
import UserLink from "../../../components/user/user-link";
|
||||
import { NostrEvent } from "../../../types/nostr-event";
|
||||
import EmojiPackFavoriteButton from "./emoji-pack-favorite-button";
|
||||
import { getEmojisFromPack, getPackName } from "../../../helpers/nostr/emoji-packs";
|
||||
import { getEmojis, getPackName } from "../../../helpers/nostr/emoji-packs";
|
||||
import EmojiPackMenu from "./emoji-pack-menu";
|
||||
import NoteZapButton from "../../../components/note/note-zap-button";
|
||||
import HoverLinkOverlay from "../../../components/hover-link-overlay";
|
||||
@ -24,7 +24,7 @@ import useEventIntersectionRef from "../../../hooks/use-event-intersection-ref";
|
||||
import useShareableEventAddress from "../../../hooks/use-shareable-event-address";
|
||||
|
||||
export default function EmojiPackCard({ pack, ...props }: Omit<CardProps, "children"> & { pack: NostrEvent }) {
|
||||
const emojis = getEmojisFromPack(pack);
|
||||
const emojis = getEmojis(pack);
|
||||
const address = useShareableEventAddress(pack);
|
||||
|
||||
// if there is a parent intersection observer, register this card
|
||||
|
@ -26,7 +26,7 @@ import { useDeleteEventContext } from "../../providers/route/delete-event-provid
|
||||
import useReplaceableEvent from "../../hooks/use-replaceable-event";
|
||||
import EmojiPackMenu from "./components/emoji-pack-menu";
|
||||
import EmojiPackFavoriteButton from "./components/emoji-pack-favorite-button";
|
||||
import { EMOJI_PACK_KIND, getEmojisFromPack, getPackName } from "../../helpers/nostr/emoji-packs";
|
||||
import { EMOJI_PACK_KIND, getEmojis, getPackName } from "../../helpers/nostr/emoji-packs";
|
||||
import { DraftNostrEvent, NostrEvent } from "../../types/nostr-event";
|
||||
import VerticalPageLayout from "../../components/vertical-page-layout";
|
||||
import UserAvatarLink from "../../components/user/user-avatar-link";
|
||||
@ -100,7 +100,7 @@ function EmojiPackPage({ pack }: { pack: NostrEvent }) {
|
||||
const [scale, setScale] = useState(10);
|
||||
|
||||
const isAuthor = account?.pubkey === pack.pubkey;
|
||||
const emojis = getEmojisFromPack(pack);
|
||||
const emojis = getEmojis(pack);
|
||||
|
||||
const [editing, setEditing] = useState(false);
|
||||
const [draftEmojis, setDraft] = useState(emojis);
|
||||
|
@ -8,7 +8,7 @@ import { NOTE_LIST_KIND, PEOPLE_LIST_KIND } from "../../helpers/nostr/lists";
|
||||
import { ErrorBoundary } from "../../components/error-boundary";
|
||||
import { COMMUNITY_DEFINITION_KIND } from "../../helpers/nostr/communities";
|
||||
import { TORRENT_KIND } from "../../helpers/nostr/torrents";
|
||||
import { FLARE_VIDEO_KIND } from "../../helpers/nostr/flare";
|
||||
import { FLARE_VIDEO_KIND } from "../../helpers/nostr/video";
|
||||
import { WIKI_PAGE_KIND } from "../../helpers/nostr/wiki";
|
||||
import { EmbedEvent, EmbedEventPointer } from "../../components/embed-event";
|
||||
import useReplaceableEvent from "../../hooks/use-replaceable-event";
|
||||
|
@ -7,7 +7,7 @@ import useTimelineLoader from "../../hooks/use-timeline-loader";
|
||||
import IntersectionObserverProvider from "../../providers/local/intersection-observer";
|
||||
import { useTimelineCurserIntersectionCallback } from "../../hooks/use-timeline-cursor-intersection-callback";
|
||||
import VerticalPageLayout from "../../components/vertical-page-layout";
|
||||
import { FLARE_VIDEO_KIND } from "../../helpers/nostr/flare";
|
||||
import { FLARE_VIDEO_KIND } from "../../helpers/nostr/video";
|
||||
import VideoCard from "../videos/components/video-card";
|
||||
|
||||
export default function UserVideosTab() {
|
||||
|
@ -2,7 +2,7 @@ import { Box, Card, CardBody, CardHeader, CardProps, Heading, LinkBox, Text } fr
|
||||
import { Link as RouterLink } from "react-router-dom";
|
||||
|
||||
import { NostrEvent } from "../../../types/nostr-event";
|
||||
import { getVideoDuration, getVideoImages, getVideoSummary, getVideoTitle } from "../../../helpers/nostr/flare";
|
||||
import { getVideoDuration, getVideoImages, getVideoSummary, getVideoTitle } from "../../../helpers/nostr/video";
|
||||
import HoverLinkOverlay from "../../../components/hover-link-overlay";
|
||||
import useEventIntersectionRef from "../../../hooks/use-event-intersection-ref";
|
||||
import useShareableEventAddress from "../../../hooks/use-shareable-event-address";
|
||||
|
@ -8,7 +8,7 @@ import TimelineActionAndStatus from "../../components/timeline/timeline-action-a
|
||||
import VerticalPageLayout from "../../components/vertical-page-layout";
|
||||
import { useTimelineCurserIntersectionCallback } from "../../hooks/use-timeline-cursor-intersection-callback";
|
||||
import IntersectionObserverProvider from "../../providers/local/intersection-observer";
|
||||
import { FLARE_VIDEO_KIND } from "../../helpers/nostr/flare";
|
||||
import { FLARE_VIDEO_KIND } from "../../helpers/nostr/video";
|
||||
import VideoCard from "./components/video-card";
|
||||
import { ErrorBoundary } from "../../components/error-boundary";
|
||||
import { useReadRelays } from "../../hooks/use-client-relays";
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
getVideoSummary,
|
||||
getVideoTitle,
|
||||
getVideoUrl,
|
||||
} from "../../helpers/nostr/flare";
|
||||
} from "../../helpers/nostr/video";
|
||||
import { NostrEvent } from "../../types/nostr-event";
|
||||
import useParamsAddressPointer from "../../hooks/use-params-address-pointer";
|
||||
import useReplaceableEvent from "../../hooks/use-replaceable-event";
|
||||
|
Loading…
x
Reference in New Issue
Block a user