From b8e58dbdd4feb075972be75f9744f01cba80a00f Mon Sep 17 00:00:00 2001 From: Alejandro Gomez Date: Sat, 4 Feb 2023 16:25:37 +0100 Subject: [PATCH 1/4] succint zaps display --- src/Element/Zap.css | 23 ++++++++++++----------- src/Element/Zap.tsx | 15 +++++---------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/Element/Zap.css b/src/Element/Zap.css index c7b3f2c1..ab8b4c3d 100644 --- a/src/Element/Zap.css +++ b/src/Element/Zap.css @@ -17,8 +17,7 @@ .zap .summary { display: flex; - align-items: center; - justify-content: space-between; + flex-direction: row; } .zap .amount { @@ -33,12 +32,15 @@ content: ''; } +.top-zap .summary { + color: var(--font-secondary-color); +} + .zaps-summary { margin-top: 8px; display: flex; flex-direction: row; - align-items: center; - justify-content: center; + margin-left: 52px; } .top-zap { @@ -51,13 +53,6 @@ margin-right: .3em; } -.top-zap .summary { - display: flex; - flex-direction: row; - align-items: center; - justify-content: center; -} - .top-zap .avatar { width: 21px; height: 21px; @@ -67,6 +62,12 @@ display: none; } +.top-zap .summary { + display: flex; + flex-direction: row; + align-items: center; +} + .amount-number { font-weight: bold; } diff --git a/src/Element/Zap.tsx b/src/Element/Zap.tsx index adfc7288..41a22268 100644 --- a/src/Element/Zap.tsx +++ b/src/Element/Zap.tsx @@ -125,10 +125,11 @@ export const ZapsSummary = ({ zaps }: ZapsSummaryProps) => { {amount && (
- {zapper ? :
Anon 
} -
- zapped {formatShort(amount)} sats -
+ {zapper && } + {restZaps.length > 0 && ( + and {restZaps.length} other{restZaps.length > 1 ? 's' : ''} + )} +  zapped
{content && ( @@ -142,12 +143,6 @@ export const ZapsSummary = ({ zaps }: ZapsSummaryProps) => {
)} - {restZapsTotal > 0 && ( -
- {restZaps.length} other{restZaps.length > 1 ? 's' : ''} zapped  - {formatShort(restZapsTotal)} sats -
- )} ) } -- 2.45.2 From afd9dc44d95d708fcbd9fd8a2a9d5441879635e6 Mon Sep 17 00:00:00 2001 From: Kieran Date: Sat, 4 Feb 2023 17:24:01 +0000 Subject: [PATCH 2/4] chore: default imgproxy on --- src/Pages/settings/Preferences.tsx | 4 ++-- src/State/Login.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Pages/settings/Preferences.tsx b/src/Pages/settings/Preferences.tsx index 7e765f05..1bb3205f 100644 --- a/src/Pages/settings/Preferences.tsx +++ b/src/Pages/settings/Preferences.tsx @@ -1,5 +1,5 @@ import { useDispatch, useSelector } from "react-redux"; -import { InitState, setPreferences, UserPreferences } from "State/Login"; +import { DefaultImgProxy, setPreferences, UserPreferences } from "State/Login"; import { RootState } from "State/Store"; import "./Preferences.css"; @@ -43,7 +43,7 @@ const PreferencesPage = () => { Use imgproxy to compress images
- dispatch(setPreferences({ ...perf, imgProxyConfig: e.target.checked ? InitState.preferences.imgProxyConfig : null }))} /> + dispatch(setPreferences({ ...perf, imgProxyConfig: e.target.checked ? DefaultImgProxy : null }))} />
{perf.imgProxyConfig && (
diff --git a/src/State/Login.ts b/src/State/Login.ts index aa69f0ef..ef083ed4 100644 --- a/src/State/Login.ts +++ b/src/State/Login.ts @@ -146,7 +146,7 @@ export interface LoginStore { preferences: UserPreferences }; -const DefaultImgProxy = { +export const DefaultImgProxy = { url: "https://imgproxy.snort.social", key: "a82fcf26aa0ccb55dfc6b4bd6a1c90744d3be0f38429f21a8828b43449ce7cebe6bdc2b09a827311bef37b18ce35cb1e6b1c60387a254541afa9e5b4264ae942", salt: "a897770d9abf163de055e9617891214e75a9016d748f8ef865e6ffbcb9ed932295659549773a22a019a5f06d0b440c320be411e3fddfe784e199e4f03d74bd9b" @@ -176,7 +176,7 @@ export const InitState = { showDebugMenus: false, autoShowLatest: false, fileUploader: "void.cat", - imgProxyConfig: null + imgProxyConfig: DefaultImgProxy } } as LoginStore; -- 2.45.2 From 6d7892ac663a5304d35e42de93de8c25e6484c70 Mon Sep 17 00:00:00 2001 From: Kieran Date: Sat, 4 Feb 2023 17:48:56 +0000 Subject: [PATCH 3/4] chore: indicate zap supported --- src/Element/LNURLTip.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Element/LNURLTip.tsx b/src/Element/LNURLTip.tsx index 91930b48..550ed07f 100644 --- a/src/Element/LNURLTip.tsx +++ b/src/Element/LNURLTip.tsx @@ -240,11 +240,12 @@ export default function LNURLTip(props: LNURLTipProps) { ) } + const defaultTitle = payService?.allowsNostr === true ? "⚡️ Send Zap!" : "⚡️ Send sats"; if (!show) return null; return (
e.stopPropagation()}> -

{props.title || "⚡️ Send sats"}

+

{props.title || defaultTitle}

{invoiceForm()} {error ?

{error}

: null} {payInvoice()} -- 2.45.2 From 1458611fc7aa4e4dbd70396bef68e403e94a77a5 Mon Sep 17 00:00:00 2001 From: Kieran Date: Sat, 4 Feb 2023 22:43:04 +0000 Subject: [PATCH 4/4] bug: profile zaps --- src/Feed/TimelineFeed.ts | 2 +- src/Feed/ZapsFeed.ts | 2 +- src/Pages/ProfilePage.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Feed/TimelineFeed.ts b/src/Feed/TimelineFeed.ts index f37e8007..958cf278 100644 --- a/src/Feed/TimelineFeed.ts +++ b/src/Feed/TimelineFeed.ts @@ -35,7 +35,7 @@ export default function useTimelineFeed(subject: TimelineSubject, options: Timel let sub = new Subscriptions(); sub.Id = `timeline:${subject.type}:${subject.discriminator}`; - sub.Kinds = new Set([EventKind.TextNote, EventKind.Repost, EventKind.ZapReceipt]); + sub.Kinds = new Set([EventKind.TextNote, EventKind.Repost]); switch (subject.type) { case "pubkey": { sub.Authors = new Set(subject.items); diff --git a/src/Feed/ZapsFeed.ts b/src/Feed/ZapsFeed.ts index 5f5c13af..84a52aa6 100644 --- a/src/Feed/ZapsFeed.ts +++ b/src/Feed/ZapsFeed.ts @@ -7,7 +7,7 @@ import useSubscription from "./Subscription"; export default function useZapsFeed(pubkey: HexKey) { const sub = useMemo(() => { let x = new Subscriptions(); - x.Id = `zaps:${pubkey}`; + x.Id = `zaps:${pubkey.slice(0, 12)}`; x.Kinds = new Set([EventKind.ZapReceipt]); x.PTags = new Set([pubkey]); return x; diff --git a/src/Pages/ProfilePage.tsx b/src/Pages/ProfilePage.tsx index a3da4820..21167cc4 100644 --- a/src/Pages/ProfilePage.tsx +++ b/src/Pages/ProfilePage.tsx @@ -67,7 +67,7 @@ export default function ProfilePage() { const profileZaps = zapFeed.store.notes.map(parseZap).filter(z => z.valid && z.p === id && !z.e && z.zapper !== id) profileZaps.sort((a, b) => b.amount - a.amount) return profileZaps - }, [zapFeed.store.notes, id]) + }, [zapFeed.store, id]) const zapsTotal = zaps.reduce((acc, z) => acc + z.amount, 0) useEffect(() => { -- 2.45.2