feat: refactor

This commit is contained in:
2024-01-12 20:32:45 +07:00
parent 67c6177291
commit 0487b8a801
63 changed files with 345 additions and 777 deletions

View File

@@ -1,6 +1,6 @@
import { NDKAppHandlerEvent } from "@nostr-dev-kit/ndk";
import { useQuery } from "@tanstack/react-query";
import { useArk } from "../../provider";
import { useArk } from "../../hooks/useArk";
export function AppHandler({ tag }: { tag: string[] }) {
const ark = useArk();

View File

@@ -1,6 +1,7 @@
import { webln } from "@getalby/sdk";
import { SendPaymentResponse } from "@getalby/sdk/dist/types";
import { CancelIcon, ZapIcon } from "@lume/icons";
import { useStorage } from "@lume/storage";
import {
compactNumber,
displayNpub,
@@ -13,8 +14,8 @@ import { QRCodeSVG } from "qrcode.react";
import { useEffect, useRef, useState } from "react";
import CurrencyInput from "react-currency-input-field";
import { useNavigate } from "react-router-dom";
import { useArk } from "../../../hooks/useArk";
import { useProfile } from "../../../hooks/useProfile";
import { useArk, useStorage } from "../../../provider";
import { useNoteContext } from "../provider";
export function NoteZap() {
@@ -87,7 +88,7 @@ export function NoteZap() {
useEffect(() => {
async function getWalletConnectURL() {
const uri: string = await invoke("secure_load", {
key: `${storage.account.pubkey}-nwc`,
key: `${ark.account.pubkey}-nwc`,
});
if (uri) setWalletConnectURL(uri);
}

View File

@@ -22,7 +22,7 @@ export function NoteChild({
"\n",
);
const text = parsedContent;
const text = parsedContent as string;
const words = text.split(/( |\n)/);
const hashtags = words.filter((word) => word.startsWith("#"));

View File

@@ -1,3 +1,4 @@
import { useStorage } from "@lume/storage";
import {
AUDIOS,
IMAGES,
@@ -15,7 +16,6 @@ import { nip19 } from "nostr-tools";
import { ReactNode, useMemo, useState } from "react";
import { Link } from "react-router-dom";
import reactStringReplace from "react-string-replace";
import { useStorage } from "../../provider";
import { Hashtag } from "./mentions/hashtag";
import { MentionNote } from "./mentions/note";
import { MentionUser } from "./mentions/user";

View File

@@ -1,5 +1,5 @@
import { useQuery } from "@tanstack/react-query";
import { useArk } from "../../provider";
import { useArk } from "../../hooks/useArk";
import { AppHandler } from "./appHandler";
import { useNoteContext } from "./provider";

View File

@@ -1,7 +1,7 @@
import { NDKEvent, NostrEvent } from "@nostr-dev-kit/ndk";
import { useQuery } from "@tanstack/react-query";
import { Note } from "..";
import { useArk } from "../../../provider";
import { useArk } from "../../../hooks/useArk";
export function RepostNote({
event,