From 62ae18065264b9dfa24bd75a6d2c23f8304e81f5 Mon Sep 17 00:00:00 2001 From: Alejandro Gomez Date: Sun, 5 Feb 2023 12:04:18 +0100 Subject: [PATCH 1/4] fix: don't show self zaps on note summary --- src/Element/NoteFooter.tsx | 5 ++++- src/Pages/ProfilePage.tsx | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Element/NoteFooter.tsx b/src/Element/NoteFooter.tsx index 7eeb7be3..27bea558 100644 --- a/src/Element/NoteFooter.tsx +++ b/src/Element/NoteFooter.tsx @@ -51,7 +51,10 @@ export default function NoteFooter(props: NoteFooterProps) { const langNames = new Intl.DisplayNames([...window.navigator.languages], { type: "language" }); const reactions = useMemo(() => getReactions(related, ev.Id, EventKind.Reaction), [related, ev]); const reposts = useMemo(() => getReactions(related, ev.Id, EventKind.Repost), [related, ev]); - const zaps = useMemo(() => getReactions(related, ev.Id, EventKind.ZapReceipt).map(parseZap).filter(z => z.valid), [related]); + const zaps = useMemo(() => + getReactions(related, ev.Id, EventKind.ZapReceipt).map(parseZap).filter(z => z.valid && z.zapper !== ev.PubKey), + [related] + ); const zapTotal = zaps.reduce((acc, z) => acc + z.amount, 0) const didZap = zaps.some(a => a.zapper === login); const groupReactions = useMemo(() => { diff --git a/src/Pages/ProfilePage.tsx b/src/Pages/ProfilePage.tsx index 21167cc4..34c3aa15 100644 --- a/src/Pages/ProfilePage.tsx +++ b/src/Pages/ProfilePage.tsx @@ -123,6 +123,7 @@ export default function ProfilePage() { case ProfileTab.Zaps: { return (
+

{formatShort(zapsTotal)} sats

{zaps.map(z => )}
) @@ -182,9 +183,6 @@ export default function ProfilePage() { <> setShowLnQr(true)}> - - {zapsTotal > 0 && formatShort(zapsTotal)} - {!loggedOut && ( <> From 31b4954f13bc4d0765f0ce002930715192151fe7 Mon Sep 17 00:00:00 2001 From: Alejandro Gomez Date: Sun, 5 Feb 2023 12:25:35 +0100 Subject: [PATCH 2/4] show zaps total in zaps tab --- src/Element/FollowListBase.tsx | 2 +- src/Element/Zap.css | 27 ++++++++++++++++----------- src/Pages/ProfilePage.tsx | 2 +- src/index.css | 8 ++++++++ 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/Element/FollowListBase.tsx b/src/Element/FollowListBase.tsx index 99e063e9..678c2237 100644 --- a/src/Element/FollowListBase.tsx +++ b/src/Element/FollowListBase.tsx @@ -16,7 +16,7 @@ export default function FollowListBase({ pubkeys, title }: FollowListBaseProps) return (
-
+
{title}
diff --git a/src/Element/Zap.css b/src/Element/Zap.css index ab8b4c3d..c9722dc7 100644 --- a/src/Element/Zap.css +++ b/src/Element/Zap.css @@ -2,17 +2,26 @@ min-height: unset; } +.zap .header .pfp { + overflow: hidden; +} + +.zap .header { + flex-direction: row; +} + +.zap .header .amount { + font-size: 32px; +} + +.zap .header .pfp { + max-width: 72%; +} + @media (max-width: 520px) { - .zap .header { - flex-direction: column; - } .zap .header .pfp { - width: 100%; padding: 4px; } - .zap .header .amount { - font-size: 32px; - } } .zap .summary { @@ -76,10 +85,6 @@ content: ", "; } -.note.zap > .header { - align-items: center; -} - .note.zap > .body { margin-bottom: 0; } diff --git a/src/Pages/ProfilePage.tsx b/src/Pages/ProfilePage.tsx index 34c3aa15..76f0ae0b 100644 --- a/src/Pages/ProfilePage.tsx +++ b/src/Pages/ProfilePage.tsx @@ -123,7 +123,7 @@ export default function ProfilePage() { case ProfileTab.Zaps: { return (
-

{formatShort(zapsTotal)} sats

+

{formatShort(zapsTotal)} sats

{zaps.map(z => )}
) diff --git a/src/index.css b/src/index.css index 29288979..c429d067 100644 --- a/src/index.css +++ b/src/index.css @@ -539,3 +539,11 @@ body.scroll-lock { .bold { font-weight: 700; } + +.main-content .h4 { + margin-bottom: 25px; +} + +.main-content .profile-preview { + margin-bottom: 16px; +} From 86043e813fbf178ed9a4f490b5863a781e04fe69 Mon Sep 17 00:00:00 2001 From: Alejandro Gomez Date: Sun, 5 Feb 2023 12:30:26 +0100 Subject: [PATCH 3/4] fix: only show zap button if lnurl is available --- src/Pages/ProfilePage.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Pages/ProfilePage.tsx b/src/Pages/ProfilePage.tsx index 76f0ae0b..00a538c1 100644 --- a/src/Pages/ProfilePage.tsx +++ b/src/Pages/ProfilePage.tsx @@ -181,9 +181,11 @@ export default function ProfilePage() { ) : ( <> - setShowLnQr(true)}> - - + {lnurl && ( + setShowLnQr(true)}> + + + )} {!loggedOut && ( <> navigate(`/messages/${hexToBech32("npub", id)}`)}> From e058e7a28c4a35f73d7c2a11d802219433f6788c Mon Sep 17 00:00:00 2001 From: Alejandro Gomez Date: Sun, 5 Feb 2023 12:47:26 +0100 Subject: [PATCH 4/4] fix: only decrypt blocklist when newer event received --- src/Feed/LoginFeed.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Feed/LoginFeed.ts b/src/Feed/LoginFeed.ts index 1e50bb01..027c47a6 100644 --- a/src/Feed/LoginFeed.ts +++ b/src/Feed/LoginFeed.ts @@ -20,7 +20,7 @@ import useModeration from "Hooks/useModeration"; */ export default function useLoginFeed() { const dispatch = useDispatch(); - const { publicKey: pubKey, privateKey: privKey } = useSelector((s: RootState) => s.login); + const { publicKey: pubKey, privateKey: privKey, latestMuted } = useSelector((s: RootState) => s.login); const { isMuted } = useModeration(); const db = useDb(); @@ -132,7 +132,7 @@ export default function useLoginFeed() { dispatch(setMuted(muted)) const newest = getNewest(mutedFeed.store.notes) - if (newest && newest.content.length > 0 && pubKey) { + if (newest && newest.content.length > 0 && pubKey && newest.created_at > latestMuted) { decryptBlocked(newest, pubKey, privKey).then((plaintext) => { try { const blocked = JSON.parse(plaintext)