Skip to content

Commit

Permalink
example note zaps event if user dose not have LN address
Browse files Browse the repository at this point in the history
  • Loading branch information
hzrd149 committed Oct 17, 2023
1 parent 9569281 commit 9fc9ac3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/perfect-walls-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nostrudel": patch
---

Fix zap button on prism posts
5 changes: 3 additions & 2 deletions src/components/note/note-zap-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default function NoteZapButton({ event, allowComment, showEventPreview, .
};

const total = totalZaps(zaps);
const canZap = !!metadata?.allowsNostr || event.tags.some((t) => t[0] === "zap");

return (
<>
Expand All @@ -43,7 +44,7 @@ export default function NoteZapButton({ event, allowComment, showEventPreview, .
colorScheme={hasZapped ? "primary" : undefined}
{...props}
onClick={onOpen}
isDisabled={!metadata?.allowsNostr}
isDisabled={!canZap}
>
{readablizeSats(total / 1000)}
</Button>
Expand All @@ -54,7 +55,7 @@ export default function NoteZapButton({ event, allowComment, showEventPreview, .
title="Zap Note"
{...props}
onClick={onOpen}
isDisabled={!metadata?.allowsNostr}
isDisabled={!canZap}
/>
)}

Expand Down
5 changes: 3 additions & 2 deletions src/services/settings/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ export const defaultSettings: AppSettings = {
youtubeRedirect: undefined,
};

export function upgradeSettings(settings: { version: number }): AppSettings {
export function upgradeSettings(settings: { version: number }): AppSettings | null {
if (isV0(settings)) return { ...defaultSettings, ...settings, version: 3 };
if (isV1(settings)) return { ...defaultSettings, ...settings, version: 3 };
if (isV2(settings)) return { ...defaultSettings, ...settings, version: 3 };
return settings as AppSettings;
if (isV3(settings)) return settings;
return null;
}

export function parseAppSettings(event: NostrEvent): AppSettings {
Expand Down

0 comments on commit 9fc9ac3

Please sign in to comment.