chore: update dependencies

This commit is contained in:
2023-12-29 08:26:13 +07:00
parent 4fc3cc8a80
commit e1edba8a78
23 changed files with 1024 additions and 825 deletions

View File

@@ -13,7 +13,7 @@ import NDK, {
NostrEvent,
} from "@nostr-dev-kit/ndk";
import { open } from "@tauri-apps/plugin-dialog";
import { readBinaryFile } from "@tauri-apps/plugin-fs";
import { readFile } from "@tauri-apps/plugin-fs";
import { fetch } from "@tauri-apps/plugin-http";
import { NostrFetcher, normalizeRelayUrl } from "nostr-fetch";
import { nip19 } from "nostr-tools";
@@ -466,7 +466,7 @@ export class Ark {
if (!selected) return null;
const file = await readBinaryFile(selected.path);
const file = await readFile(selected.path);
const blob = new Blob([file]);
const data = new FormData();

View File

@@ -43,27 +43,34 @@ export function RepostNote({
};
if (isLoading) {
return <div className="w-full px-3 pb-3" />;
return <div className="w-full px-3 pb-3">Loading...</div>;
}
if (isError) {
if (isError || !repostEvent) {
return (
<div className="my-3 h-min w-full px-3">
<div className="relative flex flex-col gap-2 overflow-hidden rounded-xl bg-neutral-50 pt-3 dark:bg-neutral-950">
<div className="relative flex flex-col gap-2">
<div className="px-3">
<p>Failed to load event</p>
</div>
<Note.Root className={className}>
<Note.Provider event={event}>
<Note.User variant="repost" className="h-14" />
</Note.Provider>
<div className="select-text px-3 mb-3">
<div className="bg-red-100 dark:bg-red-900 flex-col py-3 rounded-lg flex items-start justify-start px-3">
<p className="text-red-500">Failed to get event</p>
<p className="text-sm">
You can consider enable Outbox in Settings for better event
discovery.
</p>
</div>
</div>
</div>
</Note.Root>
);
}
return (
<Note.Provider event={repostEvent}>
<Note.Root className={className}>
<Note.Root className={className}>
<Note.Provider event={event}>
<Note.User variant="repost" className="h-14" />
</Note.Provider>
<Note.Provider event={repostEvent}>
<div className="relative flex flex-col gap-2 px-3">
<Note.User />
{renderContentByKind()}
@@ -77,7 +84,7 @@ export function RepostNote({
</div>
</div>
</div>
</Note.Root>
</Note.Provider>
</Note.Provider>
</Note.Root>
);
}

View File

@@ -6,9 +6,8 @@ import {
displayNpub,
sendNativeNotification,
} from "@lume/utils";
import { NDKEvent } from "@nostr-dev-kit/ndk";
import * as Dialog from "@radix-ui/react-dialog";
import { invoke } from "@tauri-apps/api/primitives";
import { invoke } from "@tauri-apps/api/core";
import { message } from "@tauri-apps/plugin-dialog";
import { QRCodeSVG } from "qrcode.react";
import { useEffect, useRef, useState } from "react";

View File

@@ -50,7 +50,7 @@ export function NoteReplyList({
<LoaderIcon className="h-5 w-5 animate-spin" />
</div>
) : data.length === 0 ? (
<div className="flex w-full items-center justify-center">
<div className="flex w-full items-center justify-center bg-neutral-50 dark:bg-neutral-950 rounded-lg">
<div className="flex flex-col items-center justify-center gap-2 py-6">
<h3 className="text-3xl">👋</h3>
<p className="leading-none text-neutral-600 dark:text-neutral-400">

View File

@@ -20,6 +20,7 @@ import {
normalizeRelayUrlSet,
} from "nostr-fetch";
import { PropsWithChildren, useEffect, useState } from "react";
import { toast } from "sonner";
import { createContext, useContextSelector } from "use-context-selector";
import { Ark } from "./ark";
@@ -156,9 +157,13 @@ const LumeProvider = ({ children }: PropsWithChildren<object>) => {
await ndk.connect(3000);
// auth
ndk.relayAuthDefaultPolicy = (relay: NDKRelay, challenge: string) => {
ndk.relayAuthDefaultPolicy = async (relay: NDKRelay, challenge: string) => {
const signIn = NDKRelayAuthPolicies.signIn({ ndk, signer });
return signIn(relay, challenge);
const event = await signIn(relay, challenge);
if (event) {
toast.success(`You've sign in sucessfully to relay: ${relay.url}`);
return event;
}
};
// update account's metadata