You're using nostr wallet connect
@@ -47,12 +47,12 @@ export function NWCScreen() {
diff --git a/src/shared/notes/actions/zap.tsx b/src/shared/notes/actions/zap.tsx
index e1d02e9f..dff857f4 100644
--- a/src/shared/notes/actions/zap.tsx
+++ b/src/shared/notes/actions/zap.tsx
@@ -27,6 +27,7 @@ export function NoteZap({ id, pubkey }: { id: string; pubkey: string }) {
const [invoice, setInvoice] = useState
(null);
const [isOpen, setIsOpen] = useState(false);
const [isCompleted, setIsCompleted] = useState(false);
+ const [isLoading, setIsLoading] = useState(false);
const walletConnectURL = useStronghold((state) => state.walletConnectURL);
const nwc = useRef(null);
@@ -51,7 +52,11 @@ export function NoteZap({ id, pubkey }: { id: string; pubkey: string }) {
});
await nwc.current.enable();
+ // start loading
+ setIsLoading(true);
+ // send payment via nwc
const send: SendPaymentResponse = await nwc.current.sendPayment(res);
+
if (send) {
await sendNativeNotification(
`You've tipped ${compactNumber.format(send.amount)} sats to ${
@@ -62,6 +67,7 @@ export function NoteZap({ id, pubkey }: { id: string; pubkey: string }) {
// eose
nwc.current.close();
setIsCompleted(true);
+ setIsLoading(false);
// reset after 3 secs
const timeout = setTimeout(() => setIsCompleted(false), 3000);
@@ -69,15 +75,17 @@ export function NoteZap({ id, pubkey }: { id: string; pubkey: string }) {
}
} catch (e) {
nwc.current.close();
+ setIsLoading(false);
await message(JSON.stringify(e), { title: 'Zap', type: 'error' });
}
};
useEffect(() => {
return () => {
- setAmount('');
+ setAmount('21');
setZapMessage('');
setIsCompleted(false);
+ setIsLoading(false);
};
}, []);
@@ -183,6 +191,13 @@ export function NoteZap({ id, pubkey }: { id: string; pubkey: string }) {
>
{isCompleted ? (
Successfully tipped
+ ) : isLoading ? (
+
+ Waiting for approval
+
+ Go to your wallet and approve payment request
+
+
) : (
Send tip
diff --git a/src/shared/widgets/other/learnNostr.tsx b/src/shared/widgets/other/learnNostr.tsx
index f31c761a..aee20b27 100644
--- a/src/shared/widgets/other/learnNostr.tsx
+++ b/src/shared/widgets/other/learnNostr.tsx
@@ -34,18 +34,15 @@ export function LearnNostrWidget({ params }: { params: Widget }) {
key={index}
type="button"
onClick={() => open(item.id)}
- className="flex items-center justify-between rounded-xl bg-white/10 px-3 py-3 hover:bg-white/20"
+ className="flex items-center justify-between rounded-xl bg-white/10 px-4 py-3 hover:bg-white/20"
>
-
-
-
-
{item.title}
- {seens.has(item.id) ? (
-
Readed
- ) : (
-
Unread
- )}
-
+
+
{item.title}
+ {seens.has(item.id) ? (
+
Readed
+ ) : (
+
Unread
+ )}
diff --git a/src/stores/activities.ts b/src/stores/activities.ts
index 906b89cc..a5a3b9cb 100644
--- a/src/stores/activities.ts
+++ b/src/stores/activities.ts
@@ -13,10 +13,10 @@ export const useActivities = create
((set) => ({
activities: null,
totalNewActivities: 0,
setActivities: (events: NDKEvent[], lastLogin: number) => {
- const latest = events.filter((ev) => ev.created_at > lastLogin);
+ const totalLatest = events.filter((ev) => ev.created_at > lastLogin)?.length ?? 0;
set(() => ({
activities: events,
- totalNewActivities: latest.length > 0 ? latest.length : 0,
+ totalNewActivities: totalLatest,
}));
},
addActivity: (event: NDKEvent) => {