From e6a831ef8c6cfed6e019b0e8d1713b20a3156fe3 Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 24 Jan 2023 15:24:50 +0000 Subject: [PATCH] chore: add back zap button to donate page --- src/Element/ZapButton.css | 1 + src/Element/ZapButton.tsx | 10 +++++----- src/Feed/ProfileFeed.ts | 2 +- src/Pages/DonatePage.tsx | 5 +++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Element/ZapButton.css b/src/Element/ZapButton.css index 8f8641de..863b095c 100644 --- a/src/Element/ZapButton.css +++ b/src/Element/ZapButton.css @@ -3,4 +3,5 @@ background-color: var(--highlight); padding: 4px 8px; border-radius: 16px; + cursor: pointer; } diff --git a/src/Element/ZapButton.tsx b/src/Element/ZapButton.tsx index 82416d00..147b1871 100644 --- a/src/Element/ZapButton.tsx +++ b/src/Element/ZapButton.tsx @@ -6,19 +6,19 @@ import useProfile from "Feed/ProfileFeed"; import { HexKey } from "Nostr"; import LNURLTip from "Element/LNURLTip"; -const ZapButton = ({ pubkey }: { pubkey: HexKey }) => { - const profile = useProfile(pubkey)?.get(pubkey); +const ZapButton = ({ pubkey, svc }: { pubkey?: HexKey, svc?: string }) => { + const profile = useProfile(pubkey)?.get(pubkey ?? ""); const [zap, setZap] = useState(false); - const svc = profile?.lud16 || profile?.lud06; + const service = svc ?? (profile?.lud16 || profile?.lud06); - if (!svc) return null; + if (!service) return null; return ( <>
setZap(true)}>
- setZap(false)} /> + setZap(false)} /> ) } diff --git a/src/Feed/ProfileFeed.ts b/src/Feed/ProfileFeed.ts index 435a5928..a4c4028d 100644 --- a/src/Feed/ProfileFeed.ts +++ b/src/Feed/ProfileFeed.ts @@ -5,7 +5,7 @@ import { MetadataCache } from "Db/User"; import { HexKey } from "Nostr"; import { System } from "Nostr/System"; -export default function useProfile(pubKey: HexKey | Array | undefined): Map | undefined { +export default function useProfile(pubKey?: HexKey | Array | undefined): Map | undefined { const user = useLiveQuery(async () => { let userList = new Map(); if (pubKey) { diff --git a/src/Pages/DonatePage.tsx b/src/Pages/DonatePage.tsx index 9b859c51..f422ede8 100644 --- a/src/Pages/DonatePage.tsx +++ b/src/Pages/DonatePage.tsx @@ -1,4 +1,5 @@ import ProfilePreview from "Element/ProfilePreview"; +import ZapButton from "Element/ZapButton"; import { HexKey } from "Nostr"; import { useEffect, useState } from "react"; import { bech32ToHex } from "Util"; @@ -56,6 +57,10 @@ const DonatePage = () => {

Each contributor will get paid a percentage of all donations and NIP-05 orders, you can see the split amounts below

+
+
Lightning Donation:
+ +

Primary Developers

{Developers.map(a => )}

Contributors