feat: profile only-zaps

This commit is contained in:
2023-04-20 22:05:11 +01:00
parent ed878f57f4
commit 1f0d17112c
7 changed files with 46 additions and 5 deletions

View File

@ -264,7 +264,7 @@ export default function NoteFooter(props: NoteFooterProps) {
} }
function reactionIcons() { function reactionIcons() {
if (!prefs.enableReactions) { if (!prefs.enableReactions || author?.reactions === false) {
return null; return null;
} }
return ( return (
@ -275,7 +275,6 @@ export default function NoteFooter(props: NoteFooterProps) {
<Icon name="heart" /> <Icon name="heart" />
<div className="reaction-pill-number">{formatShort(positive.length)}</div> <div className="reaction-pill-number">{formatShort(positive.length)}</div>
</div> </div>
{repostIcon()}
</> </>
); );
} }
@ -426,6 +425,7 @@ export default function NoteFooter(props: NoteFooterProps) {
<div className="footer-reactions"> <div className="footer-reactions">
{tipButton()} {tipButton()}
{reactionIcons()} {reactionIcons()}
{repostIcon()}
<div className={`reaction-pill ${showNoteCreatorModal ? "reacted" : ""}`} onClick={handleReplyButtonClick}> <div className={`reaction-pill ${showNoteCreatorModal ? "reacted" : ""}`} onClick={handleReplyButtonClick}>
<Icon name="reply" size={17} /> <Icon name="reply" size={17} />
</div> </div>

View File

@ -22,7 +22,7 @@ export default function useThreadFeed(link: NostrLink) {
.kinds( .kinds(
pref.enableReactions pref.enableReactions
? [EventKind.Reaction, EventKind.TextNote, EventKind.Repost, EventKind.ZapReceipt] ? [EventKind.Reaction, EventKind.TextNote, EventKind.Repost, EventKind.ZapReceipt]
: [EventKind.TextNote, EventKind.ZapReceipt] : [EventKind.TextNote, EventKind.ZapReceipt, EventKind.Repost]
) )
.tag("e", allEvents); .tag("e", allEvents);

View File

@ -128,7 +128,9 @@ export default function useTimelineFeed(subject: TimelineSubject, options: Timel
if (trackingEvents.length > 0) { if (trackingEvents.length > 0) {
rb.withFilter() rb.withFilter()
.kinds( .kinds(
pref.enableReactions ? [EventKind.Reaction, EventKind.Repost, EventKind.ZapReceipt] : [EventKind.ZapReceipt] pref.enableReactions
? [EventKind.Reaction, EventKind.Repost, EventKind.ZapReceipt]
: [EventKind.ZapReceipt, EventKind.Repost]
) )
.tag("e", trackingEvents); .tag("e", trackingEvents);
} }

View File

@ -36,6 +36,7 @@ export default function ProfileSettings(props: ProfileSettingsProps) {
const [website, setWebsite] = useState<string>(); const [website, setWebsite] = useState<string>();
const [nip05, setNip05] = useState<string>(); const [nip05, setNip05] = useState<string>();
const [lud16, setLud16] = useState<string>(); const [lud16, setLud16] = useState<string>();
const [reactions, setReactions] = useState<boolean>();
const avatarPicture = (picture?.length ?? 0) === 0 ? Nostrich : picture; const avatarPicture = (picture?.length ?? 0) === 0 ? Nostrich : picture;
@ -49,6 +50,7 @@ export default function ProfileSettings(props: ProfileSettingsProps) {
setWebsite(user.website); setWebsite(user.website);
setNip05(user.nip05); setNip05(user.nip05);
setLud16(user.lud16); setLud16(user.lud16);
setReactions(user.reactions);
} }
}, [user]); }, [user]);
@ -64,6 +66,7 @@ export default function ProfileSettings(props: ProfileSettingsProps) {
website, website,
nip05, nip05,
lud16, lud16,
reactions,
} as Record<string, string | number | undefined>; } as Record<string, string | number | undefined>;
delete userCopy["loaded"]; delete userCopy["loaded"];
delete userCopy["created"]; delete userCopy["created"];
@ -166,6 +169,17 @@ export default function ProfileSettings(props: ProfileSettingsProps) {
<input type="text" value={lud16} onChange={e => setLud16(e.target.value)} /> <input type="text" value={lud16} onChange={e => setLud16(e.target.value)} />
</div> </div>
</div> </div>
<div className="form-group card">
<div className="flex f-col">
<FormattedMessage defaultMessage="OnlyZaps" />:
<small>
<FormattedMessage defaultMessage="Some clients will only allow zaps on your notes" />
</small>
</div>
<div>
<input type="checkbox" checked={!reactions} onChange={e => setReactions(!e.target.checked)} />
</div>
</div>
<div className="form-group card"> <div className="form-group card">
<div></div> <div></div>
<div> <div>

View File

@ -5,6 +5,9 @@
"+aZY2h": { "+aZY2h": {
"defaultMessage": "Zap Type" "defaultMessage": "Zap Type"
}, },
"+vA//S": {
"defaultMessage": "Logins"
},
"+vIQlC": { "+vIQlC": {
"defaultMessage": "Please make sure to save the following password in order to manage your handle in the future" "defaultMessage": "Please make sure to save the following password in order to manage your handle in the future"
}, },
@ -304,12 +307,18 @@
"EnCOBJ": { "EnCOBJ": {
"defaultMessage": "Buy" "defaultMessage": "Buy"
}, },
"EqRgFp": {
"defaultMessage": "Some clients will only allow zaps on your notes"
},
"Eqjl5K": { "Eqjl5K": {
"defaultMessage": "Only Snort and our integration partner identifier gives you a colorful domain name, but you are welcome to use other services too." "defaultMessage": "Only Snort and our integration partner identifier gives you a colorful domain name, but you are welcome to use other services too."
}, },
"F+B3x1": { "F+B3x1": {
"defaultMessage": "We have also partnered with nostrplebs.com to give you more options" "defaultMessage": "We have also partnered with nostrplebs.com to give you more options"
}, },
"F3l7xL": {
"defaultMessage": "Add Account"
},
"FDguSC": { "FDguSC": {
"defaultMessage": "{n} Zaps" "defaultMessage": "{n} Zaps"
}, },
@ -334,6 +343,9 @@
"FpxElY": { "FpxElY": {
"defaultMessage": "Verification" "defaultMessage": "Verification"
}, },
"FvanT6": {
"defaultMessage": "Accounts"
},
"G/yZLu": { "G/yZLu": {
"defaultMessage": "Remove" "defaultMessage": "Remove"
}, },
@ -913,6 +925,9 @@
"mfe8RW": { "mfe8RW": {
"defaultMessage": "Option: {n}" "defaultMessage": "Option: {n}"
}, },
"n1Whvj": {
"defaultMessage": "Switch"
},
"nDejmx": { "nDejmx": {
"defaultMessage": "Unblock" "defaultMessage": "Unblock"
}, },
@ -1053,6 +1068,9 @@
"ut+2Cd": { "ut+2Cd": {
"defaultMessage": "Get a partner identifier" "defaultMessage": "Get a partner identifier"
}, },
"v48Uwm": {
"defaultMessage": "OnlyZaps"
},
"vOKedj": { "vOKedj": {
"defaultMessage": "{n,plural,=1{& {n} other} other{& {n} others}}" "defaultMessage": "{n,plural,=1{& {n} other} other{& {n} others}}"
}, },

View File

@ -1,6 +1,7 @@
{ {
"+D82kt": "Are you sure you want to repost: {id}", "+D82kt": "Are you sure you want to repost: {id}",
"+aZY2h": "Zap Type", "+aZY2h": "Zap Type",
"+vA//S": "Logins",
"+vIQlC": "Please make sure to save the following password in order to manage your handle in the future", "+vIQlC": "Please make sure to save the following password in order to manage your handle in the future",
"+vVZ/G": "Connect", "+vVZ/G": "Connect",
"/4tOwT": "Skip", "/4tOwT": "Skip",
@ -99,8 +100,10 @@
"Ebl/B2": "Translate to {lang}", "Ebl/B2": "Translate to {lang}",
"EcglP9": "Key", "EcglP9": "Key",
"EnCOBJ": "Buy", "EnCOBJ": "Buy",
"EqRgFp": "Some clients will only allow zaps on your notes",
"Eqjl5K": "Only Snort and our integration partner identifier gives you a colorful domain name, but you are welcome to use other services too.", "Eqjl5K": "Only Snort and our integration partner identifier gives you a colorful domain name, but you are welcome to use other services too.",
"F+B3x1": "We have also partnered with nostrplebs.com to give you more options", "F+B3x1": "We have also partnered with nostrplebs.com to give you more options",
"F3l7xL": "Add Account",
"FDguSC": "{n} Zaps", "FDguSC": "{n} Zaps",
"FP+D3H": "LNURL to forward zaps to", "FP+D3H": "LNURL to forward zaps to",
"FS3b54": "Done!", "FS3b54": "Done!",
@ -109,6 +112,7 @@
"FfYsOb": "An error has occured!", "FfYsOb": "An error has occured!",
"FmXUJg": "follows you", "FmXUJg": "follows you",
"FpxElY": "Verification", "FpxElY": "Verification",
"FvanT6": "Accounts",
"G/yZLu": "Remove", "G/yZLu": "Remove",
"G1BGCg": "Select Wallet", "G1BGCg": "Select Wallet",
"GFOoEE": "Salt", "GFOoEE": "Salt",
@ -299,6 +303,7 @@
"mKhgP9": "{n,plural,=0{} =1{zapped} other{zapped}}", "mKhgP9": "{n,plural,=0{} =1{zapped} other{zapped}}",
"mLcajD": "Snort Subscription", "mLcajD": "Snort Subscription",
"mfe8RW": "Option: {n}", "mfe8RW": "Option: {n}",
"n1Whvj": "Switch",
"nDejmx": "Unblock", "nDejmx": "Unblock",
"nGBrvw": "Bookmarks", "nGBrvw": "Bookmarks",
"nN9XTz": "Share your thoughts with {link}", "nN9XTz": "Share your thoughts with {link}",
@ -345,6 +350,7 @@
"uSV4Ti": "Reposts need to be manually confirmed", "uSV4Ti": "Reposts need to be manually confirmed",
"usAvMr": "Edit Profile", "usAvMr": "Edit Profile",
"ut+2Cd": "Get a partner identifier", "ut+2Cd": "Get a partner identifier",
"v48Uwm": "OnlyZaps",
"vOKedj": "{n,plural,=1{& {n} other} other{& {n} others}}", "vOKedj": "{n,plural,=1{& {n} other} other{& {n} others}}",
"vU71Ez": "Paying with {wallet}", "vU71Ez": "Paying with {wallet}",
"vZ4quW": "NIP-05 is a DNS based verification spec which helps to validate you as a real user.", "vZ4quW": "NIP-05 is a DNS based verification spec which helps to validate you as a real user.",
@ -377,4 +383,4 @@
"zjJZBd": "You're ready!", "zjJZBd": "You're ready!",
"zonsdq": "Failed to load LNURL service", "zonsdq": "Failed to load LNURL service",
"zvCDao": "Automatically show latest notes" "zvCDao": "Automatically show latest notes"
} }

View File

@ -70,6 +70,7 @@ export type UserMetadata = {
nip05?: string; nip05?: string;
lud06?: string; lud06?: string;
lud16?: string; lud16?: string;
reactions?: boolean;
}; };
/** /**